diff options
author | danieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7> | 2009-09-13 20:30:47 +0000 |
---|---|---|
committer | danieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7> | 2009-09-13 20:30:47 +0000 |
commit | 91df762e93212958db487d8517addba1a63a4ddd (patch) | |
tree | 62ef9a5e926a0ba1dac698c742faf5908da400fb /src/modules/m_ojoin.cpp | |
parent | 6d57bbe05c31c79eaad02fe81cfb9c1ed6b79c58 (diff) |
Membership* changes
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11697 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules/m_ojoin.cpp')
-rw-r--r-- | src/modules/m_ojoin.cpp | 49 |
1 files changed, 17 insertions, 32 deletions
diff --git a/src/modules/m_ojoin.cpp b/src/modules/m_ojoin.cpp index 4e9477af1..c03f2ad1f 100644 --- a/src/modules/m_ojoin.cpp +++ b/src/modules/m_ojoin.cpp @@ -115,14 +115,14 @@ class NetworkPrefix : public ModeHandler User* x = ServerInstance->FindNick(parameter); if (x) { - if (!channel->HasUser(x)) + Membership* m = channel->GetUser(x); + if (!m) { return std::make_pair(false, parameter); } else { - std::string item = "cm_network_"+std::string(channel->name); - if (x->GetExt(item)) + if (m->hasMode('Y')) { return std::make_pair(true, x->nick); } @@ -137,16 +137,15 @@ class NetworkPrefix : public ModeHandler void RemoveMode(Channel* channel, irc::modestacker* stack) { - CUList* cl = channel->GetUsers(); - std::string item = "cm_network_" + std::string(channel->name); + const UserMembList* cl = channel->GetUsers(); std::vector<std::string> mode_junk; mode_junk.push_back(channel->name); irc::modestacker modestack(ServerInstance, false); std::deque<std::string> stackresult; - for (CUList::iterator i = cl->begin(); i != cl->end(); i++) + for (UserMembCIter i = cl->begin(); i != cl->end(); i++) { - if (i->first->GetExt(item)) + if (i->second->hasMode('Y')) { if (stack) stack->Push(this->GetModeChar(), i->first->nick); @@ -179,22 +178,19 @@ class NetworkPrefix : public ModeHandler ModeAction HandleChange(User* source, User* theuser, bool adding, Channel* channel, std::string ¶meter) { - std::string item = "cm_network_" + std::string(channel->name); - - if (adding) + Membership* m = channel->GetUser(theuser); + if (m && adding) { - if (!theuser->GetExt(item)) + if (!m->hasMode('Y')) { - theuser->Extend(item); parameter = theuser->nick; return MODEACTION_ALLOW; } } - else + else if (m && !adding) { - if (theuser->GetExt(item)) + if (m->hasMode('Y')) { - theuser->Shrink(item); parameter = theuser->nick; return MODEACTION_ALLOW; } @@ -271,26 +267,15 @@ class ModuleOjoin : public Module { if (mycommand.active) { - if (NPrefix) - privs += NPrefix; - if (op && privs.find('@') == std::string::npos) - privs += '@'; + privs += 'Y'; + if (op) + privs += 'o'; return MOD_RES_ALLOW; } return MOD_RES_PASSTHRU; } - void OnUserKick(User* source, User* user, Channel* chan, const std::string &reason, bool &silent) - { - user->Shrink("cm_network_"+std::string(chan->name)); - } - - void OnUserPart(User* user, Channel* channel, std::string &partreason, bool &silent) - { - user->Shrink("cm_network_"+std::string(channel->name)); - } - void OnRehash(User* user) { ConfigReader Conf(ServerInstance); @@ -321,12 +306,12 @@ class ModuleOjoin : public Module // If a ulined nickname, or a server is setting the mode, let it // do whatever it wants. if ((ServerInstance->ULine(source->nick.c_str())) || (ServerInstance->ULine(source->server)) || (!*source->server)) - return MOD_RES_ALLOW; + return MOD_RES_PASSTHRU; - std::string network("cm_network_"+channel->name); + Membership* m = channel->GetUser(dest); // Don't do anything if they're not +Y - if (!dest->GetExt(network)) + if (!m || !m->hasMode('Y')) return MOD_RES_PASSTHRU; // Let them do whatever they want to themselves. |