X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fcommon%2Fircuser.cpp;h=f8a1e0a956d3dadc9167add6e6af57e06f6f9dc5;hp=22df0c942745d35830434ddd2f52c51802b15e67;hb=4493458caaa821deb69a0cddf13beb98394977bb;hpb=c79539bee8761bcabe057d8d72594d16da24528f diff --git a/src/common/ircuser.cpp b/src/common/ircuser.cpp index 22df0c94..f8a1e0a9 100644 --- a/src/common/ircuser.cpp +++ b/src/common/ircuser.cpp @@ -218,7 +218,6 @@ void IrcUser::joinChannel(IrcChannel *channel) { if(!_channels.contains(channel)) { _channels.insert(channel); channel->joinIrcUsers(this); - connect(channel, SIGNAL(destroyed()), this, SLOT(channelDestroyed())); } } @@ -233,7 +232,7 @@ void IrcUser::partChannel(IrcChannel *channel) { channel->part(this); emit channelParted(channel->name()); if(_channels.isEmpty() && !network()->isMe(this)) - deleteLater(); + quit(); } } @@ -246,13 +245,24 @@ void IrcUser::partChannel(const QString &channelname) { } } +void IrcUser::quit() { + QList channels = _channels.toList(); + _channels.clear(); + foreach(IrcChannel *channel, channels) { + disconnect(channel, 0, this, 0); + channel->part(this); + } + network()->removeIrcUser(this); + emit quited(); +} + void IrcUser::channelDestroyed() { // private slot! IrcChannel *channel = static_cast(sender()); if(_channels.contains(channel)) { _channels.remove(channel); - if(_channels.isEmpty()) - deleteLater(); + if(_channels.isEmpty() && !network()->isMe(this)) + quit(); } }