Mercurial > pidgin
diff src/protocols/oscar/info.c @ 4151:1a5dcfa1823e
[gaim-migrate @ 4377]
Why do I make these things so long? I'm defective, that's why.
Mr. Walp pointed out a problem with "allow only peeps in my buddy list"
for ICQ, so I fixed that. One important problem: If you set your
permdeny to "allow only peeps in my buddy list," and then add or remove
someone from your buddy list, it will not update the allow/deny list on
the server. And that's a bad thing.
I changed an error message string or 4 in oscar.c for various reasons.
1) I feel that "he/she" is much better than "it." If you disagree,
please let me know, because I'm not sure of the correct phrasing.
2) There is only 1 unknown reason, it just applies to multiple messages.
I shuffled some of the clientauto functions around in oscar.c to make
it more uniform. I intend to look into why status messages aren't
working well soon.
I added some semblance of more advanced ICQ info support to libfaim.
There's also a bit of support in oscar.c for it, but making it display
itself nicely will take a little work, so I'll do it later.
A patch from the good Mr. Blanton taking out a non-ascii character
from oscar.c (my bad).
A patch from the good Mr. Blanton adding support for i18n to away
messages and aim profile info. Questions for the good Mr. Blanton:
1) Line 59 of info.c, in the first half of that if statement, should
profile_len also be &&'ed in with the other 2?
2) I changed a gaim_parse_user_info so that it works for non-unicode
away messages and profiles. Or so I think.
3) I changed little bits of your patch to appease my annoyingness,
so it might not cvs update cleanly for you. Sorry.
I organized the ChangeLog entries for 0.60. I tried to put stuff
that I thought was more important near the top of each category.
Please change stuff around, because I'm pretty sure it could be
better.
Breathe in, breathe out, breathe in, breathe out...
Tied to a wheel...
committer: Tailor Script <tailor@pidgin.im>
| author | Mark Doliner <mark@kingant.net> |
|---|---|
| date | Sun, 29 Dec 2002 17:12:05 +0000 |
| parents | 2532f1192da3 |
| children | d833bacc054f |
line wrap: on
line diff
--- a/src/protocols/oscar/info.c Sat Dec 28 05:15:43 2002 +0000 +++ b/src/protocols/oscar/info.c Sun Dec 29 17:12:05 2002 +0000 @@ -29,19 +29,48 @@ * Subtype 0x0004 * * Gives BOS your profile. + * + * profile_encoding and awaymsg_encoding MUST be set if profile or + * away are set, respectively, and their value may or may not be + * restricted to a few choices. I am currently aware of: + * + * us-ascii Just that + * unicode-2-0 UCS2-BE + * + * profile_len and awaymsg_len MUST be set similarly, and they MUST + * be the length of their respective strings in bytes. + * + * To get the previous behavior of awaymsg == "" un-setting the away + * message, set awaymsg non-NULL and awaymsg_len to 0 (this is the + * obvious equivalent). * */ -faim_export int aim_bos_setprofile(aim_session_t *sess, aim_conn_t *conn, const char *profile, const char *awaymsg, fu32_t caps) +faim_export int aim_bos_setprofile(aim_session_t *sess, aim_conn_t *conn, + 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) { - static const char defencoding[] = {"text/aolrtf; charset=\"us-ascii\""}; + static const char defencoding[] = {"text/aolrtf; charset=\"%s\""}; aim_frame_t *fr; aim_tlvlist_t *tl = NULL; aim_snacid_t snacid; + char *encoding; + + if ((profile && profile_encoding == NULL) || (awaymsg && awaymsg_len && awaymsg_encoding == NULL)) { + return -EINVAL; + } /* Build to packet first to get real length */ if (profile) { - aim_addtlvtochain_raw(&tl, 0x0001, strlen(defencoding), defencoding); - aim_addtlvtochain_raw(&tl, 0x0002, strlen(profile), profile); + /* no + 1 here because of %s */ + encoding = malloc(strlen(defencoding) + strlen(profile_encoding)); + if (encoding == NULL) { + return -ENOMEM; + } + snprintf(encoding, strlen(defencoding) + strlen(profile_encoding), defencoding, profile_encoding); + aim_addtlvtochain_raw(&tl, 0x0001, strlen(encoding), encoding); + aim_addtlvtochain_raw(&tl, 0x0002, profile_len, profile); + free(encoding); } /* @@ -53,9 +82,15 @@ * (that is, if you were away, you'll remain away). */ if (awaymsg) { - if (strlen(awaymsg)) { - aim_addtlvtochain_raw(&tl, 0x0003, strlen(defencoding), defencoding); - aim_addtlvtochain_raw(&tl, 0x0004, strlen(awaymsg), awaymsg); + if (awaymsg_len) { + encoding = malloc(strlen(defencoding) + strlen(awaymsg_encoding)); + if (encoding == NULL) { + return -ENOMEM; + } + snprintf(encoding, strlen(defencoding) + strlen(awaymsg_encoding), defencoding, awaymsg_encoding); + aim_addtlvtochain_raw(&tl, 0x0003, strlen(encoding), encoding); + aim_addtlvtochain_raw(&tl, 0x0004, awaymsg_len, awaymsg); + free(encoding); } else aim_addtlvtochain_noval(&tl, 0x0004); } @@ -712,8 +747,10 @@ { aim_userinfo_t userinfo; char *text_encoding = NULL, *text = NULL; + int textlen = 0; aim_rxcallback_t userfunc; aim_tlvlist_t *tlvlist; + aim_tlv_t *text_tlv = NULL; aim_snac_t *origsnac = NULL; struct aim_priv_inforeq *inforeq; int ret = 0; @@ -747,10 +784,10 @@ */ if (inforeq->infotype == AIM_GETINFO_GENERALINFO) { text_encoding = aim_gettlv_str(tlvlist, 0x0001, 1); - text = aim_gettlv_str(tlvlist, 0x0002, 1); + text_tlv = aim_gettlv(tlvlist, 0x0002, 1); } else if (inforeq->infotype == AIM_GETINFO_AWAYMESSAGE) { text_encoding = aim_gettlv_str(tlvlist, 0x0003, 1); - text = aim_gettlv_str(tlvlist, 0x0004, 1); + text_tlv = aim_gettlv(tlvlist, 0x0004, 1); } else if (inforeq->infotype == AIM_GETINFO_CAPABILITIES) { aim_tlv_t *ct; @@ -764,11 +801,15 @@ } } + if (text_tlv) { + text = text_tlv->value; + textlen = text_tlv->length; + } + if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype))) - ret = userfunc(sess, rx, &userinfo, inforeq->infotype, text_encoding, text); + ret = userfunc(sess, rx, &userinfo, inforeq->infotype, text_encoding, text, textlen); free(text_encoding); - free(text); aim_freetlvchain(&tlvlist);
