From e35d1a121d5fb2da3698fbe4a365fe38d0097665 Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Sun, 22 Apr 2007 13:44:27 -0700 Subject: Read-only support for Jabber conferences (non-anonymous rooms only). Just don't use this, you're really not going to like it. :-) --- root_commands.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'root_commands.c') diff --git a/root_commands.c b/root_commands.c index a7582936..2b57fb4f 100644 --- a/root_commands.c +++ b/root_commands.c @@ -923,12 +923,21 @@ static void cmd_join_chat( irc_t *irc, char **cmd ) } if( cmd[3] && cmd[4] ) nick = cmd[4]; + else + nick = irc->nick; if( cmd[3] && cmd[4] && cmd[5] ) password = cmd[5]; - c = a->prpl->chat_join( ic, chat, nick, password ); - - g_free( channel ); + if( ( c = a->prpl->chat_join( ic, chat, nick, password ) ) ) + { + g_free( c->channel ); + c->channel = channel; + } + else + { + irc_usermsg( irc, "Tried to join chat, not sure if this was successful" ); + g_free( channel ); + } } const command_t commands[] = { -- cgit v1.2.3 From 0e7ab64dfb66192a875c37322ca6f8a364ec5bc8 Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Sun, 22 Apr 2007 19:58:44 -0700 Subject: 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... --- root_commands.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'root_commands.c') 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 ); -- cgit v1.2.3 From 7bf4326f7a9b2a2aec8b292ecbc876d4349d2624 Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Sun, 1 Jul 2007 13:20:23 +0100 Subject: Better groupchat channel name generation/verification. --- root_commands.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'root_commands.c') diff --git a/root_commands.c b/root_commands.c index 9965c2e8..8ffebd8e 100644 --- a/root_commands.c +++ b/root_commands.c @@ -911,7 +911,10 @@ static void cmd_join_chat( irc_t *irc, char **cmd ) chat = cmd[2]; if( cmd[3] ) { - channel = g_strdup( cmd[3] ); + if( channel[0] != '#' && channel[0] != '&' ) + channel = g_strdup_printf( "&%s", cmd[3] ); + else + channel = g_strdup( cmd[3] ); } else { @@ -928,7 +931,7 @@ 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] != '&' ) + if( !nick_ok( channel + 1 ) ) { irc_usermsg( irc, "Invalid channel name: %s", channel ); g_free( channel ); -- cgit v1.2.3 From 9da0bbfd42609f0f3864b5a16a3c1c378b7217c9 Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Mon, 2 Jul 2007 23:12:03 +0100 Subject: Added (and using) jabber_chat_free() for better memory management, fixed channel name generation code in root_commands.c and fixed one memory leak in jabber_buddy_remove_bare(). --- root_commands.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'root_commands.c') diff --git a/root_commands.c b/root_commands.c index 8ffebd8e..0f9f776c 100644 --- a/root_commands.c +++ b/root_commands.c @@ -911,7 +911,7 @@ static void cmd_join_chat( irc_t *irc, char **cmd ) chat = cmd[2]; if( cmd[3] ) { - if( channel[0] != '#' && channel[0] != '&' ) + if( cmd[3][0] != '#' && cmd[3][0] != '&' ) channel = g_strdup_printf( "&%s", cmd[3] ); else channel = g_strdup( cmd[3] ); -- cgit v1.2.3