-/* +------------------------------------+
- * | Inspire Internet Relay Chat Daemon |
- * +------------------------------------+
+/*
+ * InspIRCd -- Internet Relay Chat Daemon
+ *
+ * Copyright (C) 2009 Daniel De Graaf <danieldg@inspircd.org>
+ * Copyright (C) 2005-2008 Craig Edwards <craigedwards@brainbox.cc>
+ * Copyright (C) 2006-2008 Robin Burchell <robin+git@viroteck.net>
+ * Copyright (C) 2007 Dennis Friis <peavey@inspircd.org>
*
- * InspIRCd: (C) 2002-2009 InspIRCd Development Team
- * See: http://wiki.inspircd.org/Credits
+ * This file is part of InspIRCd. InspIRCd is free software: you can
+ * redistribute it and/or modify it under the terms of the GNU General Public
+ * License as published by the Free Software Foundation, version 2.
*
- * This program is free but copyrighted software; see
- * the file COPYING for details.
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
*
- * ---------------------------------------------------
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+
#include "inspircd.h"
/* $ModDesc: Provides support for the /WATCH command */
#if defined(WINDOWS) && !defined(HASHMAP_DEPRECATED)
typedef nspace::hash_map<irc::string, std::deque<User*>, nspace::hash_compare<irc::string, std::less<irc::string> > > watchentries;
#else
- typedef nspace::hash_map<irc::string, std::deque<User*>, nspace::hash<irc::string> > watchentries;
+ typedef nspace::hash_map<irc::string, std::deque<User*>, irc::hash> watchentries;
#endif
typedef std::map<irc::string, std::string> watchlist;
class CommandSVSWatch : public Command
{
public:
- CommandSVSWatch (InspIRCd* Instance, Module* Creator) : Command(Instance, Creator,"SVSWATCH", 0, 2)
+ CommandSVSWatch(Module* Creator) : Command(Creator,"SVSWATCH", 2)
{
syntax = "<target> [C|L|S]|[+|-<nick>]";
TRANSLATE3(TR_NICK, TR_TEXT, TR_END); /* we watch for a nick. not a UID. */
RouteDescriptor GetRouting(User* user, const std::vector<std::string>& parameters)
{
- return ROUTE_BROADCAST;
+ User* target = ServerInstance->FindNick(parameters[0]);
+ if (target)
+ return ROUTE_OPT_UCAST(target->server);
+ return ROUTE_LOCALONLY;
}
};
return CMD_SUCCESS;
}
- CommandWatch (InspIRCd* Instance, Module* parent, unsigned int &maxwatch)
- : Command(Instance,parent,"WATCH",0,0), MAX_WATCH(maxwatch), ext("watchlist", parent)
+ CommandWatch(Module* parent, unsigned int &maxwatch) : Command(parent,"WATCH", 0), MAX_WATCH(maxwatch), ext("watchlist", parent)
{
syntax = "[C|L|S]|[+|-<nick>]";
TRANSLATE2(TR_TEXT, TR_END); /* we watch for a nick. not a UID. */
CommandSVSWatch sw;
public:
- Modulewatch(InspIRCd* Me)
- : Module(Me), maxwatch(32), cmdw(Me, this, maxwatch), sw(Me,this)
+ Modulewatch()
+ : maxwatch(32), cmdw(this, maxwatch), sw(this)
{
OnRehash(NULL);
whos_watching_me = new watchentries();
ServerInstance->AddCommand(&cmdw);
ServerInstance->AddCommand(&sw);
- Extensible::Register(&cmdw.ext);
- Implementation eventlist[] = { I_OnRehash, I_OnGarbageCollect, I_OnCleanup, I_OnUserQuit, I_OnPostConnect, I_OnUserPostNick, I_On005Numeric, I_OnSetAway };
- ServerInstance->Modules->Attach(eventlist, this, 8);
+ ServerInstance->Extensions.Register(&cmdw.ext);
+ Implementation eventlist[] = { I_OnRehash, I_OnGarbageCollect, I_OnUserQuit, I_OnPostConnect, I_OnUserPostNick, I_On005Numeric, I_OnSetAway };
+ ServerInstance->Modules->Attach(eventlist, this, 7);
}
virtual void OnRehash(User* user)
{
- ConfigReader Conf(ServerInstance);
+ ConfigReader Conf;
maxwatch = Conf.ReadInteger("watch", "maxentries", 0, true);
if (!maxwatch)
maxwatch = 32;
virtual Version GetVersion()
{
- return Version("$Id$", VF_COMMON | VF_VENDOR, API_VERSION);
+ return Version("Provides support for the /WATCH command", VF_OPTCOMMON | VF_VENDOR);
}
};