diff options
author | Wilmer van der Gaast <wilmer@gaast.net> | 2007-04-22 19:58:44 -0700 |
---|---|---|
committer | Wilmer van der Gaast <wilmer@gaast.net> | 2007-04-22 19:58:44 -0700 |
commit | 0e7ab64dfb66192a875c37322ca6f8a364ec5bc8 (patch) | |
tree | 93e010a079632973a1e101ad0b85e4af67923643 /root_commands.c | |
parent | 43671b964b636520a54e343542c5958b30e9f589 (diff) |
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...
Diffstat (limited to 'root_commands.c')
-rw-r--r-- | root_commands.c | 15 |
1 files changed, 14 insertions, 1 deletions
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 ); |