diff options
Diffstat (limited to 'src/command/command.c')
-rw-r--r-- | src/command/command.c | 313 |
1 files changed, 198 insertions, 115 deletions
diff --git a/src/command/command.c b/src/command/command.c index 4086278c..105e41e5 100644 --- a/src/command/command.c +++ b/src/command/command.c @@ -66,42 +66,41 @@ #include "xmpp/xmpp.h" #include "xmpp/bookmark.h" #include "ui/ui.h" -#include "ui/windows.h" - -typedef char*(*autocompleter)(char*, int*); - -static gboolean _cmd_execute(const char * const command, const char * const inp); - -static char * _cmd_complete_parameters(const char * const input); - -static char * _sub_autocomplete(const char * const input); -static char * _notify_autocomplete(const char * const input); -static char * _theme_autocomplete(const char * const input); -static char * _autoaway_autocomplete(const char * const input); -static char * _autoconnect_autocomplete(const char * const input); -static char * _account_autocomplete(const char * const input); -static char * _who_autocomplete(const char * const input); -static char * _roster_autocomplete(const char * const input); -static char * _group_autocomplete(const char * const input); -static char * _bookmark_autocomplete(const char * const input); -static char * _otr_autocomplete(const char * const input); -static char * _connect_autocomplete(const char * const input); -static char * _statuses_autocomplete(const char * const input); -static char * _alias_autocomplete(const char * const input); -static char * _join_autocomplete(const char * const input); -static char * _log_autocomplete(const char * const input); -static char * _form_autocomplete(const char * const input); -static char * _form_field_autocomplete(const char * const input); -static char * _occupants_autocomplete(const char * const input); -static char * _kick_autocomplete(const char * const input); -static char * _ban_autocomplete(const char * const input); -static char * _affiliation_autocomplete(const char * const input); -static char * _role_autocomplete(const char * const input); -static char * _resource_autocomplete(const char * const input); -static char * _titlebar_autocomplete(const char * const input); -static char * _inpblock_autocomplete(const char * const input); -static char * _time_autocomplete(const char * const input); -static char * _receipts_autocomplete(const char * const input); +#include "window_list.h" + +static gboolean _cmd_execute(ProfWin *window, const char * const command, const char * const inp); + +static char * _cmd_complete_parameters(ProfWin *window, const char * const input); + +static char * _sub_autocomplete(ProfWin *window, const char * const input); +static char * _notify_autocomplete(ProfWin *window, const char * const input); +static char * _theme_autocomplete(ProfWin *window, const char * const input); +static char * _autoaway_autocomplete(ProfWin *window, const char * const input); +static char * _autoconnect_autocomplete(ProfWin *window, const char * const input); +static char * _account_autocomplete(ProfWin *window, const char * const input); +static char * _who_autocomplete(ProfWin *window, const char * const input); +static char * _roster_autocomplete(ProfWin *window, const char * const input); +static char * _group_autocomplete(ProfWin *window, const char * const input); +static char * _bookmark_autocomplete(ProfWin *window, const char * const input); +static char * _otr_autocomplete(ProfWin *window, const char * const input); +static char * _pgp_autocomplete(ProfWin *window, const char * const input); +static char * _connect_autocomplete(ProfWin *window, const char * const input); +static char * _statuses_autocomplete(ProfWin *window, const char * const input); +static char * _alias_autocomplete(ProfWin *window, const char * const input); +static char * _join_autocomplete(ProfWin *window, const char * const input); +static char * _log_autocomplete(ProfWin *window, const char * const input); +static char * _form_autocomplete(ProfWin *window, const char * const input); +static char * _form_field_autocomplete(ProfWin *window, const char * const input); +static char * _occupants_autocomplete(ProfWin *window, const char * const input); +static char * _kick_autocomplete(ProfWin *window, const char * const input); +static char * _ban_autocomplete(ProfWin *window, const char * const input); +static char * _affiliation_autocomplete(ProfWin *window, const char * const input); +static char * _role_autocomplete(ProfWin *window, const char * const input); +static char * _resource_autocomplete(ProfWin *window, const char * const input); +static char * _titlebar_autocomplete(ProfWin *window, const char * const input); +static char * _inpblock_autocomplete(ProfWin *window, const char * const input); +static char * _time_autocomplete(ProfWin *window, const char * const input); +static char * _receipts_autocomplete(ProfWin *window, const char * const input); GHashTable *commands = NULL; @@ -206,6 +205,7 @@ static struct cmd_t command_defs[] = "size : Percentage of the screen taken up by the roster (1-99).", "add jid [nick] : Add a new item to the roster.", "remove jid : Removes an item from the roster.", + "empty : Remove all items from roster." "nick jid nick : Change a contacts nickname.", "clearnick jid : Removes the current nickname.", "", @@ -668,6 +668,14 @@ static struct cmd_t command_defs[] = "If the terminal does not support sounds, it may attempt to flash the screen instead.", NULL } } }, + { "/encwarn", + cmd_encwarn, parse_args, 1, 1, &cons_encwarn_setting, + { "/encwarn on|off", "Titlebar encryption warning.", + { "/encwarn on|off", + "---------------", + "Enabled or disable the unencrypted warning message in the titlebar.", + NULL } } }, + { "/presence", cmd_presence, parse_args, 1, 1, &cons_presence_setting, { "/presence on|off", "Show the contacts presence in the titlebar.", @@ -684,6 +692,14 @@ static struct cmd_t command_defs[] = "Enable or disable word wrapping in the main window.", NULL } } }, + { "/winstidy", + cmd_winstidy, parse_args, 1, 1, &cons_winstidy_setting, + { "/winstidy on|off", "Auto tidy windows.", + { "/winstidy on|off", + "----------------", + "Enable or disable auto window tidy.", + NULL } } }, + { "/time", cmd_time, parse_args, 1, 3, &cons_time_setting, { "/time main|statusbar set|off [format]", "Time display.", @@ -855,6 +871,22 @@ static struct cmd_t command_defs[] = "Send chat state notifications during chat sessions.", NULL } } }, + { "/pgp", + cmd_pgp, parse_args, 1, 3, NULL, + { "/pgp command [args..]", "Open PGP commands.", + { "/pgp command [args..]", + "---------------------", + "Open PGP commands.", + "", + "keys : List all keys.", + "libver : Show which version of the libgpgme library is being used.", + "fps : Show known fingerprints.", + "setkey contact keyid : Manually associate a key ID with a JID.", + "start [contact] : Start PGP encrypted chat, current contact will be used if not specified.", + "end : End PGP encrypted chat with the current recipient.", + "log on|off|redact : PGP message logging, default: redact.", + NULL } } }, + { "/otr", cmd_otr, parse_args, 1, 3, NULL, { "/otr command [args..]", "Off The Record encryption commands.", @@ -1210,6 +1242,8 @@ static Autocomplete time_format_ac; static Autocomplete resource_ac; static Autocomplete inpblock_ac; static Autocomplete receipts_ac; +static Autocomplete pgp_ac; +static Autocomplete pgp_log_ac; /* * Initialise command autocompleter and history @@ -1269,6 +1303,7 @@ cmd_init(void) autocomplete_add(prefs_ac, "conn"); autocomplete_add(prefs_ac, "presence"); autocomplete_add(prefs_ac, "otr"); + autocomplete_add(prefs_ac, "pgp"); notify_ac = autocomplete_new(); autocomplete_add(notify_ac, "message"); @@ -1366,6 +1401,7 @@ cmd_init(void) autocomplete_add(account_set_ac, "muc"); autocomplete_add(account_set_ac, "nick"); autocomplete_add(account_set_ac, "otr"); + autocomplete_add(account_set_ac, "pgpkeyid"); account_clear_ac = autocomplete_new(); autocomplete_add(account_clear_ac, "password"); @@ -1373,6 +1409,7 @@ cmd_init(void) autocomplete_add(account_clear_ac, "server"); autocomplete_add(account_clear_ac, "port"); autocomplete_add(account_clear_ac, "otr"); + autocomplete_add(account_clear_ac, "pgpkeyid"); account_default_ac = autocomplete_new(); autocomplete_add(account_default_ac, "set"); @@ -1393,6 +1430,7 @@ cmd_init(void) autocomplete_add(roster_ac, "nick"); autocomplete_add(roster_ac, "clearnick"); autocomplete_add(roster_ac, "remove"); + autocomplete_add(roster_ac, "empty"); autocomplete_add(roster_ac, "show"); autocomplete_add(roster_ac, "hide"); autocomplete_add(roster_ac, "by"); @@ -1462,7 +1500,6 @@ cmd_init(void) autocomplete_add(otr_ac, "untrust"); autocomplete_add(otr_ac, "secret"); autocomplete_add(otr_ac, "log"); - autocomplete_add(otr_ac, "warn"); autocomplete_add(otr_ac, "libver"); autocomplete_add(otr_ac, "policy"); autocomplete_add(otr_ac, "question"); @@ -1571,6 +1608,20 @@ cmd_init(void) receipts_ac = autocomplete_new(); autocomplete_add(receipts_ac, "send"); autocomplete_add(receipts_ac, "request"); + + pgp_ac = autocomplete_new(); + autocomplete_add(pgp_ac, "keys"); + autocomplete_add(pgp_ac, "fps"); + autocomplete_add(pgp_ac, "setkey"); + autocomplete_add(pgp_ac, "libver"); + autocomplete_add(pgp_ac, "start"); + autocomplete_add(pgp_ac, "end"); + autocomplete_add(pgp_ac, "log"); + + pgp_log_ac = autocomplete_new(); + autocomplete_add(pgp_log_ac, "on"); + autocomplete_add(pgp_log_ac, "off"); + autocomplete_add(pgp_log_ac, "redact"); } void @@ -1630,6 +1681,8 @@ cmd_uninit(void) autocomplete_free(resource_ac); autocomplete_free(inpblock_ac); autocomplete_free(receipts_ac); + autocomplete_free(pgp_ac); + autocomplete_free(pgp_log_ac); } gboolean @@ -1714,7 +1767,7 @@ cmd_alias_remove(char *value) // Command autocompletion functions char* -cmd_autocomplete(const char * const input) +cmd_autocomplete(ProfWin *window, const char * const input) { // autocomplete command if ((strncmp(input, "/", 1) == 0) && (!str_contains(input, strlen(input), ' '))) { @@ -1726,7 +1779,7 @@ cmd_autocomplete(const char * const input) // autocomplete parameters } else { - char *found = _cmd_complete_parameters(input); + char *found = _cmd_complete_parameters(window, input); if (found) { return found; } @@ -1736,7 +1789,7 @@ cmd_autocomplete(const char * const input) } void -cmd_reset_autocomplete() +cmd_reset_autocomplete(ProfWin *window) { roster_reset_search_attempts(); muc_invites_reset_ac(); @@ -1802,23 +1855,28 @@ cmd_reset_autocomplete() autocomplete_reset(resource_ac); autocomplete_reset(inpblock_ac); autocomplete_reset(receipts_ac); + autocomplete_reset(pgp_ac); + autocomplete_reset(pgp_log_ac); - if (ui_current_win_type() == WIN_CHAT) { - ProfChatWin *chatwin = wins_get_current_chat(); + if (window->type == WIN_CHAT) { + ProfChatWin *chatwin = (ProfChatWin*)window; + assert(chatwin->memcheck == PROFCHATWIN_MEMCHECK); PContact contact = roster_get_contact(chatwin->barejid); if (contact) { p_contact_resource_ac_reset(contact); } } - if (ui_current_win_type() == WIN_MUC) { - ProfMucWin *mucwin = wins_get_current_muc(); + if (window->type == WIN_MUC) { + ProfMucWin *mucwin = (ProfMucWin*)window; + assert(mucwin->memcheck == PROFMUCWIN_MEMCHECK); muc_autocomplete_reset(mucwin->roomjid); muc_jid_autocomplete_reset(mucwin->roomjid); } - if (ui_current_win_type() == WIN_MUC_CONFIG) { - ProfMucConfWin *confwin = wins_get_current_muc_conf(); + if (window->type == WIN_MUC_CONFIG) { + ProfMucConfWin *confwin = (ProfMucConfWin*)window; + assert(confwin->memcheck == PROFCONFWIN_MEMCHECK); if (confwin->form) { form_reset_autocompleters(confwin->form); } @@ -1832,11 +1890,11 @@ cmd_reset_autocomplete() * continue, FALSE otherwise */ gboolean -cmd_process_input(char *inp) +cmd_process_input(ProfWin *window, char *inp) { log_debug("Input received: %s", inp); gboolean result = FALSE; - g_strstrip(inp); + g_strchomp(inp); // just carry on if no input if (strlen(inp) == 0) { @@ -1846,12 +1904,12 @@ cmd_process_input(char *inp) } else if (inp[0] == '/') { char *inp_cpy = strdup(inp); char *command = strtok(inp_cpy, " "); - result = _cmd_execute(command, inp); + result = _cmd_execute(window, command, inp); free(inp_cpy); // call a default handler if input didn't start with '/' } else { - result = cmd_execute_default(inp); + result = cmd_execute_default(window, inp); } return result; @@ -1860,18 +1918,18 @@ cmd_process_input(char *inp) // Command execution void -cmd_execute_connect(const char * const account) +cmd_execute_connect(ProfWin *window, const char * const account) { GString *command = g_string_new("/connect "); g_string_append(command, account); - cmd_process_input(command->str); + cmd_process_input(window, command->str); g_string_free(command, TRUE); } static gboolean -_cmd_execute(const char * const command, const char * const inp) +_cmd_execute(ProfWin *window, const char * const command, const char * const inp) { - if (g_str_has_prefix(command, "/field") && ui_current_win_type() == WIN_MUC_CONFIG) { + if (g_str_has_prefix(command, "/field") && window->type == WIN_MUC_CONFIG) { gboolean result = FALSE; gchar **args = parse_args_with_freetext(inp, 1, 2, &result); if (!result) { @@ -1880,7 +1938,7 @@ _cmd_execute(const char * const command, const char * const inp) } else { gchar **tokens = g_strsplit(inp, " ", 2); char *field = tokens[0] + 1; - result = cmd_form_field(field, args); + result = cmd_form_field(window, field, args); g_strfreev(tokens); } @@ -1897,15 +1955,15 @@ _cmd_execute(const char * const command, const char * const inp) ui_invalid_command_usage(cmd->help.usage, cmd->setting_func); return TRUE; } else { - gboolean result = cmd->func(args, cmd->help); + gboolean result = cmd->func(window, args, cmd->help); g_strfreev(args); return result; } } else { gboolean ran_alias = FALSE; - gboolean alias_result = cmd_execute_alias(inp, &ran_alias); + gboolean alias_result = cmd_execute_alias(window, inp, &ran_alias); if (!ran_alias) { - return cmd_execute_default(inp); + return cmd_execute_default(window, inp); } else { return alias_result; } @@ -1913,7 +1971,7 @@ _cmd_execute(const char * const command, const char * const inp) } static char * -_cmd_complete_parameters(const char * const input) +_cmd_complete_parameters(ProfWin *window, const char * const input) { int i; char *result = NULL; @@ -1921,7 +1979,7 @@ _cmd_complete_parameters(const char * const input) // autocomplete boolean settings gchar *boolean_choices[] = { "/beep", "/intype", "/states", "/outtype", "/flash", "/splash", "/chlog", "/grlog", "/mouse", "/history", - "/vercheck", "/privileges", "/presence", "/wrap", "/carbons" }; + "/vercheck", "/privileges", "/presence", "/wrap", "/winstidy", "/carbons", "/encwarn" }; for (i = 0; i < ARRAY_SIZE(boolean_choices); i++) { result = autocomplete_param_with_func(input, boolean_choices[i], prefs_autocomplete_boolean_choice); @@ -1931,8 +1989,9 @@ _cmd_complete_parameters(const char * const input) } // autocomplete nickname in chat rooms - if (ui_current_win_type() == WIN_MUC) { - ProfMucWin *mucwin = wins_get_current_muc(); + if (window->type == WIN_MUC) { + ProfMucWin *mucwin = (ProfMucWin*)window; + assert(mucwin->memcheck == PROFMUCWIN_MEMCHECK); Autocomplete nick_ac = muc_roster_ac(mucwin->roomjid); if (nick_ac) { gchar *nick_choices[] = { "/msg", "/info", "/caps", "/status", "/software" } ; @@ -2008,6 +2067,7 @@ _cmd_complete_parameters(const char * const input) g_hash_table_insert(ac_funcs, "/bookmark", _bookmark_autocomplete); g_hash_table_insert(ac_funcs, "/autoconnect", _autoconnect_autocomplete); g_hash_table_insert(ac_funcs, "/otr", _otr_autocomplete); + g_hash_table_insert(ac_funcs, "/pgp", _pgp_autocomplete); g_hash_table_insert(ac_funcs, "/connect", _connect_autocomplete); g_hash_table_insert(ac_funcs, "/statuses", _statuses_autocomplete); g_hash_table_insert(ac_funcs, "/alias", _alias_autocomplete); @@ -2037,9 +2097,9 @@ _cmd_complete_parameters(const char * const input) } parsed[i] = '\0'; - char * (*ac_func)(const char * const) = g_hash_table_lookup(ac_funcs, parsed); + char * (*ac_func)(ProfWin*, const char * const) = g_hash_table_lookup(ac_funcs, parsed); if (ac_func) { - result = ac_func(input); + result = ac_func(window, input); if (result) { g_hash_table_destroy(ac_funcs); return result; @@ -2048,7 +2108,7 @@ _cmd_complete_parameters(const char * const input) g_hash_table_destroy(ac_funcs); if (g_str_has_prefix(input, "/field")) { - result = _form_field_autocomplete(input); + result = _form_field_autocomplete(window, input); if (result) { return result; } @@ -2058,7 +2118,7 @@ _cmd_complete_parameters(const char * const input) } static char * -_sub_autocomplete(const char * const input) +_sub_autocomplete(ProfWin *window, const char * const input) { char *result = NULL; result = autocomplete_param_with_func(input, "/sub allow", presence_sub_request_find); @@ -2078,12 +2138,11 @@ _sub_autocomplete(const char * const input) } static char * -_who_autocomplete(const char * const input) +_who_autocomplete(ProfWin *window, const char * const input) { char *result = NULL; - win_type_t win_type = ui_current_win_type(); - if (win_type == WIN_MUC) { + if (window->type == WIN_MUC) { result = autocomplete_param_with_ac(input, "/who", who_room_ac, TRUE); if (result) { return result; @@ -2111,7 +2170,7 @@ _who_autocomplete(const char * const input) } static char * -_roster_autocomplete(const char * const input) +_roster_autocomplete(ProfWin *window, const char * const input) { char *result = NULL; result = autocomplete_param_with_func(input, "/roster nick", roster_barejid_autocomplete); @@ -2147,7 +2206,7 @@ _roster_autocomplete(const char * const input) } static char * -_group_autocomplete(const char * const input) +_group_autocomplete(ProfWin *window, const char * const input) { char *result = NULL; result = autocomplete_param_with_func(input, "/group show", roster_group_autocomplete); @@ -2180,7 +2239,7 @@ _group_autocomplete(const char * const input) } static char * -_bookmark_autocomplete(const char * const input) +_bookmark_autocomplete(ProfWin *window, const char * const input) { char *found = NULL; @@ -2259,7 +2318,7 @@ _bookmark_autocomplete(const char * const input) } static char * -_notify_autocomplete(const char * const input) +_notify_autocomplete(ProfWin *window, const char * const input) { int i = 0; char *result = NULL; @@ -2322,7 +2381,7 @@ _notify_autocomplete(const char * const input) } static char * -_autoaway_autocomplete(const char * const input) +_autoaway_autocomplete(ProfWin *window, const char * const input) { char *result = NULL; @@ -2344,7 +2403,7 @@ _autoaway_autocomplete(const char * const input) } static char * -_log_autocomplete(const char * const input) +_log_autocomplete(ProfWin *window, const char * const input) { char *result = NULL; @@ -2367,7 +2426,7 @@ _log_autocomplete(const char * const input) } static char * -_autoconnect_autocomplete(const char * const input) +_autoconnect_autocomplete(ProfWin *window, const char * const input) { char *result = NULL; @@ -2385,7 +2444,7 @@ _autoconnect_autocomplete(const char * const input) } static char * -_otr_autocomplete(const char * const input) +_otr_autocomplete(ProfWin *window, const char * const input) { char *found = NULL; @@ -2423,13 +2482,35 @@ _otr_autocomplete(const char * const input) return found; } - found = autocomplete_param_with_func(input, "/otr warn", - prefs_autocomplete_boolean_choice); + found = autocomplete_param_with_ac(input, "/otr", otr_ac, TRUE); if (found) { return found; } - found = autocomplete_param_with_ac(input, "/otr", otr_ac, TRUE); + return NULL; +} + +static char * +_pgp_autocomplete(ProfWin *window, const char * const input) +{ + char *found = NULL; + + found = autocomplete_param_with_func(input, "/pgp start", roster_contact_autocomplete); + if (found) { + return found; + } + + found = autocomplete_param_with_ac(input, "/pgp log", pgp_log_ac, TRUE); + if (found) { + return found; + } + + found = autocomplete_param_with_func(input, "/pgp setkey", roster_barejid_autocomplete); + if (found) { + return found; + } + + found = autocomplete_param_with_ac(input, "/pgp", pgp_ac, TRUE); if (found) { return found; } @@ -2438,7 +2519,7 @@ _otr_autocomplete(const char * const input) } static char * -_theme_autocomplete(const char * const input) +_theme_autocomplete(ProfWin *window, const char * const input) { char *result = NULL; if ((strncmp(input, "/theme load ", 12) == 0) && (strlen(input) > 12)) { @@ -2467,13 +2548,13 @@ _theme_autocomplete(const char * const input) } static char * -_resource_autocomplete(const char * const input) +_resource_autocomplete(ProfWin *window, const char * const input) { char *found = NULL; - ProfWin *current = wins_get_current(); - if (current && current->type == WIN_CHAT) { - ProfChatWin *chatwin = wins_get_current_chat(); + if (window->type == WIN_CHAT) { + ProfChatWin *chatwin = (ProfChatWin*)window; + assert(chatwin->memcheck == PROFCHATWIN_MEMCHECK); PContact contact = roster_get_contact(chatwin->barejid); if (contact) { Autocomplete ac = p_contact_resource_ac(contact); @@ -2503,7 +2584,7 @@ _resource_autocomplete(const char * const input) } static char * -_titlebar_autocomplete(const char * const input) +_titlebar_autocomplete(ProfWin *window, const char * const input) { char *found = NULL; @@ -2526,7 +2607,7 @@ _titlebar_autocomplete(const char * const input) } static char * -_inpblock_autocomplete(const char * const input) +_inpblock_autocomplete(ProfWin *window, const char * const input) { char *found = NULL; @@ -2544,16 +2625,15 @@ _inpblock_autocomplete(const char * const input) } static char * -_form_autocomplete(const char * const input) +_form_autocomplete(ProfWin *window, const char * const input) { - ProfWin *current = wins_get_current(); - if (current->type != WIN_MUC_CONFIG) { + if (window->type != WIN_MUC_CONFIG) { return NULL; } char *found = NULL; - ProfMucConfWin *confwin = (ProfMucConfWin*)current; + ProfMucConfWin *confwin = (ProfMucConfWin*)window; DataForm *form = confwin->form; if (form) { found = autocomplete_param_with_ac(input, "/form help", form->tag_ac, TRUE); @@ -2571,16 +2651,15 @@ _form_autocomplete(const char * const input) } static char * -_form_field_autocomplete(const char * const input) +_form_field_autocomplete(ProfWin *window, const char * const input) { - ProfWin *current = wins_get_current(); - if (current->type != WIN_MUC_CONFIG) { + if (window->type != WIN_MUC_CONFIG) { return NULL; } char *found = NULL; - ProfMucConfWin *confwin = (ProfMucConfWin*)current; + ProfMucConfWin *confwin = (ProfMucConfWin*)window; DataForm *form = confwin->form; if (form == NULL) { return NULL; @@ -2642,7 +2721,7 @@ _form_field_autocomplete(const char * const input) } static char * -_occupants_autocomplete(const char * const input) +_occupants_autocomplete(ProfWin *window, const char * const input) { char *found = NULL; @@ -2680,7 +2759,7 @@ _occupants_autocomplete(const char * const input) } static char * -_time_autocomplete(const char * const input) +_time_autocomplete(ProfWin *window, const char * const input) { char *found = NULL; @@ -2703,12 +2782,13 @@ _time_autocomplete(const char * const input) } static char * -_kick_autocomplete(const char * const input) +_kick_autocomplete(ProfWin *window, const char * const input) { char *result = NULL; - if (ui_current_win_type() == WIN_MUC) { - ProfMucWin *mucwin = wins_get_current_muc(); + if (window->type == WIN_MUC) { + ProfMucWin *mucwin = (ProfMucWin*)window; + assert(mucwin->memcheck == PROFMUCWIN_MEMCHECK); Autocomplete nick_ac = muc_roster_ac(mucwin->roomjid); if (nick_ac) { @@ -2723,12 +2803,13 @@ _kick_autocomplete(const char * const input) } static char * -_ban_autocomplete(const char * const input) +_ban_autocomplete(ProfWin *window, const char * const input) { char *result = NULL; - if (ui_current_win_type() == WIN_MUC) { - ProfMucWin *mucwin = wins_get_current_muc(); + if (window->type == WIN_MUC) { + ProfMucWin *mucwin = (ProfMucWin*)window; + assert(mucwin->memcheck == PROFMUCWIN_MEMCHECK); Autocomplete jid_ac = muc_roster_jid_ac(mucwin->roomjid); if (jid_ac) { @@ -2743,12 +2824,13 @@ _ban_autocomplete(const char * const input) } static char * -_affiliation_autocomplete(const char * const input) +_affiliation_autocomplete(ProfWin *window, const char * const input) { char *result = NULL; - if (ui_current_win_type() == WIN_MUC) { - ProfMucWin *mucwin = wins_get_current_muc(); + if (window->type == WIN_MUC) { + ProfMucWin *mucwin = (ProfMucWin*)window; + assert(mucwin->memcheck == PROFMUCWIN_MEMCHECK); gboolean parse_result; Autocomplete jid_ac = muc_roster_jid_ac(mucwin->roomjid); @@ -2790,12 +2872,13 @@ _affiliation_autocomplete(const char * const input) } static char * -_role_autocomplete(const char * const input) +_role_autocomplete(ProfWin *window, const char * const input) { char *result = NULL; - if (ui_current_win_type() == WIN_MUC) { - ProfMucWin *mucwin = wins_get_current_muc(); + if (window->type == WIN_MUC) { + ProfMucWin *mucwin = (ProfMucWin*)window; + assert(mucwin->memcheck == PROFMUCWIN_MEMCHECK); gboolean parse_result; Autocomplete nick_ac = muc_roster_ac(mucwin->roomjid); @@ -2837,7 +2920,7 @@ _role_autocomplete(const char * const input) } static char * -_statuses_autocomplete(const char * const input) +_statuses_autocomplete(ProfWin *window, const char * const input) { char *result = NULL; @@ -2865,7 +2948,7 @@ _statuses_autocomplete(const char * const input) } static char * -_receipts_autocomplete(const char * const input) +_receipts_autocomplete(ProfWin *window, const char * const input) { char *result = NULL; @@ -2888,7 +2971,7 @@ _receipts_autocomplete(const char * const input) } static char * -_alias_autocomplete(const char * const input) +_alias_autocomplete(ProfWin *window, const char * const input) { char *result = NULL; @@ -2906,7 +2989,7 @@ _alias_autocomplete(const char * const input) } static char * -_connect_autocomplete(const char * const input) +_connect_autocomplete(ProfWin *window, const char * const input) { char *found = NULL; gboolean result = FALSE; @@ -2941,7 +3024,7 @@ _connect_autocomplete(const char * const input) } static char * -_join_autocomplete(const char * const input) +_join_autocomplete(ProfWin *window, const char * const input) { char *found = NULL; gboolean result = FALSE; @@ -2976,7 +3059,7 @@ _join_autocomplete(const char * const input) } static char * -_account_autocomplete(const char * const input) +_account_autocomplete(ProfWin *window, const char * const input) { char *found = NULL; gboolean result = FALSE; |