added cmd_staff
[NeonServV5.git] / src / UserNode.h
index f905437aae542a80341aafa035dafb29f4d625a4..e7932fd0197af12a86d46da04b0a8f172a4de418 100644 (file)
@@ -1,3 +1,19 @@
+/* UserNode.h - NeonServ v5.2
+ * Copyright (C) 2011  Philipp Kreil (pk910)
+ * 
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ * 
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License 
+ * along with this program. If not, see <http://www.gnu.org/licenses/>. 
+ */
 #ifndef _UserNode_h
 #define _UserNode_h
 #include "main.h"
@@ -11,7 +27,9 @@
 #define USERFLAG_LOADED_SETTINGS    0x0040
 #define USERFLAG_REPLY_PRIVMSG      0x0080
 #define USERFLAG_GOD_MODE           0x0100
+#define USERFLAG_HAS_USERID         0x0200
 
+#define USERFLAG_WAS_REGISTRING     0x20000000 /* only set for event_join if the quit reason was Registered */
 #define USERFLAG_SCRIPTFLAG1        0x40000000
 #define USERFLAG_SCRIPTFLAG2        0x80000000
 
@@ -25,14 +43,17 @@ struct UserNode {
     char realname[REALLEN+1];
     char auth[AUTHLEN+1];
     unsigned int flags;
-    time_t created;
+    time_t created, last_who;
     struct ChanUser *channel;
     struct language *language;
     
+    int user_id;
+    
     struct UserNode *next;
 };
 
-#define isNetworkService(USER) (USER->flags & (USERFLAG_ISBOT | USERFLAG_ISIRCOP))
+#define isNetworkService(USER) (USER->flags & (USERFLAG_ISBOT | USERFLAG_ISIRCOP | USERFLAG_ISSERVER))
+#define isBot(USER) (USER->flags & (USERFLAG_ISBOT))
 
 void init_UserNode();
 void free_UserNode();
@@ -43,6 +64,7 @@ int countUsersWithHost(char *host);
 char *getAuthFakehost(char *auth);
 struct UserNode* searchUserByNick(const char *nick);
 struct UserNode* getAllUsers(struct UserNode *last);
+struct UserNode* getUsersWithAuth(const char *auth, struct UserNode *last);
 int getUserCount();
 struct UserNode* addUser(const char *nick);
 struct UserNode* addUserMask(const char *mask);