fixed path of mysql/errmsg.h (OSX compilation fix)
[NeonServV5.git] / src / ModeNode.h
1 /* ModeNode.h - NeonServ v5.6
2  * Copyright (C) 2011-2012  Philipp Kreil (pk910)
3  * 
4  * This program is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation, either version 3 of the License, or
7  * (at your option) any later version.
8  * 
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  * 
14  * You should have received a copy of the GNU General Public License 
15  * along with this program. If not, see <http://www.gnu.org/licenses/>. 
16  */
17 #ifndef _ModeNode_h
18 #define _ModeNode_h
19 #include "main.h"
20
21 struct ChanNode;
22
23 //Types: http://www.irc.org/tech_docs/draft-brocklesby-irc-isupport-03.txt
24 #define CHANNEL_MODE_TYPE_A        0x01 /* ... special (addresses or users) ... */
25 #define CHANNEL_MODE_TYPE_B        0x02 /* These modes always take a parameter. */
26 #define CHANNEL_MODE_TYPE_C        0x03 /* These modes take a parameter only when set. */
27 #define CHANNEL_MODE_TYPE_D        0x04 /* These modes never take a parameter. */
28 #define CHANNEL_MODE_TYPE          0x07 /* bit mask to get the type */
29
30 #define CHANNEL_MODE_VALUE_STRING  0x10
31 #define CHANNEL_MODE_VALUE_INTEGER 0x20
32 #define CHANNEL_MODE_VALUE         0x30 /* bit mask to get the value */
33
34 #define CHANNEL_MODE_KEY           0x40 /* mode is a key - automatically add the current key as parameter on unset */
35
36 #define CHANNEL_MODE_VALUE_INDEX_SHIFT 8
37 #define CHANNEL_MODE_VALUE_INDEX_MASK  (0xff << CHANNEL_MODE_VALUE_INDEX_SHIFT) /* this "bitrange" is reserved for storing the array indexes of the mode values */
38
39 struct ModeNode {
40     struct ChanNode *chan;
41     unsigned int modes;
42     unsigned int allmodes;
43     char **mode_str_args;
44     int *mode_int_args;
45 };
46
47 #ifndef DND_FUNCTIONS
48 void init_ModeNode();
49 /* MODULAR ACCESSIBLE */ struct ModeNode *createModeNode(struct ChanNode *chan);
50 /* MODULAR ACCESSIBLE */ void freeModeNode(struct ModeNode *modes);
51 /* MODULAR ACCESSIBLE */ int isModeSet(struct ModeNode* modes, char modeChar);
52 /* MODULAR ACCESSIBLE */ int isModeAffected(struct ModeNode* modes, char modeChar);
53 /* MODULAR ACCESSIBLE */ void* getModeValue(struct ModeNode* modes, char modeChar);
54 /* MODULAR ACCESSIBLE */ unsigned int getModeType(struct ModeNode* modes, char modeChar);
55 /* MODULAR ACCESSIBLE */ void parseModes(struct ModeNode* modes, char *modeStr, char **argv, int argc);
56 /* MODULAR ACCESSIBLE */ void parseModeString(struct ModeNode* modes, char *modeStr);
57 /* MODULAR ACCESSIBLE */ int parseMode(struct ModeNode* modes, int add, char mode, char *param);
58 /* MODULAR ACCESSIBLE */ void getModeString(struct ModeNode* modes, char *modesStr);
59 /* MODULAR ACCESSIBLE */ void getFullModeString(struct ModeNode* modes, char *modesStr);
60 #endif
61 #endif