2 * InspIRCd -- Internet Relay Chat Daemon
4 * Copyright (C) 2018 Sadie Powell <sadie@witchery.services>
6 * This file is part of InspIRCd. InspIRCd is free software: you can
7 * redistribute it and/or modify it under the terms of the GNU General Public
8 * License as published by the Free Software Foundation, version 2.
10 * This program is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
30 class Away::EventListener
31 : public Events::ModuleEventListener
34 EventListener(Module* mod)
35 : ModuleEventListener(mod, "event/away")
40 /** Called when a user wishes to mark themselves as away.
41 * @param user The user who is going away.
42 * @param message The away message that the user set.
43 * @return Either MOD_RES_ALLOW to allow the user to mark themself as away, MOD_RES_DENY to
44 * disallow the user to mark themself as away, or MOD_RES_PASSTHRU to let another module
47 virtual ModResult OnUserPreAway(LocalUser* user, std::string& message)
49 return MOD_RES_PASSTHRU;
52 /** Called when a user wishes to mark themselves as back.
53 * @param user The user who is going away.
54 * @param message The away message that the user set.
55 * @return Either MOD_RES_ALLOW to allow the user to mark themself as back, MOD_RES_DENY to
56 * disallow the user to mark themself as back, or MOD_RES_PASSTHRU to let another module
59 virtual ModResult OnUserPreBack(LocalUser* user)
61 return MOD_RES_PASSTHRU;
64 /** Called when a user has marked themself as away.
65 * @param user The user who has gone away.
67 virtual void OnUserAway(User* user) = 0;
69 /** Called when a user has returned from being away.
70 * @param user The user who has returned from being away.
72 virtual void OnUserBack(User* user) = 0;
75 class Away::EventProvider
76 : public Events::ModuleEventProvider
79 EventProvider(Module* mod)
80 : ModuleEventProvider(mod, "event/away")