X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_callerid.cpp;h=3810fcf322157be61e7b1bcd16912d59c44e2e28;hb=d4a1ea70451abb333e71f9cff09b624db59531a0;hp=f50bdeedff3ca2b5e6e970d46a86de21d9f755e7;hpb=77730fd5f09f8fc193205654c8bba84d34365670;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_callerid.cpp b/src/modules/m_callerid.cpp index f50bdeedf..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') { } @@ -418,7 +441,7 @@ public: void ReadConfig(ConfigStatus& status) CXX11_OVERRIDE { ConfigTag* tag = ServerInstance->Config->ConfValue("callerid"); - cmd.maxaccepts = tag->getUInt("maxaccepts", 16); + cmd.maxaccepts = tag->getUInt("maxaccepts", 30); tracknick = tag->getBool("tracknick"); notify_cooldown = tag->getDuration("cooldown", 60); }