Mercurial > pidgin.yaz
changeset 7045:237ad253dd34
[gaim-migrate @ 7608]
This should fix SimGuy's problem and maybe the problem Luke had
earlier. I don't know what I was thinking with the static variables.
committer: Tailor Script <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Tue, 30 Sep 2003 01:32:29 +0000 |
parents | c889aee7bd95 |
children | 4003419d753b |
files | src/protocols/oscar/aim.h src/protocols/oscar/conn.c src/protocols/oscar/email.c src/protocols/oscar/locate.c src/protocols/oscar/oscar.c |
diffstat | 5 files changed, 52 insertions(+), 54 deletions(-) [+] |
line wrap: on
line diff
--- a/src/protocols/oscar/aim.h Tue Sep 30 00:39:24 2003 +0000 +++ b/src/protocols/oscar/aim.h Tue Sep 30 01:32:29 2003 +0000 @@ -443,6 +443,13 @@ struct aim_icq_info *icq_info; struct aim_oft_info *oft_info; struct aim_authresp_info *authinfo; + struct aim_emailinfo *emailinfo; + + struct { + struct aim_userinfo_s *userinfo; + struct userinfo_node *request_queue; + int waiting_for_response; + } locate; /* Server-stored information (ssi) */ struct { @@ -961,6 +968,11 @@ #define AIM_USERINFO_PRESENT_SESSIONLEN 0x00000100 #define AIM_USERINFO_PRESENT_CREATETIME 0x00000200 +struct userinfo_node { + char *sn; + struct userinfo_node *next; +}; + typedef struct aim_userinfo_s { char *sn; fu16_t warnlevel; /* evil percent * 10 (999 = 99.9%) */ @@ -1053,7 +1065,7 @@ #define AIM_COOKIETYPE_OFTIMAGE 0x14 #define AIM_COOKIETYPE_OFTICON 0x15 -faim_export aim_userinfo_t *aim_locate_finduserinfo(const char *sn); +faim_export aim_userinfo_t *aim_locate_finduserinfo(aim_session_t *sess, const char *sn); /* 0x0002 */ faim_export int aim_locate_reqrights(aim_session_t *sess); /* 0x0004 */ faim_export int aim_locate_setprofile(aim_session_t *sess, const char *profile_encoding, const char *profile, const int profile_len, const char *awaymsg_encoding, const char *awaymsg, const int awaymsg_len, fu32_t caps);
--- a/src/protocols/oscar/conn.c Tue Sep 30 00:39:24 2003 +0000 +++ b/src/protocols/oscar/conn.c Tue Sep 30 01:32:29 2003 +0000 @@ -874,6 +874,10 @@ sess->msgcookies = NULL; sess->icq_info = NULL; sess->oft_info = NULL; + sess->emailinfo = NULL; + sess->locate.userinfo = NULL; + sess->locate.request_queue = NULL; + sess->locate.waiting_for_response = FALSE; sess->snacid_next = 0x00000001; sess->flags = 0;
--- a/src/protocols/oscar/email.c Tue Sep 30 00:39:24 2003 +0000 +++ b/src/protocols/oscar/email.c Tue Sep 30 01:32:29 2003 +0000 @@ -12,11 +12,6 @@ #include <aim.h> /** - * All info maintained by this family. - */ -static struct aim_emailinfo *emailinfo = NULL; - -/** * Subtype 0x0006 - Request information about your email account * * @param sess The oscar session. @@ -90,7 +85,7 @@ cookie16 = aimbs_getraw(bs, 16); /* Mail cookie sent above */ /* See if we already have some info associated with this cookie */ - for (new=emailinfo; (new && strncmp(cookie16, new->cookie16, 16)); new=new->next); + for (new=sess->emailinfo; (new && strncmp(cookie16, new->cookie16, 16)); new=new->next); if (new) { /* Free some of the old info, if existant */ free(new->cookie8); @@ -102,8 +97,8 @@ if (!(new = malloc(sizeof(struct aim_emailinfo)))) return -ENOMEM; memset(new, 0, sizeof(struct aim_emailinfo)); - new->next = emailinfo; - emailinfo = new; + new->next = sess->emailinfo; + sess->emailinfo = new; } new->cookie8 = cookie8; @@ -182,9 +177,9 @@ static void email_shutdown(aim_session_t *sess, aim_module_t *mod) { - while (emailinfo) { - struct aim_emailinfo *tmp = emailinfo; - emailinfo = emailinfo->next; + while (sess->emailinfo) { + struct aim_emailinfo *tmp = sess->emailinfo; + sess->emailinfo = sess->emailinfo->next; free(tmp->cookie16); free(tmp->cookie8); free(tmp->url);
--- a/src/protocols/oscar/locate.c Tue Sep 30 00:39:24 2003 +0000 +++ b/src/protocols/oscar/locate.c Tue Sep 30 01:32:29 2003 +0000 @@ -12,18 +12,6 @@ #include "win32dep.h" #endif -struct node { - char *sn; - struct node *next; -}; - -/** - * Keep an aim_userinfo_t for each user we are aware of. - */ -static aim_userinfo_t *infos = NULL; -static struct node *request_queue = NULL; -static int waiting_for_response = FALSE; - /* * Capability blocks. * @@ -193,16 +181,16 @@ * for this buddy, then just overwrite parts of the old data. * @param userinfo Contains the new information for the buddy. */ -static void aim_locate_adduserinfo(aim_userinfo_t *userinfo) { +static void aim_locate_adduserinfo(aim_session_t *sess, aim_userinfo_t *userinfo) { aim_userinfo_t *cur; - cur = aim_locate_finduserinfo(userinfo->sn); + cur = aim_locate_finduserinfo(sess, userinfo->sn); if (cur == NULL) { cur = (aim_userinfo_t *)calloc(1, sizeof(aim_userinfo_t)); cur->sn = strdup(userinfo->sn); - cur->next = infos; - infos = cur; + cur->next = sess->locate.userinfo; + sess->locate.userinfo = cur; } cur->warnlevel = userinfo->warnlevel; @@ -241,31 +229,31 @@ } static void aim_locate_dorequest(aim_session_t *sess) { - struct node *cur = request_queue; + struct userinfo_node *cur = sess->locate.request_queue; if (cur == NULL) return; - if (waiting_for_response == TRUE) + if (sess->locate.waiting_for_response == TRUE) return; - waiting_for_response = TRUE; + sess->locate.waiting_for_response = TRUE; aim_locate_getinfoshort(sess, cur->sn, 0x00000007); } faim_internal void aim_locate_requestuserinfo(aim_session_t *sess, const char *sn) { - struct node *cur; + struct userinfo_node *cur; - cur = (struct node *)malloc(sizeof(struct node)); + cur = (struct userinfo_node *)malloc(sizeof(struct userinfo_node)); cur->sn = strdup(sn); - cur->next = request_queue; - request_queue = cur; + cur->next = sess->locate.request_queue; + sess->locate.request_queue = cur; aim_locate_dorequest(sess); } -faim_export aim_userinfo_t *aim_locate_finduserinfo(const char *sn) { - aim_userinfo_t *cur = infos; +faim_export aim_userinfo_t *aim_locate_finduserinfo(aim_session_t *sess, const char *sn) { + aim_userinfo_t *cur = sess->locate.userinfo; while (cur != NULL) { if (aim_sncmp(cur->sn, sn) == 0) @@ -663,7 +651,7 @@ aim_bstream_setpos(bs, endpos); } - aim_locate_adduserinfo(outinfo); + aim_locate_adduserinfo(sess, outinfo); return 0; } @@ -892,7 +880,7 @@ aim_tlvlist_t *tlvlist; aim_tlv_t *tlv = NULL; int was_explicit; - struct node *cur, *del; + struct userinfo_node *cur, *del; userinfo = (aim_userinfo_t *)malloc(sizeof(aim_userinfo_t)); aim_info_extract(sess, bs, userinfo); @@ -923,8 +911,8 @@ } aim_freetlvchain(&tlvlist); - aim_locate_adduserinfo(userinfo); - userinfo2 = aim_locate_finduserinfo(userinfo->sn); + aim_locate_adduserinfo(sess, userinfo); + userinfo2 = aim_locate_finduserinfo(sess, userinfo->sn); aim_info_free(userinfo); free(userinfo); @@ -934,14 +922,14 @@ * for this buddy. */ was_explicit = TRUE; - while ((request_queue != NULL) && (aim_sncmp(userinfo2->sn, request_queue->sn) == 0)) { - del = request_queue; - request_queue = del->next; + while ((sess->locate.request_queue != NULL) && (aim_sncmp(userinfo2->sn, sess->locate.request_queue->sn) == 0)) { + del = sess->locate.request_queue; + sess->locate.request_queue = del->next; was_explicit = FALSE; free(del->sn); free(del); } - cur = request_queue; + cur = sess->locate.request_queue; while ((cur != NULL) && (cur->next != NULL)) { if (aim_sncmp(userinfo2->sn, cur->next->sn) == 0) { del = cur->next; @@ -957,7 +945,7 @@ if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype))) ret = userfunc(sess, rx, userinfo2); } else { - waiting_for_response = FALSE; + sess->locate.waiting_for_response = FALSE; aim_locate_dorequest(sess); } @@ -1142,9 +1130,9 @@ { aim_userinfo_t *del; - while (infos) { - del = infos; - infos = infos->next; + while (sess->locate.userinfo) { + del = sess->locate.userinfo; + sess->locate.userinfo = sess->locate.userinfo->next; free(del->sn); free(del->info); free(del->avail);
--- a/src/protocols/oscar/oscar.c Tue Sep 30 00:39:24 2003 +0000 +++ b/src/protocols/oscar/oscar.c Tue Sep 30 01:32:29 2003 +0000 @@ -3169,8 +3169,7 @@ } } - /* gaim_notify_formatted(gc, NULL, _("Buddy Information"), NULL, text->str, NULL, NULL); */ - gaim_notify_formatted(gc, NULL, _("Below are the results of your search:"), NULL, text->str, NULL, NULL); + gaim_notify_formatted(gc, NULL, _("Buddy Information"), NULL, text->str, NULL, NULL); g_string_free(text, TRUE); return 1; @@ -3506,7 +3505,7 @@ return FALSE; } - userinfo = aim_locate_finduserinfo((char *)od->requesticon->data); + userinfo = aim_locate_finduserinfo(od->sess, (char *)od->requesticon->data); if ((userinfo != NULL) && (userinfo->iconcsumlen > 0)) { aim_bart_request(od->sess, od->requesticon->data, userinfo->iconcsum, userinfo->iconcsumlen); return FALSE; @@ -5356,7 +5355,7 @@ GaimConnection *gc = b->account->gc; struct oscar_data *od = gc->proto_data; struct buddyinfo *bi = g_hash_table_lookup(od->buddyinfo, normalize(b->name)); - aim_userinfo_t *userinfo = aim_locate_finduserinfo(b->name); + aim_userinfo_t *userinfo = aim_locate_finduserinfo(od->sess, b->name); gchar *tmp = NULL, *ret = g_strdup(""); if (GAIM_BUDDY_IS_ONLINE(b)) { @@ -6076,7 +6075,7 @@ aim_userinfo_t *userinfo; if (b) - userinfo = aim_locate_finduserinfo(b->name); + userinfo = aim_locate_finduserinfo(od->sess, b->name); if (b && userinfo && aim_sncmp(gaim_account_get_username(gaim_connection_get_account(gc)), who) && GAIM_BUDDY_IS_ONLINE(b)) { if (userinfo->capabilities & AIM_CAPS_DIRECTIM) {