mirror of
https://github.com/profanity-im/profanity.git
synced 2025-01-03 14:57:42 -05:00
Merge branch 'master' into osx-functional
Conflicts: tests/functionaltests/functionaltests.c
This commit is contained in:
commit
232e746637
@ -817,14 +817,6 @@ static struct cmd_t command_defs[] =
|
|||||||
"goodbye : Show a message in the title when exiting profanity.",
|
"goodbye : Show a message in the title when exiting profanity.",
|
||||||
NULL } } },
|
NULL } } },
|
||||||
|
|
||||||
{ "/mouse",
|
|
||||||
cmd_mouse, parse_args, 1, 1, &cons_mouse_setting,
|
|
||||||
{ "/mouse on|off", "Use profanity mouse handling.",
|
|
||||||
{ "/mouse on|off",
|
|
||||||
"-------------",
|
|
||||||
"This feature is experimental, default is 'off'.",
|
|
||||||
NULL } } },
|
|
||||||
|
|
||||||
{ "/alias",
|
{ "/alias",
|
||||||
cmd_alias, parse_args_with_freetext, 1, 3, NULL,
|
cmd_alias, parse_args_with_freetext, 1, 3, NULL,
|
||||||
{ "/alias add|remove|list [name value]", "Add your own command aliases.",
|
{ "/alias add|remove|list [name value]", "Add your own command aliases.",
|
||||||
@ -1987,8 +1979,8 @@ _cmd_complete_parameters(ProfWin *window, const char * const input)
|
|||||||
|
|
||||||
// autocomplete boolean settings
|
// autocomplete boolean settings
|
||||||
gchar *boolean_choices[] = { "/beep", "/intype", "/states", "/outtype",
|
gchar *boolean_choices[] = { "/beep", "/intype", "/states", "/outtype",
|
||||||
"/flash", "/splash", "/chlog", "/grlog", "/mouse", "/history",
|
"/flash", "/splash", "/chlog", "/grlog", "/history", "/vercheck",
|
||||||
"/vercheck", "/privileges", "/presence", "/wrap", "/winstidy", "/carbons", "/encwarn" };
|
"/privileges", "/presence", "/wrap", "/winstidy", "/carbons", "/encwarn" };
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_SIZE(boolean_choices); i++) {
|
for (i = 0; i < ARRAY_SIZE(boolean_choices); i++) {
|
||||||
result = autocomplete_param_with_func(input, boolean_choices[i], prefs_autocomplete_boolean_choice);
|
result = autocomplete_param_with_func(input, boolean_choices[i], prefs_autocomplete_boolean_choice);
|
||||||
|
@ -840,9 +840,9 @@ cmd_help(ProfWin *window, gchar **args, struct cmd_help_t help)
|
|||||||
} else if (strcmp(args[0], "settings") == 0) {
|
} else if (strcmp(args[0], "settings") == 0) {
|
||||||
gchar *filter[] = { "/account", "/autoaway", "/autoping", "/autoconnect", "/beep",
|
gchar *filter[] = { "/account", "/autoaway", "/autoping", "/autoconnect", "/beep",
|
||||||
"/carbons", "/chlog", "/flash", "/gone", "/grlog", "/history", "/intype",
|
"/carbons", "/chlog", "/flash", "/gone", "/grlog", "/history", "/intype",
|
||||||
"/log", "/mouse", "/notify", "/outtype", "/prefs", "/priority",
|
"/log", "/notify", "/outtype", "/prefs", "/priority", "/reconnect", "/roster",
|
||||||
"/reconnect", "/roster", "/splash", "/states", "/statuses", "/theme",
|
"/splash", "/states", "/statuses", "/theme", "/titlebar", "/vercheck",
|
||||||
"/titlebar", "/vercheck", "/privileges", "/occupants", "/presence", "/wrap", "/winstidy" };
|
"/privileges", "/occupants", "/presence", "/wrap", "/winstidy" };
|
||||||
_cmd_show_filtered_help("Settings commands", filter, ARRAY_SIZE(filter));
|
_cmd_show_filtered_help("Settings commands", filter, ARRAY_SIZE(filter));
|
||||||
|
|
||||||
} else if (strcmp(args[0], "navigation") == 0) {
|
} else if (strcmp(args[0], "navigation") == 0) {
|
||||||
@ -4079,13 +4079,6 @@ cmd_grlog(ProfWin *window, gchar **args, struct cmd_help_t help)
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
|
||||||
cmd_mouse(ProfWin *window, gchar **args, struct cmd_help_t help)
|
|
||||||
{
|
|
||||||
return _cmd_set_boolean_preference(args[0], help,
|
|
||||||
"Mouse handling", PREF_MOUSE);
|
|
||||||
}
|
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
cmd_history(ProfWin *window, gchar **args, struct cmd_help_t help)
|
cmd_history(ProfWin *window, gchar **args, struct cmd_help_t help)
|
||||||
{
|
{
|
||||||
|
@ -99,7 +99,6 @@ gboolean cmd_invites(ProfWin *window, gchar **args, struct cmd_help_t help);
|
|||||||
gboolean cmd_join(ProfWin *window, gchar **args, struct cmd_help_t help);
|
gboolean cmd_join(ProfWin *window, gchar **args, struct cmd_help_t help);
|
||||||
gboolean cmd_leave(ProfWin *window, gchar **args, struct cmd_help_t help);
|
gboolean cmd_leave(ProfWin *window, gchar **args, struct cmd_help_t help);
|
||||||
gboolean cmd_log(ProfWin *window, gchar **args, struct cmd_help_t help);
|
gboolean cmd_log(ProfWin *window, gchar **args, struct cmd_help_t help);
|
||||||
gboolean cmd_mouse(ProfWin *window, gchar **args, struct cmd_help_t help);
|
|
||||||
gboolean cmd_msg(ProfWin *window, gchar **args, struct cmd_help_t help);
|
gboolean cmd_msg(ProfWin *window, gchar **args, struct cmd_help_t help);
|
||||||
gboolean cmd_nick(ProfWin *window, gchar **args, struct cmd_help_t help);
|
gboolean cmd_nick(ProfWin *window, gchar **args, struct cmd_help_t help);
|
||||||
gboolean cmd_notify(ProfWin *window, gchar **args, struct cmd_help_t help);
|
gboolean cmd_notify(ProfWin *window, gchar **args, struct cmd_help_t help);
|
||||||
|
@ -506,7 +506,6 @@ _get_group(preference_t pref)
|
|||||||
case PREF_FLASH:
|
case PREF_FLASH:
|
||||||
case PREF_INTYPE:
|
case PREF_INTYPE:
|
||||||
case PREF_HISTORY:
|
case PREF_HISTORY:
|
||||||
case PREF_MOUSE:
|
|
||||||
case PREF_OCCUPANTS:
|
case PREF_OCCUPANTS:
|
||||||
case PREF_OCCUPANTS_JID:
|
case PREF_OCCUPANTS_JID:
|
||||||
case PREF_STATUSES:
|
case PREF_STATUSES:
|
||||||
@ -599,8 +598,6 @@ _get_key(preference_t pref)
|
|||||||
return "receipts.send";
|
return "receipts.send";
|
||||||
case PREF_RECEIPTS_REQUEST:
|
case PREF_RECEIPTS_REQUEST:
|
||||||
return "receipts.request";
|
return "receipts.request";
|
||||||
case PREF_MOUSE:
|
|
||||||
return "mouse";
|
|
||||||
case PREF_OCCUPANTS:
|
case PREF_OCCUPANTS:
|
||||||
return "occupants";
|
return "occupants";
|
||||||
case PREF_OCCUPANTS_JID:
|
case PREF_OCCUPANTS_JID:
|
||||||
|
@ -57,7 +57,6 @@ typedef enum {
|
|||||||
PREF_CARBONS,
|
PREF_CARBONS,
|
||||||
PREF_RECEIPTS_SEND,
|
PREF_RECEIPTS_SEND,
|
||||||
PREF_RECEIPTS_REQUEST,
|
PREF_RECEIPTS_REQUEST,
|
||||||
PREF_MOUSE,
|
|
||||||
PREF_OCCUPANTS,
|
PREF_OCCUPANTS,
|
||||||
PREF_OCCUPANTS_SIZE,
|
PREF_OCCUPANTS_SIZE,
|
||||||
PREF_OCCUPANTS_JID,
|
PREF_OCCUPANTS_JID,
|
||||||
|
@ -955,20 +955,16 @@ cons_time_setting(void)
|
|||||||
{
|
{
|
||||||
char *pref_time = prefs_get_string(PREF_TIME);
|
char *pref_time = prefs_get_string(PREF_TIME);
|
||||||
if (g_strcmp0(pref_time, "off") == 0)
|
if (g_strcmp0(pref_time, "off") == 0)
|
||||||
cons_show("Time (/time) : OFF");
|
cons_show("Time main (/time) : OFF");
|
||||||
else
|
else
|
||||||
cons_show("Time (/time) : %s", pref_time);
|
cons_show("Time main (/time) : %s", pref_time);
|
||||||
|
|
||||||
prefs_free_string(pref_time);
|
prefs_free_string(pref_time);
|
||||||
|
|
||||||
char *pref_time_statusbar = prefs_get_string(PREF_TIME_STATUSBAR);
|
char *pref_time_statusbar = prefs_get_string(PREF_TIME_STATUSBAR);
|
||||||
if (g_strcmp0(pref_time_statusbar, "minutes") == 0)
|
if (g_strcmp0(pref_time_statusbar, "off") == 0)
|
||||||
cons_show("Time statusbar (/time) : minutes");
|
|
||||||
else if (g_strcmp0(pref_time_statusbar, "off") == 0)
|
|
||||||
cons_show("Time statusbar (/time) : OFF");
|
cons_show("Time statusbar (/time) : OFF");
|
||||||
else
|
else
|
||||||
cons_show("Time statusbar (/time) : seconds");
|
cons_show("Time statusbar (/time) : %s", pref_time_statusbar);
|
||||||
|
|
||||||
prefs_free_string(pref_time_statusbar);
|
prefs_free_string(pref_time_statusbar);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -981,15 +977,6 @@ cons_vercheck_setting(void)
|
|||||||
cons_show("Version checking (/vercheck) : OFF");
|
cons_show("Version checking (/vercheck) : OFF");
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
cons_mouse_setting(void)
|
|
||||||
{
|
|
||||||
if (prefs_get_boolean(PREF_MOUSE))
|
|
||||||
cons_show("Mouse handling (/mouse) : ON");
|
|
||||||
else
|
|
||||||
cons_show("Mouse handling (/mouse) : OFF");
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
cons_statuses_setting(void)
|
cons_statuses_setting(void)
|
||||||
{
|
{
|
||||||
@ -1066,7 +1053,6 @@ cons_show_ui_prefs(void)
|
|||||||
cons_time_setting();
|
cons_time_setting();
|
||||||
cons_resource_setting();
|
cons_resource_setting();
|
||||||
cons_vercheck_setting();
|
cons_vercheck_setting();
|
||||||
cons_mouse_setting();
|
|
||||||
cons_statuses_setting();
|
cons_statuses_setting();
|
||||||
cons_occupants_setting();
|
cons_occupants_setting();
|
||||||
cons_roster_setting();
|
cons_roster_setting();
|
||||||
|
@ -101,10 +101,6 @@ ui_init(void)
|
|||||||
cbreak();
|
cbreak();
|
||||||
noecho();
|
noecho();
|
||||||
keypad(stdscr, TRUE);
|
keypad(stdscr, TRUE);
|
||||||
if (prefs_get_boolean(PREF_MOUSE)) {
|
|
||||||
mousemask(ALL_MOUSE_EVENTS, NULL);
|
|
||||||
mouseinterval(5);
|
|
||||||
}
|
|
||||||
ui_load_colours();
|
ui_load_colours();
|
||||||
refresh();
|
refresh();
|
||||||
create_title_bar();
|
create_title_bar();
|
||||||
|
@ -286,7 +286,7 @@ _inp_printable(const wint_t ch)
|
|||||||
bytes[utf_len] = '\0';
|
bytes[utf_len] = '\0';
|
||||||
gunichar unichar = g_utf8_get_char(bytes);
|
gunichar unichar = g_utf8_get_char(bytes);
|
||||||
|
|
||||||
return g_unichar_isprint(unichar) && (ch != KEY_MOUSE);
|
return g_unichar_isprint(unichar);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
@ -297,7 +297,6 @@ void cons_presence_setting(void);
|
|||||||
void cons_wrap_setting(void);
|
void cons_wrap_setting(void);
|
||||||
void cons_winstidy_setting(void);
|
void cons_winstidy_setting(void);
|
||||||
void cons_time_setting(void);
|
void cons_time_setting(void);
|
||||||
void cons_mouse_setting(void);
|
|
||||||
void cons_statuses_setting(void);
|
void cons_statuses_setting(void);
|
||||||
void cons_titlebar_setting(void);
|
void cons_titlebar_setting(void);
|
||||||
void cons_notify_setting(void);
|
void cons_notify_setting(void);
|
||||||
|
@ -499,53 +499,6 @@ win_resize(ProfWin *window)
|
|||||||
win_redraw(window);
|
win_redraw(window);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
win_mouse(ProfWin *window, const wint_t ch, const int result)
|
|
||||||
{
|
|
||||||
int rows = getmaxy(stdscr);
|
|
||||||
int y = getcury(window->layout->win);
|
|
||||||
|
|
||||||
int page_space = rows - 4;
|
|
||||||
int *page_start = &(window->layout->y_pos);
|
|
||||||
|
|
||||||
if (prefs_get_boolean(PREF_MOUSE)) {
|
|
||||||
MEVENT mouse_event;
|
|
||||||
|
|
||||||
if (ch == KEY_MOUSE) {
|
|
||||||
if (getmouse(&mouse_event) == OK) {
|
|
||||||
|
|
||||||
#ifdef PLATFORM_CYGWIN
|
|
||||||
if (mouse_event.bstate & BUTTON5_PRESSED) { // mouse wheel down
|
|
||||||
#else
|
|
||||||
if (mouse_event.bstate & BUTTON2_PRESSED) { // mouse wheel down
|
|
||||||
#endif
|
|
||||||
*page_start += 4;
|
|
||||||
|
|
||||||
// only got half a screen, show full screen
|
|
||||||
if ((y - (*page_start)) < page_space)
|
|
||||||
*page_start = y - page_space;
|
|
||||||
|
|
||||||
// went past end, show full screen
|
|
||||||
else if (*page_start >= y)
|
|
||||||
*page_start = y - page_space;
|
|
||||||
|
|
||||||
window->layout->paged = 1;
|
|
||||||
win_update_virtual(window);
|
|
||||||
} else if (mouse_event.bstate & BUTTON4_PRESSED) { // mouse wheel up
|
|
||||||
*page_start -= 4;
|
|
||||||
|
|
||||||
// went past beginning, show first page
|
|
||||||
if (*page_start < 0)
|
|
||||||
*page_start = 0;
|
|
||||||
|
|
||||||
window->layout->paged = 1;
|
|
||||||
win_update_virtual(window);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
win_update_virtual(ProfWin *window)
|
win_update_virtual(ProfWin *window)
|
||||||
{
|
{
|
||||||
|
@ -68,7 +68,6 @@ void win_redraw(ProfWin *window);
|
|||||||
int win_roster_cols(void);
|
int win_roster_cols(void);
|
||||||
int win_occpuants_cols(void);
|
int win_occpuants_cols(void);
|
||||||
void win_printline_nowrap(WINDOW *win, char *msg);
|
void win_printline_nowrap(WINDOW *win, char *msg);
|
||||||
void win_mouse(ProfWin *current, const wint_t ch, const int result);
|
|
||||||
void win_mark_received(ProfWin *window, const char * const id);
|
void win_mark_received(ProfWin *window, const char * const id);
|
||||||
|
|
||||||
gboolean win_has_active_subwin(ProfWin *window);
|
gboolean win_has_active_subwin(ProfWin *window);
|
||||||
|
@ -129,6 +129,12 @@ int main(int argc, char* argv[]) {
|
|||||||
unit_test_setup_teardown(send_disable_carbons,
|
unit_test_setup_teardown(send_disable_carbons,
|
||||||
init_prof_test,
|
init_prof_test,
|
||||||
close_prof_test),
|
close_prof_test),
|
||||||
|
unit_test_setup_teardown(receive_carbon,
|
||||||
|
init_prof_test,
|
||||||
|
close_prof_test),
|
||||||
|
unit_test_setup_teardown(receive_self_carbon,
|
||||||
|
init_prof_test,
|
||||||
|
close_prof_test),
|
||||||
*/
|
*/
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -48,3 +48,73 @@ send_disable_carbons(void **state)
|
|||||||
"<iq id=\"*\" type=\"set\"><disable xmlns=\"urn:xmpp:carbons:2\"/></iq>"
|
"<iq id=\"*\" type=\"set\"><disable xmlns=\"urn:xmpp:carbons:2\"/></iq>"
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
receive_carbon(void **state)
|
||||||
|
{
|
||||||
|
prof_input("/carbons on");
|
||||||
|
|
||||||
|
prof_connect();
|
||||||
|
assert_true(stbbr_received(
|
||||||
|
"<iq id=\"*\" type=\"set\"><enable xmlns=\"urn:xmpp:carbons:2\"/></iq>"
|
||||||
|
));
|
||||||
|
|
||||||
|
stbbr_send(
|
||||||
|
"<presence to=\"stabber@localhost\" from=\"buddy1@localhost/mobile\">"
|
||||||
|
"<priority>10</priority>"
|
||||||
|
"<status>On my mobile</status>"
|
||||||
|
"</presence>"
|
||||||
|
);
|
||||||
|
assert_true(prof_output_exact("Buddy1 (mobile) is online, \"On my mobile\""));
|
||||||
|
prof_input("/msg Buddy1");
|
||||||
|
prof_output_exact("unencrypted");
|
||||||
|
|
||||||
|
stbbr_send(
|
||||||
|
"<message type=\"chat\" to=\"stabber@localhost/profanity\" from=\"buddy1@localhost\">"
|
||||||
|
"<received xmlns=\"urn:xmpp:carbons:2\">"
|
||||||
|
"<forwarded xmlns=\"urn:xmpp:forward:0\">"
|
||||||
|
"<message id=\"prof_msg_7\" xmlns=\"jabber:client\" type=\"chat\" lang=\"en\" to=\"stabber@localhost/profanity\" from=\"buddy1@localhost/mobile\">"
|
||||||
|
"<body>test carbon from recipient</body>"
|
||||||
|
"</message>"
|
||||||
|
"</forwarded>"
|
||||||
|
"</received>"
|
||||||
|
"</message>"
|
||||||
|
);
|
||||||
|
|
||||||
|
assert_true(prof_output_regex("Buddy1/mobile: .+test carbon from recipient"));
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
receive_self_carbon(void **state)
|
||||||
|
{
|
||||||
|
prof_input("/carbons on");
|
||||||
|
|
||||||
|
prof_connect();
|
||||||
|
assert_true(stbbr_received(
|
||||||
|
"<iq id=\"*\" type=\"set\"><enable xmlns=\"urn:xmpp:carbons:2\"/></iq>"
|
||||||
|
));
|
||||||
|
|
||||||
|
stbbr_send(
|
||||||
|
"<presence to=\"stabber@localhost\" from=\"buddy1@localhost/mobile\">"
|
||||||
|
"<priority>10</priority>"
|
||||||
|
"<status>On my mobile</status>"
|
||||||
|
"</presence>"
|
||||||
|
);
|
||||||
|
assert_true(prof_output_exact("Buddy1 (mobile) is online, \"On my mobile\""));
|
||||||
|
prof_input("/msg Buddy1");
|
||||||
|
prof_output_exact("unencrypted");
|
||||||
|
|
||||||
|
stbbr_send(
|
||||||
|
"<message type=\"chat\" to=\"stabber@localhost/profanity\" from=\"stabber@localhost\">"
|
||||||
|
"<sent xmlns=\"urn:xmpp:carbons:2\">"
|
||||||
|
"<forwarded xmlns=\"urn:xmpp:forward:0\">"
|
||||||
|
"<message id=\"59\" xmlns=\"jabber:client\" type=\"chat\" to=\"buddy1@localhost/mobile\" lang=\"en\" from=\"stabber@localhost/profanity\">"
|
||||||
|
"<body>self sent carbon</body>"
|
||||||
|
"</message>"
|
||||||
|
"</forwarded>"
|
||||||
|
"</sent>"
|
||||||
|
"</message>"
|
||||||
|
);
|
||||||
|
|
||||||
|
assert_true(prof_output_regex("me: .+self sent carbon"));
|
||||||
|
}
|
||||||
|
@ -1,3 +1,6 @@
|
|||||||
void send_enable_carbons(void **state);
|
void send_enable_carbons(void **state);
|
||||||
void connect_with_carbons_enabled(void **state);
|
void connect_with_carbons_enabled(void **state);
|
||||||
void send_disable_carbons(void **state);
|
void send_disable_carbons(void **state);
|
||||||
|
void receive_carbon(void **state);
|
||||||
|
void receive_self_carbon(void **state);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user