diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2007-10-26 20:15:18 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2007-10-26 20:15:18 +0000 |
commit | d22271ed979f0fd5984bfa7e7fd1a9f3966d572e (patch) | |
tree | f9873aba362c63596eaa7425e27caf08b08ff407 /src/modules | |
parent | 371030bca712400eaca6c92b92d07d11a0c83dbb (diff) |
Seems to work! Are you impressed, w00t? :p
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@8373 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules')
-rw-r--r-- | src/modules/m_delayjoin.cpp | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/src/modules/m_delayjoin.cpp b/src/modules/m_delayjoin.cpp index 8a596d5dc..b6fc00f2b 100644 --- a/src/modules/m_delayjoin.cpp +++ b/src/modules/m_delayjoin.cpp @@ -81,26 +81,32 @@ class ModuleDelayJoin : public Module virtual int OnUserList(User* user, Channel* Ptr, CUList* &nameslist) { + if (!nameslist) + return 0; + /* For +D channels ... */ if (Ptr->IsModeSet('D')) { /* Modify the names list, erasing users with the delay join metadata * for this channel (havent spoken yet) */ - nl = *nameslist; + ServerInstance->Log(DEBUG,"Iterate"); for (CUListIter n = nameslist->begin(); n != nameslist->end(); ++n) { - if (n->first->GetExt("delayjoin_notspoken")) - nl.erase(n->first); + ServerInstance->Log(DEBUG,"Item"); + + if (!n->first->GetExt("delayjoin_notspoken")) + nl.insert(*n); } + ServerInstance->Log(DEBUG,"Done"); nl[user] = user->nick; nameslist = &nl; } return 0; } - + virtual void OnUserJoin(User* user, Channel* channel, bool &silent) { if (channel->IsModeSet('D')) @@ -149,19 +155,12 @@ class ModuleDelayJoin : public Module void OnUserQuit(User* user, const std::string &reason, const std::string &oper_message) { Command* parthandler = ServerInstance->Parser->GetHandler("PART"); - std::vector<std::string> to_leave; const char* parameters[2]; if (parthandler && user->GetExt("delayjoin")) { for (UCListIter f = user->chans.begin(); f != user->chans.end(); f++) { - if (f->first->IsModeSet('D')) - to_leave.push_back(f->first->name); - } - /* We cant do this neatly in one loop, as we are modifying the map we are iterating */ - for (std::vector<std::string>::iterator n = to_leave.begin(); n != to_leave.end(); n++) - { - parameters[0] = n->c_str(); + parameters[0] = f->first->name; /* This triggers our OnUserPart, above, making the PART silent */ parthandler->Handle(parameters, 1, user); } |