blob: d2f5f087df00939abbabf262ff23b47efddf5ce6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
|
/*
* Anope IRC Services
*
* Copyright (C) 2012-2017 Anope Team <team@anope.org>
*
* This file is part of Anope. Anope 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 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 see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include "event.h"
#include "channels.h"
#include "modules/nickserv.h"
#include "modules/memoserv.h"
#include "bots.h"
#include "chanserv/channel.h"
#include "chanserv/privilege.h"
#include "chanserv/chanaccess.h"
#include "chanserv/level.h"
#include "chanserv/mode.h"
namespace ChanServ
{
class Channel;
using registered_channel_map = Anope::locale_hash_map<Channel *>;
class ChanServService : public Service
{
public:
static constexpr const char *NAME = "chanserv";
ChanServService(Module *m) : Service(m, NAME)
{
}
virtual Channel *Find(const Anope::string &name) anope_abstract;
virtual registered_channel_map& GetChannels() anope_abstract;
/* Have ChanServ hold the channel, that is, join and set +nsti and wait
* for a few minutes so no one can join or rejoin.
*/
virtual void Hold(::Channel *c) anope_abstract;
virtual void AddPrivilege(Privilege p) anope_abstract;
virtual void RemovePrivilege(Privilege &p) anope_abstract;
virtual Privilege *FindPrivilege(const Anope::string &name) anope_abstract;
virtual std::vector<Privilege> &GetPrivileges() anope_abstract;
virtual void ClearPrivileges() anope_abstract;
};
extern ChanServService *service;
inline Channel *Find(const Anope::string name)
{
return service ? service->Find(name) : nullptr;
}
namespace Event
{
struct CoreExport PreChanExpire : Events
{
static constexpr const char *NAME = "prechanexpire";
using Events::Events;
/** Called before a channel expires
* @param ci The channel
* @param expire Set to true to allow the chan to expire
*/
virtual void OnPreChanExpire(Channel *ci, bool &expire) anope_abstract;
};
struct CoreExport ChanExpire : Events
{
static constexpr const char *NAME = "chanexpire";
using Events::Events;
/** Called before a channel expires
* @param ci The channel
*/
virtual void OnChanExpire(Channel *ci) anope_abstract;
};
}
}
|