X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fcommon%2Fircuser.cpp;h=ec1ecb1c93c903c93b3386fbf30a4c9da29b3b92;hp=a23595c15a9f9a6ec2671a3f761d6ae8f59bdd08;hb=7298446b3e86140c4bbbfe7aeeb959c16c53363c;hpb=cc6e7c08709c4e761e2fd9c2e322751015497003 diff --git a/src/common/ircuser.cpp b/src/common/ircuser.cpp index a23595c1..ec1ecb1c 100644 --- a/src/common/ircuser.cpp +++ b/src/common/ircuser.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2019 by the Quassel Project * + * Copyright (C) 2005-2020 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * @@ -293,15 +293,7 @@ void IrcUser::joinChannel(const QString& channelname) void IrcUser::partChannel(IrcChannel* channel) { - 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 (_channels.isEmpty() && !network()->isMe(this)) - quit(); - } + partChannelInternal(channel, false); } void IrcUser::partChannel(const QString& channelname) @@ -315,16 +307,34 @@ void IrcUser::partChannel(const QString& channelname) } } +void IrcUser::partChannelInternal(IrcChannel* channel, bool skip_sync) +{ + if (_channels.contains(channel)) { + _channels.remove(channel); + disconnect(channel, nullptr, this, nullptr); + channel->part(this); + QString channelName = channel->name(); + if (!skip_sync) SYNC_OTHER(partChannel, ARG(channelName)) + if (_channels.isEmpty() && !network()->isMe(this)) + quitInternal(skip_sync); + } +} + void IrcUser::quit() { - QList channels = _channels.toList(); + quitInternal(false); +} + +void IrcUser::quitInternal(bool skip_sync) +{ + QList channels = _channels.values(); _channels.clear(); foreach (IrcChannel* channel, channels) { disconnect(channel, nullptr, this, nullptr); channel->part(this); } network()->removeIrcUser(this); - SYNC(NO_ARG) + if (!skip_sync) SYNC(NO_ARG) emit quited(); }