Mercurial > pidgin.yaz
diff src/protocols/oscar/family_admin.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 | e9289db48a5d |
line wrap: on
line diff
--- a/src/protocols/oscar/family_admin.c Fri Apr 07 01:05:48 2006 +0000 +++ b/src/protocols/oscar/family_admin.c Fri Apr 07 05:10:56 2006 +0000 @@ -37,21 +37,21 @@ * 0x0013 - Unknown * */ -faim_export int aim_admin_getinfo(OscarSession *sess, OscarConnection *conn, guint16 info) +int +aim_admin_getinfo(OscarData *od, FlapConnection *conn, guint16 info) { FlapFrame *fr; aim_snacid_t snacid; - if (!(fr = flap_frame_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 14))) - return -ENOMEM; + fr = flap_frame_new(od, 0x02, 14); - snacid = aim_cachesnac(sess, 0x0007, 0x0002, 0x0000, NULL, 0); + snacid = aim_cachesnac(od, 0x0007, 0x0002, 0x0000, NULL, 0); aim_putsnac(&fr->data, 0x0007, 0x0002, 0x0000, snacid); - aimbs_put16(&fr->data, info); - aimbs_put16(&fr->data, 0x0000); + byte_stream_put16(&fr->data, info); + byte_stream_put16(&fr->data, 0x0000); - aim_tx_enqueue(sess, fr); + flap_connection_send(conn, fr); return 0; } @@ -63,48 +63,48 @@ * an information change (subtype 0x0004). * */ -static int infochange(OscarSession *sess, aim_module_t *mod, FlapFrame *rx, aim_modsnac_t *snac, ByteStream *bs) +static int +infochange(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) { aim_rxcallback_t userfunc; char *url=NULL, *sn=NULL, *email=NULL; guint16 perms, tlvcount, err=0; - perms = aimbs_get16(bs); - tlvcount = aimbs_get16(bs); + perms = byte_stream_get16(bs); + tlvcount = byte_stream_get16(bs); - while (tlvcount && aim_bstream_empty(bs)) { + while (tlvcount && byte_stream_empty(bs)) { guint16 type, length; - type = aimbs_get16(bs); - length = aimbs_get16(bs); + type = byte_stream_get16(bs); + length = byte_stream_get16(bs); switch (type) { case 0x0001: { - sn = aimbs_getstr(bs, length); + sn = byte_stream_getstr(bs, length); } break; case 0x0004: { - url = aimbs_getstr(bs, length); + url = byte_stream_getstr(bs, length); } break; case 0x0008: { - err = aimbs_get16(bs); + err = byte_stream_get16(bs); } break; case 0x0011: { - if (length == 0) { - email = (char*)malloc(13*sizeof(char)); - strcpy(email, "*suppressed*"); - } else - email = aimbs_getstr(bs, length); + if (length == 0) + email = g_strdup("*suppressed"); + else + email = byte_stream_getstr(bs, length); } break; } tlvcount--; } - if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype))) - userfunc(sess, rx, (snac->subtype == 0x0005) ? 1 : 0, perms, err, url, sn, email); + if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) + userfunc(od, conn, frame, (snac->subtype == 0x0005) ? 1 : 0, perms, err, url, sn, email); free(sn); free(url); @@ -117,16 +117,17 @@ * Subtype 0x0004 - Set screenname formatting. * */ -faim_export int aim_admin_setnick(OscarSession *sess, OscarConnection *conn, const char *newnick) +int +aim_admin_setnick(OscarData *od, FlapConnection *conn, const char *newnick) { FlapFrame *fr; aim_snacid_t snacid; aim_tlvlist_t *tl = NULL; - if (!(fr = flap_frame_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10+2+2+strlen(newnick)))) + fr = flap_frame_new(od, 0x02, 10+2+2+strlen(newnick)); return -ENOMEM; - snacid = aim_cachesnac(sess, 0x0007, 0x0004, 0x0000, NULL, 0); + snacid = aim_cachesnac(od, 0x0007, 0x0004, 0x0000, NULL, 0); aim_putsnac(&fr->data, 0x0007, 0x0004, 0x0000, snacid); aim_tlvlist_add_str(&tl, 0x0001, newnick); @@ -134,7 +135,7 @@ aim_tlvlist_write(&fr->data, &tl); aim_tlvlist_free(&tl); - aim_tx_enqueue(sess, fr); + flap_connection_send(conn, fr); return 0; @@ -144,16 +145,16 @@ * Subtype 0x0004 - Change password. * */ -faim_export int aim_admin_changepasswd(OscarSession *sess, OscarConnection *conn, const char *newpw, const char *curpw) +int +aim_admin_changepasswd(OscarData *od, FlapConnection *conn, const char *newpw, const char *curpw) { FlapFrame *fr; aim_tlvlist_t *tl = NULL; aim_snacid_t snacid; - if (!(fr = flap_frame_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10+4+strlen(curpw)+4+strlen(newpw)))) - return -ENOMEM; + fr = flap_frame_new(od, 0x02, 10+4+strlen(curpw)+4+strlen(newpw)); - snacid = aim_cachesnac(sess, 0x0007, 0x0004, 0x0000, NULL, 0); + snacid = aim_cachesnac(od, 0x0007, 0x0004, 0x0000, NULL, 0); aim_putsnac(&fr->data, 0x0007, 0x0004, 0x0000, snacid); /* new password TLV t(0002) */ @@ -165,7 +166,7 @@ aim_tlvlist_write(&fr->data, &tl); aim_tlvlist_free(&tl); - aim_tx_enqueue(sess, fr); + flap_connection_send(conn, fr); return 0; } @@ -174,16 +175,16 @@ * Subtype 0x0004 - Change email address. * */ -faim_export int aim_admin_setemail(OscarSession *sess, OscarConnection *conn, const char *newemail) +int +aim_admin_setemail(OscarData *od, FlapConnection *conn, const char *newemail) { FlapFrame *fr; aim_snacid_t snacid; aim_tlvlist_t *tl = NULL; - if (!(fr = flap_frame_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10+2+2+strlen(newemail)))) - return -ENOMEM; + flap_frame_new(od, 0x02, 10+2+2+strlen(newemail)); - snacid = aim_cachesnac(sess, 0x0007, 0x0004, 0x0000, NULL, 0); + snacid = aim_cachesnac(od, 0x0007, 0x0004, 0x0000, NULL, 0); aim_putsnac(&fr->data, 0x0007, 0x0004, 0x0000, snacid); aim_tlvlist_add_str(&tl, 0x0011, newemail); @@ -191,7 +192,7 @@ aim_tlvlist_write(&fr->data, &tl); aim_tlvlist_free(&tl); - aim_tx_enqueue(sess, fr); + flap_connection_send(conn, fr); return 0; } @@ -204,47 +205,48 @@ * get the TRIAL flag removed from your account. * */ -faim_export int aim_admin_reqconfirm(OscarSession *sess, OscarConnection *conn) +int +aim_admin_reqconfirm(OscarData *od, FlapConnection *conn) { - return aim_genericreq_n(sess, conn, 0x0007, 0x0006); + return aim_genericreq_n(od, conn, 0x0007, 0x0006); } /* * Subtype 0x0007 - Account confirmation request acknowledgement. * */ -static int accountconfirm(OscarSession *sess, aim_module_t *mod, FlapFrame *rx, aim_modsnac_t *snac, ByteStream *bs) +static int +accountconfirm(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) { int ret = 0; aim_rxcallback_t userfunc; guint16 status; aim_tlvlist_t *tl; - status = aimbs_get16(bs); + status = byte_stream_get16(bs); /* This is 0x0013 if unable to confirm at this time */ tl = aim_tlvlist_read(bs); - if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype))) - ret = userfunc(sess, rx, status); + if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) + ret = userfunc(od, conn, frame, status); 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) || (snac->subtype == 0x0005)) - return infochange(sess, mod, rx, snac, bs); + return infochange(od, conn, mod, frame, snac, bs); else if (snac->subtype == 0x0007) - return accountconfirm(sess, mod, rx, snac, bs); + return accountconfirm(od, conn, mod, frame, snac, bs); return 0; } -faim_internal int admin_modfirst(OscarSession *sess, aim_module_t *mod) +int admin_modfirst(OscarData *od, aim_module_t *mod) { - mod->family = 0x0007; mod->version = 0x0001; mod->toolid = 0x0010;