diff options
author | Timo Sirainen <cras@irssi.org> | 2002-02-10 10:07:12 +0000 |
---|---|---|
committer | cras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564> | 2002-02-10 10:07:12 +0000 |
commit | 3990779dc507e0c81dceae0ea691294d2b15e910 (patch) | |
tree | 1c175175f48fb817baa39ad3c045e0162c4fdc5f /src/fe-common/core/chat-completion.c | |
parent | 62028ad487cf61549a3c32f6fcab093dddf8db0d (diff) | |
download | irssi-3990779dc507e0c81dceae0ea691294d2b15e910.zip |
/BIND meta-k erase_completion - support for removing completion data.
Currently this works only with /MSG completion, so eg. /MSG nick <meta-k>
removes nick from completion list and jumps to next completion.
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@2407 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'src/fe-common/core/chat-completion.c')
-rw-r--r-- | src/fe-common/core/chat-completion.c | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/src/fe-common/core/chat-completion.c b/src/fe-common/core/chat-completion.c index 7be923fc..54143062 100644 --- a/src/fe-common/core/chat-completion.c +++ b/src/fe-common/core/chat-completion.c @@ -646,6 +646,41 @@ static void sig_complete_msg(GList **list, WINDOW_REC *window, if (*list != NULL) signal_stop(); } +static void sig_erase_complete_msg(WINDOW_REC *window, const char *word, + const char *line) +{ + SERVER_REC *server; + MODULE_SERVER_REC *mserver; + GSList *tmp; + + server = line_get_server(line); + if (server == NULL){ + server = window->active_server; + if (server == NULL) + return; + } + + if (*word == '\0') + return; + + /* check from global list */ + completion_last_message_remove(word); + + /* check from server specific list */ + if (server != NULL) { + mserver = MODULE_DATA(server); + for (tmp = mserver->lastmsgs; tmp != NULL; tmp = tmp->next) { + LAST_MSG_REC *rec = tmp->data; + + if (g_strcasecmp(rec->nick, word) == 0) { + last_msg_destroy(&mserver->lastmsgs, rec); + break; + } + } + + } +} + GList *completion_get_chatnets(const char *word) { GList *list; @@ -874,6 +909,7 @@ void chat_completion_init(void) read_settings(); signal_add("complete word", (SIGNAL_FUNC) sig_complete_word); signal_add("complete command msg", (SIGNAL_FUNC) sig_complete_msg); + signal_add("complete erase command msg", (SIGNAL_FUNC) sig_erase_complete_msg); signal_add("complete command connect", (SIGNAL_FUNC) sig_complete_connect); signal_add("complete command server", (SIGNAL_FUNC) sig_complete_connect); signal_add("complete command topic", (SIGNAL_FUNC) sig_complete_topic); @@ -897,6 +933,7 @@ void chat_completion_deinit(void) signal_remove("complete word", (SIGNAL_FUNC) sig_complete_word); signal_remove("complete command msg", (SIGNAL_FUNC) sig_complete_msg); + signal_remove("complete erase command msg", (SIGNAL_FUNC) sig_erase_complete_msg); signal_remove("complete command connect", (SIGNAL_FUNC) sig_complete_connect); signal_remove("complete command server", (SIGNAL_FUNC) sig_complete_connect); signal_remove("complete command topic", (SIGNAL_FUNC) sig_complete_topic); |