X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fcommon%2Fircchannel.cpp;h=5c2ba7221f303fcb389cbf94c30b57cc72147f6e;hp=fd983608024164178ae205b64a94d8a45b0990ce;hb=79fbcfb49f7cc92a89f0158ebac1a3006a559e8a;hpb=e9096505f07fc0c08a7c36f3680c1fde975d4f80 diff --git a/src/common/ircchannel.cpp b/src/common/ircchannel.cpp index fd983608..5c2ba722 100644 --- a/src/common/ircchannel.cpp +++ b/src/common/ircchannel.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 * @@ -43,6 +43,9 @@ IrcChannel::IrcChannel(const QString &channelname, Network *network) setObjectName(QString::number(network->networkId().toInt()) + "/" + channelname); } +IrcChannel::~IrcChannel() { +} + // ==================== // PUBLIC: // ==================== @@ -144,9 +147,8 @@ void IrcChannel::joinIrcUsers(const QList &users, const QStringList & _userModes[ircuser] = modes[i]; ircuser->joinChannel(this); - //qDebug() << "JOIN" << name() << ircuser->nick() << ircUsers().count(); connect(ircuser, SIGNAL(nickSet(QString)), this, SLOT(ircUserNickSet(QString))); - connect(ircuser, SIGNAL(destroyed()), this, SLOT(ircUserDestroyed())); + // connect(ircuser, SIGNAL(destroyed()), this, SLOT(ircUserDestroyed())); // if you wonder why there is no counterpart to ircUserJoined: // the joines are propagted by the ircuser. the signal ircUserJoined is only for convenience @@ -185,13 +187,23 @@ void IrcChannel::part(IrcUser *ircuser) { if(isKnownUser(ircuser)) { _userModes.remove(ircuser); ircuser->partChannel(this); - //qDebug() << "PART" << name() << ircuser->nick() << ircUsers().count(); // if you wonder why there is no counterpart to ircUserParted: // the joines are propagted by the ircuser. the signal ircUserParted is only for convenience disconnect(ircuser, 0, this, 0); emit ircUserParted(ircuser); - if(network->isMe(ircuser)) - deleteLater(); + + if(network->isMe(ircuser) || _userModes.isEmpty()) { + // in either case we're no longer in the channel + // -> clean up the channel and destroy it + QList users = _userModes.keys(); + _userModes.clear(); + foreach(IrcUser *user, users) { + disconnect(user, 0, this, 0); + user->partChannel(this); + } + emit parted(); + network->removeIrcChannel(this); + } } }