X-Git-Url: https://git.quassel-irc.org/?a=blobdiff_plain;f=src%2Fcommon%2Fircuser.cpp;h=de299800b7dfd3e517b57eabe8763832706623fe;hb=c01c1ad4823a3e49c9526c19560dd5ce4fe30cb8;hp=d7b65f09a4bb330b5ab326328caa1c03a956770d;hpb=52209badc8e769e50aa3019b63689dda0e79e9d0;p=quassel.git diff --git a/src/common/ircuser.cpp b/src/common/ircuser.cpp index d7b65f09..de299800 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,7 +307,25 @@ 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() +{ + quitInternal(false); +} + +void IrcUser::quitInternal(bool skip_sync) { QList channels = _channels.values(); _channels.clear(); @@ -324,7 +334,7 @@ void IrcUser::quit() channel->part(this); } network()->removeIrcUser(this); - SYNC(NO_ARG) + if (!skip_sync) SYNC_OTHER(quit, NO_ARG) emit quited(); }