From 034f74a23b3d6aff177682c916e18382621f495a Mon Sep 17 00:00:00 2001 From: brain Date: Sat, 28 Oct 2006 18:12:45 +0000 Subject: Add support for OnWhoisLine, which allows modules to change or drop any line of whois before its sent to a user git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@5570 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/helperfuncs.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'src/helperfuncs.cpp') diff --git a/src/helperfuncs.cpp b/src/helperfuncs.cpp index c09b714f1..7eb4544fb 100644 --- a/src/helperfuncs.cpp +++ b/src/helperfuncs.cpp @@ -506,3 +506,25 @@ void InspIRCd::LoadAllModules() this->Log(DEFAULT,"Total loaded modules: %d", this->ModCount+1); } +void InspIRCd::SendWhoisLine(userrec* user, 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)); + + if (!MOD_RESULT) + user->WriteServ("%d %s", numeric, copy_text.c_str()); +} + +void InspIRCd::SendWhoisLine(userrec* user, int numeric, const char* format, ...) +{ + char textbuffer[MAXBUF]; + va_list argsPtr; + va_start (argsPtr, format); + vsnprintf(textbuffer, MAXBUF, format, argsPtr); + va_end(argsPtr); + + this->SendWhoisLine(user, numeric, std::string(textbuffer)); +} + -- cgit v1.3.1-10-gc9f91