diff options
author | Sven Moritz Hallberg <pesco@khjk.org> | 2009-03-12 20:33:28 +0100 |
---|---|---|
committer | Sven Moritz Hallberg <pesco@khjk.org> | 2009-03-12 20:33:28 +0100 |
commit | 673a54c5a78afd1dd41b4cd8811df5ab65042583 (patch) | |
tree | bffaa961139ac2be20f0875ef0ed37c87d6b18a9 /irc_commands.c | |
parent | 823de9d44f262ea2364ac8ec6a1e18e0f7dab658 (diff) | |
parent | 9e768da723b4a770967efa0d4dcaf58ccef8917f (diff) |
pretty blind try at merging in the latest trunk
Diffstat (limited to 'irc_commands.c')
-rw-r--r-- | irc_commands.c | 32 |
1 files changed, 7 insertions, 25 deletions
diff --git a/irc_commands.c b/irc_commands.c index 6a47007a..09289a55 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,32 +192,14 @@ 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] ) - { - user_t *u = user_find( irc, cmd[1] + 1 ); - - 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 - { - irc_reply( irc, 403, "%s :No such nick", cmd[1] ); - } - } + struct chat *c; + + if( strchr( CTYPES, cmd[1][0] ) == NULL || cmd[1][1] == 0 ) + irc_reply( irc, 479, "%s :Invalid channel name", cmd[1] ); + else if( ( c = chat_bychannel( irc, cmd[1] ) ) && c->acc && c->acc->ic ) + chat_join( irc, c, cmd[2] ); else - { irc_reply( irc, 403, "%s :No such channel", cmd[1] ); - } } } |