im.pidgin.pidgin: 0d6eac6c5529c327cd61a438dc9a97455283a8e2

markdoliner at pidgin.im markdoliner at pidgin.im
Sat Jan 5 03:20:53 EST 2008


-----------------------------------------------------------------
Revision: 0d6eac6c5529c327cd61a438dc9a97455283a8e2
Ancestor: 568b030373c034c12f19227bbecc365875d56753
Author: markdoliner at pidgin.im
Date: 2008-01-05T08:15:43
Branch: im.pidgin.pidgin

Modified files:
        libpurple/protocols/oscar/family_locate.c
        libpurple/protocols/oscar/oscar.h
        libpurple/protocols/oscar/oscar_data.c

ChangeLog: 

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(-)

-------------- next part --------------
============================================================
--- libpurple/protocols/oscar/family_locate.c	b43d8310b7245ba73220c70331cec67d6885d8bc
+++ libpurple/protocols/oscar/family_locate.c	96c5fe8ac9c3ddbda16c592e3e34b7cb3953980f
@@ -347,41 +347,6 @@ aim_locate_adduserinfo(OscarData *od, ai
 		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 @@ aim_locate_gotuserinfo(OscarData *od, Fl
 			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 @@ aim_locate_requestuserinfo(OscarData *od
 {
 	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) {
============================================================
--- libpurple/protocols/oscar/oscar.h	c2dcebcec9fcb5c70af5de796e1862fd27d26b9e
+++ libpurple/protocols/oscar/oscar.h	56e4a06a254de7c1e9128ffe8dea7450d60eb487
@@ -466,7 +466,6 @@ struct _OscarData
 
 	gboolean icq;
 	guint getblisttimer;
-	guint getinfotimer;
 
 	struct {
 		guint maxwatchers; /* max users who can watch you */
@@ -511,9 +510,7 @@ struct _OscarData
 
 	struct {
 		struct aim_userinfo_s *userinfo;
-		struct userinfo_node *torequest;
 		struct userinfo_node *requested;
-		gboolean waiting_for_response;
 	} locate;
 
 	/* Server-stored information (ssi) */
============================================================
--- libpurple/protocols/oscar/oscar_data.c	aba3ac952f3c282673c9e6533a0c1c8edf4e76a9
+++ libpurple/protocols/oscar/oscar_data.c	1d9f9c76fefec415a27c847474d28fd9887fa1f9
@@ -97,8 +97,6 @@ oscar_data_destroy(OscarData *od)
 	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);


More information about the Commits mailing list