* devel@quassel-irc.org *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* devel@quassel-irc.org *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
// QHashIterator<QString, IrcUser *> ircuser(_ircUsers);
// while (ircuser.hasNext()) {
// ircuser.next();
// delete ircuser.value();
// }
// QHashIterator<QString, IrcUser *> ircuser(_ircUsers);
// while (ircuser.hasNext()) {
// ircuser.next();
// delete ircuser.value();
// }
if(!_ircUsers.contains(nick)) {
IrcUser *ircuser = new IrcUser(hostmask, this);
if(!_ircUsers.contains(nick)) {
IrcUser *ircuser = new IrcUser(hostmask, this);
- new Synchronizer(ircuser, synchronizer()->proxy());
+ // mark IrcUser as already initialized to keep the SignalProxy from requesting initData
+ if(initialized())
+ ircuser->setInitialized();
+ if(proxy())
+ proxy()->synchronize(ircuser);
+ else
+ qWarning() << "unable to synchronize new IrcUser" << hostmask << "forgot to call NetworkInfo::setProxy(SignalProxy *)?";
+
connect(ircuser, SIGNAL(nickSet(QString)), this, SLOT(ircUserNickChanged(QString)));
connect(ircuser, SIGNAL(initDone()), this, SIGNAL(ircUserInitDone()));
connect(ircuser, SIGNAL(destroyed()), this, SLOT(ircUserDestroyed()));
_ircUsers[nick] = ircuser;
emit ircUserAdded(hostmask);
}
connect(ircuser, SIGNAL(nickSet(QString)), this, SLOT(ircUserNickChanged(QString)));
connect(ircuser, SIGNAL(initDone()), this, SIGNAL(ircUserInitDone()));
connect(ircuser, SIGNAL(destroyed()), this, SLOT(ircUserDestroyed()));
_ircUsers[nick] = ircuser;
emit ircUserAdded(hostmask);
}
- return _ircUsers[nick];
+ return _ircUsers[nick];
+}
+
+void NetworkInfo::removeIrcUser(IrcUser *ircuser) {
+ QString nick = _ircUsers.key(ircuser);
+ if(nick.isNull())
+ return;
+
+ _ircUsers.remove(nick);
+ ircuser->deleteLater();
+ emit ircUserRemoved(nick);
-IrcUser *NetworkInfo::ircUser(const QString &nickname) const {
+void NetworkInfo::removeIrcUser(QString nick) {
+ IrcUser *ircuser;
+ if((ircuser = ircUser(nick)) != 0)
+ removeIrcUser(ircuser);
+}
+
+IrcUser *NetworkInfo::ircUser(QString nickname) const {
+ nickname = nickname.toLower();
- new Synchronizer(channel, synchronizer()->proxy());
+ // mark IrcUser as already initialized to keep the SignalProxy from requesting initData
+ if(initialized())
+ channel->setInitialized();
+
+ if(proxy())
+ proxy()->synchronize(channel);
+ else
+ qWarning() << "unable to synchronize new IrcChannel" << channelname << "forgot to call NetworkInfo::setProxy(SignalProxy *)?";
+
connect(channel, SIGNAL(initDone()), this, SIGNAL(ircChannelInitDone()));
connect(channel, SIGNAL(destroyed()), this, SLOT(channelDestroyed()));
connect(channel, SIGNAL(initDone()), this, SIGNAL(ircChannelInitDone()));
connect(channel, SIGNAL(destroyed()), this, SLOT(channelDestroyed()));
_prefixes = PREFIX.section(")", 1);
_prefixModes = PREFIX.mid(1).section(")", 0, 0);
} else {
_prefixes = PREFIX.section(")", 1);
_prefixModes = PREFIX.mid(1).section(")", 0, 0);
} else {
// we just assume that in PREFIX are only prefix chars stored
for(int i = 0; i < defaultPrefixes.size(); i++) {
// we just assume that in PREFIX are only prefix chars stored
for(int i = 0; i < defaultPrefixes.size(); i++) {