ZNC
trunk
Toggle main menu visibility
Loading...
Searching...
No Matches
include
znc
main.h
Go to the documentation of this file.
1
/*
2
* Copyright (C) 2004-2025 ZNC, see the NOTICE file for details.
3
*
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
* you may not use this file except in compliance with the License.
6
* You may obtain a copy of the License at
7
*
8
* http://www.apache.org/licenses/LICENSE-2.0
9
*
10
* Unless required by applicable law or agreed to in writing, software
11
* distributed under the License is distributed on an "AS IS" BASIS,
12
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
* See the License for the specific language governing permissions and
14
* limitations under the License.
15
*/
16
17
#ifndef ZNC_MAIN_H
18
#define ZNC_MAIN_H
19
20
#include <znc/zncconfig.h>
21
#include <
znc/version.h
>
22
23
extern
bool
ZNC_NO_NEED_TO_DO_ANYTHING_ON_MODULE_CALL_EXITER
;
24
#define NOTHING &ZNC_NO_NEED_TO_DO_ANYTHING_ON_MODULE_CALL_EXITER
25
26
#define ALLMODULECALL(macFUNC, macEXITER) \
27
do { \
28
CModules& GMods = CZNC::Get().GetModules(); \
29
bool bAllExit = false; \
30
if (GMods.macFUNC) { \
31
bAllExit = true; \
32
} else { \
33
const map<CString, CUser*>& mUsers = CZNC::Get().GetUserMap(); \
34
map<CString, CUser*>::const_iterator it; \
35
for (it = mUsers.begin(); it != mUsers.end(); ++it) { \
36
CModules& UMods = it->second->GetModules(); \
37
if (UMods.macFUNC) { \
38
bAllExit = true; \
39
break; \
40
} \
41
const vector<CIRCNetwork*>& mNets = it->second->GetNetworks(); \
42
vector<CIRCNetwork*>::const_iterator it2; \
43
for (it2 = mNets.begin(); it2 != mNets.end(); ++it2) { \
44
CModules& NMods = (*it2)->GetModules(); \
45
if (NMods.macFUNC) { \
46
bAllExit = true; \
47
break; \
48
} \
49
} \
50
if (bAllExit) break; \
51
} \
52
} \
53
if (bAllExit) *macEXITER = true; \
54
} while (false)
55
56
#define _GLOBALMODULECALL(macFUNC, macUSER, macNETWORK, macCLIENT, macEXITER) \
57
do { \
58
CModules& GMods = CZNC::Get().GetModules(); \
59
CTemporaryModsUser TempUser(GMods, macUSER); \
60
CTemporaryModsNetwork TempNetwork(GMods, macNETWORK); \
61
CTemporaryModsClient TempClient(GMods, macCLIENT); \
62
if (GMods.macFUNC) { \
63
*macEXITER = true; \
64
} \
65
} while (false)
66
67
#define _USERMODULECALL(macFUNC, macUSER, macNETWORK, macCLIENT, macEXITER) \
68
do { \
69
bool bGlobalExited = false; \
70
_GLOBALMODULECALL(macFUNC, macUSER, macNETWORK, macCLIENT, \
71
&bGlobalExited); \
72
if (bGlobalExited) { \
73
*macEXITER = true; \
74
break; \
75
} \
76
if (macUSER != nullptr) { \
77
CModules& UMods = macUSER->GetModules(); \
78
CTemporaryModsNetwork TempNetwork(UMods, macNETWORK); \
79
CTemporaryModsClient TempClient(UMods, macCLIENT); \
80
if (UMods.macFUNC) { \
81
*macEXITER = true; \
82
} \
83
} \
84
} while (false)
85
86
#define NETWORKMODULECALL(macFUNC, macUSER, macNETWORK, macCLIENT, macEXITER) \
87
do { \
88
bool bUserExited = false; \
89
_USERMODULECALL(macFUNC, macUSER, macNETWORK, macCLIENT, \
90
&bUserExited); \
91
if (bUserExited) { \
92
*macEXITER = true; \
93
break; \
94
} \
95
if (macNETWORK != nullptr) { \
96
CModules& NMods = macNETWORK->GetModules(); \
97
CTemporaryModsClient TempClient(NMods, macCLIENT); \
98
if (NMods.macFUNC) { \
99
*macEXITER = true; \
100
} \
101
} \
102
} while (false)
103
104
#define GLOBALMODULECALL(macFUNC, macEXITER) \
105
_GLOBALMODULECALL(macFUNC, nullptr, nullptr, nullptr, macEXITER)
106
107
#define USERMODULECALL(macFUNC, macUSER, macCLIENT, macEXITER) \
108
_USERMODULECALL(macFUNC, macUSER, nullptr, macCLIENT, macEXITER)
109
126
127
#endif
// !ZNC_MAIN_H
ZNC_NO_NEED_TO_DO_ANYTHING_ON_MODULE_CALL_EXITER
bool ZNC_NO_NEED_TO_DO_ANYTHING_ON_MODULE_CALL_EXITER
version.h
Generated by
1.18.0