X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fcommon%2Fircchannel.cpp;h=cff2e7513c50de00d406fa05acedc89067afbdee;hp=28d6c6ed46f9d0294607f4d068dc23fc71efc4b8;hb=69952553cf2f5248a0c7e964d6d5844065d26612;hpb=1956aab57bf98ce072ed86f34785e5d7abba35a0 diff --git a/src/common/ircchannel.cpp b/src/common/ircchannel.cpp index 28d6c6ed..cff2e751 100644 --- a/src/common/ircchannel.cpp +++ b/src/common/ircchannel.cpp @@ -21,6 +21,7 @@ #include "ircchannel.h" #include "networkinfo.h" +//#include "nicktreemodel.h" #include "signalproxy.h" #include "ircuser.h" @@ -40,6 +41,10 @@ IrcChannel::IrcChannel(const QString &channelname, NetworkInfo *networkinfo) setObjectName(QString::number(networkInfo->networkId()) + "/" + channelname); } +IrcChannel::~IrcChannel() { + +} + // ==================== // PUBLIC: // ==================== @@ -51,7 +56,7 @@ bool IrcChannel::isKnownUser(IrcUser *ircuser) const { isknown = false; } - if(!_userModes.contains(ircuser) && ircuser) { + if(!_userModes.contains(ircuser)) { qWarning() << "Channel" << name() << "received data for unknown User" << ircuser->nick(); isknown = false; } @@ -84,15 +89,15 @@ QList IrcChannel::ircUsers() const { return _userModes.keys(); } -QString IrcChannel::userMode(IrcUser *ircuser) const { +QString IrcChannel::userModes(IrcUser *ircuser) const { if(_userModes.contains(ircuser)) return _userModes[ircuser]; else return QString(); } -QString IrcChannel::userMode(const QString &nick) const { - return userMode(networkInfo->ircUser(nick)); +QString IrcChannel::userModes(const QString &nick) const { + return userModes(networkInfo->ircUser(nick)); } // ==================== @@ -107,6 +112,7 @@ void IrcChannel::join(IrcUser *ircuser) { if(!_userModes.contains(ircuser) && ircuser) { _userModes[ircuser] = QString(); ircuser->joinChannel(name()); + connect(ircuser, SIGNAL(nickSet(QString)), this, SLOT(ircUserNickSet(QString))); 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 @@ -137,6 +143,7 @@ void IrcChannel::setUserModes(IrcUser *ircuser, const QString &modes) { if(isKnownUser(ircuser)) { _userModes[ircuser] = modes; emit userModesSet(ircuser->nick(), modes); + emit ircUserModesSet(ircuser, modes); } } @@ -148,10 +155,11 @@ void IrcChannel::setUserModes(const QString &nick, const QString &modes) { void IrcChannel::addUserMode(IrcUser *ircuser, const QString &mode) { if(!isKnownUser(ircuser) || !isValidChannelUserMode(mode)) return; - + if(!_userModes[ircuser].contains(mode)) { _userModes[ircuser] += mode; emit userModeAdded(ircuser->nick(), mode); + emit ircUserModeAdded(ircuser, mode); } } @@ -160,7 +168,6 @@ void IrcChannel::addUserMode(const QString &nick, const QString &mode) { addUserMode(networkInfo->ircUser(nick), mode); } - // REMOVE USER MODE void IrcChannel::removeUserMode(IrcUser *ircuser, const QString &mode) { if(!isKnownUser(ircuser) || !isValidChannelUserMode(mode)) @@ -169,6 +176,7 @@ void IrcChannel::removeUserMode(IrcUser *ircuser, const QString &mode) { if(_userModes[ircuser].contains(mode)) { _userModes[ircuser].remove(mode); emit userModeRemoved(ircuser->nick(), mode); + emit ircUserModeRemoved(ircuser, mode); } } @@ -200,6 +208,13 @@ void IrcChannel::ircUserDestroyed() { IrcUser *ircUser = static_cast(sender()); Q_ASSERT(ircUser); _userModes.remove(ircUser); + emit ircUserParted(ircUser); +} + +void IrcChannel::ircUserNickSet(QString nick) { + IrcUser *ircUser = qobject_cast(sender()); + Q_ASSERT(ircUser); + emit ircUserNickSet(ircUser, nick); } void IrcChannel::setInitialized() {