#define AUTHSERV_NICK "AuthServ"
struct HandleInfoQueueEntry {
+ struct ClientSocket *client;
void *callback;
void *data;
+
+ struct HandleInfoQueueEntry *next;
};
static struct HandleInfoQueueEntry *first_entry = NULL, *last_entry = NULL;
struct HandleInfoQueueEntry* entry = addHandleInfoQueueEntry(bot);
entry->callback = callback;
entry->data = data;
- putsock(bot, "PRIVMSG " AUTHSERV_NICK " :HANDLEINFO *%s", auth);
+ putsock(bot, "PRIVMSG " AUTHSERV_NICK " :ACCOUNTINFO *%s", auth);
}
static void recv_notice(struct UserNode *user, struct UserNode *target, char *message) {
if(bot->user == target) break;
}
if(!bot) return;
- char *auth;
- int match = 0, exists = 0;
+ char *auth = NULL;
+ int do_match = 0, exists = 0;
char *tmp;
//messages to parse:
// Account * has not been registered.
// Account information for Skynet:
if(!match("Account * has not been registered.", message)) {
- match = 1;
+ do_match = 1;
tmp = strstr(message, "\002");
auth = tmp+1;
tmp = strstr(auth, "\002");
*tmp = '\0';
}
if(!match("Account information for *", message)) {
- match = 1;
+ do_match = 1;
exists = 1;
tmp = strstr(message, "\002");
auth = tmp+1;
tmp = strstr(auth, "\002");
*tmp = '\0';
}
- if(match) {
- struct HandleInfoQueueEntry* entry = getNextHandleInfoQueueEntry(client, 1);
+ if(do_match) {
+ struct HandleInfoQueueEntry* entry = getNextHandleInfoQueueEntry(bot, 1);
authlookup_callback_t *callback = entry->callback;
callback(auth, exists, entry->data);
free(entry);