From 50e1776cb0c76b3328d458dd8a1bfb379b6b0e43 Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Mon, 19 Nov 2007 22:23:58 +0000 Subject: Merging /TOPIC code from Miklos Vajna. Untested, because I still have to implement the Jabber hooks. --- irc_commands.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'irc_commands.c') diff --git a/irc_commands.c b/irc_commands.c index 266d9732..287a126f 100644 --- a/irc_commands.c +++ b/irc_commands.c @@ -420,10 +420,21 @@ static void irc_cmd_watch( irc_t *irc, char **cmd ) static void irc_cmd_topic( irc_t *irc, char **cmd ) { - if( cmd[2] ) - irc_reply( irc, 482, "%s :Cannot change topic", cmd[1] ); + char *channel = cmd[1]; + char *topic = cmd[2]; + + if( topic ) + { + /* Send the topic */ + struct groupchat *c = irc_chat_by_channel( irc, channel ); + if( c && c->ic && c->ic->acc->prpl->chat_topic ) + c->ic->acc->prpl->chat_topic( c, topic ); + } else - irc_topic( irc, cmd[1] ); + { + /* Get the topic */ + irc_topic( irc, channel ); + } } static void irc_cmd_away( irc_t *irc, char **cmd ) -- cgit v1.2.3