// 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();
// }
QString nick(nickFromMask(hostmask));
if(!_ircUsers.contains(nick)) {
IrcUser *ircuser = new IrcUser(hostmask, this);
QString nick(nickFromMask(hostmask));
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()));
connect(ircuser, SIGNAL(nickSet(QString)), this, SLOT(ircUserNickChanged(QString)));
connect(ircuser, SIGNAL(initDone()), this, SIGNAL(ircUserInitDone()));
connect(ircuser, SIGNAL(destroyed()), this, SLOT(ircUserDestroyed()));
IrcChannel *NetworkInfo::newIrcChannel(const QString &channelname) {
if(!_ircChannels.contains(channelname)) {
IrcChannel *channel = new IrcChannel(channelname, this);
IrcChannel *NetworkInfo::newIrcChannel(const QString &channelname) {
if(!_ircChannels.contains(channelname)) {
IrcChannel *channel = new IrcChannel(channelname, this);
- 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()));
_ircChannels[channelname] = channel;
connect(channel, SIGNAL(initDone()), this, SIGNAL(ircChannelInitDone()));
connect(channel, SIGNAL(destroyed()), this, SLOT(channelDestroyed()));
_ircChannels[channelname] = channel;
void NetworkInfo::ircUserNickChanged(QString newnick) {
QString oldnick = _ircUsers.key(qobject_cast<IrcUser*>(sender()));
void NetworkInfo::ircUserNickChanged(QString newnick) {
QString oldnick = _ircUsers.key(qobject_cast<IrcUser*>(sender()));
- IrcUser *ircuser = qobject_cast<IrcUser *>(sender());
- QHash<QString, IrcUser*>::iterator i = _ircUsers.begin();
- while(i != _ircUsers.end()) {
- if(i.value() == ircuser) {
- i = _ircUsers.erase(i);
- } else {
- i++;
- }
- }
+ IrcUser *ircuser = static_cast<IrcUser *>(sender());
+ Q_ASSERT(ircuser);
+ _ircUsers.remove(_ircUsers.key(ircuser));
- IrcChannel *channel = qobject_cast<IrcChannel *>(sender());
- QHash<QString, IrcChannel*>::iterator i = _ircChannels.begin();
- while(i != _ircChannels.end()) {
- if(i.value() == channel) {
- i = _ircChannels.erase(i);
- } else {
- i++;
- }
- }
+ IrcChannel *channel = static_cast<IrcChannel *>(sender());
+ Q_ASSERT(channel);
+ _ircChannels.remove(_ircChannels.key(channel));
_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++) {