#include "UserNode.h"
#include "ChanUser.h"
+#include "tools.h"
static struct UserNode **userList;
return count;
}
+char *getAuthFakehost(char *auth) {
+ int i;
+ struct UserNode *user;
+ for(i = 0; i < VALID_NICK_CHARS_FIRST_LEN+1; i++) {
+ for(user = userList[i]; user; user = user->next) {
+ if((user->flags & USERFLAG_ISAUTHED) && !strcmp(user->auth, auth) && isFakeHost(user->host)) {
+ return user->host;
+ }
+ }
+ }
+ return NULL;
+}
+
+struct UserNode* getAllUsers(struct UserNode *last) {
+ if(last == NULL || last->next == NULL) {
+ int cindex;
+ if(last == NULL)
+ cindex = 0;
+ else
+ cindex = get_nicklist_entry(last->nick[0]) + 1;
+ while(userList[cindex] == NULL && cindex <= VALID_NICK_CHARS_FIRST_LEN)
+ cindex++;
+ if(cindex > VALID_NICK_CHARS_FIRST_LEN) return NULL;
+ return userList[cindex];
+ } else
+ return last->next;
+}
+
+int getUserCount() {
+ int i, count = 0;
+ struct UserNode *user;
+ for(i = 0; i < VALID_NICK_CHARS_FIRST_LEN+1; i++) {
+ for(user = userList[i]; user; user = user->next) {
+ count++;
+ }
+ }
+ return count;
+}
+
struct UserNode* addUser(const char *nick) {
int userListIndex = get_nicklist_entry(*nick);
if(userListIndex == -1 || !is_valid_nick(nick))