X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fcommon%2Fircuser.cpp;h=8acb67826215bacba205c61001edc0a6fa1cd571;hp=eee29a8d908c5a0c6714964ed9b7a263f3291990;hb=79fbcfb49f7cc92a89f0158ebac1a3006a559e8a;hpb=7a1202a4d6b127521ac1d460aed45ffe9383ebf0 diff --git a/src/common/ircuser.cpp b/src/common/ircuser.cpp index eee29a8d..8acb6782 100644 --- a/src/common/ircuser.cpp +++ b/src/common/ircuser.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-08 by the Quassel Project * + * Copyright (C) 2005-09 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * @@ -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(); } }