From 5a75d1586478f78446b6c78b161572fc7cabe4d9 Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Sat, 5 Jun 2010 23:32:36 +0100 Subject: Chatroom improvements. Merged chatroom stub into normal chatroom stuff, restored "chat add" behaviour a little bit better (don't clean up a channel when its room disappears, just disconnect it from the groupchat). --- root_commands.c | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) (limited to 'root_commands.c') diff --git a/root_commands.c b/root_commands.c index cf1c169c..7c54e272 100644 --- a/root_commands.c +++ b/root_commands.c @@ -979,6 +979,11 @@ static void cmd_chat( irc_t *irc, char **cmd ) irc_usermsg( irc, "Invalid account" ); return; } + else if( !acc->prpl->chat_join ) + { + irc_usermsg( irc, "Named chatrooms not supported on that account." ); + return; + } if( cmd[4] == NULL ) { @@ -998,13 +1003,19 @@ static void cmd_chat( irc_t *irc, char **cmd ) channel = s; } - if( ( ic = irc_channel_new( irc, channel ) ) ) + if( ( ic = irc_channel_new( irc, channel ) ) && + set_setstr( &ic->set, "chat_type", "room" ) && + set_setstr( &ic->set, "account", cmd[2] ) && + set_setstr( &ic->set, "room", cmd[3] ) ) + { + irc_usermsg( irc, "Chatroom successfully added." ); + } + else { - struct irc_groupchat_stub *igs; + if( ic ) + irc_channel_free( ic ); - ic->data = igs = g_new0( struct irc_groupchat_stub, 1 ); - igs->acc = acc; - igs->room = g_strdup( cmd[3] ); + irc_usermsg( irc, "Could not add chatroom." ); } } /* -- cgit v1.2.3