diff options
author | Peter Powell <petpow@saberuk.com> | 2018-12-09 04:28:20 +0000 |
---|---|---|
committer | Peter Powell <petpow@saberuk.com> | 2018-12-09 04:28:20 +0000 |
commit | 9dab477dadb5d65be1eee584d37f1622b6a396c0 (patch) | |
tree | 39349b8c3c21add9e5089e3916ce09c10c0feea4 /src/modules | |
parent | 94eb36566e0de00c158bcbdd57a5d372bb76b264 (diff) |
Allow modules to check if a user is on a callerid accept list.
Diffstat (limited to 'src/modules')
-rw-r--r-- | src/modules/m_callerid.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/modules/m_callerid.cpp b/src/modules/m_callerid.cpp index cdb10c04c..40cbc3506 100644 --- a/src/modules/m_callerid.cpp +++ b/src/modules/m_callerid.cpp @@ -21,6 +21,7 @@ #include "inspircd.h" +#include "modules/callerid.h" enum { @@ -324,9 +325,30 @@ public: } }; +class CallerIDAPIImpl : public CallerID::APIBase +{ + private: + CallerIDExtInfo& ext; + + public: + CallerIDAPIImpl(Module* Creator, CallerIDExtInfo& Ext) + : CallerID::APIBase(Creator) + , ext(Ext) + { + } + + bool IsOnAcceptList(User* source, User* target) CXX11_OVERRIDE + { + callerid_data* dat = ext.get(target, true); + return dat->accepting.count(source); + } +}; + + class ModuleCallerID : public Module { CommandAccept cmd; + CallerIDAPIImpl api; SimpleUserModeHandler myumode; // Configuration variables: @@ -359,6 +381,7 @@ class ModuleCallerID : public Module public: ModuleCallerID() : cmd(this) + , api(this, cmd.extInfo) , myumode(this, "callerid", 'g') { } |