summaryrefslogtreecommitdiff
path: root/src/fe-common/core
diff options
context:
space:
mode:
authorTimo Sirainen <cras@irssi.org>2001-10-21 11:22:06 +0000
committercras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564>2001-10-21 11:22:06 +0000
commit3ae5080619c97d57ecc36b60eea651fe4d7302fe (patch)
treef2b4acf759c4413642d024172f50df48c4498de7 /src/fe-common/core
parent06c431bcd784ec9f30e39d3ddece269bfa3da63a (diff)
downloadirssi-3ae5080619c97d57ecc36b60eea651fe4d7302fe.zip
/TOPIC <tab> inserts the topic in active channel.
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@1876 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'src/fe-common/core')
-rw-r--r--src/fe-common/core/chat-completion.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/fe-common/core/chat-completion.c b/src/fe-common/core/chat-completion.c
index 2a0ef852..632897f0 100644
--- a/src/fe-common/core/chat-completion.c
+++ b/src/fe-common/core/chat-completion.c
@@ -698,6 +698,24 @@ static void sig_complete_connect(GList **list, WINDOW_REC *window,
if (*list != NULL) signal_stop();
}
+static void sig_complete_topic(GList **list, WINDOW_REC *window,
+ const char *word, const char *line,
+ int *want_space)
+{
+ const char *topic;
+
+ g_return_if_fail(list != NULL);
+ g_return_if_fail(word != NULL);
+
+ if (*word == '\0' && IS_CHANNEL(window->active)) {
+ topic = CHANNEL(window->active)->topic;
+ if (topic != NULL) {
+ *list = g_list_append(NULL, g_strdup(topic));
+ signal_stop();
+ }
+ }
+}
+
/* expand \n, \t and \\ */
static char *expand_escapes(const char *line, SERVER_REC *server,
WI_ITEM_REC *item)
@@ -837,6 +855,7 @@ void chat_completion_init(void)
signal_add("complete command msg", (SIGNAL_FUNC) sig_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("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);
@@ -859,6 +878,7 @@ void chat_completion_deinit(void)
signal_remove("complete command msg", (SIGNAL_FUNC) sig_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("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);