1 /* tools.h - NeonServ v5.2
2 * Copyright (C) 2011 Philipp Kreil (pk910)
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.
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.
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/>.
22 #define TABLE_FLAG_USE_POINTER 0x01
23 #define TABLE_FLAG_COL_BOLD 0x02
24 #define TABLE_FLAG_COL_CONTENTS 0x04
40 char **table_lines; //we just store this to free it in table_free
44 struct ClientSocket *client;
45 struct ChanNode *chan;
46 char addModes[MAXMODES];
47 char delModes[MAXMODES];
48 char *addModesParams[MAXMODES];
49 char *delModesParams[MAXMODES];
54 int match(const char *mask, const char *name);
56 struct Table *table_init(int width, int length, int flags);
57 int table_add(struct Table *table, char **entry);
58 int table_change(struct Table *table, int row, char **entry);
59 int table_change_field(struct Table *table, int row, int col, char *entry);
60 int table_set_bold(struct Table *table, int collum, int bold);
61 char **table_end(struct Table *table);
62 void table_free(struct Table *table);
64 char* timeToStr(struct UserNode *user, int seconds, int items, char *buf);
65 int strToTime(struct UserNode *user, char *str);
67 struct ModeBuffer* initModeBuffer(struct ClientSocket *client, struct ChanNode *chan);
68 #define modeBufferSimpleMode(MODEBUF,ADD,MODE) modeBufferSet(MODEBUF, ADD, MODE, NULL)
69 #define modeBufferOp(MODEBUF,USER) modeBufferSet(MODEBUF, 1, 'o', USER)
70 #define modeBufferDeop(MODEBUF,USER) modeBufferSet(MODEBUF, 0, 'o', USER)
71 #define modeBufferVoice(MODEBUF,USER) modeBufferSet(MODEBUF, 1, 'v', USER)
72 #define modeBufferDevoice(MODEBUF,USER) modeBufferSet(MODEBUF, 0, 'v', USER)
73 #define modeBufferBan(MODEBUF,MASK) modeBufferSet(MODEBUF, 1, 'b', MASK)
74 #define modeBufferUnban(MODEBUF,MASK) modeBufferSet(MODEBUF, 0, 'b', MASK)
75 void modeBufferSet(struct ModeBuffer *modeBuf, int add, char mode, char *param);
76 void flushModeBuffer(struct ModeBuffer *modeBuf);
77 void freeModeBuffer(struct ModeBuffer *modeBuf);
79 int is_ircmask(const char *text);
81 char* generate_banmask(struct UserNode *user, char *buffer);
82 char* make_banmask(char *input, char* buffer);
83 int isFakeHost(char *host);
85 unsigned long crc32(const char *text);