Mercurial > pidgin.yaz
changeset 2742:6f527cbd899d
[gaim-migrate @ 2755]
i'll commit it later.
committer: Tailor Script <tailor@pidgin.im>
author | Eric Warmenhoven <eric@warmenhoven.org> |
---|---|
date | Sun, 18 Nov 2001 00:21:49 +0000 |
parents | 38cb5fa48bec |
children | 9f71beb77c60 |
files | src/protocols/oscar/aim.h src/protocols/oscar/aim_cbtypes.h src/protocols/oscar/icq.c src/protocols/oscar/oscar.c |
diffstat | 4 files changed, 124 insertions(+), 13 deletions(-) [+] |
line wrap: on
line diff
--- a/src/protocols/oscar/aim.h Sat Nov 17 22:50:08 2001 +0000 +++ b/src/protocols/oscar/aim.h Sun Nov 18 00:21:49 2001 +0000 @@ -978,8 +978,17 @@ char *msg; }; +struct aim_icq_simpleinfo { + fu32_t uin; + char *nick; + char *first; + char *last; + char *email; +}; + faim_export int aim_icq_reqofflinemsgs(aim_session_t *sess); faim_export int aim_icq_ackofflinemsgs(aim_session_t *sess); +faim_export int aim_icq_getsimpleinfo(aim_session_t *sess, const char *uin); /* aim_util.c */ /*
--- a/src/protocols/oscar/aim_cbtypes.h Sat Nov 17 22:50:08 2001 +0000 +++ b/src/protocols/oscar/aim_cbtypes.h Sun Nov 18 00:21:49 2001 +0000 @@ -180,6 +180,7 @@ #define AIM_CB_ICQ_ERROR 0x0001 #define AIM_CB_ICQ_OFFLINEMSG 0x00f0 #define AIM_CB_ICQ_OFFLINEMSGCOMPLETE 0x00f1 +#define AIM_CB_ICQ_SIMPLEINFO 0x00f2 #define AIM_CB_ICQ_DEFAULT 0xffff /*
--- a/src/protocols/oscar/icq.c Sat Nov 17 22:50:08 2001 +0000 +++ b/src/protocols/oscar/icq.c Sun Nov 18 00:21:49 2001 +0000 @@ -108,6 +108,43 @@ return 0; } +faim_export int aim_icq_getsimpleinfo(aim_session_t *sess, const char *uin) +{ + aim_conn_t *conn; + aim_frame_t *fr; + aim_snacid_t snacid; + int bslen; + + if (!uin || uin[0] < '0' || uin[0] > '9') + return -EINVAL; + + if (!sess || !(conn = aim_conn_findbygroup(sess, 0x0015))) + return -EINVAL; + + bslen = 2 + 4 + 2 + 2 + 2 + 4; + + if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10 + 4 + bslen))) + return -ENOMEM; + + snacid = aim_cachesnac(sess, 0x0015, 0x0002, 0x0000, NULL, 0); + aim_putsnac(&fr->data, 0x0015, 0x0002, 0x0000, snacid); + + /* For simplicity, don't bother using a tlvlist */ + aimbs_put16(&fr->data, 0x0001); + aimbs_put16(&fr->data, bslen); + + aimbs_putle16(&fr->data, bslen - 2); + aimbs_putle32(&fr->data, atoi(sess->sn)); + aimbs_putle16(&fr->data, 0x07d0); /* I command thee. */ + aimbs_putle16(&fr->data, snacid); /* eh. */ + aimbs_putle16(&fr->data, 0x051f); /* shrug. */ + aimbs_putle32(&fr->data, atoi(uin)); + + aim_tx_enqueue(sess, fr); + + return 0; +} + /* * Response to 15/2, contains an ICQ packet. */ @@ -162,6 +199,40 @@ if ((userfunc = aim_callhandler(sess, rx->conn, AIM_CB_FAM_ICQ, AIM_CB_ICQ_OFFLINEMSGCOMPLETE))) ret = userfunc(sess, rx); + } else if (cmd == 0x07da) { + fu16_t subtype; + + subtype = aimbs_getle16(&qbs); + + if (subtype == 0x019a) { + fu16_t tlen; + struct aim_icq_simpleinfo info; + aim_rxcallback_t userfunc; + + memset(&info, 0, sizeof(info)); + + aimbs_getle8(&qbs); /* no clue */ + aimbs_getle16(&qbs); /* no clue */ + info.uin = aimbs_getle32(&qbs); + tlen = aimbs_getle16(&qbs); + info.nick = aimbs_getstr(&qbs, tlen); + tlen = aimbs_getle16(&qbs); + info.first = aimbs_getstr(&qbs, tlen); + tlen = aimbs_getle16(&qbs); + info.last = aimbs_getstr(&qbs, tlen); + tlen = aimbs_getle16(&qbs); + info.email = aimbs_getstr(&qbs, tlen); + /* no clue what the rest of it is */ + + if ((userfunc = aim_callhandler(sess, rx->conn, AIM_CB_FAM_ICQ, AIM_CB_ICQ_SIMPLEINFO))) + ret = userfunc(sess, rx, &info); + + free(info.nick); + free(info.first); + free(info.last); + free(info.email); + } + } aim_freetlvchain(&tl);
--- a/src/protocols/oscar/oscar.c Sat Nov 17 22:50:08 2001 +0000 +++ b/src/protocols/oscar/oscar.c Sun Nov 18 00:21:49 2001 +0000 @@ -229,23 +229,24 @@ static int gaim_parse_searcherror(aim_session_t *, aim_frame_t *, ...); static int gaim_parse_searchreply(aim_session_t *, aim_frame_t *, ...); static int gaim_bosrights (aim_session_t *, aim_frame_t *, ...); -static int conninitdone_bos (aim_session_t *sess, aim_frame_t *fr, ...); -static int conninitdone_admin (aim_session_t *sess, aim_frame_t *fr, ...); -static int conninitdone_chat (aim_session_t *sess, aim_frame_t *fr, ...); -static int conninitdone_chatnav (aim_session_t *sess, aim_frame_t *fr, ...); +static int conninitdone_bos (aim_session_t *, aim_frame_t *, ...); +static int conninitdone_admin (aim_session_t *, aim_frame_t *, ...); +static int conninitdone_chat (aim_session_t *, aim_frame_t *, ...); +static int conninitdone_chatnav (aim_session_t *, aim_frame_t *, ...); static int gaim_parse_msgerr (aim_session_t *, aim_frame_t *, ...); static int gaim_parse_buddyrights(aim_session_t *, aim_frame_t *, ...); static int gaim_parse_locerr (aim_session_t *, aim_frame_t *, ...); static int gaim_icbm_param_info (aim_session_t *, aim_frame_t *, ...); static int gaim_parse_genericerr (aim_session_t *, aim_frame_t *, ...); -static int gaim_memrequest (aim_session_t *, aim_frame_t*, ...); -static int gaim_selfinfo (aim_session_t *, aim_frame_t*, ...); -static int gaim_offlinemsg (aim_session_t *, aim_frame_t*, ...); -static int gaim_offlinemsgdone (aim_session_t *, aim_frame_t*, ...); - -static int gaim_directim_initiate (aim_session_t *, aim_frame_t *, ...); -static int gaim_directim_incoming (aim_session_t *, aim_frame_t *, ...); -static int gaim_directim_typing (aim_session_t *, aim_frame_t *, ...); +static int gaim_memrequest (aim_session_t *, aim_frame_t *, ...); +static int gaim_selfinfo (aim_session_t *, aim_frame_t *, ...); +static int gaim_offlinemsg (aim_session_t *, aim_frame_t *, ...); +static int gaim_offlinemsgdone (aim_session_t *, aim_frame_t *, ...); +static int gaim_simpleinfo (aim_session_t *, aim_frame_t *, ...); + +static int gaim_directim_initiate(aim_session_t *, aim_frame_t *, ...); +static int gaim_directim_incoming(aim_session_t *, aim_frame_t *, ...); +static int gaim_directim_typing (aim_session_t *, aim_frame_t *, ...); static char *msgerrreason[] = { "Invalid error", @@ -652,6 +653,7 @@ aim_conn_addhandler(sess, bosconn, 0x0001, 0x000f, gaim_selfinfo, 0); aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_ICQ, AIM_CB_ICQ_OFFLINEMSG, gaim_offlinemsg, 0); aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_ICQ, AIM_CB_ICQ_OFFLINEMSGCOMPLETE, gaim_offlinemsgdone, 0); + aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_ICQ, AIM_CB_ICQ_SIMPLEINFO, gaim_simpleinfo, 0); ((struct oscar_data *)gc->proto_data)->conn = bosconn; for (i = 0; i < (int)strlen(info->bosip); i++) { @@ -2025,6 +2027,31 @@ return 1; } +static int gaim_simpleinfo(aim_session_t *sess, aim_frame_t *fr, ...) +{ + va_list ap; + struct aim_icq_simpleinfo *info; + char buf[16 * 1024]; + + va_start(ap, fr); + info = va_arg(ap, struct aim_icq_simpleinfo *); + va_end(ap); + + g_snprintf(buf, sizeof buf, + "<B>UIN:</B> %lu<BR>" + "<B>Nick:</B> %s<BR>" + "<B>Name:</B> %s %s<BR>" + "<B>Email:</B> %s\n", + info->uin, + info->nick, + info->first, info->last, + info->email); + + g_show_info_text(buf, NULL); + + return 1; +} + static int gaim_parse_searchreply(aim_session_t *sess, aim_frame_t *fr, ...) { va_list ap; char *address, *SNs; @@ -2189,7 +2216,10 @@ static void oscar_get_info(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_GENERALINFO); + if (odata->icq) + aim_icq_getsimpleinfo(odata->sess, name); + else + aim_getinfo(odata->sess, odata->conn, name, AIM_GETINFO_GENERALINFO); } static void oscar_get_away_msg(struct gaim_connection *g, char *name) {