X-Git-Url: https://git.quassel-irc.org/?a=blobdiff_plain;f=src%2Fcommon%2Fircuser.cpp;h=dc39e154e041bb941913799c57ce8c820eab1f84;hb=24c7de34254b5de4cf28045a6923a527e06f7290;hp=94d404d5f1a30c4ecdcafca3ad3ad6e173bb929a;hpb=3e800ec6553158aa0da3b08da78083d587389914;p=quassel.git diff --git a/src/common/ircuser.cpp b/src/common/ircuser.cpp index 94d404d5..dc39e154 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-2022 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * @@ -291,17 +291,9 @@ void IrcUser::joinChannel(const QString& channelname) joinChannel(network()->newIrcChannel(channelname)); } -void IrcUser::partChannel(IrcChannel* channel, bool skip_sync) +void IrcUser::partChannel(IrcChannel* channel) { - 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)) - quit(skip_sync); - } + partChannelInternal(channel, false); } void IrcUser::partChannel(const QString& channelname) @@ -315,7 +307,25 @@ void IrcUser::partChannel(const QString& channelname) } } -void IrcUser::quit(bool skip_sync) +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(bool skip_sync) channel->part(this); } network()->removeIrcUser(this); - if (!skip_sync) SYNC(NO_ARG) + if (!skip_sync) SYNC_OTHER(quit, NO_ARG) emit quited(); }