Merges from Irssi CVS.
[crypto.git] / apps / irssi / src / fe-common / core / chat-completion.c
index a3d92ccde09384fa103e2f07bbf0de2008572247..df5525eb4ad08765f979c893e8b99e2f8967b188 100644 (file)
@@ -22,6 +22,7 @@
 #include "signals.h"
 #include "commands.h"
 #include "misc.h"
+#include "levels.h"
 #include "settings.h"
 
 #include "chatnets.h"
@@ -603,6 +604,9 @@ static void sig_complete_word(GList **list, WINDOW_REC *window,
                /* nick completion .. we could also be completing a nick
                   after /MSG from nicks in channel */
                complete_window_nicks(list, window, word, linestart);
+       } else if (window->level & MSGLEVEL_MSGS) {
+               /* msgs window, complete /MSG nicks */
+                *list = g_list_concat(completion_msg(server, NULL, word, NULL), *list);
        }
 
        if (*list != NULL) signal_stop();
@@ -753,6 +757,17 @@ static void sig_complete_topic(GList **list, WINDOW_REC *window,
        }
 }
 
+static void sig_complete_channel(GList **list, WINDOW_REC *window,
+                                const char *word, const char *line,
+                                int *want_space)
+{
+       g_return_if_fail(list != NULL);
+       g_return_if_fail(word != NULL);
+
+       *list = completion_get_channels(NULL, word);
+       if (*list != NULL) signal_stop();
+}
+
 /* expand \n, \t and \\ */
 static char *expand_escapes(const char *line, SERVER_REC *server,
                            WI_ITEM_REC *item)
@@ -910,11 +925,14 @@ void chat_completion_init(void)
        signal_add("complete word", (SIGNAL_FUNC) sig_complete_word);
        signal_add("complete command msg", (SIGNAL_FUNC) sig_complete_msg);
        signal_add("complete command query", (SIGNAL_FUNC) sig_complete_msg);
+       signal_add("complete command action", (SIGNAL_FUNC) sig_complete_msg);
        signal_add("complete erase command msg", (SIGNAL_FUNC) sig_erase_complete_msg);
        signal_add("complete erase command query", (SIGNAL_FUNC) sig_erase_complete_msg);
+       signal_add("complete erase command action", (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);
+       signal_add("complete command window item move", (SIGNAL_FUNC) sig_complete_channel);
        signal_add("message public", (SIGNAL_FUNC) sig_message_public);
        signal_add("message join", (SIGNAL_FUNC) sig_message_join);
        signal_add("message private", (SIGNAL_FUNC) sig_message_private);
@@ -936,11 +954,14 @@ 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 command query", (SIGNAL_FUNC) sig_complete_msg);
+       signal_remove("complete command action", (SIGNAL_FUNC) sig_complete_msg);
        signal_remove("complete erase command msg", (SIGNAL_FUNC) sig_erase_complete_msg);
        signal_remove("complete erase command query", (SIGNAL_FUNC) sig_erase_complete_msg);
+       signal_remove("complete erase command action", (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);
+       signal_remove("complete command window item move", (SIGNAL_FUNC) sig_complete_channel);
        signal_remove("message public", (SIGNAL_FUNC) sig_message_public);
        signal_remove("message join", (SIGNAL_FUNC) sig_message_join);
        signal_remove("message private", (SIGNAL_FUNC) sig_message_private);