X-Git-Url: https://git.quassel-irc.org/?a=blobdiff_plain;f=src%2Fcommon%2Fircuser.cpp;h=de299800b7dfd3e517b57eabe8763832706623fe;hb=2491fb92519912fa2169fb9d7dbc631a03bf5570;hp=e0bcc787a01f80280e74dc72ce93b386f140c473;hpb=b8ce41ef6c0036d854f5bef0fb52e2a69dc5def2;p=quassel.git diff --git a/src/common/ircuser.cpp b/src/common/ircuser.cpp index e0bcc787..de299800 100644 --- a/src/common/ircuser.cpp +++ b/src/common/ircuser.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2018 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_OTHER(quit, NO_ARG) emit quited(); }