diff options
author | w00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7> | 2008-02-12 22:26:07 +0000 |
---|---|---|
committer | w00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7> | 2008-02-12 22:26:07 +0000 |
commit | 1ea31c8ecfc02b77c8ac89be88f760da9fa9d6eb (patch) | |
tree | 2a0b929f46e820e98f964c86cd1a208e2af0c46e /src/modules | |
parent | 6fc7edf5e38514b3dc55100a02ce707b018206c5 (diff) |
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
Diffstat (limited to 'src/modules')
-rw-r--r-- | src/modules/m_watch.cpp | 33 |
1 files changed, 32 insertions, 1 deletions
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<irc::string, std::string> watchlist; */ watchentries* whos_watching_me; +class CommandSVSWatch : public Command +{ + public: + CommandSVSWatch (InspIRCd* Instance) : Command(Instance,"WATCH", 0, 2) + { + this->source = "m_watch.so"; + syntax = "<target> [C|L|S]|[+|-<nick>]"; + 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); } |