X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_callerid.cpp;h=3810fcf322157be61e7b1bcd16912d59c44e2e28;hb=d4a1ea70451abb333e71f9cff09b624db59531a0;hp=cdb10c04c79ebc197fed3d64a758582be5a8982a;hpb=9361492b41918980f5f53de5cc25882958d20e36;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_callerid.cpp b/src/modules/m_callerid.cpp index cdb10c04c..3810fcf32 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 { @@ -98,7 +99,7 @@ struct CallerIDExtInfo : public ExtensionItem irc::commasepstream s(value); std::string tok; if (s.GetToken(tok)) - dat->lastnotify = ConvToInt(tok); + dat->lastnotify = ConvToNum(tok); while (s.GetToken(tok)) { @@ -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') { }