X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=include%2Fmodules%2Fwhois.h;h=4f09d268bff7f935bafabc05c8a786a53348ea0b;hb=d4a1ea70451abb333e71f9cff09b624db59531a0;hp=b64d46410760d851afcd19eedbbd9e6846eaa087;hpb=0b63ccd0b5cb26883d6becb196fb98e4f95d0397;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/include/modules/whois.h b/include/modules/whois.h index b64d46410..4f09d268b 100644 --- a/include/modules/whois.h +++ b/include/modules/whois.h @@ -55,12 +55,11 @@ class Whois::LineEventListener : public Events::ModuleEventListener * the values numeric and text, but you cannot change the user the * numeric is sent to. * @param whois Whois context, can be used to send numerics - * @param numeric The numeric of the line being sent - * @param text The text of the numeric, including any parameters + * @param numeric Numeric being sent * @return MOD_RES_DENY to drop the line completely so that the user does not * receive it, or MOD_RES_PASSTHRU to allow the line to be sent. */ - virtual ModResult OnWhoisLine(Context& whois, unsigned int& numeric, std::string& text) = 0; + virtual ModResult OnWhoisLine(Context& whois, Numeric::Numeric& numeric) = 0; }; class Whois::Context @@ -97,20 +96,51 @@ class Whois::Context User* GetTarget() const { return target; } /** Send a line of WHOIS data to the source of the WHOIS - * @param numeric Numeric to send - * @param format Format string for the numeric - * @param ... Parameters for the format string */ - void SendLine(unsigned int numeric, const char* format, ...) CUSTOM_PRINTF(3, 4) + template + void SendLine(unsigned int numeric, T1 p1) + { + Numeric::Numeric n(numeric); + n.push(target->nick); + n.push(p1); + SendLine(n); + } + + template + void SendLine(unsigned int numeric, T1 p1, T2 p2) + { + Numeric::Numeric n(numeric); + n.push(target->nick); + n.push(p1); + n.push(p2); + SendLine(n); + } + + template + void SendLine(unsigned int numeric, T1 p1, T2 p2, T3 p3) + { + Numeric::Numeric n(numeric); + n.push(target->nick); + n.push(p1); + n.push(p2); + n.push(p3); + SendLine(n); + } + + template + void SendLine(unsigned int numeric, T1 p1, T2 p2, T3 p3, T4 p4) { - std::string textbuffer; - VAFORMAT(textbuffer, format, format) - SendLine(numeric, textbuffer); + Numeric::Numeric n(numeric); + n.push(target->nick); + n.push(p1); + n.push(p2); + n.push(p3); + n.push(p4); + SendLine(n); } /** Send a line of WHOIS data to the source of the WHOIS * @param numeric Numeric to send - * @param text Text of the numeric */ - virtual void SendLine(unsigned int numeric, const std::string& text) = 0; + virtual void SendLine(Numeric::Numeric& numeric) = 0; };