1 /* UserNode.h - NeonServ v5.5
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/>.
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
30 #define USERFLAG_HAS_USERID 0x0200
31 #define USERFLAG_IS_ON_WHO_QUEUE 0x0400 /* prevents the user struct from beeing freed too early */
32 #define USERFLAG_FREE_AFTER_WHO 0x0800 /* user struct is no more referenced - free it after WHO */
33 #define USERFLAG_QUITTING 0x1000 /* user is currently quitting... */
35 #define USERFLAG_WAS_REGISTERING 0x20000000 /* only set for event_join if the quit reason was Registered */
36 #define USERFLAG_SCRIPTFLAG1 0x40000000
37 #define USERFLAG_SCRIPTFLAG2 0x80000000
45 char ident[USERLEN+1];
47 char realname[REALLEN+1];
50 unsigned int flags, usermode;
51 time_t created, last_who;
52 struct ChanUser *channel;
53 struct language *language;
57 struct UserNode *next;
60 #define isNetworkService(USER) (USER->flags & (USERFLAG_ISBOT | USERFLAG_ISIRCOP | USERFLAG_ISSERVER))
61 #define isBot(USER) (USER->flags & (USERFLAG_ISBOT))
66 /* MODULAR ACCESSIBLE */ int isUserModeSet(struct UserNode *user, char modeChar);
67 void parseUserModes(struct UserNode* user, char *modeStr);
68 /* MODULAR ACCESSIBLE */ int is_valid_nick(const char *nick);
69 /* MODULAR ACCESSIBLE */ struct UserNode* getUserByNick(const char *nick);
70 /* MODULAR ACCESSIBLE */ struct UserNode* getUserByMask(const char *mask);
71 /* MODULAR ACCESSIBLE */ int countUsersWithHost(char *host);
72 /* MODULAR ACCESSIBLE */ char *getAuthFakehost(char *auth);
73 /* MODULAR ACCESSIBLE */ struct UserNode* searchUserByNick(const char *nick);
74 /* MODULAR ACCESSIBLE */ struct UserNode* getAllUsers(struct UserNode *last);
75 /* MODULAR ACCESSIBLE */ struct UserNode* getUsersWithAuth(const char *auth, struct UserNode *last);
76 /* MODULAR ACCESSIBLE */ int getUserCount();
77 struct UserNode* addUser(const char *nick);
78 struct UserNode* addUserMask(const char *mask);
79 /* MODULAR ACCESSIBLE */ struct UserNode* createTempUser(const char *nick);
80 struct UserNode* createTempUserMask(const char *mask);
81 int renameUser(struct UserNode* user, const char *new_nick);
82 void delUser(struct UserNode* user, int freeUser);
83 void clearTempUsers();