diff options
author | Wilmer van der Gaast <wilmer@gaast.net> | 2008-08-31 14:42:33 +0100 |
---|---|---|
committer | Wilmer van der Gaast <wilmer@gaast.net> | 2008-08-31 14:42:33 +0100 |
commit | 39f93f0ce1c0a179b51f5ff6474d57509e9e0d17 (patch) | |
tree | 2471e302b8e5afff153cd1d8c831b9ec0c68f7ed /irc_commands.c | |
parent | 0e639f5e5245aa807764162b7f1928b641947658 (diff) |
/join can now be used to join chatrooms, join_chat should not be used
anymore. /join should not be used for unnamed groupchats anymore, use
"chat with" instead.
Diffstat (limited to 'irc_commands.c')
-rw-r--r-- | irc_commands.c | 37 |
1 files changed, 19 insertions, 18 deletions
diff --git a/irc_commands.c b/irc_commands.c index fb2bc7cf..d083f714 100644 --- a/irc_commands.c +++ b/irc_commands.c @@ -124,7 +124,7 @@ static void irc_cmd_oper( irc_t *irc, char **cmd ) static void irc_cmd_mode( irc_t *irc, char **cmd ) { - if( *cmd[1] == '#' || *cmd[1] == '&' ) + if( strchr( CTYPES, *cmd[1] ) ) { if( cmd[2] ) { @@ -192,26 +192,27 @@ static void irc_cmd_join( irc_t *irc, char **cmd ) RFC doesn't have any reply for that though? */ else if( cmd[1] ) { - if( ( cmd[1][0] == '#' || cmd[1][0] == '&' ) && cmd[1][1] ) + struct groupchat *gc; + struct chat *c; + user_t *u; + + if( strchr( CTYPES, cmd[1][0] ) == NULL || cmd[1][1] == 0 ) + { + irc_reply( irc, 403, "%s :No such channel", cmd[1] ); + return; + } + + if( ( c = chat_bychannel( irc, cmd[1] ) ) ) { - user_t *u = user_find( irc, cmd[1] + 1 ); + char *nick = set_getstr( &c->set, "nick" ); - if( u && u->ic && u->ic->acc->prpl->chat_with ) - { - irc_reply( irc, 403, "%s :Initializing groupchat in a different channel", cmd[1] ); - - if( !u->ic->acc->prpl->chat_with( u->ic, u->handle ) ) - { - irc_usermsg( irc, "Could not open a groupchat with %s.", u->nick ); - } - } - else if( u ) - { - irc_reply( irc, 403, "%s :Groupchats are not possible with %s", cmd[1], cmd[1]+1 ); - } - else + if( nick == NULL ) + nick = irc->nick; + + if( ( gc = c->acc->prpl->chat_join( c->acc->ic, c->handle, nick, NULL ) ) ) { - irc_reply( irc, 403, "%s :No such nick", cmd[1] ); + g_free( gc->channel ); + gc->channel = g_strdup( c->channel ); } } else |