From 51a3d12c3187bb0af530bbf36cf8619b57d0ea1a Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Sun, 25 Jul 2010 11:11:48 +0200 Subject: Allow change nicknames when moving contacts between groups. Also fixing a bug that caused many empty channel mode changes being sent. --- irc_im.c | 11 +++++++++++ irc_send.c | 3 ++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/irc_im.c b/irc_im.c index 2033b1a8..d2898db4 100644 --- a/irc_im.c +++ b/irc_im.c @@ -287,10 +287,21 @@ static gboolean bee_irc_user_group( bee_t *bee, bee_user_t *bu ) { irc_user_t *iu = (irc_user_t *) bu->ui_data; irc_t *irc = (irc_t *) bee->ui_data; + bee_user_flags_t online; + + /* Take the user offline temporarily so we can change the nick (if necessary). */ + if( ( online = bu->flags & BEE_USER_ONLINE ) ) + bu->flags &= ~BEE_USER_ONLINE; bee_irc_channel_update( irc, NULL, iu ); bee_irc_user_nick_update( iu ); + if( online ) + { + bu->flags |= online; + bee_irc_channel_update( irc, NULL, iu ); + } + return TRUE; } diff --git a/irc_send.c b/irc_send.c index b62d2011..b6ffe130 100644 --- a/irc_send.c +++ b/irc_send.c @@ -395,5 +395,6 @@ void irc_send_channel_user_mode_diff( irc_channel_t *ic, irc_user_t *iu, g_snprintf( from, sizeof( from ), "%s!%s@%s", ic->irc->root->nick, ic->irc->root->user, ic->irc->root->host ); - irc_write( ic->irc, ":%s MODE %s %s", from, ic->name, changes ); + if( *changes ) + irc_write( ic->irc, ":%s MODE %s %s", from, ic->name, changes ); } -- cgit v1.2.3