# HG changeset patch # User Adam Fritzler # Date 1009878544 0 # Node ID 4ed6fb39870be20168f0989e5a0e17f70eaaedc1 # Parent 22aefb8de0cb9c90e6b9fd33cd021039e433901f [gaim-migrate @ 2933] who the hell cares. committer: Tailor Script diff -r 22aefb8de0cb -r 4ed6fb39870b src/buddy.c --- a/src/buddy.c Sat Dec 22 08:11:11 2001 +0000 +++ b/src/buddy.c Tue Jan 01 09:49:04 2002 +0000 @@ -1894,12 +1894,12 @@ return 0; } -static char *caps_string(gushort caps) +static char *caps_string(guint caps) { static char buf[256], *tmp; int count = 0, i = 0; - gushort bit = 1; - while (bit <= 0x800) { + guint bit = 1; + while (bit <= 0x10000) { if (bit & caps) { switch (bit) { case 0x1: @@ -1927,12 +1927,30 @@ case 0x80: tmp = _("Stocks"); break; + case 0x100: + tmp = _("Send Buddy List"); + break; case 0x400: tmp = _("EveryBuddy Bug"); break; case 0x800: tmp = _("AP User"); break; + case 0x1000: + tmp = _("ICQ RTF"); + break; + case 0x2000: + tmp = _("Nihilist"); + break; + case 0x4000: + tmp = _("ICQ Server Relay"); + break; + case 0x8000: + tmp = _("ICQ Unknown"); + break; + case 0x10000: + tmp = _("Trillian Encryption"); + break; default: tmp = NULL; break; diff -r 22aefb8de0cb -r 4ed6fb39870b src/core.h --- a/src/core.h Sat Dec 22 08:11:11 2001 +0000 +++ b/src/core.h Tue Jan 01 09:49:04 2002 +0000 @@ -118,7 +118,7 @@ time_t signon; time_t idle; int uc; - gushort caps; /* woohoo! */ + guint caps; /* woohoo! */ void *proto_data; /* what a hack */ struct gaim_connection *gc; /* the connection it belongs to */ }; @@ -190,7 +190,7 @@ extern char *event_name(enum gaim_event); /* Functions in server.c */ -extern void serv_got_update(struct gaim_connection *, char *, int, int, time_t, time_t, int, gushort); +extern void serv_got_update(struct gaim_connection *, char *, int, int, time_t, time_t, int, guint); extern void serv_got_im(struct gaim_connection *, char *, char *, guint32, time_t, gint); extern void serv_got_eviled(struct gaim_connection *, char *, int); extern void serv_got_chat_invite(struct gaim_connection *, char *, char *, char *, GList *); diff -r 22aefb8de0cb -r 4ed6fb39870b src/protocols/oscar/aim.h --- a/src/protocols/oscar/aim.h Sat Dec 22 08:11:11 2001 +0000 +++ b/src/protocols/oscar/aim.h Tue Jan 01 09:49:04 2002 +0000 @@ -846,7 +846,8 @@ #define AIM_CAPS_EMPTY 0x00002000 #define AIM_CAPS_ICQSERVERRELAY 0x00004000 #define AIM_CAPS_ICQUNKNOWN 0x00008000 -#define AIM_CAPS_LAST 0x00010000 +#define AIM_CAPS_TRILLIANCRYPT 0x00010000 +#define AIM_CAPS_LAST 0x00020000 faim_export int aim_0002_000b(aim_session_t *sess, aim_conn_t *conn, const char *sn); @@ -857,6 +858,7 @@ #define AIM_GETINFO_GENERALINFO 0x00001 #define AIM_GETINFO_AWAYMESSAGE 0x00003 +#define AIM_GETINFO_CAPABILITIES 0x0004 struct aim_invite_priv { char *sn; diff -r 22aefb8de0cb -r 4ed6fb39870b src/protocols/oscar/info.c --- a/src/protocols/oscar/info.c Sat Dec 22 08:11:11 2001 +0000 +++ b/src/protocols/oscar/info.c Tue Jan 01 09:49:04 2002 +0000 @@ -23,9 +23,6 @@ if (!sess || !conn || !sn) return -EINVAL; - if ((infotype != AIM_GETINFO_GENERALINFO) && (infotype != AIM_GETINFO_AWAYMESSAGE)) - return -EINVAL; - if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 12+1+strlen(sn)))) return -ENOMEM; @@ -209,6 +206,10 @@ {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}}, + {AIM_CAPS_TRILLIANCRYPT, + {0xf2, 0xe7, 0xc7, 0xf4, 0xfe, 0xad, 0x4d, 0xfb, + 0xb2, 0x35, 0x36, 0x79, 0x8b, 0xdf, 0x00, 0x00}}, + {AIM_CAPS_LAST} }; @@ -238,8 +239,15 @@ } } - if (!identified) - faimdprintf(sess, 0, "unknown capability!\n"); + if (!identified) { + faimdprintf(sess, 0, "unknown capability: {%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x}\n", + cap[0], cap[1], cap[2], cap[3], + cap[4], cap[5], + cap[6], cap[7], + cap[8], cap[9], + cap[10], cap[11], cap[12], cap[13], + cap[14], cap[15]); + } free(cap); } @@ -601,7 +609,8 @@ inforeq = (struct aim_priv_inforeq *)origsnac->data; if ((inforeq->infotype != AIM_GETINFO_GENERALINFO) && - (inforeq->infotype != AIM_GETINFO_AWAYMESSAGE)) { + (inforeq->infotype != AIM_GETINFO_AWAYMESSAGE) && + (inforeq->infotype != AIM_GETINFO_CAPABILITIES)) { faimdprintf(sess, 0, "parse_userinfo_middle: unknown infotype in request! (0x%04x)\n", inforeq->infotype); return 0; } @@ -614,18 +623,30 @@ * Depending on what informational text was requested, different * TLVs will appear here. * - * Profile will be 1 and 2, away message will be 3 and 4. + * Profile will be 1 and 2, away message will be 3 and 4, caps + * will be 5. */ - if (aim_gettlv(tlvlist, 0x0001, 1)) { + if (inforeq->infotype == AIM_GETINFO_GENERALINFO) { text_encoding = aim_gettlv_str(tlvlist, 0x0001, 1); text = aim_gettlv_str(tlvlist, 0x0002, 1); - } else if (aim_gettlv(tlvlist, 0x0003, 1)) { + } else if (inforeq->infotype == AIM_GETINFO_AWAYMESSAGE) { text_encoding = aim_gettlv_str(tlvlist, 0x0003, 1); text = aim_gettlv_str(tlvlist, 0x0004, 1); + } else if (inforeq->infotype == AIM_GETINFO_CAPABILITIES) { + aim_tlv_t *ct; + + if ((ct = aim_gettlv(tlvlist, 0x0005, 1))) { + aim_bstream_t cbs; + + aim_bstream_init(&cbs, ct->value, ct->length); + + userinfo.capabilities = aim_getcap(sess, &cbs, ct->length); + userinfo.capspresent = 1; + } } if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype))) - ret = userfunc(sess, rx, &userinfo, text_encoding, text, inforeq->infotype); + ret = userfunc(sess, rx, &userinfo, inforeq->infotype, text_encoding, text); free(text_encoding); free(text); diff -r 22aefb8de0cb -r 4ed6fb39870b src/protocols/oscar/oscar.c --- a/src/protocols/oscar/oscar.c Sat Dec 22 08:11:11 2001 +0000 +++ b/src/protocols/oscar/oscar.c Tue Jan 01 09:49:04 2002 +0000 @@ -1570,6 +1570,78 @@ return buf; } +/* XXX This is horribly copied from ../../buddy.c. */ +static char *caps_string(guint caps) +{ + static char buf[512], *tmp; + int count = 0, i = 0; + guint bit = 1; + while (bit <= 0x10000) { + if (bit & caps) { + switch (bit) { + case 0x1: + tmp = _("Buddy Icon"); + break; + case 0x2: + tmp = _("Voice"); + break; + case 0x4: + tmp = _("IM Image"); + break; + case 0x8: + tmp = _("Chat"); + break; + case 0x10: + tmp = _("Get File"); + break; + case 0x20: + tmp = _("Send File"); + break; + case 0x40: + case 0x200: + tmp = _("Games"); + break; + case 0x80: + tmp = _("Stocks"); + break; + case 0x100: + tmp = _("Send Buddy List"); + break; + case 0x400: + tmp = _("EveryBuddy Bug"); + break; + case 0x800: + tmp = _("AP User"); + break; + case 0x1000: + tmp = _("ICQ RTF"); + break; + case 0x2000: + tmp = _("Nihilist"); + break; + case 0x4000: + tmp = _("ICQ Server Relay"); + break; + case 0x8000: + tmp = _("ICQ Unknown"); + break; + case 0x10000: + tmp = _("Trillian Encryption"); + break; + default: + tmp = NULL; + break; + } + if (tmp) + i += g_snprintf(buf + i, sizeof(buf) - i, "%s%s", (count ? ", " : ""), + tmp); + count++; + } + bit <<= 1; + } + return buf; +} + static int gaim_parse_user_info(aim_session_t *sess, aim_frame_t *fr, ...) { aim_userinfo_t *info; char *prof_enc = NULL, *prof = NULL; @@ -1580,15 +1652,14 @@ struct oscar_data *od = gc->proto_data; GSList *l = od->evilhack; gboolean evilhack = FALSE; - gboolean away; va_list ap; char *asc; va_start(ap, fr); info = va_arg(ap, aim_userinfo_t *); + infotype = (fu16_t)va_arg(ap, unsigned int); prof_enc = va_arg(ap, char *); prof = va_arg(ap, char *); - infotype = (fu16_t)va_arg(ap, unsigned int); va_end(ap); g_snprintf(legend, sizeof legend, @@ -1598,8 +1669,6 @@ " : Trial AIM User
" " : Administrator")); - away = infotype != AIM_GETINFO_GENERALINFO; - if (info->membersince) asc = g_strdup_printf("Member Since : %s
\n", asctime(localtime(&info->membersince))); @@ -1629,7 +1698,7 @@ l = l->next; } - if (away) { + if (infotype == AIM_GETINFO_AWAYMESSAGE) { if (evilhack) { g_show_info_text(gc, info->sn, 2, header, @@ -1643,6 +1712,14 @@ (prof && *prof) ? "


