-/* UserNode.c - NeonServ v5.0
- * Copyright (C) 2011 Philipp Kreil (pk910)
+/* UserNode.c - NeonServ v5.3
+ * Copyright (C) 2011-2012 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
#include "UserNode.h"
#include "ChanUser.h"
#include "tools.h"
+#include "IRCEvents.h"
static struct UserNode **userList;
return last->next;
}
+struct UserNode* getUsersWithAuth(const char *auth, struct UserNode *last) {
+ int cindex = (last ? get_nicklist_entry(last->nick[0]) : 0);
+ struct UserNode *cuser = last;
+ while(cindex <= VALID_NICK_CHARS_FIRST_LEN) {
+ for(cuser = (cuser ? cuser->next : userList[cindex]); cuser; cuser = cuser->next) {
+ if((cuser->flags & USERFLAG_ISAUTHED) && !strcmp(cuser->auth, auth))
+ return cuser;
+ }
+ cindex++;
+ cuser = NULL;
+ }
+ return NULL;
+}
+
int getUserCount() {
int i, count = 0;
struct UserNode *user;
user->realname[0] = 0;
user->flags = 0;
user->channel = NULL;
+ user->last_who = 0;
user->next = userList[userListIndex];
userList[userListIndex] = user;
return user;
user->realname[0] = 0;
user->flags = 0;
user->channel = NULL;
+ user->last_who = 0;
ii = i+1;
} else if(cmask[i] == '.' && !user) {
//it's a server
user->realname[0] = 0;
user->flags = USERFLAG_ISSERVER;
user->channel = NULL;
+ user->last_who = 0;
return user;
} else if(cmask[i] == '@') {
if(user == NULL) return NULL;
user->realname[0] = 0;
user->flags = 0;
user->channel = NULL;
+ user->last_who = 0;
return user;
}
strcpy(user->host, &cmask[ii]);
void delUser(struct UserNode* user, int freeUser) {
int userListIndex = get_nicklist_entry(user->nick[0]);
if(userListIndex == -1) return;
+ event_freeuser(user);
struct UserNode *cuser, *last_user = NULL;
for(cuser = userList[userListIndex]; cuser; cuser = cuser->next) {
if(cuser == user) {