# HG changeset patch # User Eric Warmenhoven # Date 1003115761 0 # Node ID 1069b09402378c2c9f4b556ee5bfd58709cdc8d5 # Parent 072f253d5939e77edadafd3a36935162dbef58d1 [gaim-migrate @ 2520] hi. this is better. committer: Tailor Script diff -r 072f253d5939 -r 1069b0940237 src/protocols/oscar/CHANGES --- a/src/protocols/oscar/CHANGES Mon Oct 15 02:43:44 2001 +0000 +++ b/src/protocols/oscar/CHANGES Mon Oct 15 03:16:01 2001 +0000 @@ -1,6 +1,21 @@ No release numbers ------------------ + - Sun Oct 14 19:45:54 PDT 2001 + - Fix aim_icq_setstatus + - Minor touchups + - Parse 1/f (selfinfo) + - Add ICQ status defines + + - Wed Oct 3 11:07:22 PDT 2001 + - Fix awful bug in ft listenestablish. + - struct aim_userinfo_s becomes aim_userinfo_t. + - I haven't decided what to do with this. I like it in its current + form to an extent, but it is also not flexible enough. But it would + become too complex and cumbersome if I were to do it more flexibly. + - Also added a few accessor functions that should be used instead of + directly accessing the struct, particularly for the capabilities. + - Wed Sep 19 18:50:34 PDT 2001 - Remove non-standard default features from aim_send_im_ext. - Sadly, AOL 5.0 ignores messages with non-standard features. Once diff -r 072f253d5939 -r 1069b0940237 src/protocols/oscar/aim.h --- a/src/protocols/oscar/aim.h Mon Oct 15 02:43:44 2001 +0000 +++ b/src/protocols/oscar/aim.h Mon Oct 15 03:16:01 2001 +0000 @@ -372,6 +372,15 @@ #define AIM_SESS_FLAGS_XORLOGIN 0x00000002 #define AIM_SESS_FLAGS_NONBLOCKCONNECT 0x00000004 +/* Valid for calling aim_icq_setstatus() and for aim_userinfo_t->icqinfo.status */ +#define AIM_ICQ_STATE_ONLINE 0x0000 +#define AIM_ICQ_STATE_AWAY 0x0001 +#define AIM_ICQ_STATE_DND 0x0002 +#define AIM_ICQ_STATE_NA 0x0004 +#define AIM_ICQ_STATE_OCCUPIED 0x0010 +#define AIM_ICQ_STATE_CHAT 0x0020 +#define AIM_ICQ_STATE_INVISIBLE 0x0100 + /* * AIM User Info, Standard Form. */ @@ -567,7 +576,7 @@ faim_export int aim_setversions(aim_session_t *sess, aim_conn_t *conn); faim_export int aim_setdirectoryinfo(aim_session_t *sess, aim_conn_t *conn, const char *first, const char *middle, const char *last, const char *maiden, const char *nickname, const char *street, const char *city, const char *state, const char *zip, int country, fu16_t privacy); faim_export int aim_setuserinterests(aim_session_t *sess, aim_conn_t *conn, const char *interest1, const char *interest2, const char *interest3, const char *interest4, const char *interest5, fu16_t privacy); -faim_export int aim_icq_setstatus(aim_session_t *sess, aim_conn_t *conn, fu32_t status); +faim_export int aim_icq_setstatus(aim_session_t *sess, aim_conn_t *conn, fu16_t status); faim_export struct aim_fileheader_t *aim_getlisting(aim_session_t *sess, FILE *); diff -r 072f253d5939 -r 1069b0940237 src/protocols/oscar/im.c --- a/src/protocols/oscar/im.c Mon Oct 15 02:43:44 2001 +0000 +++ b/src/protocols/oscar/im.c Mon Oct 15 03:16:01 2001 +0000 @@ -1383,14 +1383,6 @@ channel = aimbs_get16(bs); /* - * Technically Channel 3 in chat could be done here too. - */ - if ((channel != 0x01) && (channel != 0x02)) { - faimdprintf(sess, 0, "icbm: ICBM received on an unsupported channel. Ignoring.\n (chan = %04x)", channel); - return 0; - } - - /* * Extract the standard user info block. * * Note that although this contains TLVs that appear contiguous @@ -1434,6 +1426,9 @@ * Free up the TLV chain. */ aim_freetlvchain(&tlvlist); + } else { + faimdprintf(sess, 0, "icbm: ICBM received on an unsupported channel. Ignoring.\n (chan = %04x)", channel); + return 0; } return ret; diff -r 072f253d5939 -r 1069b0940237 src/protocols/oscar/login.c --- a/src/protocols/oscar/login.c Mon Oct 15 02:43:44 2001 +0000 +++ b/src/protocols/oscar/login.c Mon Oct 15 03:16:01 2001 +0000 @@ -602,13 +602,15 @@ return 0; } -/* XXX parse this */ static int selfinfo(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs) { aim_rxcallback_t userfunc; + aim_userinfo_t userinfo; + + aim_extractuserinfo(sess, bs, &userinfo); if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype))) - return userfunc(sess, rx); + return userfunc(sess, rx, &userinfo); return 0; } diff -r 072f253d5939 -r 1069b0940237 src/protocols/oscar/misc.c --- a/src/protocols/oscar/misc.c Mon Oct 15 02:43:44 2001 +0000 +++ b/src/protocols/oscar/misc.c Mon Oct 15 03:16:01 2001 +0000 @@ -642,7 +642,7 @@ return 0; } -faim_export int aim_icq_setstatus(aim_session_t *sess, aim_conn_t *conn, fu32_t status) +faim_export int aim_icq_setstatus(aim_session_t *sess, aim_conn_t *conn, fu16_t status) { aim_frame_t *fr; aim_snacid_t snacid; diff -r 072f253d5939 -r 1069b0940237 src/protocols/oscar/oscar.c --- a/src/protocols/oscar/oscar.c Mon Oct 15 02:43:44 2001 +0000 +++ b/src/protocols/oscar/oscar.c Mon Oct 15 03:16:01 2001 +0000 @@ -68,14 +68,6 @@ #define UC_NORMAL 0x10 #define UC_AB 0x20 -#define ICQ_ONLINE 0x0000 -#define ICQ_AWAY 0x0001 -#define ICQ_DND 0x0002 -#define ICQ_NA 0x0004 -#define ICQ_OCCUPIED 0x0010 -#define ICQ_CHAT 0x0020 -#define ICQ_INVISIBLE 0x0100 - #define AIMHASHDATA "http://gaim.sourceforge.net/aim_data.php3" static int gaim_caps = AIM_CAPS_CHAT | @@ -247,6 +239,7 @@ static int gaim_parse_genericerr (aim_session_t *, aim_frame_t *, ...); static int gaim_memrequest (aim_session_t *, aim_frame_t*, ...); static int server_ready_bos (aim_session_t *, aim_frame_t*, ...); +static int gaim_selfinfo (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 *, ...); @@ -679,6 +672,7 @@ aim_conn_addhandler(sess, bosconn, 0x0003, 0x0001, gaim_parse_genericerr, 0); aim_conn_addhandler(sess, bosconn, 0x0009, 0x0001, gaim_parse_genericerr, 0); aim_conn_addhandler(sess, bosconn, 0x0001, 0x001f, gaim_memrequest, 0); + aim_conn_addhandler(sess, bosconn, 0x0001, 0x000f, gaim_selfinfo, 0); ((struct oscar_data *)gc->proto_data)->conn = bosconn; for (i = 0; i < (int)strlen(bosip); i++) { @@ -1172,7 +1166,7 @@ } else { if (info->icqinfo.status) { type = (info->icqinfo.status << 6); - if (!(info->icqinfo.status & ICQ_CHAT)) + if (!(info->icqinfo.status & AIM_ICQ_STATE_CHAT)) type |= UC_UNAVAILABLE; } debug_printf("icq status: %d\n", info->icqinfo.status); @@ -1925,6 +1919,21 @@ return 1; } +static int gaim_selfinfo(aim_session_t *sess, aim_frame_t *fr, ...) { + va_list ap; + aim_userinfo_t *info; + struct gaim_connection *gc = sess->aux_data; + + va_start(ap, fr); + info = va_arg(ap, aim_userinfo_t *); + va_end(ap); + + gc->evil = info->warnlevel/10; + gc->correction_time = (info->onlinesince - gc->login_time); + + return 1; +} + static int rateresp_bos(aim_session_t *sess, aim_frame_t *fr, ...) { struct gaim_connection *gc = sess->aux_data; @@ -2236,31 +2245,31 @@ gc->away = NULL; if (!strcmp(state, "Online")) - aim_icq_setstatus(od->sess, od->conn, ICQ_ONLINE); + aim_icq_setstatus(od->sess, od->conn, AIM_ICQ_STATE_ONLINE); else if (!strcmp(state, "Away")) { - aim_icq_setstatus(od->sess, od->conn, ICQ_AWAY); + aim_icq_setstatus(od->sess, od->conn, AIM_ICQ_STATE_AWAY); gc->away = ""; } else if (!strcmp(state, "Do Not Disturb")) { - aim_icq_setstatus(od->sess, od->conn, ICQ_DND); + aim_icq_setstatus(od->sess, od->conn, AIM_ICQ_STATE_DND); gc->away = ""; } else if (!strcmp(state, "Not Available")) { - aim_icq_setstatus(od->sess, od->conn, ICQ_NA); + aim_icq_setstatus(od->sess, od->conn, AIM_ICQ_STATE_NA); gc->away = ""; } else if (!strcmp(state, "Occupied")) { - aim_icq_setstatus(od->sess, od->conn, ICQ_OCCUPIED); + aim_icq_setstatus(od->sess, od->conn, AIM_ICQ_STATE_OCCUPIED); gc->away = ""; } else if (!strcmp(state, "Free For Chat")) { - aim_icq_setstatus(od->sess, od->conn, ICQ_CHAT); + aim_icq_setstatus(od->sess, od->conn, AIM_ICQ_STATE_CHAT); gc->away = ""; } else if (!strcmp(state, "Invisible")) { - aim_icq_setstatus(od->sess, od->conn, ICQ_INVISIBLE); + aim_icq_setstatus(od->sess, od->conn, AIM_ICQ_STATE_INVISIBLE); gc->away = ""; } else if (!strcmp(state, GAIM_AWAY_CUSTOM)) { if (message) { - aim_icq_setstatus(od->sess, od->conn, ICQ_NA); + aim_icq_setstatus(od->sess, od->conn, AIM_ICQ_STATE_NA); gc->away = ""; } else { - aim_icq_setstatus(od->sess, od->conn, ICQ_ONLINE); + aim_icq_setstatus(od->sess, od->conn, AIM_ICQ_STATE_ONLINE); } } } @@ -2455,17 +2464,17 @@ return (char **)icon_online_xpm; if (uc & 0x7fc0) { uc >>= 6; - if (uc & ICQ_AWAY) + if (uc & AIM_ICQ_STATE_AWAY) return icon_away_xpm; - if (uc & ICQ_DND) + if (uc & AIM_ICQ_STATE_DND) return icon_dnd_xpm; - if (uc & ICQ_NA) + if (uc & AIM_ICQ_STATE_NA) return icon_na_xpm; - if (uc & ICQ_OCCUPIED) + if (uc & AIM_ICQ_STATE_OCCUPIED) return icon_occ_xpm; - if (uc & ICQ_CHAT) + if (uc & AIM_ICQ_STATE_CHAT) return icon_ffc_xpm; - if (uc & ICQ_INVISIBLE) + if (uc & AIM_ICQ_STATE_INVISIBLE) return icon_offline_xpm; return icon_online_xpm; } @@ -2804,7 +2813,7 @@ void oscar_init(struct prpl *ret) { ret->protocol = PROTO_OSCAR; - ret->options = OPT_PROTO_HTML | OPT_PROTO_CORRECT_TIME | OPT_PROTO_BUDDY_ICON; + ret->options = OPT_PROTO_HTML | OPT_PROTO_BUDDY_ICON; ret->name = oscar_name; ret->list_icon = oscar_list_icon; ret->away_states = oscar_away_states;