+#include "ChanNode.h"
+#include "UserNode.h"
+
+struct WHOQueueEntry {
+ char type;
+ struct ChanNode *chan;
+ struct UserNode *user;
+ struct WHOQueueEntry *next;
+}
+
+static struct WHOQueueEntry *first_entry = NULL, *last_entry = NULL;
+
+static struct WHOQueueEntry* addWHOQueueEntry() {
+ struct WHOQueueEntry *entry = malloc(sizeof(*entry));
+ if (!entry)
+ {
+ perror("malloc() failed");
+ return NULL;
+ }
+ entry->next = NULL;
+ if(last_entry)
+ last_entry->next = entry;
+ if(!first_entry)
+ first_entry = entry;
+}
+
+static struct WHOQueueEntry* getNextWHOQueueEntry(int remove) {
+ if(!first_entry) return NULL;
+ struct WHOQueueEntry *entry = first_entry;
+ if(remove) {
+ first_entry = first_entry->next;
+ if(last_entry == first_entry)
+ last_entry = NULL;
+ }
+ return entry;
+}