Mercurial > pidgin.yaz
changeset 21996:1728c7414856
Now that oscar throttles itself as it approaches the rate limit, we can
request user info almost instantaneously at sign on. This is awesome.
3 files changed, 5 insertions(+), 62 deletions(-)
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Sat, 05 Jan 2008 08:15:43 +0000 |
parents | 2fd32731ff57 |
children | 82297cc4bb47 |
files | libpurple/protocols/oscar/family_locate.c libpurple/protocols/oscar/oscar.h libpurple/protocols/oscar/oscar_data.c |
diffstat | 3 files changed, 5 insertions(+), 62 deletions(-) [+] |
line wrap: on
line diff
--- a/libpurple/protocols/oscar/family_locate.c Sat Jan 05 07:49:15 2008 +0000 +++ b/libpurple/protocols/oscar/family_locate.c Sat Jan 05 08:15:43 2008 +0000 @@ -347,41 +347,6 @@ userfunc(od, conn, NULL, cur); } -void -aim_locate_dorequest(OscarData *od) -{ - struct userinfo_node *cur = od->locate.torequest; - - if (od->locate.waiting_for_response == TRUE) - return; - - od->locate.waiting_for_response = TRUE; - aim_locate_getinfoshort(od, cur->sn, 0x00000003); - - /* Move this node to the "requested" queue */ - od->locate.torequest = cur->next; - cur->next = od->locate.requested; - od->locate.requested = cur; -} - -static gboolean -purple_reqinfo_timeout_cb(void *data) -{ - OscarData *od; - - od = data; - - if (od->locate.torequest == NULL) - { - od->getinfotimer = 0; - return FALSE; - } - - aim_locate_dorequest(od); - - return TRUE; -} - /** * 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. @@ -417,19 +382,6 @@ 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; } @@ -438,22 +390,18 @@ { struct userinfo_node *cur; - /* Make sure we aren't already requesting info for this buddy */ - cur = od->locate.torequest; - while (cur != NULL) { + /* Make sure we haven't already requested info for this buddy */ + for (cur = od->locate.requested; cur != NULL; cur = cur->next) 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; + cur->next = od->locate.requested; + od->locate.requested = cur; - /* Actually request some info up in this piece */ - aim_locate_dorequest(od); + aim_locate_getinfoshort(od, cur->sn, 0x00000003); } aim_userinfo_t *aim_locate_finduserinfo(OscarData *od, const char *sn) {
--- a/libpurple/protocols/oscar/oscar.h Sat Jan 05 07:49:15 2008 +0000 +++ b/libpurple/protocols/oscar/oscar.h Sat Jan 05 08:15:43 2008 +0000 @@ -466,7 +466,6 @@ gboolean icq; guint getblisttimer; - guint getinfotimer; struct { guint maxwatchers; /* max users who can watch you */ @@ -511,9 +510,7 @@ struct { struct aim_userinfo_s *userinfo; - struct userinfo_node *torequest; struct userinfo_node *requested; - gboolean waiting_for_response; } locate; /* Server-stored information (ssi) */
--- a/libpurple/protocols/oscar/oscar_data.c Sat Jan 05 07:49:15 2008 +0000 +++ b/libpurple/protocols/oscar/oscar_data.c Sat Jan 05 08:15:43 2008 +0000 @@ -97,8 +97,6 @@ g_free(od->oldp); if (od->getblisttimer > 0) purple_timeout_remove(od->getblisttimer); - if (od->getinfotimer > 0) - purple_timeout_remove(od->getinfotimer); while (od->oscar_connections != NULL) flap_connection_destroy(od->oscar_connections->data, OSCAR_DISCONNECT_DONE, NULL);