From 1ea31c8ecfc02b77c8ac89be88f760da9fa9d6eb Mon Sep 17 00:00:00 2001 From: w00t Date: Tue, 12 Feb 2008 22:26:07 +0000 Subject: Add SVSWATCH command: services may issue it to modify the watch list of a client. Syntax: :sender SVSWATCH user watchcraphere git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@8916 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/modules/m_watch.cpp | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/modules/m_watch.cpp b/src/modules/m_watch.cpp index 5f93bd9cb..dff282633 100644 --- a/src/modules/m_watch.cpp +++ b/src/modules/m_watch.cpp @@ -74,6 +74,34 @@ typedef std::map watchlist; */ watchentries* whos_watching_me; +class CommandSVSWatch : public Command +{ + public: + CommandSVSWatch (InspIRCd* Instance) : Command(Instance,"WATCH", 0, 2) + { + this->source = "m_watch.so"; + syntax = " [C|L|S]|[+|-]"; + TRANSLATE3(TR_NICK, TR_TEXT, TR_END); /* we watch for a nick. not a UID. */ + } + + CmdResult Handle (const char** parameters, int pcnt, User *user) + { + if (!ServerInstance->ULine(user->server)) + return CMD_FAILURE; + + User *u = ServerInstance->FindNick(parameters[0]); + if (!u) + return CMD_FAILURE; + + if (IS_LOCAL(u)) + { + ServerInstance->Parser->CallHandler("WATCH", ¶meters[1], 1, u); + } + + return CMD_SUCCESS; + } +}; + /** Handle /WATCH */ class CommandWatch : public Command @@ -306,9 +334,10 @@ class CommandWatch : public Command class Modulewatch : public Module { CommandWatch* mycommand; + CommandSVSWatch *sw; unsigned int maxwatch; + public: - Modulewatch(InspIRCd* Me) : Module(Me), maxwatch(32) { @@ -316,6 +345,8 @@ class Modulewatch : public Module whos_watching_me = new watchentries(); mycommand = new CommandWatch(ServerInstance, maxwatch); ServerInstance->AddCommand(mycommand); + sw = new CommandSVSWatch(ServerInstance); + ServerInstance->AddCommand(sw); Implementation eventlist[] = { I_OnRehash, I_OnGarbageCollect, I_OnCleanup, I_OnUserQuit, I_OnPostConnect, I_OnUserPostNick, I_On005Numeric }; ServerInstance->Modules->Attach(eventlist, this, 7); } -- cgit v1.2.3