From aca1075bd9f04dc599a1a5a5687aa87184baeae4 Mon Sep 17 00:00:00 2001 From: special Date: Wed, 15 Nov 2006 00:10:46 +0000 Subject: Added to m_swhois, which will override if specified git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@5747 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/modules/m_swhois.cpp | 54 ++++++++++++++++++++++++++++++++---------------- 1 file 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() -- cgit v1.2.3