]> jfr.im git - irc/rizon/znc.git/blame - main.h
Increase the version number to 0.200
[irc/rizon/znc.git] / main.h
CommitLineData
a09a7e79 1/*
b9b0fd4c 2 * Copyright (C) 2004-2011 See the AUTHORS file for details.
a09a7e79 3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License version 2 as published
6 * by the Free Software Foundation.
7 */
6dcacaa7 8
538d3ece 9#ifndef _MAIN_H
10#define _MAIN_H
11
3ecbf133 12#include "zncconfig.h"
13
c7cf105e 14// The following defines are for #if comparison (preprocessor only likes ints)
f2d7ae1a 15#define VERSION_MAJOR 0
d91803bf 16#define VERSION_MINOR 200
77e4ce40 17// This one is for display purpose
f2d7ae1a 18#define VERSION (VERSION_MAJOR + VERSION_MINOR / 1000.0)
e4de3c42 19
edb56b16 20// You can add -DVERSION_EXTRA="stuff" to your CXXFLAGS!
21#ifndef VERSION_EXTRA
22#define VERSION_EXTRA ""
23#endif
24
1023d868 25#define NOTHING (void)0
26
94ea2c6c 27#define ALLMODULECALL(macFUNC, macEXITER) \
28 do { \
29 CGlobalModules& GMods = CZNC::Get().GetModules(); \
30 if (GMods.macFUNC) { \
31 macEXITER; \
32 } else { \
33 const map<CString, CUser*>& mUsers = \
34 CZNC::Get().GetUserMap(); \
35 map<CString, CUser*>::const_iterator it; \
36 for (it = mUsers.begin(); it != mUsers.end(); ++it) { \
37 CModules& UMods = it->second->GetModules(); \
38 if (UMods.macFUNC) { \
39 macEXITER; \
40 } \
41 } \
42 } \
43 } while (false)
44
430898be 45#define GLOBALMODULECALL(macFUNC, macUSER, macCLIENT, macEXITER) \
46 do { \
3faf0adf 47 CGlobalModules& GMods = CZNC::Get().GetModules(); \
3faf0adf 48 CUser* pOldGUser = GMods.GetUser(); \
49 CClient* pOldGClient = GMods.GetClient(); \
3faf0adf 50 GMods.SetUser(macUSER); \
51 GMods.SetClient(macCLIENT); \
430898be 52 if (GMods.macFUNC) { \
3faf0adf 53 GMods.SetUser(pOldGUser); \
54 GMods.SetClient(pOldGClient); \
3faf0adf 55 macEXITER; \
56 } \
57 GMods.SetUser(pOldGUser); \
58 GMods.SetClient(pOldGClient); \
430898be 59 } while (false)
60
61#define MODULECALL(macFUNC, macUSER, macCLIENT, macEXITER) \
62 if (macUSER) { \
63 GLOBALMODULECALL(macFUNC, macUSER, macCLIENT, macEXITER); \
64 CModules& UMods = macUSER->GetModules(); \
65 CClient* pOldUClient = UMods.GetClient(); \
66 UMods.SetClient(macCLIENT); \
67 if (UMods.macFUNC) { \
68 UMods.SetClient(pOldUClient); \
69 macEXITER; \
70 } \
71 UMods.SetClient(pOldUClient); \
3dde793e 72 }
3dde793e 73
ae29c50e 74/** @mainpage
75 * Welcome to the API documentation for ZNC.
76 *
77 * To write your own module, you should start with writing a new class which
78 * inherits from CModule. Use #MODCONSTRUCTOR for the module's constructor and
79 * call #MODULEDEFS at the end of your source file.
80 * Congratulations, you just wrote your first module. <br>
81 * For global modules, the procedure is similar. Instead of CModule you inherit
82 * from CGlobalModule. The two macros are replaced by #GLOBALMODCONSTRUCTOR and
83 * #GLOBALMODULEDEFS.
84 *
85 * If you want your module to actually do something, you should override some
86 * of the hooks from CModule. These are the functions whose names start with
ced990fb 87 * "On". They are called when the associated event happens.
ae29c50e 88 *
89 * Feel free to also look at existing modules.
90 */
91
538d3ece 92#endif // !_MAIN_H