" : NULL, NULL); } + } else if (infotype == AIM_GETINFO_CAPABILITIES) { + g_show_info_text(gc, info->sn, 2, + header, + "", _("Client Capabilities: "), + caps_string(info->capabilities), + "", + legend, + NULL); } else { g_show_info_text(gc, info->sn, 1, (prof && *prof) ? away_subs(prof, gc->username) : @@ -2324,6 +2401,11 @@ aim_getinfo(odata->sess, odata->conn, name, AIM_GETINFO_GENERALINFO); } +static void oscar_get_caps(struct gaim_connection *g, char *name) { + struct oscar_data *odata = (struct oscar_data *)g->proto_data; + aim_getinfo(odata->sess, odata->conn, name, AIM_GETINFO_CAPABILITIES); +} + static void oscar_set_dir(struct gaim_connection *g, char *first, char *middle, char *last, char *maiden, char *city, char *state, char *country, int web) { /* FIXME : some of these things are wrong, but i'm lazy */ @@ -2774,6 +2856,13 @@ m = g_list_append(m, pbm); } } + + pbm = g_new0(struct proto_buddy_menu, 1); + pbm->label = _("Get Capabilities"); + pbm->callback = oscar_get_caps; + pbm->gc = gc; + m = g_list_append(m, pbm); + g_free(n); return m; diff -r 22aefb8de0cb -r 4ed6fb39870b src/server.c --- a/src/server.c Sat Dec 22 08:11:11 2001 +0000 +++ b/src/server.c Tue Jan 01 09:49:04 2002 +0000 @@ -650,7 +650,7 @@ void serv_got_update(struct gaim_connection *gc, char *name, int loggedin, int evil, time_t signon, - time_t idle, int type, gushort caps) + time_t idle, int type, guint caps) { struct buddy *b = find_buddy(gc, name);