X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fcommon%2Fircuser.cpp;h=f8a1e0a956d3dadc9167add6e6af57e06f6f9dc5;hp=eee29a8d908c5a0c6714964ed9b7a263f3291990;hb=a5dfcc8ecf8b81025d24b3c5c816169e3e030ea4;hpb=ad801015af3afad53e0b245afc3a2214373a1b44 diff --git a/src/common/ircuser.cpp b/src/common/ircuser.cpp index eee29a8d..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())); } } @@ -232,8 +231,8 @@ void IrcUser::partChannel(IrcChannel *channel) { disconnect(channel, 0, this, 0); channel->part(this); emit channelParted(channel->name()); - if(_channels.isEmpty() && network()->isMe(this)) - deleteLater(); + if(_channels.isEmpty() && !network()->isMe(this)) + 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(); } }