From a78cecbeb9c677bdd4b2f44c01195759af63485b Mon Sep 17 00:00:00 2001 From: brain Date: Thu, 14 Dec 2006 17:46:47 +0000 Subject: Refactor userrec::chans. Old way: A vector of ucrec, MAXCHANS in size by default populated by NULLS, so you have to scan the vector to find an empty slot when joining a user, parting a user etc New way: std::map (the char holds their basic core permissions on the channel [voice, halfop, op]) This increases speed a ton, and removes some wtf-age. git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@5986 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/modules.cpp | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) (limited to 'src/modules.cpp') diff --git a/src/modules.cpp b/src/modules.cpp index b670291ec..16631c1f2 100644 --- a/src/modules.cpp +++ b/src/modules.cpp @@ -472,20 +472,17 @@ bool InspIRCd::PseudoToUser(userrec* alive, userrec* zombie, const std::string & } // Fix by brain - cant write the user until their fd table entry is updated zombie->Write(":%s!%s@%s NICK %s",oldnick.c_str(),oldident.c_str(),oldhost.c_str(),zombie->nick); - for (std::vector::const_iterator i = zombie->chans.begin(); i != zombie->chans.end(); i++) + for (UCListIter i = zombie->chans.begin(); i != zombie->chans.end(); i++) { - if (((ucrec*)(*i))->channel != NULL) + chanrec* Ptr = i->first; + zombie->WriteFrom(zombie,"JOIN %s",Ptr->name); + if (Ptr->topicset) { - chanrec* Ptr = ((ucrec*)(*i))->channel; - zombie->WriteFrom(zombie,"JOIN %s",Ptr->name); - if (Ptr->topicset) - { - zombie->WriteServ("332 %s %s :%s", zombie->nick, Ptr->name, Ptr->topic); - zombie->WriteServ("333 %s %s %s %d", zombie->nick, Ptr->name, Ptr->setby, Ptr->topicset); - } - Ptr->UserList(zombie); - zombie->WriteServ("366 %s %s :End of /NAMES list.", zombie->nick, Ptr->name); + zombie->WriteServ("332 %s %s :%s", zombie->nick, Ptr->name, Ptr->topic); + zombie->WriteServ("333 %s %s %s %d", zombie->nick, Ptr->name, Ptr->setby, Ptr->topicset); } + Ptr->UserList(zombie); + zombie->WriteServ("366 %s %s :End of /NAMES list.", zombie->nick, Ptr->name); } if ((find(local_users.begin(),local_users.end(),zombie) == local_users.end()) && (zombie->GetFd() != FD_MAGIC_NUMBER)) local_users.push_back(zombie); -- cgit v1.3.1-10-gc9f91