diff options
Diffstat (limited to 'protocols/oscar/admin.c')
-rw-r--r-- | protocols/oscar/admin.c | 58 |
1 files changed, 34 insertions, 24 deletions
diff --git a/protocols/oscar/admin.c b/protocols/oscar/admin.c index 09082c5b..b317529b 100644 --- a/protocols/oscar/admin.c +++ b/protocols/oscar/admin.c @@ -27,17 +27,20 @@ static int infochange(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, a type = aimbs_get16(bs); len = aimbs_get16(bs); - if ((type == 0x0011) || (type == 0x0004)) + if ((type == 0x0011) || (type == 0x0004)) { str = 1; + } - if (str) - val = (guint8 *)aimbs_getstr(bs, len); - else + if (str) { + val = (guint8 *) aimbs_getstr(bs, len); + } else { val = aimbs_getraw(bs, len); + } /* XXX fix so its only called once for the entire packet */ - if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype))) + if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype))) { userfunc(sess, rx, (snac->subtype == 0x0005) ? 1 : 0, perms, type, len, val, str); + } g_free(val); @@ -48,15 +51,17 @@ static int infochange(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, a return 1; } -static int accountconfirm(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs) +static int accountconfirm(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, + aim_bstream_t *bs) { aim_rxcallback_t userfunc; guint16 status; status = aimbs_get16(bs); - if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype))) + if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype))) { return userfunc(sess, rx, status); + } return 0; } @@ -64,10 +69,11 @@ static int accountconfirm(aim_session_t *sess, aim_module_t *mod, aim_frame_t *r static int snachandler(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs) { - if ((snac->subtype == 0x0003) || (snac->subtype == 0x0005)) + if ((snac->subtype == 0x0003) || (snac->subtype == 0x0005)) { return infochange(sess, mod, rx, snac, bs); - else if (snac->subtype == 0x0007) + } else if (snac->subtype == 0x0007) { return accountconfirm(sess, mod, rx, snac, bs); + } return 0; } @@ -78,7 +84,7 @@ int admin_modfirst(aim_session_t *sess, aim_module_t *mod) mod->family = AIM_CB_FAM_ADM; mod->version = 0x0001; mod->toolid = AIM_TOOL_NEWWIN; - mod->toolversion = 0x0629; + mod->toolversion = 0x0629; mod->flags = 0; strncpy(mod->name, "admin", sizeof(mod->name)); mod->snachandler = snachandler; @@ -92,17 +98,18 @@ int aim_admin_changepasswd(aim_session_t *sess, aim_conn_t *conn, const char *ne aim_tlvlist_t *tl = NULL; aim_snacid_t snacid; - if (!(tx = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10+4+strlen(curpw)+4+strlen(newpw)))) + if (!(tx = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10 + 4 + strlen(curpw) + 4 + strlen(newpw)))) { return -ENOMEM; + } snacid = aim_cachesnac(sess, 0x0007, 0x0004, 0x0000, NULL, 0); aim_putsnac(&tx->data, 0x0007, 0x0004, 0x0000, snacid); /* new password TLV t(0002) */ - aim_addtlvtochain_raw(&tl, 0x0002, strlen(newpw), (guint8 *)newpw); + aim_addtlvtochain_raw(&tl, 0x0002, strlen(newpw), (guint8 *) newpw); /* current password TLV t(0012) */ - aim_addtlvtochain_raw(&tl, 0x0012, strlen(curpw), (guint8 *)curpw); + aim_addtlvtochain_raw(&tl, 0x0012, strlen(curpw), (guint8 *) curpw); aim_writetlvchain(&tx->data, &tl); aim_freetlvchain(&tl); @@ -113,7 +120,7 @@ int aim_admin_changepasswd(aim_session_t *sess, aim_conn_t *conn, const char *ne } /* - * Request account confirmation. + * Request account confirmation. * * This will cause an email to be sent to the address associated with * the account. By following the instructions in the mail, you can @@ -130,14 +137,15 @@ int aim_admin_reqconfirm(aim_session_t *sess, aim_conn_t *conn) * * The only known valid tag is 0x0011 (email address). * - */ + */ int aim_admin_getinfo(aim_session_t *sess, aim_conn_t *conn, guint16 info) { aim_frame_t *tx; aim_snacid_t snacid; - if (!(tx = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 14))) + if (!(tx = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 14))) { return -ENOMEM; + } snacid = aim_cachesnac(sess, 0x0002, 0x0002, 0x0000, NULL, 0); aim_putsnac(&tx->data, 0x0007, 0x0002, 0x0000, snacid); @@ -156,17 +164,18 @@ int aim_admin_setemail(aim_session_t *sess, aim_conn_t *conn, const char *newema aim_snacid_t snacid; aim_tlvlist_t *tl = NULL; - if (!(tx = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10+2+2+strlen(newemail)))) + if (!(tx = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10 + 2 + 2 + strlen(newemail)))) { return -ENOMEM; + } snacid = aim_cachesnac(sess, 0x0007, 0x0004, 0x0000, NULL, 0); aim_putsnac(&tx->data, 0x0007, 0x0004, 0x0000, snacid); - aim_addtlvtochain_raw(&tl, 0x0011, strlen(newemail), (guint8 *)newemail); - + aim_addtlvtochain_raw(&tl, 0x0011, strlen(newemail), (guint8 *) newemail); + aim_writetlvchain(&tx->data, &tl); aim_freetlvchain(&tl); - + aim_tx_enqueue(sess, tx); return 0; @@ -178,17 +187,18 @@ int aim_admin_setnick(aim_session_t *sess, aim_conn_t *conn, const char *newnick aim_snacid_t snacid; aim_tlvlist_t *tl = NULL; - if (!(tx = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10+2+2+strlen(newnick)))) + if (!(tx = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10 + 2 + 2 + strlen(newnick)))) { return -ENOMEM; + } snacid = aim_cachesnac(sess, 0x0007, 0x0004, 0x0000, NULL, 0); aim_putsnac(&tx->data, 0x0007, 0x0004, 0x0000, snacid); - aim_addtlvtochain_raw(&tl, 0x0001, strlen(newnick), (guint8 *)newnick); - + aim_addtlvtochain_raw(&tl, 0x0001, strlen(newnick), (guint8 *) newnick); + aim_writetlvchain(&tx->data, &tl); aim_freetlvchain(&tl); - + aim_tx_enqueue(sess, tx); |