diff options
-rw-r--r-- | include/inspircd.h | 4 | ||||
-rw-r--r-- | include/modules.h | 5 | ||||
-rw-r--r-- | src/cmd_whois.cpp | 24 | ||||
-rw-r--r-- | src/helperfuncs.cpp | 8 | ||||
-rw-r--r-- | src/modules.cpp | 2 |
5 files changed, 22 insertions, 21 deletions
diff --git a/include/inspircd.h b/include/inspircd.h index 1aead5d5e..3a752e21c 100644 --- a/include/inspircd.h +++ b/include/inspircd.h @@ -998,9 +998,9 @@ class InspIRCd : public classbase */ void Log(int level, const std::string &text); - void SendWhoisLine(userrec* user, int numeric, const std::string &text); + void SendWhoisLine(userrec* user, userrec* dest, int numeric, const std::string &text); - void SendWhoisLine(userrec* user, int numeric, const char* format, ...); + void SendWhoisLine(userrec* user, userrec* dest, int numeric, const char* format, ...); /** Begin execution of the server. * NOTE: this function NEVER returns. Internally, diff --git a/include/modules.h b/include/modules.h index 2d7e9f4ab..a92369854 100644 --- a/include/modules.h +++ b/include/modules.h @@ -74,7 +74,7 @@ enum TargetTypeFlags { * ipv4 servers, so this value will be ten times as * high on ipv6 servers. */ -#define NATIVE_API_VERSION 11001 +#define NATIVE_API_VERSION 11002 #ifdef IPV6 #define API_VERSION (NATIVE_API_VERSION * 10) #else @@ -1293,12 +1293,13 @@ class Module : public Extensible * the values numeric and text, but you cannot change the user the * numeric is sent to. You may however change the user's userrec values. * @param user The user the numeric is being sent to + * @param dest The user being WHOISed * @param numeric The numeric of the line being sent * @param text The text of the numeric, including any parameters * @return nonzero to drop the line completely so that the user does not * receive it, or zero to allow the line to be sent. */ - virtual int OnWhoisLine(userrec* user, int &numeric, std::string &text); + virtual int OnWhoisLine(userrec* user, userrec* dest, int &numeric, std::string &text); }; diff --git a/src/cmd_whois.cpp b/src/cmd_whois.cpp index 42c272c97..475e73c59 100644 --- a/src/cmd_whois.cpp +++ b/src/cmd_whois.cpp @@ -26,10 +26,10 @@ void do_whois(InspIRCd* ServerInstance, userrec* user, userrec* dest,unsigned lo // bug found by phidjit - were able to whois an incomplete connection if it had sent a NICK or USER if (dest->registered == REG_ALL) { - ServerInstance->SendWhoisLine(user, 311, "%s %s %s %s * :%s",user->nick, dest->nick, dest->ident, dest->dhost, dest->fullname); + ServerInstance->SendWhoisLine(user, dest, 311, "%s %s %s %s * :%s",user->nick, dest->nick, dest->ident, dest->dhost, dest->fullname); if ((user == dest) || (*user->oper)) { - ServerInstance->SendWhoisLine(user, 378, "%s %s :is connecting from *@%s %s",user->nick, dest->nick, dest->host, dest->GetIPString()); + ServerInstance->SendWhoisLine(user, dest, 378, "%s %s :is connecting from *@%s %s",user->nick, dest->nick, dest->host, dest->GetIPString()); } std::string cl = dest->ChannelList(user); if (cl.length()) @@ -40,24 +40,24 @@ void do_whois(InspIRCd* ServerInstance, userrec* user, userrec* dest,unsigned lo } else { - ServerInstance->SendWhoisLine(user, 319, "%s %s :%s",user->nick, dest->nick, cl.c_str()); + ServerInstance->SendWhoisLine(user, dest, 319, "%s %s :%s",user->nick, dest->nick, cl.c_str()); } } if (*ServerInstance->Config->HideWhoisServer && !(*user->oper)) { - ServerInstance->SendWhoisLine(user, 312, "%s %s %s :%s",user->nick, dest->nick, ServerInstance->Config->HideWhoisServer, ServerInstance->Config->Network); + ServerInstance->SendWhoisLine(user, dest, 312, "%s %s %s :%s",user->nick, dest->nick, ServerInstance->Config->HideWhoisServer, ServerInstance->Config->Network); } else { - ServerInstance->SendWhoisLine(user, 312, "%s %s %s :%s",user->nick, dest->nick, dest->server, ServerInstance->GetServerDescription(dest->server).c_str()); + ServerInstance->SendWhoisLine(user, dest, 312, "%s %s %s :%s",user->nick, dest->nick, dest->server, ServerInstance->GetServerDescription(dest->server).c_str()); } if (*dest->awaymsg) { - ServerInstance->SendWhoisLine(user, 301, "%s %s :%s",user->nick, dest->nick, dest->awaymsg); + ServerInstance->SendWhoisLine(user, dest, 301, "%s %s :%s",user->nick, dest->nick, dest->awaymsg); } if (*dest->oper) { - ServerInstance->SendWhoisLine(user, 313, "%s %s :is %s %s on %s",user->nick, dest->nick, (strchr("AEIOUaeiou",*dest->oper) ? "an" : "a"),irc::Spacify(dest->oper), ServerInstance->Config->Network); + ServerInstance->SendWhoisLine(user, dest, 313, "%s %s :is %s %s on %s",user->nick, dest->nick, (strchr("AEIOUaeiou",*dest->oper) ? "an" : "a"),irc::Spacify(dest->oper), ServerInstance->Config->Network); } if ((!signon) && (!idle)) { @@ -66,19 +66,19 @@ void do_whois(InspIRCd* ServerInstance, userrec* user, userrec* dest,unsigned lo if (!strcasecmp(user->server,dest->server)) { // idle time and signon line can only be sent if youre on the same server (according to RFC) - ServerInstance->SendWhoisLine(user, 317, "%s %s %d %d :seconds idle, signon time",user->nick, dest->nick, abs((dest->idle_lastmsg)-ServerInstance->Time()), dest->signon); + ServerInstance->SendWhoisLine(user, dest, 317, "%s %s %d %d :seconds idle, signon time",user->nick, dest->nick, abs((dest->idle_lastmsg)-ServerInstance->Time()), dest->signon); } else { if ((idle) || (signon)) - ServerInstance->SendWhoisLine(user, 317, "%s %s %d %d :seconds idle, signon time",user->nick, dest->nick, idle, signon); + ServerInstance->SendWhoisLine(user, dest, 317, "%s %s %d %d :seconds idle, signon time",user->nick, dest->nick, idle, signon); } - ServerInstance->SendWhoisLine(user, 318, "%s %s :End of /WHOIS list.",user->nick, dest->nick); + ServerInstance->SendWhoisLine(user, dest, 318, "%s %s :End of /WHOIS list.",user->nick, dest->nick); } else { - ServerInstance->SendWhoisLine(user, 401, "%s %s :No such nick/channel",user->nick, *nick ? nick : "*"); - ServerInstance->SendWhoisLine(user, 318, "%s %s :End of /WHOIS list.",user->nick, *nick ? nick : "*"); + ServerInstance->SendWhoisLine(user, dest, 401, "%s %s :No such nick/channel",user->nick, *nick ? nick : "*"); + ServerInstance->SendWhoisLine(user, dest, 318, "%s %s :End of /WHOIS list.",user->nick, *nick ? nick : "*"); } } diff --git a/src/helperfuncs.cpp b/src/helperfuncs.cpp index 7eb4544fb..4475c169a 100644 --- a/src/helperfuncs.cpp +++ b/src/helperfuncs.cpp @@ -506,18 +506,18 @@ void InspIRCd::LoadAllModules() this->Log(DEFAULT,"Total loaded modules: %d", this->ModCount+1); } -void InspIRCd::SendWhoisLine(userrec* user, int numeric, const std::string &text) +void InspIRCd::SendWhoisLine(userrec* user, userrec* dest, int numeric, const std::string &text) { std::string copy_text = text; int MOD_RESULT = 0; - FOREACH_RESULT_I(this, I_OnWhoisLine, OnWhoisLine(user, numeric, copy_text)); + FOREACH_RESULT_I(this, I_OnWhoisLine, OnWhoisLine(user, dest, numeric, copy_text)); if (!MOD_RESULT) user->WriteServ("%d %s", numeric, copy_text.c_str()); } -void InspIRCd::SendWhoisLine(userrec* user, int numeric, const char* format, ...) +void InspIRCd::SendWhoisLine(userrec* user, userrec* dest, int numeric, const char* format, ...) { char textbuffer[MAXBUF]; va_list argsPtr; @@ -525,6 +525,6 @@ void InspIRCd::SendWhoisLine(userrec* user, int numeric, const char* format, ... vsnprintf(textbuffer, MAXBUF, format, argsPtr); va_end(argsPtr); - this->SendWhoisLine(user, numeric, std::string(textbuffer)); + this->SendWhoisLine(user, dest, numeric, std::string(textbuffer)); } diff --git a/src/modules.cpp b/src/modules.cpp index 5822e0975..f10c96b20 100644 --- a/src/modules.cpp +++ b/src/modules.cpp @@ -192,7 +192,7 @@ Priority Module::Prioritize() { return PRIORITY_DONTCARE; } void Module::OnSetAway(userrec* user) { }; void Module::OnCancelAway(userrec* user) { }; int Module::OnUserList(userrec* user, chanrec* Ptr) { return 0; }; -int Module::OnWhoisLine(userrec* user, int &numeric, std::string &text) { return 0; }; +int Module::OnWhoisLine(userrec* user, userrec* dest, int &numeric, std::string &text) { return 0; }; long InspIRCd::PriorityAfter(const std::string &modulename) { |