tried to reorder the program structure and build process
[NeonServV5.git] / src / ModeNode.h
diff --git a/src/ModeNode.h b/src/ModeNode.h
new file mode 100644 (file)
index 0000000..6d2d5d9
--- /dev/null
@@ -0,0 +1,46 @@
+#ifndef _ModeNode_h
+#define _ModeNode_h
+#include "main.h"
+
+struct ChanNode;
+
+//Types: http://www.irc.org/tech_docs/draft-brocklesby-irc-isupport-03.txt
+#define CHANNEL_MODE_TYPE_A        0x01 /* ... special (addresses or users) ... */
+#define CHANNEL_MODE_TYPE_B        0x02 /* These modes always take a parameter. */
+#define CHANNEL_MODE_TYPE_C        0x03 /* These modes take a parameter only when set. */
+#define CHANNEL_MODE_TYPE_D        0x04 /* These modes never take a parameter. */
+#define CHANNEL_MODE_TYPE          0x07 /* bit mask to get the type */
+
+#define CHANNEL_MODE_VALUE_STRING  0x10
+#define CHANNEL_MODE_VALUE_INTEGER 0x20
+#define CHANNEL_MODE_VALUE         0x30 /* bit mask to get the value */
+
+#define CHANNEL_MODE_KEY           0x40 /* mode is a key - automatically add the current key as parameter on unset */
+
+#define CHANNEL_MODE_VALUE_INDEX_SHIFT 8
+#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 */
+
+struct ModeNode {
+    struct ChanNode *chan;
+    unsigned int modes;
+    unsigned int allmodes;
+    char **mode_str_args;
+    int *mode_int_args;
+};
+
+extern unsigned int valid_modes[];
+
+void init_ModeNode();
+struct ModeNode *createModeNode(struct ChanNode *chan);
+void freeModeNode(struct ModeNode *modes);
+int isModeSet(struct ModeNode* modes, char modeChar);
+int isModeAffected(struct ModeNode* modes, char modeChar);
+void* getModeValue(struct ModeNode* modes, char modeChar);
+unsigned int getModeType(struct ModeNode* modes, char modeChar);
+void parseModes(struct ModeNode* modes, char *modeStr, char **argv, int argc);
+void parseModeString(struct ModeNode* modes, char *modeStr);
+int parseMode(struct ModeNode* modes, int add, char mode, char *param);
+void getModeString(struct ModeNode* modes, char *modesStr);
+void getFullModeString(struct ModeNode* modes, char *modesStr);
+
+#endif
\ No newline at end of file