From d22271ed979f0fd5984bfa7e7fd1a9f3966d572e Mon Sep 17 00:00:00 2001 From: brain Date: Fri, 26 Oct 2007 20:15:18 +0000 Subject: Seems to work! Are you impressed, w00t? :p git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@8373 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/modules/m_delayjoin.cpp | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) (limited to 'src') 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 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::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); } -- cgit v1.2.3