]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - include/modules/away.h
Fix various documentation comments.
[user/henk/code/inspircd.git] / include / modules / away.h
1 /*
2  * InspIRCd -- Internet Relay Chat Daemon
3  *
4  *   Copyright (C) 2018 Sadie Powell <sadie@witchery.services>
5  *
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.
9  *
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
13  * details.
14  *
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/>.
17  */
18
19
20 #pragma once
21
22 #include "event.h"
23
24 namespace Away
25 {
26         class EventListener;
27         class EventProvider;
28 }
29
30 class Away::EventListener
31         : public Events::ModuleEventListener
32 {
33  protected:
34         EventListener(Module* mod)
35                 : ModuleEventListener(mod, "event/away")
36         {
37         }
38
39  public:
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
45          *         handle the event.
46          */
47         virtual ModResult OnUserPreAway(LocalUser* user, std::string& message)
48         {
49                 return MOD_RES_PASSTHRU;
50         }
51
52         /** Called when a user wishes to mark themselves as back.
53          * @param user The user who is going away.
54          * @return Either MOD_RES_ALLOW to allow the user to mark themself as back, MOD_RES_DENY to
55          *         disallow the user to mark themself as back, or MOD_RES_PASSTHRU to let another module
56          *         handle the event.
57          */
58         virtual ModResult OnUserPreBack(LocalUser* user)
59         {
60                 return MOD_RES_PASSTHRU;
61         }
62
63         /** Called when a user has marked themself as away.
64          * @param user The user who has gone away.
65          */
66         virtual void OnUserAway(User* user) = 0;
67
68         /** Called when a user has returned from being away.
69          * @param user The user who has returned from being away.
70          */
71         virtual void OnUserBack(User* user) = 0;
72 };
73
74 class Away::EventProvider
75         : public Events::ModuleEventProvider
76 {
77  public:
78         EventProvider(Module* mod)
79                 : ModuleEventProvider(mod, "event/away")
80         {
81         }
82 };