diff options
author | aquanight <aquanight@e03df62e-2008-0410-955e-edbf42e46eb7> | 2008-01-19 17:30:32 +0000 |
---|---|---|
committer | aquanight <aquanight@e03df62e-2008-0410-955e-edbf42e46eb7> | 2008-01-19 17:30:32 +0000 |
commit | b3fc1e9af2045b7c040f4d6a90e6378e88a6dd31 (patch) | |
tree | 0d921474eab029318db875fa8ce97bd1d7d01733 /src/modules | |
parent | 37283ce7b325fc5d7bbdbf03513ccdd9463762d5 (diff) |
Fix m_callerid not adding the usermode.
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@8738 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules')
-rw-r--r-- | src/modules/m_callerid.cpp | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/src/modules/m_callerid.cpp b/src/modules/m_callerid.cpp index 18f15d03d..6098ff9e9 100644 --- a/src/modules/m_callerid.cpp +++ b/src/modules/m_callerid.cpp @@ -59,6 +59,24 @@ void RemoveFromAllAccepts(InspIRCd* ServerInstance, User* who) } } +class User_g : public ModeHandler +{ +private: + +public: + User_g(InspIRCd* Instance) : ModeHandler(Instance, 'g', 0, 0, false, MODETYPE_USER, false) { } + + ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string ¶meter, bool adding) + { + if (adding != dest->IsModeSet('g')) + { + dest->SetMode('g', adding); + return MODEACTION_ALLOW; + } + return MODEACTION_DENY; + } +}; + class CommandAccept : public Command { private: @@ -178,6 +196,7 @@ class ModuleCallerID : public Module { private: CommandAccept *mycommand; + User_g* myumode; // Configuration variables: unsigned int maxaccepts; // Maximum ACCEPT entries. @@ -190,7 +209,19 @@ public: { OnRehash(NULL, ""); mycommand = new CommandAccept(ServerInstance, maxaccepts); - ServerInstance->AddCommand(mycommand); + myumode = new User_g(ServerInstance); + try { + ServerInstance->AddCommand(mycommand); + } catch (const ModuleException& e) { + delete mycommand; + throw; + } + if (!ServerInstance->Modes->AddMode(myumode)) + { + delete mycommand; + delete myumode; + throw new ModuleException("Could not add usermode and command!"); + } Implementation eventlist[] = { I_OnRehash, I_OnUserPreNick, I_OnUserQuit, I_On005Numeric, I_OnUserPreNotice, I_OnUserPreMessage }; ServerInstance->Modules->Attach(eventlist, this, 6); } |