struct ClientSocket *client;
FD_ZERO(&fds);
FD_ZERO(&fds2);
+ got_chanmsg_loop1:
for(client = getBots(SOCKET_FLAG_READY, NULL); client; client = getBots(SOCKET_FLAG_READY, client)) {
if(isUserOnChan(client->user, chan) && (client->flags & SOCKET_FLAG_PREFERRED) && ((client->botid == 0 && !FD_ISSET(client->clientid, &fds)) || (client->botid && !FD_ISSET(client->botid, &fds2)))) {
FD_SET(client->clientid, &fds);
trigger = get_channel_trigger(client->botid, client->clientid, chan);
if(trigger && stricmplen(message, trigger, strlen(trigger)) == 0) {
handle_command(client, user, chan, message + strlen(trigger));
+ goto got_chanmsg_loop1; //Thats really really bad, i know... But we can't count on the "getBots" list anymore after executing a command
}
}
}
+ got_chanmsg_loop2:
for(client = getBots(SOCKET_FLAG_READY, NULL); client; client = getBots(SOCKET_FLAG_READY, client)) {
if(isUserOnChan(client->user, chan) && ((client->botid == 0 && !FD_ISSET(client->clientid, &fds)) || (client->botid && !FD_ISSET(client->botid, &fds2)))) {
- FD_SET(client->botid, &fds);
+ FD_SET(client->clientid, &fds);
FD_SET(client->botid, &fds2);
trigger = get_channel_trigger(client->botid, client->clientid, chan);
if(trigger && stricmplen(message, trigger, strlen(trigger)) == 0) {
handle_command(client, user, chan, message + strlen(trigger));
+ goto got_chanmsg_loop2; //Thats really really bad, i know... But we can't count on the "getBots" list anymore after executing a command
}
}
}