diff options
author | special <special@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-11-15 00:10:46 +0000 |
---|---|---|
committer | special <special@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-11-15 00:10:46 +0000 |
commit | aca1075bd9f04dc599a1a5a5687aa87184baeae4 (patch) | |
tree | e052b876cfe629f0e8f9ccaac0d827187f7a6556 | |
parent | d66880ade524cf236716b09e7ddd9ce8c15f6787 (diff) |
Added <oper:swhois> to m_swhois, which will override <type:swhois> if specified
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@5747 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r-- | src/modules/m_swhois.cpp | 54 |
1 files changed, 36 insertions, 18 deletions
diff --git a/src/modules/m_swhois.cpp b/src/modules/m_swhois.cpp index 4cf2bcd50..7c244834e 100644 --- a/src/modules/m_swhois.cpp +++ b/src/modules/m_swhois.cpp @@ -100,7 +100,7 @@ class ModuleSWhois : public Module void Implements(char* List) { - List[I_OnWhois] = List[I_OnSyncUserMetaData] = List[I_OnUserQuit] = List[I_OnCleanup] = List[I_OnRehash] = List[I_OnOper] = 1; + List[I_OnWhois] = List[I_OnSyncUserMetaData] = List[I_OnUserQuit] = List[I_OnCleanup] = List[I_OnRehash] = List[I_OnPostCommand] = 1; } // :kenny.chatspike.net 320 Brain Azhrarn :is getting paid to play games. @@ -187,32 +187,50 @@ class ModuleSWhois : public Module } } - virtual void OnOper(userrec* user, const std::string &opertype) + virtual void OnPostCommand(const std::string &command, const char **params, int pcnt, userrec *user, CmdResult result, const std::string &original_line) { - for(int i =0; i < Conf->Enumerate("type"); i++) + if ((command != "OPER") || (result != CMD_SUCCESS)) + return; + + std::string swhois; + + for (int i = 0; i < Conf->Enumerate("oper"); i++) { - std::string type = Conf->ReadValue("type", "name", i); + std::string name = Conf->ReadValue("oper", "name", i); - if(strcmp(type.c_str(), user->oper) == 0) + if (name == params[0]) + { + swhois = Conf->ReadValue("oper", "swhois", i); + break; + } + } + + if (!swhois.length()) + { + for (int i = 0; i < Conf->Enumerate("type"); i++) { - std::string swhois = Conf->ReadValue("type", "swhois", i); + std::string type = Conf->ReadValue("type", "name", i); - if(swhois.length()) + if (type == user->oper) { - std::string* old; - if(user->GetExt("swhois", old)) - { - user->Shrink("swhois"); - DELETE(old); - } - - std::string* text = new std::string(swhois); - user->Extend("swhois", text); - + swhois = Conf->ReadValue("type", "swhois", i); break; } } - } + } + + std::string *old; + if (user->GetExt("swhois", old)) + { + user->Shrink("swhois"); + DELETE(old); + } + + if (!swhois.length()) + return; + + std::string *text = new std::string(swhois); + user->Extend("swhois", text); } virtual ~ModuleSWhois() |