From: Janne Koschinski Date: Tue, 28 May 2019 11:04:06 +0000 (+0200) Subject: Fix protocol spam on part/quit/disconnect X-Git-Tag: test-travis-01~11 X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=commitdiff_plain;h=3e800ec6553158aa0da3b08da78083d587389914 Fix protocol spam on part/quit/disconnect --- diff --git a/src/common/ircchannel.cpp b/src/common/ircchannel.cpp index 15093b35..2b955188 100644 --- a/src/common/ircchannel.cpp +++ b/src/common/ircchannel.cpp @@ -231,7 +231,7 @@ void IrcChannel::part(IrcUser* ircuser) _userModes.clear(); foreach (IrcUser* user, users) { disconnect(user, nullptr, this, nullptr); - user->partChannel(this); + user->partChannel(this, true); } emit parted(); network()->removeIrcChannel(this); diff --git a/src/common/ircuser.cpp b/src/common/ircuser.cpp index d7b65f09..94d404d5 100644 --- a/src/common/ircuser.cpp +++ b/src/common/ircuser.cpp @@ -291,16 +291,16 @@ void IrcUser::joinChannel(const QString& channelname) joinChannel(network()->newIrcChannel(channelname)); } -void IrcUser::partChannel(IrcChannel* channel) +void IrcUser::partChannel(IrcChannel* channel, bool skip_sync) { if (_channels.contains(channel)) { _channels.remove(channel); disconnect(channel, nullptr, this, nullptr); channel->part(this); QString channelName = channel->name(); - SYNC_OTHER(partChannel, ARG(channelName)) + if (!skip_sync) SYNC_OTHER(partChannel, ARG(channelName)) if (_channels.isEmpty() && !network()->isMe(this)) - quit(); + quit(skip_sync); } } @@ -315,7 +315,7 @@ void IrcUser::partChannel(const QString& channelname) } } -void IrcUser::quit() +void IrcUser::quit(bool skip_sync) { QList channels = _channels.values(); _channels.clear(); @@ -324,7 +324,7 @@ void IrcUser::quit() channel->part(this); } network()->removeIrcUser(this); - SYNC(NO_ARG) + if (!skip_sync) SYNC(NO_ARG) emit quited(); } diff --git a/src/common/ircuser.h b/src/common/ircuser.h index 81847701..2aa2c179 100644 --- a/src/common/ircuser.h +++ b/src/common/ircuser.h @@ -166,9 +166,9 @@ public slots: */ void joinChannel(IrcChannel* channel, bool skip_channel_join = false); void joinChannel(const QString& channelname); - void partChannel(IrcChannel* channel); + void partChannel(IrcChannel* channel, bool skip_sync = false); void partChannel(const QString& channelname); - void quit(); + void quit(bool skip_sync = false); void addUserModes(const QString& modes); void removeUserModes(const QString& modes);