void *data[MAXCALLBACKS];
};
-#ifdef HAVE_THREADS
-struct ParseOrder {
- unsigned long tid;
- struct ParseOrder *next;
-};
-struct ParseOrder *parse_order = NULL;
-#endif
-
static int checkWHOID(struct ClientSocket *client, int whoid) {
struct WHOQueueEntry *entry;
for(entry = client->whoqueue_first; entry; entry = entry->next) {
DESYNCHRONIZE(whohandler_sync);
}
-#if HAVE_THREADS
-void whohandler_start_of_recv(struct ClientSocket *client, unsigned long tid) {
- SYNCHRONIZE(whohandler_sync);
- struct ParseOrder *entry, *last;
- for(last = parse_order; last; last = last->next) {
- if(last->next == NULL)
- break;
- }
- entry = malloc(sizeof(*entry));
- entry->tid = tid;
- entry->next = NULL;
- if(last)
- last->next = entry;
- else
- parse_order = entry;
- DESYNCHRONIZE(whohandler_sync);
-}
-
-void whohandler_end_of_recv(struct ClientSocket *client, unsigned long tid) {
- SYNCHRONIZE(whohandler_sync);
- struct ParseOrder *entry, *last = NULL;
- for(entry = parse_order; entry; entry = entry->next) {
- if(entry->tid == tid) {
- if(last)
- last->next = entry->next;
- else
- parse_order = entry->next;
- free(entry);
- break;
- } else
- last = entry;
- }
- DESYNCHRONIZE(whohandler_sync);
-}
-#endif
-
void get_userlist(struct ChanNode *chan, userlist_callback_t callback, void *data) {
struct ClientSocket *bot;
for(bot = getBots(SOCKET_FLAG_READY, NULL); bot; bot = getBots(SOCKET_FLAG_READY, bot)) {
if(entry == NULL) return;
#ifdef HAVE_THREADS
unsigned long tid = syscall(SYS_gettid);
- while(parse_order->tid != tid) {
- usleep(5000); //5ms
+ while(!clientsocket_parseorder_top(tid)) {
+ usleep(1000); //1ms
}
#endif
if(entry->type & WHOQUEUETYPE_USERLIST) {
struct UserNode *user = getUserByNick(argv[5]);
struct ChanUser *chanuser;
- if((chanuserflags & CHANUSERFLAG_INVISIBLE) && (!user || !isBot(user))) {
- user = createTempUser(argv[5]);
- user->flags |= USERFLAG_ISTMPUSER;
+ if((chanuserflags & CHANUSERFLAG_INVISIBLE)) {
+ if(!user) {
+ user = createTempUser(argv[5]);
+ user->flags |= USERFLAG_ISTMPUSER;
+ }
chan->flags |= CHANFLAG_HAVE_INVISIBLES;
chanuser = addInvisibleChanUser(chan, user);
chanuser->flags = (chanuser->flags & ~CHANUSERFLAG_OPPED_OR_VOICED) | chanuserflags;
if(entry == NULL) return;
#ifdef HAVE_THREADS
unsigned long tid = syscall(SYS_gettid);
- while(parse_order->tid != tid) {
- usleep(5000); //5ms
+ while(!clientsocket_parseorder_top(tid)) {
+ usleep(1000); //1ms
}
#endif
getNextWHOQueueEntry(client, type, 1);