X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_watch.cpp;h=803bd2c40f2f540470d771c130a5a2e9f9652734;hb=80e81e3b81b779901fd9d67f8ae030ee30c0bcec;hp=6406f0573cc83ba3488d565a0d3184cfc43d349b;hpb=124c17e14134a4999afc1a5e981ab7c75b3694b9;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_watch.cpp b/src/modules/m_watch.cpp index 6406f0573..803bd2c40 100644 --- a/src/modules/m_watch.cpp +++ b/src/modules/m_watch.cpp @@ -1,6 +1,8 @@ /* * InspIRCd -- Internet Relay Chat Daemon * + * Copyright (C) 2019 Robby + * Copyright (C) 2017-2018 Sadie Powell * Copyright (C) 2016 Attila Molnar * * This file is part of InspIRCd. InspIRCd is free software: you can @@ -18,6 +20,7 @@ #include "inspircd.h" +#include "modules/away.h" #define INSPIRCD_MONITOR_MANAGER_ONLY #include "m_monitor.cpp" @@ -132,10 +135,10 @@ class CommandWatch : public SplitCommand , manager(managerref) { allow_empty_last_param = false; - syntax = "[|->]"; + syntax = "C|L|l|S|(+|-) [(+|-)]+"; } - CmdResult HandleLocal(const std::vector& parameters, LocalUser* user) CXX11_OVERRIDE + CmdResult HandleLocal(LocalUser* user, const Params& parameters) CXX11_OVERRIDE { if (parameters.empty()) { @@ -179,7 +182,9 @@ class CommandWatch : public SplitCommand } }; -class ModuleWatch : public Module +class ModuleWatch + : public Module + , public Away::EventListener { IRCv3::Monitor::Manager manager; CommandWatch cmd; @@ -211,7 +216,8 @@ class ModuleWatch : public Module public: ModuleWatch() - : manager(this, "watch") + : Away::EventListener(this) + , manager(this, "watch") , cmd(this, manager) { } @@ -245,14 +251,14 @@ class ModuleWatch : public Module Offline(user, user->nick); } - ModResult OnSetAway(User* user, const std::string& awaymsg) CXX11_OVERRIDE + void OnUserAway(User* user) CXX11_OVERRIDE { - if (awaymsg.empty()) - SendAlert(user, user->nick, RPL_NOTAWAY, "is no longer away", ServerInstance->Time()); - else - SendAlert(user, user->nick, RPL_GONEAWAY, awaymsg.c_str(), user->awaytime); + SendAlert(user, user->nick, RPL_GONEAWAY, user->awaymsg.c_str(), user->awaytime); + } - return MOD_RES_PASSTHRU; + void OnUserBack(User* user) CXX11_OVERRIDE + { + SendAlert(user, user->nick, RPL_NOTAWAY, "is no longer away", ServerInstance->Time()); } void On005Numeric(std::map& tokens) CXX11_OVERRIDE @@ -262,7 +268,7 @@ class ModuleWatch : public Module Version GetVersion() CXX11_OVERRIDE { - return Version("Provides WATCH support", VF_VENDOR); + return Version("Adds the /WATCH command which allows users to find out when their friends are connected to the server.", VF_VENDOR); } };