added ModeBuffer to tools.c
[NeonServV5.git] / tools.h
diff --git a/tools.h b/tools.h
index 60a590e5f178c3a71da39e22c50b220ec781f1ce..b47a6bb320b91593635f61120c3a21026dfffd78 100644 (file)
--- a/tools.h
+++ b/tools.h
@@ -6,7 +6,9 @@
 #define TABLE_FLAG_USE_POINTER 0x01
 #define TABLE_FLAG_COL_BOLD    0x02
 
+struct ClientSocket;
 struct UserNode;
+struct ChanNode
 
 struct Table {
     char ***contents;
@@ -21,6 +23,17 @@ struct Table {
     char **table_lines; //we just store this to free it in table_free
 };
 
+struct ModeBuffer {
+    struct ClientSocket *client;
+    struct ChanNode *chan;
+    char addModes[MAXMODES];
+    char delModes[MAXMODES];
+    char *addModesParams[MAXMODES];
+    char *delModesParams[MAXMODES];
+    char addCount;
+    char delCount;
+};
+
 int match(const char *mask, const char *name);
 
 struct Table *table_init(int width, int length, int flags);
@@ -32,6 +45,16 @@ void table_free(struct Table *table);
 char* timeToStr(struct UserNode *user, int seconds, int items, char *buf);
 int strToTime(struct UserNode *user, char *str);
 
+struct ModeBuffer* initModeBuffer(struct ClientSocket *client, struct ChanNode *chan);
+#define modeBufferSimpleMode(MODEBUF,ADD,MODE) modeBufferSet(MODEBUF, ADD, MODE, NULL) 
+#define modeBufferOp(MODEBUF,USER) modeBufferSet(MODEBUF, 1, 'o', USER)
+#define modeBufferDeop(MODEBUF,USER) modeBufferSet(MODEBUF, 0, 'o', USER) 
+#define modeBufferVoice(MODEBUF,USER) modeBufferSet(MODEBUF, 1, 'v', USER)
+#define modeBufferDevoice(MODEBUF,USER) modeBufferSet(MODEBUF, 0, 'v', USER) 
+void modeBufferSet(struct ModeBuffer *modeBuf, int add, char mode, char *param);
+void flushModeBuffer(struct ModeBuffer *modeBuf);
+void freeModeBuffer(struct ModeBuffer *modeBuf);
+
 void init_tools();
 
 #endif
\ No newline at end of file