aboutsummaryrefslogtreecommitdiffstats
path: root/irc_commands.c
diff options
context:
space:
mode:
authorWilmer van der Gaast <wilmer@gaast.net>2009-12-07 21:54:19 +0000
committerWilmer van der Gaast <wilmer@gaast.net>2009-12-07 21:54:19 +0000
commit2288705af462b4aca2d56f228bff269eab8d8b5f (patch)
treecbdf792579f11297773583cc822548867fdfc19c /irc_commands.c
parentaac40178a6669e20855b7f5d3cc6a82cba10042e (diff)
parent36cf9fda6a5cc4bcbfe98319b48af636fa142590 (diff)
Merging head.
Diffstat (limited to 'irc_commands.c')
-rw-r--r--irc_commands.c35
1 files changed, 9 insertions, 26 deletions
diff --git a/irc_commands.c b/irc_commands.c
index fb2bc7cf..74334ee9 100644
--- a/irc_commands.c
+++ b/irc_commands.c
@@ -26,6 +26,7 @@
#define BITLBEE_CORE
#include "bitlbee.h"
#include "ipc.h"
+#include "chat.h"
static void irc_cmd_pass( irc_t *irc, char **cmd )
{
@@ -124,7 +125,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 +193,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] );
- }
}
}
@@ -432,8 +415,8 @@ static void irc_cmd_watch( irc_t *irc, char **cmd )
if( g_hash_table_lookup_extended( irc->watches, nick, &okey, &ovalue ) )
{
- g_free( okey );
g_hash_table_remove( irc->watches, okey );
+ g_free( okey );
irc_reply( irc, 602, "%s %s %s %d :%s", nick, "*", "*", 0, "Stopped watching" );
}