mirror of
https://github.com/inspircd/inspircd.git
synced 2025-03-10 11:09:04 -04:00
Add 'dest' parameter to OnWhoisLine, contains the user being whois'ed (we need this for +H and probably the stuff w00t is doing too)
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@5573 e03df62e-2008-0410-955e-edbf42e46eb7
This commit is contained in:
parent
b7c7e603e9
commit
94db28f9b3
@ -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,
|
||||
|
@ -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);
|
||||
};
|
||||
|
||||
|
||||
|
@ -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 : "*");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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));
|
||||
}
|
||||
|
||||
|
@ -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)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user