_userModes.clear();
foreach (IrcUser* user, users) {
disconnect(user, nullptr, this, nullptr);
- user->partChannel(this, true);
+ user->partChannelInternal(this, true);
}
emit parted();
network()->removeIrcChannel(this);
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)
}
}
-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<IrcChannel*> channels = _channels.values();
_channels.clear();
_awayChanged = false;
}
+ void partChannelInternal(IrcChannel* channel, bool skip_sync = false);
+ void quitInternal(bool skip_sync = false);
+
public slots:
void setUser(const QString& user);
void setHost(const QString& host);
*/
void joinChannel(IrcChannel* channel, bool skip_channel_join = false);
void joinChannel(const QString& channelname);
- void partChannel(IrcChannel* channel, bool skip_sync = false);
+ void partChannel(IrcChannel* channel);
void partChannel(const QString& channelname);
- void quit(bool skip_sync = false);
+ void quit();
void addUserModes(const QString& modes);
void removeUserModes(const QString& modes);