diff options
author | Jackmcbarn <jackmcbarn@jackmcbarn.no-ip.org> | 2011-01-24 12:06:54 -0500 |
---|---|---|
committer | Jackmcbarn <jackmcbarn@jackmcbarn.no-ip.org> | 2011-01-24 12:06:54 -0500 |
commit | c56c8dea82a40c95c640ac6196f3d9d70ebb9e4e (patch) | |
tree | ea998f5bc0ef391da2016e5de5138cb5507faefd /src/modules/m_autoop.cpp | |
parent | 0f2ca5f1ebc1a086724528a5ac95c7c8a7c6f35f (diff) |
Fix bug #110
Diffstat (limited to 'src/modules/m_autoop.cpp')
-rw-r--r-- | src/modules/m_autoop.cpp | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/src/modules/m_autoop.cpp b/src/modules/m_autoop.cpp index 3448bf9f5..8d50818fc 100644 --- a/src/modules/m_autoop.cpp +++ b/src/modules/m_autoop.cpp @@ -81,33 +81,39 @@ public: ServerInstance->Modules->AddService(mh); mh.DoImplements(this); - Implementation list[] = { I_OnUserPreJoin, }; + Implementation list[] = { I_OnPostJoin, }; ServerInstance->Modules->Attach(list, this, 1); } - ModResult OnUserPreJoin(User *user, Channel *chan, const char *cname, std::string &privs, const std::string &keygiven) + void OnPostJoin(Membership *memb) { - if (!chan) - return MOD_RES_PASSTHRU; + if (!IS_LOCAL(memb->user)) + return; - modelist* list = mh.extItem.get(chan); + modelist* list = mh.extItem.get(memb->chan); if (list) { + std::string modeline("+"); + std::vector<std::string> modechange; + modechange.push_back(memb->chan->name); for (modelist::iterator it = list->begin(); it != list->end(); it++) { std::string::size_type colon = it->mask.find(':'); if (colon == std::string::npos) continue; - if (chan->CheckBan(user, it->mask.substr(colon+1))) + if (memb->chan->CheckBan(memb->user, it->mask.substr(colon+1))) { ModeHandler* given = mh.FindMode(it->mask.substr(0, colon)); - if (given) - privs += given->GetModeChar(); + if (given && given->GetPrefixRank()) + modeline.push_back(given->GetModeChar()); } } + modechange.push_back(modeline); + for(std::string::size_type i = modeline.length(); i > 1; --i) // we use "i > 1" instead of "i" so we skip the + + modechange.push_back(memb->user->nick); + if(modechange.size() >= 3) + ServerInstance->SendMode(modechange,ServerInstance->FakeClient); } - - return MOD_RES_PASSTHRU; } void OnCleanup(int target_type, void* item) |