Mercurial > pidgin
diff src/protocols/oscar/family_odir.c @ 13592:6519aeb66b31
[gaim-migrate @ 15978]
Holy cow this is crazy.
34 files changed, 5760 insertions(+), 8517 deletions(-)
* Non-blocking I/O for all of oscar. That includes normal FLAP
connections as well as file transfers and direct IM.
* Kick-ass file transfer and direct IM. Either party can request
the connection. Gaim will try both the "public" IP and the
"client" IP. It'll fall back to transferring through a proxy
if that fails. Should be relatively few memleaks (I didn't
have a lot of confidence in the non-memleakiness of the old
code). And the code is reasonably generic, so it shouldn't
be too much work to add voice chat. This might still be a
LITTLE buggy, but it shouldn't be too bad. If anything, file
transfer will be more buggy than direct IM. And sending a
file will be more buggy than receiving a file. Bug reports
with a series of steps to reproduce are welcome.
* I merged OscarData and aim_session_t
* Somewhere between 50 and 100 hours of work.
committer: Tailor Script <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Fri, 07 Apr 2006 05:10:56 +0000 |
parents | 87a7c3077c19 |
children |
line wrap: on
line diff
--- a/src/protocols/oscar/family_odir.c Fri Apr 07 01:05:48 2006 +0000 +++ b/src/protocols/oscar/family_odir.c Fri Apr 07 05:10:56 2006 +0000 @@ -33,19 +33,19 @@ * * Search for an AIM screen name based on their email address. * - * @param sess The oscar session. + * @param od The oscar session. * @param region Should be "us-ascii" unless you know what you're doing. * @param email The email address you want to search for. * @return Return 0 if no errors, otherwise return the error number. */ -faim_export int aim_odir_email(OscarSession *sess, const char *region, const char *email) +int aim_odir_email(OscarData *od, const char *region, const char *email) { - OscarConnection *conn; - FlapFrame *fr; + FlapConnection *conn; + FlapFrame *frame; aim_snacid_t snacid; aim_tlvlist_t *tl = NULL; - if (!sess || !(conn = aim_conn_findbygroup(sess, 0x000f)) || !region || !email) + if (!od || !(conn = flap_connection_findbygroup(od, 0x000f)) || !region || !email) return -EINVAL; /* Create a TLV chain, write it to the outgoing frame, then free the chain */ @@ -53,15 +53,14 @@ aim_tlvlist_add_16(&tl, 0x000a, 0x0001); /* Type of search */ aim_tlvlist_add_str(&tl, 0x0005, email); - if (!(fr = flap_frame_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10+aim_tlvlist_size(&tl)))) - return -ENOMEM; - snacid = aim_cachesnac(sess, 0x000f, 0x0002, 0x0000, NULL, 0); - aim_putsnac(&fr->data, 0x000f, 0x0002, 0x0000, snacid); + frame = flap_frame_new(od, 0x02, 10+aim_tlvlist_size(&tl)); + snacid = aim_cachesnac(od, 0x000f, 0x0002, 0x0000, NULL, 0); + aim_putsnac(&frame->data, 0x000f, 0x0002, 0x0000, snacid); - aim_tlvlist_write(&fr->data, &tl); + aim_tlvlist_write(&frame->data, &tl); aim_tlvlist_free(&tl); - aim_tx_enqueue(sess, fr); + flap_connection_send(conn, frame); return 0; } @@ -73,7 +72,7 @@ * Search for an AIM screen name based on various info * about the person. * - * @param sess The oscar session. + * @param od The oscar session. * @param region Should be "us-ascii" unless you know what you're doing. * @param first The first name of the person you want to search for. * @param middle The middle name of the person you want to search for. @@ -87,14 +86,14 @@ * @param address The street address where the person you want to seach for resides. * @return Return 0 if no errors, otherwise return the error number. */ -faim_export int aim_odir_name(OscarSession *sess, const char *region, const char *first, const char *middle, const char *last, const char *maiden, const char *nick, const char *city, const char *state, const char *country, const char *zip, const char *address) +int aim_odir_name(OscarData *od, const char *region, const char *first, const char *middle, const char *last, const char *maiden, const char *nick, const char *city, const char *state, const char *country, const char *zip, const char *address) { - OscarConnection *conn; - FlapFrame *fr; + FlapConnection *conn; + FlapFrame *frame; aim_snacid_t snacid; aim_tlvlist_t *tl = NULL; - if (!sess || !(conn = aim_conn_findbygroup(sess, 0x000f)) || !region) + if (!od || !(conn = flap_connection_findbygroup(od, 0x000f)) || !region) return -EINVAL; /* Create a TLV chain, write it to the outgoing frame, then free the chain */ @@ -121,15 +120,14 @@ if (address) aim_tlvlist_add_str(&tl, 0x0021, address); - if (!(fr = flap_frame_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10+aim_tlvlist_size(&tl)))) - return -ENOMEM; - snacid = aim_cachesnac(sess, 0x000f, 0x0002, 0x0000, NULL, 0); - aim_putsnac(&fr->data, 0x000f, 0x0002, 0x0000, snacid); + frame = flap_frame_new(od, 0x02, 10+aim_tlvlist_size(&tl)); + snacid = aim_cachesnac(od, 0x000f, 0x0002, 0x0000, NULL, 0); + aim_putsnac(&frame->data, 0x000f, 0x0002, 0x0000, snacid); - aim_tlvlist_write(&fr->data, &tl); + aim_tlvlist_write(&frame->data, &tl); aim_tlvlist_free(&tl); - aim_tx_enqueue(sess, fr); + flap_connection_send(conn, frame); return 0; } @@ -138,18 +136,18 @@ /** * Subtype 0x0002 - Submit a User Search Request * - * @param sess The oscar session. + * @param od The oscar session. * @param interest1 An interest you want to search for. * @return Return 0 if no errors, otherwise return the error number. */ -faim_export int aim_odir_interest(OscarSession *sess, const char *region, const char *interest) +int aim_odir_interest(OscarData *od, const char *region, const char *interest) { - OscarConnection *conn; - FlapFrame *fr; + FlapConnection *conn; + FlapFrame *frame; aim_snacid_t snacid; aim_tlvlist_t *tl = NULL; - if (!sess || !(conn = aim_conn_findbygroup(sess, 0x000f)) || !region) + if (!od || !(conn = flap_connection_findbygroup(od, 0x000f)) || !region) return -EINVAL; /* Create a TLV chain, write it to the outgoing frame, then free the chain */ @@ -158,15 +156,14 @@ if (interest) aim_tlvlist_add_str(&tl, 0x0001, interest); - if (!(fr = flap_frame_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10+aim_tlvlist_size(&tl)))) - return -ENOMEM; - snacid = aim_cachesnac(sess, 0x000f, 0x0002, 0x0000, NULL, 0); - aim_putsnac(&fr->data, 0x000f, 0x0002, 0x0000, snacid); + frame = flap_frame_new(od, 0x02, 10+aim_tlvlist_size(&tl)); + snacid = aim_cachesnac(od, 0x000f, 0x0002, 0x0000, NULL, 0); + aim_putsnac(&frame->data, 0x000f, 0x0002, 0x0000, snacid); - aim_tlvlist_write(&fr->data, &tl); + aim_tlvlist_write(&frame->data, &tl); aim_tlvlist_free(&tl); - aim_tx_enqueue(sess, fr); + flap_connection_send(conn, frame); return 0; } @@ -176,23 +173,23 @@ * Subtype 0x0003 - Receive Reply From a User Search * */ -static int parseresults(OscarSession *sess, aim_module_t *mod, FlapFrame *rx, aim_modsnac_t *snac, ByteStream *bs) +static int parseresults(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) { int ret = 0; aim_rxcallback_t userfunc; guint16 tmp, numresults; struct aim_odir *results = NULL; - tmp = aimbs_get16(bs); /* Unknown */ - tmp = aimbs_get16(bs); /* Unknown */ - aim_bstream_advance(bs, tmp); + tmp = byte_stream_get16(bs); /* Unknown */ + tmp = byte_stream_get16(bs); /* Unknown */ + byte_stream_advance(bs, tmp); - numresults = aimbs_get16(bs); /* Number of results to follow */ + numresults = byte_stream_get16(bs); /* Number of results to follow */ /* Allocate a linked list, 1 node per result */ while (numresults) { struct aim_odir *new; - aim_tlvlist_t *tl = aim_tlvlist_readnum(bs, aimbs_get16(bs)); + aim_tlvlist_t *tl = aim_tlvlist_readnum(bs, byte_stream_get16(bs)); new = (struct aim_odir *)malloc(sizeof(struct aim_odir)); new->first = aim_tlv_getstr(tl, 0x0001, 1); new->last = aim_tlv_getstr(tl, 0x0002, 1); @@ -213,8 +210,8 @@ numresults--; } - if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype))) - ret = userfunc(sess, rx, results); + if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) + ret = userfunc(od, conn, frame, results); /* Now free everything from above */ while (results) { @@ -240,18 +237,18 @@ return ret; } -static int snachandler(OscarSession *sess, aim_module_t *mod, FlapFrame *rx, aim_modsnac_t *snac, ByteStream *bs) +static int +snachandler(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) { - if (snac->subtype == 0x0003) - return parseresults(sess, mod, rx, snac, bs); + return parseresults(od, conn, mod, frame, snac, bs); return 0; } -faim_internal int odir_modfirst(OscarSession *sess, aim_module_t *mod) +int +odir_modfirst(OscarData *od, aim_module_t *mod) { - mod->family = 0x000f; mod->version = 0x0001; mod->toolid = 0x0010;