1 /* UserNode.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/>.
21 #define USERFLAG_ISBOT 0x0001
22 #define USERFLAG_ISAUTHED 0x0002
23 #define USERFLAG_ISIRCOP 0x0004
24 #define USERFLAG_ISTMPUSER 0x0008
25 #define USERFLAG_ISSERVER 0x0010
26 #define USERFLAG_FREETMPUSER 0x0020
27 #define USERFLAG_LOADED_SETTINGS 0x0040
28 #define USERFLAG_REPLY_PRIVMSG 0x0080
29 #define USERFLAG_GOD_MODE 0x0100
31 #define USERFLAG_SCRIPTFLAG1 0x40000000
32 #define USERFLAG_SCRIPTFLAG2 0x80000000
39 char ident[USERLEN+1];
41 char realname[REALLEN+1];
44 time_t created, last_who;
45 struct ChanUser *channel;
46 struct language *language;
48 struct UserNode *next;
51 #define isNetworkService(USER) (USER->flags & (USERFLAG_ISBOT | USERFLAG_ISIRCOP | USERFLAG_ISSERVER))
52 #define isBot(USER) (USER->flags & (USERFLAG_ISBOT))
56 int is_valid_nick(const char *nick);
57 struct UserNode* getUserByNick(const char *nick);
58 struct UserNode* getUserByMask(const char *mask);
59 int countUsersWithHost(char *host);
60 char *getAuthFakehost(char *auth);
61 struct UserNode* searchUserByNick(const char *nick);
62 struct UserNode* getAllUsers(struct UserNode *last);
64 struct UserNode* addUser(const char *nick);
65 struct UserNode* addUserMask(const char *mask);
66 struct UserNode* createTempUser(const char *mask);
67 int renameUser(struct UserNode* user, const char *new_nick);
68 void delUser(struct UserNode* user, int freeUser);
69 void clearTempUsers();