diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2007-05-19 17:36:26 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2007-05-19 17:36:26 +0000 |
commit | 206e3b49c7bfe3e8a7ca972103fe9e30feb3a86a (patch) | |
tree | c4d7878e6b460f81cda67fa1fb8d9839b0081676 /src/modules | |
parent | badadc427a99e5483402c21bf5b7ae64722930e9 (diff) |
SPACE INDENTING ACTION RANGERS -- ATTACK!
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@7048 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules')
-rw-r--r-- | src/modules/extra/m_httpclienttest.cpp | 125 | ||||
-rw-r--r-- | src/modules/extra/m_ssl_gnutls.cpp | 2 | ||||
-rw-r--r-- | src/modules/extra/m_ziplink.cpp | 4 | ||||
-rw-r--r-- | src/modules/m_banexception.cpp | 5 | ||||
-rw-r--r-- | src/modules/m_chanprotect.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_conn_umodes.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_connflood.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_dnsbl.cpp | 3 | ||||
-rw-r--r-- | src/modules/m_joinflood.cpp | 22 | ||||
-rw-r--r-- | src/modules/m_kicknorejoin.cpp | 18 | ||||
-rw-r--r-- | src/modules/m_md5.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_messageflood.cpp | 12 | ||||
-rw-r--r-- | src/modules/m_namesx.cpp | 4 | ||||
-rw-r--r-- | src/modules/m_operchans.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_redirect.cpp | 20 | ||||
-rw-r--r-- | src/modules/m_regonlycreate.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_restrictchans.cpp | 4 | ||||
-rw-r--r-- | src/modules/m_stripcolor.cpp | 4 | ||||
-rw-r--r-- | src/modules/m_timedbans.cpp | 16 | ||||
-rw-r--r-- | src/modules/m_uhnames.cpp | 6 | ||||
-rw-r--r-- | src/modules/m_watch.cpp | 12 |
21 files changed, 137 insertions, 132 deletions
diff --git a/src/modules/extra/m_httpclienttest.cpp b/src/modules/extra/m_httpclienttest.cpp index 9e43379c1..19c6c376b 100644 --- a/src/modules/extra/m_httpclienttest.cpp +++ b/src/modules/extra/m_httpclienttest.cpp @@ -1,12 +1,12 @@ -/* +------------------------------------+ - * | Inspire Internet Relay Chat Daemon | - * +------------------------------------+ +/* +------------------------------------+ + * | Inspire Internet Relay Chat Daemon | + * +------------------------------------+ * * InspIRCd: (C) 2002-2007 InspIRCd Development Team * See: http://www.inspircd.org/wiki/index.php/Credits * * This program is free but copyrighted software; see - * the file COPYING for details. + * the file COPYING for details. * * --------------------------------------------------- */ @@ -21,79 +21,82 @@ class MyModule : public Module { + public: - MyModule(InspIRCd* Me) - : Module::Module(Me) - { - } - virtual ~MyModule() - { - } + MyModule(InspIRCd* Me) + : Module::Module(Me) + { + } + + virtual ~MyModule() + { + } - virtual void Implements(char* List) - { + virtual void Implements(char* List) + { List[I_OnRequest] = List[I_OnUserJoin] = List[I_OnUserPart] = 1; - } - - virtual Version GetVersion() - { - return Version(1,0,0,1,VF_VENDOR,API_VERSION); - } - - virtual void OnUserJoin(userrec* user, chanrec* channel, bool &silent) - { - // method called when a user joins a channel - - std::string chan = channel->name; - std::string nick = user->nick; -// ServerInstance->Log(DEBUG,"User " + nick + " joined " + chan); - - Module* target = ServerInstance->FindModule("m_http_client.so"); - if(target) { - HTTPClientRequest req(ServerInstance, this, target, "http://znc.in/~psychon"); - req.Send(); - } - else - ServerInstance->Log(DEBUG,"module not found, load it!!"); - } - - char* OnRequest(Request* req) - { - HTTPClientResponse* resp = (HTTPClientResponse*)req; - if(!strcmp(resp->GetId(), HTTP_CLIENT_RESPONSE)) - { - ServerInstance->Log(DEBUG, resp->GetData()); - } - return NULL; - } - - virtual void OnUserPart(userrec* user, chanrec* channel, const std::string &partmessage, bool &silent) - { - } + } + + virtual Version GetVersion() + { + return Version(1,0,0,1,VF_VENDOR,API_VERSION); + } + + virtual void OnUserJoin(userrec* user, chanrec* channel, bool &silent) + { + // method called when a user joins a channel + + std::string chan = channel->name; + std::string nick = user->nick; + ServerInstance->Log(DEBUG,"User " + nick + " joined " + chan); + + Module* target = ServerInstance->FindModule("m_http_client.so"); + if(target) + { + HTTPClientRequest req(ServerInstance, this, target, "http://znc.in/~psychon"); + req.Send(); + } + else + ServerInstance->Log(DEBUG,"module not found, load it!!"); + } + + char* OnRequest(Request* req) + { + HTTPClientResponse* resp = (HTTPClientResponse*)req; + if(!strcmp(resp->GetId(), HTTP_CLIENT_RESPONSE)) + { + ServerInstance->Log(DEBUG, resp->GetData()); + } + return NULL; + } + + virtual void OnUserPart(userrec* user, chanrec* channel, const std::string &partmessage, bool &silent) + { + } }; class MyModuleFactory : public ModuleFactory { public: - MyModuleFactory() - { - } + MyModuleFactory() + { + } - ~MyModuleFactory() - { - } + ~MyModuleFactory() + { + } - virtual Module * CreateModule(InspIRCd* Me) - { - return new MyModule(Me); - } + virtual Module * CreateModule(InspIRCd* Me) + { + return new MyModule(Me); + } }; extern "C" void * init_module( void ) { - return new MyModuleFactory; + return new MyModuleFactory; } diff --git a/src/modules/extra/m_ssl_gnutls.cpp b/src/modules/extra/m_ssl_gnutls.cpp index 436b0f364..aae039738 100644 --- a/src/modules/extra/m_ssl_gnutls.cpp +++ b/src/modules/extra/m_ssl_gnutls.cpp @@ -288,7 +288,7 @@ class ModuleSSLGnuTLS : public Module List[I_OnRequest] = List[I_OnSyncUserMetaData] = List[I_OnDecodeMetaData] = List[I_OnUnloadModule] = List[I_OnRehash] = List[I_OnWhois] = List[I_OnPostConnect] = 1; } - virtual char* OnRequest(Request* request) + virtual char* OnRequest(Request* request) { ISHRequest* ISR = (ISHRequest*)request; if (strcmp("IS_NAME", request->GetId()) == 0) diff --git a/src/modules/extra/m_ziplink.cpp b/src/modules/extra/m_ziplink.cpp index ab40acb46..2677d3088 100644 --- a/src/modules/extra/m_ziplink.cpp +++ b/src/modules/extra/m_ziplink.cpp @@ -178,7 +178,7 @@ class ModuleZLib : public Module } /* Handle InspSocketHook API requests */ - virtual char* OnRequest(Request* request) + virtual char* OnRequest(Request* request) { ISHRequest* ISR = (ISHRequest*)request; if (strcmp("IS_NAME", request->GetId()) == 0) @@ -392,7 +392,7 @@ class ModuleZLib : public Module return 0; } } - /* Finish the stream */ + /* Finish the stream */ for (session->c_stream.avail_out = 1; deflate(&session->c_stream, Z_FINISH) != Z_STREAM_END; session->c_stream.avail_out = 1); deflateEnd(&session->c_stream); diff --git a/src/modules/m_banexception.cpp b/src/modules/m_banexception.cpp index 3fc192cb5..629e43078 100644 --- a/src/modules/m_banexception.cpp +++ b/src/modules/m_banexception.cpp @@ -114,12 +114,12 @@ public: be->DoRehash(); } - virtual char* OnRequest(Request* request) + virtual char* OnRequest(Request* request) { ListModeRequest* LM = (ListModeRequest*)request; if (strcmp("LM_CHECKLIST", request->GetId()) == 0) { - modelist* list; + modelist* list; LM->chan->GetExt(be->GetInfoKey(), list); if (list) { @@ -174,3 +174,4 @@ extern "C" DllExport void * init_module( void ) { return new ModuleBanExceptionFactory; } + diff --git a/src/modules/m_chanprotect.cpp b/src/modules/m_chanprotect.cpp index 5ba18a2bf..d35a81532 100644 --- a/src/modules/m_chanprotect.cpp +++ b/src/modules/m_chanprotect.cpp @@ -107,7 +107,7 @@ class FounderProtectBase unload_kludge = false; } - void DisplayList(userrec* user, chanrec* channel) + void DisplayList(userrec* user, chanrec* channel) { CUList* cl = channel->GetUsers(); std::string item = extend+std::string(channel->name); diff --git a/src/modules/m_conn_umodes.cpp b/src/modules/m_conn_umodes.cpp index 1973820cd..cfed84c45 100644 --- a/src/modules/m_conn_umodes.cpp +++ b/src/modules/m_conn_umodes.cpp @@ -95,7 +95,7 @@ class ModuleModesOnConnect : public Module } ServerInstance->Parser->CallHandler("MODE", modes, size, user); - delete [] modes; + delete [] modes; } break; } diff --git a/src/modules/m_connflood.cpp b/src/modules/m_connflood.cpp index 1cfacf480..08ba6bbc2 100644 --- a/src/modules/m_connflood.cpp +++ b/src/modules/m_connflood.cpp @@ -129,7 +129,7 @@ public: ~ModuleConnFloodFactory() { } - + virtual Module * CreateModule(InspIRCd* Me) { return new ModuleConnFlood(Me); diff --git a/src/modules/m_dnsbl.cpp b/src/modules/m_dnsbl.cpp index d53706af3..fc85e9cc7 100644 --- a/src/modules/m_dnsbl.cpp +++ b/src/modules/m_dnsbl.cpp @@ -51,7 +51,8 @@ class DNSBLResolver : public Resolver userrec* them; DNSBLConfEntry *ConfEntry; - public: + public: + DNSBLResolver(Module *me, InspIRCd *ServerInstance, const std::string &hostname, userrec* u, int userfd, DNSBLConfEntry *conf, bool &cached) : Resolver(ServerInstance, hostname, DNS_QUERY_A, cached, me) { diff --git a/src/modules/m_joinflood.cpp b/src/modules/m_joinflood.cpp index f6b5f4b90..b869e5020 100644 --- a/src/modules/m_joinflood.cpp +++ b/src/modules/m_joinflood.cpp @@ -33,8 +33,8 @@ class joinfloodsettings : public classbase time_t unlocktime; int counter; bool locked; - InspIRCd* ServerInstance; - + InspIRCd* ServerInstance; + joinfloodsettings() : secs(0), joins(0) {}; joinfloodsettings(int b, int c) : secs(b), joins(c) @@ -96,16 +96,16 @@ class JoinFlood : public ModeHandler public: JoinFlood(InspIRCd* Instance) : ModeHandler(Instance, 'j', 1, 0, false, MODETYPE_CHANNEL, false) { } - ModePair ModeSet(userrec* source, userrec* dest, chanrec* channel, const std::string ¶meter) - { - joinfloodsettings* x; - if (channel->GetExt("joinflood",x)) - return std::make_pair(true, ConvToStr(x->joins)+":"+ConvToStr(x->secs)); - else - return std::make_pair(false, parameter); - } + ModePair ModeSet(userrec* source, userrec* dest, chanrec* channel, const std::string ¶meter) + { + joinfloodsettings* x; + if (channel->GetExt("joinflood",x)) + return std::make_pair(true, ConvToStr(x->joins)+":"+ConvToStr(x->secs)); + else + return std::make_pair(false, parameter); + } - bool CheckTimeStamp(time_t theirs, time_t ours, const std::string &their_param, const std::string &our_param, chanrec* channel) + bool CheckTimeStamp(time_t theirs, time_t ours, const std::string &their_param, const std::string &our_param, chanrec* channel) { /* When TS is equal, the alphabetically later one wins */ return (their_param < our_param); diff --git a/src/modules/m_kicknorejoin.cpp b/src/modules/m_kicknorejoin.cpp index a38d260bb..627786d35 100644 --- a/src/modules/m_kicknorejoin.cpp +++ b/src/modules/m_kicknorejoin.cpp @@ -41,15 +41,15 @@ class KickRejoin : public ModeHandler public: KickRejoin(InspIRCd* Instance) : ModeHandler(Instance, 'J', 1, 0, false, MODETYPE_CHANNEL, false) { } - ModePair ModeSet(userrec* source, userrec* dest, chanrec* channel, const std::string ¶meter) - { - if (channel->IsModeSet('J')) - return std::make_pair(true, channel->GetModeParameter('J')); - else - return std::make_pair(false, parameter); - } - - bool CheckTimeStamp(time_t theirs, time_t ours, const std::string &their_param, const std::string &our_param, chanrec* channel) + ModePair ModeSet(userrec* source, userrec* dest, chanrec* channel, const std::string ¶meter) + { + if (channel->IsModeSet('J')) + return std::make_pair(true, channel->GetModeParameter('J')); + else + return std::make_pair(false, parameter); + } + + bool CheckTimeStamp(time_t theirs, time_t ours, const std::string &their_param, const std::string &our_param, chanrec* channel) { /* When TS is equal, the alphabetically later one wins */ return (their_param < our_param); diff --git a/src/modules/m_md5.cpp b/src/modules/m_md5.cpp index 19b351e0c..5d6fdd00d 100644 --- a/src/modules/m_md5.cpp +++ b/src/modules/m_md5.cpp @@ -33,7 +33,7 @@ /* This is the central step in the MD5 algorithm. */ #define MD5STEP(f,w,x,y,z,in,s) \ - (w += f(x,y,z) + in, w = (w<<s | w>>(32-s)) + x) + (w += f(x,y,z) + in, w = (w<<s | w>>(32-s)) + x) #ifndef HAS_STDINT typedef unsigned int uint32_t; diff --git a/src/modules/m_messageflood.cpp b/src/modules/m_messageflood.cpp index ae458a0d6..f36dacebd 100644 --- a/src/modules/m_messageflood.cpp +++ b/src/modules/m_messageflood.cpp @@ -82,14 +82,14 @@ class MsgFlood : public ModeHandler public: MsgFlood(InspIRCd* Instance) : ModeHandler(Instance, 'f', 1, 0, false, MODETYPE_CHANNEL, false) { } - ModePair ModeSet(userrec* source, userrec* dest, chanrec* channel, const std::string ¶meter) - { + ModePair ModeSet(userrec* source, userrec* dest, chanrec* channel, const std::string ¶meter) + { floodsettings* x; - if (channel->GetExt("flood",x)) + if (channel->GetExt("flood",x)) return std::make_pair(true, (x->ban ? "*" : "")+ConvToStr(x->lines)+":"+ConvToStr(x->secs)); - else - return std::make_pair(false, parameter); - } + else + return std::make_pair(false, parameter); + } bool CheckTimeStamp(time_t theirs, time_t ours, const std::string &their_param, const std::string &our_param, chanrec* channel) { diff --git a/src/modules/m_namesx.cpp b/src/modules/m_namesx.cpp index f078aa8bf..5f0b0a483 100644 --- a/src/modules/m_namesx.cpp +++ b/src/modules/m_namesx.cpp @@ -49,12 +49,12 @@ class ModuleNamesX : public Module return Version(1,1,0,1,VF_VENDOR,API_VERSION); } - virtual void On005Numeric(std::string &output) + virtual void On005Numeric(std::string &output) { output.append(" NAMESX"); } - virtual int OnPreCommand(const std::string &command, const char** parameters, int pcnt, userrec *user, bool validated, const std::string &original_line) + virtual int OnPreCommand(const std::string &command, const char** parameters, int pcnt, userrec *user, bool validated, const std::string &original_line) { irc::string c = command.c_str(); /* We don't actually create a proper command handler class for PROTOCTL, diff --git a/src/modules/m_operchans.cpp b/src/modules/m_operchans.cpp index 15ef0faf9..bfeed72bf 100644 --- a/src/modules/m_operchans.cpp +++ b/src/modules/m_operchans.cpp @@ -82,7 +82,7 @@ class ModuleOperChans : public Module return 0; } - virtual ~ModuleOperChans() + virtual ~ModuleOperChans() { ServerInstance->Modes->DelMode(oc); DELETE(oc); diff --git a/src/modules/m_redirect.cpp b/src/modules/m_redirect.cpp index 492d39e58..ae522bf38 100644 --- a/src/modules/m_redirect.cpp +++ b/src/modules/m_redirect.cpp @@ -25,19 +25,19 @@ class Redirect : public ModeHandler public: Redirect(InspIRCd* Instance) : ModeHandler(Instance, 'L', 1, 0, false, MODETYPE_CHANNEL, false) { } - ModePair ModeSet(userrec* source, userrec* dest, chanrec* channel, const std::string ¶meter) - { - if (channel->IsModeSet('L')) - return std::make_pair(true, channel->GetModeParameter('L')); - else - return std::make_pair(false, parameter); - } - - bool CheckTimeStamp(time_t theirs, time_t ours, const std::string &their_param, const std::string &our_param, chanrec* channel) + ModePair ModeSet(userrec* source, userrec* dest, chanrec* channel, const std::string ¶meter) + { + if (channel->IsModeSet('L')) + return std::make_pair(true, channel->GetModeParameter('L')); + else + return std::make_pair(false, parameter); + } + + bool CheckTimeStamp(time_t theirs, time_t ours, const std::string &their_param, const std::string &our_param, chanrec* channel) { /* When TS is equal, the alphabetically later one wins */ return (their_param < our_param); - } + } ModeAction OnModeChange(userrec* source, userrec* dest, chanrec* channel, std::string ¶meter, bool adding) { diff --git a/src/modules/m_regonlycreate.cpp b/src/modules/m_regonlycreate.cpp index f4738ef08..33207da3e 100644 --- a/src/modules/m_regonlycreate.cpp +++ b/src/modules/m_regonlycreate.cpp @@ -48,7 +48,7 @@ class ModuleRegOnlyCreate : public Module return 0; } - virtual ~ModuleRegOnlyCreate() + virtual ~ModuleRegOnlyCreate() { } diff --git a/src/modules/m_restrictchans.cpp b/src/modules/m_restrictchans.cpp index eab419c46..e283440f4 100644 --- a/src/modules/m_restrictchans.cpp +++ b/src/modules/m_restrictchans.cpp @@ -6,7 +6,7 @@ * See: http://www.inspircd.org/wiki/index.php/Credits * * This program is free but copyrighted software; see - * the file COPYING for details. + * the file COPYING for details. * * --------------------------------------------------- */ @@ -75,7 +75,7 @@ class ModuleRestrictChans : public Module return 0; } - virtual ~ModuleRestrictChans() + virtual ~ModuleRestrictChans() { } diff --git a/src/modules/m_stripcolor.cpp b/src/modules/m_stripcolor.cpp index e3ee3fe2f..446fd6d61 100644 --- a/src/modules/m_stripcolor.cpp +++ b/src/modules/m_stripcolor.cpp @@ -6,7 +6,7 @@ * See: http://www.inspircd.org/wiki/index.php/Credits * * This program is free but copyrighted software; see - * the file COPYING for details. + * the file COPYING for details. * * --------------------------------------------------- */ @@ -142,7 +142,7 @@ class ModuleStripColor : public Module remove++; if (sentence[i + remove] == ',') - { + { remove += 2; if (isdigit(sentence[i + remove])) diff --git a/src/modules/m_timedbans.cpp b/src/modules/m_timedbans.cpp index a1fb41439..6106abc9a 100644 --- a/src/modules/m_timedbans.cpp +++ b/src/modules/m_timedbans.cpp @@ -6,7 +6,7 @@ * See: http://www.inspircd.org/wiki/index.php/Credits * * This program is free but copyrighted software; see - * the file COPYING for details. + * the file COPYING for details. * * --------------------------------------------------- */ @@ -176,14 +176,14 @@ class ModuleTimedBans : public Module // falls into the abyss :p userrec* temp = new userrec(ServerInstance); temp->SetFd(FD_MAGIC_NUMBER); - /* FIX: Send mode remotely*/ - std::deque<std::string> n; - n.push_back(setban[0]); - n.push_back("-b"); - n.push_back(setban[2]); + /* FIX: Send mode remotely*/ + std::deque<std::string> n; + n.push_back(setban[0]); + n.push_back("-b"); + n.push_back(setban[2]); ServerInstance->SendMode(setban,3,temp); - Event rmode((char *)&n, NULL, "send_mode"); - rmode.Send(ServerInstance); + Event rmode((char *)&n, NULL, "send_mode"); + rmode.Send(ServerInstance); DELETE(temp); } else diff --git a/src/modules/m_uhnames.cpp b/src/modules/m_uhnames.cpp index a3caf7082..a918b4234 100644 --- a/src/modules/m_uhnames.cpp +++ b/src/modules/m_uhnames.cpp @@ -39,7 +39,7 @@ class ModuleUHNames : public Module { } - void OnSyncUserMetaData(userrec* user, Module* proto,void* opaque, const std::string &extname, bool displayable) + void OnSyncUserMetaData(userrec* user, Module* proto,void* opaque, const std::string &extname, bool displayable) { if ((displayable) && (extname == "UHNAMES")) proto->ProtoSendMetaData(opaque, TYPE_USER, user, extname, "Enabled"); @@ -50,7 +50,7 @@ class ModuleUHNames : public Module return Version(1,1,0,1,VF_VENDOR,API_VERSION); } - virtual void On005Numeric(std::string &output) + virtual void On005Numeric(std::string &output) { output.append(" UHNAMES"); } @@ -60,7 +60,7 @@ class ModuleUHNames : public Module return (Priority)ServerInstance->PriorityBefore("m_namesx.so"); } - virtual int OnPreCommand(const std::string &command, const char** parameters, int pcnt, userrec *user, bool validated, const std::string &original_line) + virtual int OnPreCommand(const std::string &command, const char** parameters, int pcnt, userrec *user, bool validated, const std::string &original_line) { irc::string c = command.c_str(); /* We don't actually create a proper command handler class for PROTOCTL, diff --git a/src/modules/m_watch.cpp b/src/modules/m_watch.cpp index ef0f897d2..a8575dd98 100644 --- a/src/modules/m_watch.cpp +++ b/src/modules/m_watch.cpp @@ -62,11 +62,11 @@ */ #ifdef WINDOWS -typedef nspace::hash_map<irc::string, std::deque<userrec*>, nspace::hash_compare<irc::string, less<irc::string> > > watchentries; +typedef nspace::hash_map<irc::string, std::deque<userrec*>, nspace::hash_compare<irc::string, less<irc::string> > > watchentries; #else -typedef nspace::hash_map<irc::string, std::deque<userrec*>, nspace::hash<irc::string> > watchentries; +typedef nspace::hash_map<irc::string, std::deque<userrec*>, nspace::hash<irc::string> > watchentries; #endif -typedef std::map<irc::string, std::string> watchlist; +typedef std::map<irc::string, std::string>watchlist; /* Who's watching each nickname. * NOTE: We do NOT iterate this to display a user's WATCH list! @@ -372,15 +372,15 @@ class Modulewatch : public Module virtual void OnGarbageCollect() { watchentries* old_watch = whos_watching_me; - whos_watching_me = new watchentries(); + whos_watching_me = new watchentries(); for (watchentries::const_iterator n = old_watch->begin(); n != old_watch->end(); n++) whos_watching_me->insert(*n); - delete old_watch; + delete old_watch; } - virtual void OnCleanup(int target_type, void* item) + virtual void OnCleanup(int target_type, void* item) { if (target_type == TYPE_USER) { |