diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-07-09 17:31:53 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-07-09 17:31:53 +0000 |
commit | cbff8c76278f7cb706e3c4ae0c8bc4cb63c15f96 (patch) | |
tree | a3919e7e2eafbd831bf242a6a8efda2a8b8be0e2 | |
parent | cd767403e9cce6cc0749160fddb9e7c82042d23c (diff) |
And we're all done!!! (well, it compiles, anyway)
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@4235 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r-- | src/modules/m_showwhois.cpp | 87 | ||||
-rw-r--r-- | src/modules/m_sslmodes.cpp | 5 | ||||
-rw-r--r-- | src/modules/m_stripcolor.cpp | 4 |
3 files changed, 61 insertions, 35 deletions
diff --git a/src/modules/m_showwhois.cpp b/src/modules/m_showwhois.cpp index 519b13352..c7ba52035 100644 --- a/src/modules/m_showwhois.cpp +++ b/src/modules/m_showwhois.cpp @@ -10,49 +10,74 @@ using namespace std; /* $ModDesc: Allows opers to set +W to see when a user uses WHOIS on them */ -class ModuleShowwhois : public Module +class SeeWhois : public ModeHandler { - Server* Srv; - - public: - ModuleShowwhois(Server* Me) - : Module::Module(Me) - { - Srv = Me; - Srv->AddExtendedMode('W',MT_CLIENT,true,0,0); - } + public: + SeeWhois() : ModeHandler('W', 0, 0, false, MODETYPE_CHANNEL, false) { } - ~ModuleShowwhois() - { - } - - void Implements(char* List) - { - List[I_OnWhois] = List[I_OnExtendedMode] = 1; - } + ModeAction OnModeChange(userrec* source, userrec* dest, chanrec* channel, std::string ¶meter, bool adding) + { + /* Only opers can change other users modes */ + if ((source != dest) && (!*source->oper)) + return MODEACTION_DENY; - virtual Version GetVersion() + if (adding) { - return Version(1,0,0,3,VF_STATIC); + if (!channel->IsModeSet('W')) + { + dest->SetMode('W',true); + return MODEACTION_ALLOW; + } } - - virtual int OnExtendedMode(userrec* user, void* target, char modechar, int type, bool mode_on, string_list& params) + else { - if((type == MT_CLIENT) && (modechar == 'W')) + if (channel->IsModeSet('W')) { - return 1; + dest->SetMode('W',false); + return MODEACTION_ALLOW; } - - return 0; } - virtual void OnWhois(userrec* source, userrec* dest) + return MODEACTION_DENY; + } +}; + +class ModuleShowwhois : public Module +{ + Server* Srv; + SeeWhois* sw; + + public: + + ModuleShowwhois(Server* Me) : Module::Module(Me) + { + Srv = Me; + sw = new SeeWhois(); + Srv->AddMode(sw, 'W'); + } + + ~ModuleShowwhois() + { + DELETE(sw); + } + + void Implements(char* List) + { + List[I_OnWhois] = 1; + } + + virtual Version GetVersion() + { + return Version(1,0,0,3,VF_STATIC); + } + + virtual void OnWhois(userrec* source, userrec* dest) + { + if ((dest->IsModeSet('W')) && (source != dest)) { - if ((dest->modes['W'-65]) && (source != dest)) - { - WriteServ(dest->fd,"NOTICE %s :*** %s (%s@%s) did a /whois on you.",dest->nick,source->nick,source->ident,source->host); - } + WriteServ(dest->fd,"NOTICE %s :*** %s (%s@%s) did a /whois on you.",dest->nick,source->nick,source->ident,source->host); } + } }; diff --git a/src/modules/m_sslmodes.cpp b/src/modules/m_sslmodes.cpp index 97576795a..e0b3126e4 100644 --- a/src/modules/m_sslmodes.cpp +++ b/src/modules/m_sslmodes.cpp @@ -7,8 +7,9 @@ class SSLMode : public ModeHandler { + Server* Srv; public: - SSLMode() : ModeHandler('z', 0, 0, false, MODETYPE_CHANNEL, false) { } + SSLMode(Server* s) : ModeHandler('z', 0, 0, false, MODETYPE_CHANNEL, false), Srv(s) { } ModeAction OnModeChange(userrec* source, userrec* dest, chanrec* channel, std::string ¶meter, bool adding) { @@ -57,7 +58,7 @@ class ModuleSSLModes : public Module { Srv = Me; - sslm = new SSLMode(); + sslm = new SSLMode(Me); Srv->AddMode(sslm, 'z'); } diff --git a/src/modules/m_stripcolor.cpp b/src/modules/m_stripcolor.cpp index 601500586..3550d9301 100644 --- a/src/modules/m_stripcolor.cpp +++ b/src/modules/m_stripcolor.cpp @@ -28,7 +28,7 @@ using namespace std; class ChannelStripColor : public ModeHandler { public: - StripColor() : ModeHandler('S', 0, 0, false, MODETYPE_CHANNEL, false) { } + ChannelStripColor() : ModeHandler('S', 0, 0, false, MODETYPE_CHANNEL, false) { } ModeAction OnModeChange(userrec* source, userrec* dest, chanrec* channel, std::string ¶meter, bool adding) { @@ -60,7 +60,7 @@ class ChannelStripColor : public ModeHandler class UserStripColor : public ModeHandler { public: - StripColor() : ModeHandler('S', 0, 0, false, MODETYPE_USER, false) { } + UserStripColor() : ModeHandler('S', 0, 0, false, MODETYPE_USER, false) { } ModeAction OnModeChange(userrec* source, userrec* dest, chanrec* channel, std::string ¶meter, bool adding) { |