From 0e7ab64dfb66192a875c37322ca6f8a364ec5bc8 Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Sun, 22 Apr 2007 19:58:44 -0700 Subject: Got rid of one HORRIBLE stupidity called chat_by_channel(), which still used the GLOBAL IM connections list, allowing user A to interfere with user B's groupchats if running in daemon mode. I can't believe this was still there... --- root_commands.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'root_commands.c') diff --git a/root_commands.c b/root_commands.c index 2b57fb4f..9965c2e8 100644 --- a/root_commands.c +++ b/root_commands.c @@ -917,7 +917,7 @@ static void cmd_join_chat( irc_t *irc, char **cmd ) { char *s; - channel = g_strdup( chat ); + channel = g_strdup_printf( "&%s", chat ); if( ( s = strchr( channel, '@' ) ) ) *s = 0; } @@ -928,6 +928,19 @@ static void cmd_join_chat( irc_t *irc, char **cmd ) if( cmd[3] && cmd[4] && cmd[5] ) password = cmd[5]; + if( channel[0] != '#' && channel[0] != '&' ) + { + irc_usermsg( irc, "Invalid channel name: %s", channel ); + g_free( channel ); + return; + } + else if( g_strcasecmp( channel, irc->channel ) == 0 || irc_chat_by_channel( irc, channel ) ) + { + irc_usermsg( irc, "Channel already exists: %s", channel ); + g_free( channel ); + return; + } + if( ( c = a->prpl->chat_join( ic, chat, nick, password ) ) ) { g_free( c->channel ); -- cgit v1.2.3