1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-06-23 21:45:30 +00:00

Add plugin wins to /win and /close autocompletion

This commit is contained in:
James Booth 2016-03-01 00:03:11 +00:00
parent da7e59bc86
commit 7fdf50eb31
2 changed files with 18 additions and 4 deletions

View File

@ -350,7 +350,7 @@ win_get_string(ProfWin *window)
{
ProfPluginWin *pluginwin = (ProfPluginWin*)window;
GString *gstring = g_string_new("");
g_string_append_printf(gstring, "%s plugin", pluginwin->tag);
g_string_append_printf(gstring, "Plugin: %s", pluginwin->tag);
char *res = gstring->str;
g_string_free(gstring, FALSE);
return res;

View File

@ -389,6 +389,11 @@ wins_get_by_string(char *str)
return (ProfWin*)privwin;
}
ProfPluginWin *pluginwin = wins_get_plugin(str);
if (pluginwin) {
return (ProfWin*)pluginwin;
}
return NULL;
}
@ -539,6 +544,13 @@ wins_close_by_num(int i)
autocomplete_remove(wins_close_ac, "xmlconsole");
break;
}
case WIN_PLUGIN:
{
ProfPluginWin *pluginwin = (ProfPluginWin*)window;
autocomplete_remove(wins_ac, pluginwin->tag);
autocomplete_remove(wins_close_ac, pluginwin->tag);
break;
}
case WIN_MUC_CONFIG:
default:
break;
@ -640,10 +652,12 @@ wins_new_plugin(const char * const tag)
{
GList *keys = g_hash_table_get_keys(windows);
int result = get_next_available_win_num(keys);
ProfWin *new = win_create_plugin(tag);
g_hash_table_insert(windows, GINT_TO_POINTER(result), new);
g_list_free(keys);
return new;
ProfWin *newwin = win_create_plugin(tag);
g_hash_table_insert(windows, GINT_TO_POINTER(result), newwin);
autocomplete_add(wins_ac, tag);
autocomplete_add(wins_close_ac, tag);
return newwin;
}
gboolean