1 /* tools.h - NeonServ v5.6
2 * Copyright (C) 2011-2012 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
25 #define TABLE_FLAG_COL_SKIP_NULL 0x08
41 char **table_lines; //we just store this to free it in table_free
45 struct ClientSocket *client;
46 struct ChanNode *chan;
47 char addModes[MAXMODES];
48 char delModes[MAXMODES];
49 char *addModesParams[MAXMODES];
50 char *delModesParams[MAXMODES];
55 #define modeBufferSimpleMode(MODEBUF,ADD,MODE) modeBufferSet(MODEBUF, ADD, MODE, NULL)
56 #define modeBufferOp(MODEBUF,USER) modeBufferSet(MODEBUF, 1, 'o', USER)
57 #define modeBufferDeop(MODEBUF,USER) modeBufferSet(MODEBUF, 0, 'o', USER)
58 #define modeBufferHalfop(MODEBUF,USER) modeBufferSet(MODEBUF, 1, 'h', USER)
59 #define modeBufferDehalfop(MODEBUF,USER) modeBufferSet(MODEBUF, 0, 'h', USER)
60 #define modeBufferVoice(MODEBUF,USER) modeBufferSet(MODEBUF, 1, 'v', USER)
61 #define modeBufferDevoice(MODEBUF,USER) modeBufferSet(MODEBUF, 0, 'v', USER)
62 #define modeBufferBan(MODEBUF,MASK) modeBufferSet(MODEBUF, 1, 'b', MASK)
63 #define modeBufferUnban(MODEBUF,MASK) modeBufferSet(MODEBUF, 0, 'b', MASK)
66 /* MODULAR ACCESSIBLE */ int match(const char *mask, const char *name);
68 /* MODULAR ACCESSIBLE */ struct Table *table_init(int width, int length, int flags);
69 /* MODULAR ACCESSIBLE */ int table_add(struct Table *table, char **entry);
70 /* MODULAR ACCESSIBLE */ int table_change(struct Table *table, int row, char **entry);
71 /* MODULAR ACCESSIBLE */ int table_change_field(struct Table *table, int row, int col, char *entry);
72 /* MODULAR ACCESSIBLE */ int table_set_bold(struct Table *table, int collum, int bold);
73 /* MODULAR ACCESSIBLE */ char **table_end(struct Table *table);
74 /* MODULAR ACCESSIBLE */ void table_free(struct Table *table);
76 /* MODULAR ACCESSIBLE */ char* timeToStr(struct UserNode *user, int seconds, int items, char *buf);
77 /* MODULAR ACCESSIBLE */ int strToTime(struct UserNode *user, char *str);
78 /* MODULAR ACCESSIBLE */ int getCurrentSecondsOfDay();
80 /* MODULAR ACCESSIBLE */ struct ModeBuffer* initModeBuffer(struct ClientSocket *client, struct ChanNode *chan);
81 /* MODULAR ACCESSIBLE */ void modeBufferSet(struct ModeBuffer *modeBuf, int add, char mode, char *param);
82 /* MODULAR ACCESSIBLE */ void flushModeBuffer(struct ModeBuffer *modeBuf);
83 /* MODULAR ACCESSIBLE */ void freeModeBuffer(struct ModeBuffer *modeBuf);
85 /* MODULAR ACCESSIBLE */ int is_ircmask(const char *text);
87 /* MODULAR ACCESSIBLE */ char* generate_banmask(struct UserNode *user, char *buffer);
88 /* MODULAR ACCESSIBLE */ char* make_banmask(char *input, char* buffer);
89 /* MODULAR ACCESSIBLE */ int isFakeHost(char *host);
91 /* MODULAR ACCESSIBLE */ int mask_match(char *mask, struct UserNode *user);
93 /* MODULAR ACCESSIBLE */ unsigned long crc32(const char *text);
95 /* MODULAR ACCESSIBLE */ int stricmp (const char *s1, const char *s2);
96 /* MODULAR ACCESSIBLE */ int stricmplen (const char *s1, const char *s2, int len);