From 39f93f0ce1c0a179b51f5ff6474d57509e9e0d17 Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Sun, 31 Aug 2008 14:42:33 +0100 Subject: /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. --- irc_commands.c | 37 +++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 18 deletions(-) (limited to 'irc_commands.c') 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 -- cgit v1.2.3 From 3611717156f4c9ebfdf829319840d49e59b827ce Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Sun, 31 Aug 2008 16:00:35 +0100 Subject: Added auto_join code. --- irc_commands.c | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) (limited to 'irc_commands.c') diff --git a/irc_commands.c b/irc_commands.c index d083f714..8941b0e9 100644 --- a/irc_commands.c +++ b/irc_commands.c @@ -192,7 +192,6 @@ static void irc_cmd_join( irc_t *irc, char **cmd ) RFC doesn't have any reply for that though? */ else if( cmd[1] ) { - struct groupchat *gc; struct chat *c; user_t *u; @@ -204,16 +203,7 @@ static void irc_cmd_join( irc_t *irc, char **cmd ) if( ( c = chat_bychannel( irc, cmd[1] ) ) ) { - char *nick = set_getstr( &c->set, "nick" ); - - if( nick == NULL ) - nick = irc->nick; - - if( ( gc = c->acc->prpl->chat_join( c->acc->ic, c->handle, nick, NULL ) ) ) - { - g_free( gc->channel ); - gc->channel = g_strdup( c->channel ); - } + chat_join( irc, c ); } else { -- cgit v1.2.3 From e180c59a7796bb651b96ffaa5757e4688f1d3cc6 Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Sun, 28 Sep 2008 11:56:46 +0100 Subject: Fixed irc_cmd_join(). Giving a more proper response to invalid channel names, and checking if an account is on-line before attempting to join one of its chatrooms. --- irc_commands.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) (limited to 'irc_commands.c') diff --git a/irc_commands.c b/irc_commands.c index 8941b0e9..71a8fb3e 100644 --- a/irc_commands.c +++ b/irc_commands.c @@ -196,19 +196,11 @@ static void irc_cmd_join( irc_t *irc, char **cmd ) 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] ) ) ) - { + 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 ); - } else - { irc_reply( irc, 403, "%s :No such channel", cmd[1] ); - } } } -- cgit v1.2.3 From 94acdd0d7beaa659a5f6b26673c5dea5dbcc4496 Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Sun, 28 Sep 2008 12:18:19 +0100 Subject: Restored support for password-protected chatrooms (for now only by accepting a password in the IRC JOIN command). --- irc_commands.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'irc_commands.c') diff --git a/irc_commands.c b/irc_commands.c index 71a8fb3e..bdca5b24 100644 --- a/irc_commands.c +++ b/irc_commands.c @@ -193,12 +193,11 @@ static void irc_cmd_join( irc_t *irc, char **cmd ) else if( cmd[1] ) { struct chat *c; - user_t *u; 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 ); + chat_join( irc, c, cmd[2] ); else irc_reply( irc, 403, "%s :No such channel", cmd[1] ); } -- cgit v1.2.3 From e59b4f65183a7bee638312a0c96e3d0607cb181f Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Sun, 4 Oct 2009 20:00:53 +0100 Subject: Fixed embarassing early free() bug that sat in the WATCH command handling for *years*. I guess it took a while for IRC clients to actually use that functionality... --- irc_commands.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'irc_commands.c') diff --git a/irc_commands.c b/irc_commands.c index bdca5b24..044ff62c 100644 --- a/irc_commands.c +++ b/irc_commands.c @@ -414,8 +414,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" ); } -- cgit v1.2.3 From b75acf6367400ff88428618719cefbbee648b0cb Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Thu, 22 Oct 2009 22:55:23 +0100 Subject: Don't include chat.h from bitlbee.h. make install-dev doesn't install chat.h and it shouldn't ... but things broke because bitlbee.h includes it. Fixes #534. --- irc_commands.c | 1 + 1 file changed, 1 insertion(+) (limited to 'irc_commands.c') diff --git a/irc_commands.c b/irc_commands.c index 044ff62c..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 ) { -- cgit v1.2.3