diff options
author | Attila Molnar <attilamolnar@hush.com> | 2015-12-06 11:24:39 +0100 |
---|---|---|
committer | Attila Molnar <attilamolnar@hush.com> | 2015-12-06 11:24:39 +0100 |
commit | fd87f9f073dff6e2f21a92c96144fb6c0a46e8e3 (patch) | |
tree | 2021c3870d73f62bcb5b6df1f644a7eec3260c80 /src | |
parent | f307c873e00a11de74bea348fff6bc29b08768d9 (diff) |
Add minimum channel rank and exception list parameters to the OnUserInvite hook
Diffstat (limited to 'src')
-rw-r--r-- | src/coremods/core_channel/cmd_invite.cpp | 13 | ||||
-rw-r--r-- | src/modules.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_spanningtree/main.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_spanningtree/main.h | 2 |
4 files changed, 13 insertions, 6 deletions
diff --git a/src/coremods/core_channel/cmd_invite.cpp b/src/coremods/core_channel/cmd_invite.cpp index 55ed33f7f..c1f1b00c7 100644 --- a/src/coremods/core_channel/cmd_invite.cpp +++ b/src/coremods/core_channel/cmd_invite.cpp @@ -123,17 +123,23 @@ CmdResult CommandInvite::Handle (const std::vector<std::string>& parameters, Use } char prefix = 0; + unsigned int minrank = 0; switch (ServerInstance->Config->AnnounceInvites) { case ServerConfig::INVITE_ANNOUNCE_OPS: { prefix = '@'; + minrank = OP_VALUE; break; } case ServerConfig::INVITE_ANNOUNCE_DYNAMIC: { PrefixMode* mh = ServerInstance->Modes->FindPrefixMode('h'); - prefix = (mh && mh->name == "halfop" ? mh->GetPrefix() : '@'); + if ((mh) && (mh->name == "halfop")) + { + prefix = mh->GetPrefix(); + minrank = mh->GetPrefixRank(); + } break; } default: @@ -141,10 +147,11 @@ CmdResult CommandInvite::Handle (const std::vector<std::string>& parameters, Use } } - FOREACH_MOD(OnUserInvite, (user, u, c, timeout)); + CUList excepts; + FOREACH_MOD(OnUserInvite, (user, u, c, timeout, minrank, excepts)); if (ServerInstance->Config->AnnounceInvites != ServerConfig::INVITE_ANNOUNCE_NONE) - c->WriteAllExceptSender(user, true, prefix, "NOTICE %s :*** %s invited %s into the channel", c->name.c_str(), user->nick.c_str(), u->nick.c_str()); + c->WriteAllExcept(user, true, prefix, excepts, "NOTICE %s :*** %s invited %s into the channel", c->name.c_str(), user->nick.c_str(), u->nick.c_str()); } else if (IS_LOCAL(user)) { diff --git a/src/modules.cpp b/src/modules.cpp index d77221c39..292986df5 100644 --- a/src/modules.cpp +++ b/src/modules.cpp @@ -114,7 +114,7 @@ ModResult Module::OnPreTopicChange(User*, Channel*, const std::string&) { Detach ModResult Module::OnPassCompare(Extensible* ex, const std::string &password, const std::string &input, const std::string& hashtype) { DetachEvent(I_OnPassCompare); return MOD_RES_PASSTHRU; } void Module::OnPostConnect(User*) { DetachEvent(I_OnPostConnect); } void Module::OnUserMessage(User*, void*, int, const std::string&, char, const CUList&, MessageType) { DetachEvent(I_OnUserMessage); } -void Module::OnUserInvite(User*, User*, Channel*, time_t) { DetachEvent(I_OnUserInvite); } +void Module::OnUserInvite(User*, User*, Channel*, time_t, unsigned int, CUList&) { DetachEvent(I_OnUserInvite); } void Module::OnPostTopicChange(User*, Channel*, const std::string&) { DetachEvent(I_OnPostTopicChange); } void Module::OnSyncUser(User*, ProtocolInterface::Server&) { DetachEvent(I_OnSyncUser); } void Module::OnSyncChannel(Channel*, ProtocolInterface::Server&) { DetachEvent(I_OnSyncChannel); } diff --git a/src/modules/m_spanningtree/main.cpp b/src/modules/m_spanningtree/main.cpp index 98cf3188f..4e45b4fe8 100644 --- a/src/modules/m_spanningtree/main.cpp +++ b/src/modules/m_spanningtree/main.cpp @@ -358,7 +358,7 @@ ModResult ModuleSpanningTree::HandleConnect(const std::vector<std::string>& para return MOD_RES_DENY; } -void ModuleSpanningTree::OnUserInvite(User* source,User* dest,Channel* channel, time_t expiry) +void ModuleSpanningTree::OnUserInvite(User* source, User* dest, Channel* channel, time_t expiry, unsigned int notifyrank, CUList& notifyexcepts) { if (IS_LOCAL(source)) { diff --git a/src/modules/m_spanningtree/main.h b/src/modules/m_spanningtree/main.h index 9fde32cad..d29609a35 100644 --- a/src/modules/m_spanningtree/main.h +++ b/src/modules/m_spanningtree/main.h @@ -149,7 +149,7 @@ class ModuleSpanningTree : public Module ModResult OnPreCommand(std::string &command, std::vector<std::string>& parameters, LocalUser *user, bool validated, const std::string &original_line) CXX11_OVERRIDE; void OnPostCommand(Command*, const std::vector<std::string>& parameters, LocalUser* user, CmdResult result, const std::string& original_line) CXX11_OVERRIDE; void OnUserConnect(LocalUser* source) CXX11_OVERRIDE; - void OnUserInvite(User* source,User* dest,Channel* channel, time_t) CXX11_OVERRIDE; + void OnUserInvite(User* source, User* dest, Channel* channel, time_t timeout, unsigned int notifyrank, CUList& notifyexcepts) CXX11_OVERRIDE; void OnPostTopicChange(User* user, Channel* chan, const std::string &topic) CXX11_OVERRIDE; void OnUserMessage(User* user, void* dest, int target_type, const std::string& text, char status, const CUList& exempt_list, MessageType msgtype) CXX11_OVERRIDE; void OnBackgroundTimer(time_t curtime) CXX11_OVERRIDE; |