/** * Remove this screen name from our queue. If this info was requested * by our info request queue, then pop the next element off of the queue. * * @param od The aim session. * @param sn Screen name of the info we just received. * @return True if the request was explicit (client requested the info), * false if the request was implicit (libfaim request the info). */ static int aim_locate_gotuserinfo(OscarData *od, FlapConnection *conn, const char *sn) { struct userinfo_node *cur, *del; int was_explicit = TRUE; while ((od->locate.requested != NULL) && (aim_sncmp(sn, od->locate.requested->sn) == 0)) { del = od->locate.requested; od->locate.requested = del->next; was_explicit = FALSE; g_free(del->sn); g_free(del); } cur = od->locate.requested; while ((cur != NULL) && (cur->next != NULL)) { if (aim_sncmp(sn, cur->next->sn) == 0) { del = cur->next; cur->next = del->next; was_explicit = FALSE; g_free(del->sn); g_free(del); } else cur = cur->next; } if (!was_explicit) { od->locate.waiting_for_response = FALSE; /* * Wait a little while then call aim_locate_dorequest(od). * This keeps us from hitting the rate limit due to * requesting away messages and info too quickly. */ if (od->getinfotimer == 0) od->getinfotimer = purple_timeout_add(500, purple_reqinfo_timeout_cb, od); } return was_explicit; }
/** * @param cookie This must be exactly 8 characters. */ PeerConnection * peer_connection_find_by_cookie(OscarData *od, const char *sn, const guchar *cookie) { GSList *cur; PeerConnection *conn; for (cur = od->peer_connections; cur != NULL; cur = cur->next) { conn = cur->data; if (!memcmp(conn->cookie, cookie, 8) && !aim_sncmp(conn->sn, sn)) return conn; } return NULL; }
PeerConnection * peer_connection_find_by_type(OscarData *od, const char *sn, OscarCapability type) { GSList *cur; PeerConnection *conn; for (cur = od->peer_connections; cur != NULL; cur = cur->next) { conn = cur->data; if ((conn->type == type) && !aim_sncmp(conn->sn, sn)) return conn; } return NULL; }
aim_userinfo_t *aim_locate_finduserinfo(OscarData *od, const char *sn) { aim_userinfo_t *cur = NULL; if (sn == NULL) return NULL; cur = od->locate.userinfo; while (cur != NULL) { if (aim_sncmp(cur->sn, sn) == 0) return cur; cur = cur->next; } return NULL; }
void aim_locate_requestuserinfo(OscarData *od, const char *sn) { struct userinfo_node *cur; /* Make sure we aren't already requesting info for this buddy */ cur = od->locate.torequest; while (cur != NULL) { if (aim_sncmp(sn, cur->sn) == 0) return; cur = cur->next; } /* Add a new node to our request queue */ cur = (struct userinfo_node *)g_malloc(sizeof(struct userinfo_node)); cur->sn = g_strdup(sn); cur->next = od->locate.torequest; od->locate.torequest = cur; /* Actually request some info up in this piece */ aim_locate_dorequest(od); }