# HG changeset patch # User Mark Doliner # Date 1165046625 0 # Node ID f3573d941d662351be71f7501650a7b1e1cb3768 # Parent e0d70bba8290777ad16099948257646c2a5cd5e6 [gaim-migrate @ 17871] Minor cleanup. Mostly make some functions void instead of int where the return value was always 0 and wasn't used committer: Tailor Script diff -r e0d70bba8290 -r f3573d941d66 libgaim/protocols/oscar/family_admin.c --- a/libgaim/protocols/oscar/family_admin.c Sat Dec 02 03:12:57 2006 +0000 +++ b/libgaim/protocols/oscar/family_admin.c Sat Dec 02 08:03:45 2006 +0000 @@ -207,10 +207,10 @@ * get the TRIAL flag removed from your account. * */ -int +void aim_admin_reqconfirm(OscarData *od, FlapConnection *conn) { - return aim_genericreq_n(od, conn, 0x0007, 0x0006); + aim_genericreq_n(od, conn, 0x0007, 0x0006); } /* diff -r e0d70bba8290 -r f3573d941d66 libgaim/protocols/oscar/family_advert.c --- a/libgaim/protocols/oscar/family_advert.c Sat Dec 02 03:12:57 2006 +0000 +++ b/libgaim/protocols/oscar/family_advert.c Sat Dec 02 08:03:45 2006 +0000 @@ -25,9 +25,10 @@ #include "oscar.h" -int aim_ads_requestads(OscarData *od, FlapConnection *conn) +void +aim_ads_requestads(OscarData *od, FlapConnection *conn) { - return aim_genericreq_n(od, conn, 0x0005, 0x0002); + aim_genericreq_n(od, conn, 0x0005, 0x0002); } static int snachandler(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *rx, aim_modsnac_t *snac, ByteStream *bs) diff -r e0d70bba8290 -r f3573d941d66 libgaim/protocols/oscar/family_bos.c --- a/libgaim/protocols/oscar/family_bos.c Sat Dec 02 03:12:57 2006 +0000 +++ b/libgaim/protocols/oscar/family_bos.c Sat Dec 02 08:03:45 2006 +0000 @@ -78,9 +78,10 @@ * a bitwise OR of all the user classes you want to see you. * */ -int aim_bos_setgroupperm(OscarData *od, FlapConnection *conn, guint32 mask) +void +aim_bos_setgroupperm(OscarData *od, FlapConnection *conn, guint32 mask) { - return aim_genericreq_l(od, conn, 0x0009, 0x0004, &mask); + aim_genericreq_l(od, conn, 0x0009, 0x0004, &mask); } /* diff -r e0d70bba8290 -r f3573d941d66 libgaim/protocols/oscar/family_feedbag.c --- a/libgaim/protocols/oscar/family_feedbag.c Sat Dec 02 03:12:57 2006 +0000 +++ b/libgaim/protocols/oscar/family_feedbag.c Sat Dec 02 08:03:45 2006 +0000 @@ -1350,7 +1350,9 @@ if (!od || !(conn = flap_connection_findbygroup(od, SNAC_FAMILY_FEEDBAG))) return -EINVAL; - return aim_genericreq_n(od, conn, SNAC_FAMILY_FEEDBAG, 0x0007); + aim_genericreq_n(od, conn, SNAC_FAMILY_FEEDBAG, 0x0007); + + return 0; } /* @@ -1694,7 +1696,9 @@ if (!od || !(conn = flap_connection_findbygroup(od, SNAC_FAMILY_FEEDBAG))) return -EINVAL; - return aim_genericreq_n(od, conn, SNAC_FAMILY_FEEDBAG, SNAC_SUBTYPE_FEEDBAG_EDITSTART); + aim_genericreq_n(od, conn, SNAC_FAMILY_FEEDBAG, SNAC_SUBTYPE_FEEDBAG_EDITSTART); + + return 0; } /* @@ -1710,7 +1714,9 @@ if (!od || !(conn = flap_connection_findbygroup(od, SNAC_FAMILY_FEEDBAG))) return -EINVAL; - return aim_genericreq_n(od, conn, SNAC_FAMILY_FEEDBAG, SNAC_SUBTYPE_FEEDBAG_EDITSTOP); + aim_genericreq_n(od, conn, SNAC_FAMILY_FEEDBAG, SNAC_SUBTYPE_FEEDBAG_EDITSTOP); + + return 0; } /* diff -r e0d70bba8290 -r f3573d941d66 libgaim/protocols/oscar/family_oservice.c --- a/libgaim/protocols/oscar/family_oservice.c Sat Dec 02 03:12:57 2006 +0000 +++ b/libgaim/protocols/oscar/family_oservice.c Sat Dec 02 08:03:45 2006 +0000 @@ -93,19 +93,20 @@ * give it. * */ - aim_setversions(od, conn); + aim_srv_setversions(od, conn); return 1; } /* Subtype 0x0004 - Service request */ -int aim_reqservice(OscarData *od, guint16 serviceid) +void +aim_srv_requestnew(OscarData *od, guint16 serviceid) { FlapConnection *conn; conn = flap_connection_findbygroup(od, SNAC_FAMILY_BOS); - return aim_genericreq_s(od, conn, 0x0001, 0x0004, &serviceid); + aim_genericreq_s(od, conn, 0x0001, 0x0004, &serviceid); } /* @@ -205,7 +206,7 @@ /* Subtype 0x0006 - Request Rate Information. */ void -aim_reqrates(OscarData *od, FlapConnection *conn) +aim_srv_reqrates(OscarData *od, FlapConnection *conn) { aim_genericreq_n_snacid(od, conn, 0x0001, 0x0006); } @@ -256,6 +257,9 @@ * system is how the actual numbers relate to the passing of time. This * seems to be a big mystery. * + * See joscar's javadoc for the RateClassInfo class for a great + * explanation. You might be able to find it at + * http://dscoder.com/RateClassInfo.html */ static void @@ -383,7 +387,7 @@ * Last step in the conn init procedure is to acknowledge that we * agree to these draconian limitations. */ - aim_rates_addparam(od, conn); + aim_srv_rates_addparam(od, conn); /* * Finally, tell the client it's ready to go... @@ -396,7 +400,7 @@ /* Subtype 0x0008 - Add Rate Parameter */ void -aim_rates_addparam(OscarData *od, FlapConnection *conn) +aim_srv_rates_addparam(OscarData *od, FlapConnection *conn) { FlapFrame *frame; aim_snacid_t snacid; @@ -415,7 +419,7 @@ /* Subtype 0x0009 - Delete Rate Parameter */ void -aim_rates_delparam(OscarData *od, FlapConnection *conn) +aim_srv_rates_delparam(OscarData *od, FlapConnection *conn) { FlapFrame *frame; aim_snacid_t snacid; @@ -487,7 +491,7 @@ /* * Subtype 0x000c - Service Pause Acknowledgement * - * It is rather important that aim_sendpauseack() gets called for the exact + * It is rather important that aim_srv_sendpauseack() gets called for the exact * same connection that the Server Pause callback was called for, since * libfaim extracts the data for the SNAC from the connection structure. * @@ -496,7 +500,7 @@ * */ void -aim_sendpauseack(OscarData *od, FlapConnection *conn) +aim_srv_sendpauseack(OscarData *od, FlapConnection *conn) { FlapFrame *frame; aim_snacid_t snacid; @@ -533,7 +537,7 @@ /* Subtype 0x000e - Request self-info */ void -aim_reqpersonalinfo(OscarData *od, FlapConnection *conn) +aim_srv_reqpersonalinfo(OscarData *od, FlapConnection *conn) { aim_genericreq_n_snacid(od, conn, 0x0001, 0x000e); } @@ -589,15 +593,13 @@ * call it again with zero when you're back. * */ -int +void aim_srv_setidle(OscarData *od, guint32 idletime) { FlapConnection *conn; - if (!od || !(conn = flap_connection_findbygroup(od, SNAC_FAMILY_BOS))) - return -EINVAL; - - return aim_genericreq_l(od, conn, 0x0001, 0x0011, &idletime); + conn = flap_connection_findbygroup(od, SNAC_FAMILY_BOS); + aim_genericreq_l(od, conn, 0x0001, 0x0011, &idletime); } /* @@ -703,10 +705,10 @@ * Bit 2: Allows other AIM users to see how long you've been a member. * */ -int -aim_bos_setprivacyflags(OscarData *od, FlapConnection *conn, guint32 flags) +void +aim_srv_setprivacyflags(OscarData *od, FlapConnection *conn, guint32 flags) { - return aim_genericreq_l(od, conn, 0x0001, 0x0014, &flags); + aim_genericreq_l(od, conn, 0x0001, 0x0014, &flags); } /* @@ -718,10 +720,10 @@ * Wha? No? Since when? I think WinAIM sends an empty channel 5 * FLAP as a no-op... */ -int -aim_nop(OscarData *od, FlapConnection *conn) +void +aim_srv_nop(OscarData *od, FlapConnection *conn) { - return aim_genericreq_n(od, conn, 0x0001, 0x0016); + aim_genericreq_n(od, conn, 0x0001, 0x0016); } /* @@ -738,7 +740,7 @@ * */ void -aim_setversions(OscarData *od, FlapConnection *conn) +aim_srv_setversions(OscarData *od, FlapConnection *conn) { FlapFrame *frame; aim_snacid_t snacid; @@ -782,7 +784,7 @@ /* * Now request rates. */ - aim_reqrates(od, conn); + aim_srv_reqrates(od, conn); return 1; } @@ -805,7 +807,7 @@ * TODO: Combine this with the function below. */ int -aim_setextstatus(OscarData *od, guint32 status) +aim_srv_setextstatus(OscarData *od, guint32 status) { FlapConnection *conn; FlapFrame *frame; diff -r e0d70bba8290 -r f3573d941d66 libgaim/protocols/oscar/flap_connection.c --- a/libgaim/protocols/oscar/flap_connection.c Sat Dec 02 03:12:57 2006 +0000 +++ b/libgaim/protocols/oscar/flap_connection.c Sat Dec 02 08:03:45 2006 +0000 @@ -681,6 +681,8 @@ break; } + /* TODO: Verify the sequence number sent by the server. */ + /* Initialize a new temporary FlapFrame for incoming data */ conn->buffer_incoming.channel = aimutil_get8(&header[1]); conn->buffer_incoming.seqnum = aimutil_get16(&header[2]); diff -r e0d70bba8290 -r f3573d941d66 libgaim/protocols/oscar/misc.c --- a/libgaim/protocols/oscar/misc.c Sat Dec 02 03:12:57 2006 +0000 +++ b/libgaim/protocols/oscar/misc.c Sat Dec 02 08:03:45 2006 +0000 @@ -36,7 +36,7 @@ * back to the single. I don't see any advantage to doing it either way. * */ -int +void aim_genericreq_n(OscarData *od, FlapConnection *conn, guint16 family, guint16 subtype) { FlapFrame *frame; @@ -47,8 +47,6 @@ aim_putsnac(&frame->data, family, subtype, 0x0000, snacid); flap_connection_send(conn, frame); - - return 0; } void @@ -65,7 +63,7 @@ flap_connection_send(conn, frame); } -int +void aim_genericreq_l(OscarData *od, FlapConnection *conn, guint16 family, guint16 subtype, guint32 *longdata) { FlapFrame *frame; @@ -82,11 +80,9 @@ byte_stream_put32(&frame->data, *longdata); flap_connection_send(conn, frame); - - return 0; } -int +void aim_genericreq_s(OscarData *od, FlapConnection *conn, guint16 family, guint16 subtype, guint16 *shortdata) { FlapFrame *frame; @@ -103,8 +99,6 @@ byte_stream_put16(&frame->data, *shortdata); flap_connection_send(conn, frame); - - return 0; } /* diff -r e0d70bba8290 -r f3573d941d66 libgaim/protocols/oscar/oscar.c --- a/libgaim/protocols/oscar/oscar.c Sat Dec 02 03:12:57 2006 +0000 +++ b/libgaim/protocols/oscar/oscar.c Sat Dec 02 08:03:45 2006 +0000 @@ -1000,7 +1000,7 @@ { GaimConnection *gc = od->gc; - aim_reqpersonalinfo(od, conn); + aim_srv_reqpersonalinfo(od, conn); gaim_debug_info("oscar", "ssi: requesting rights and list\n"); aim_ssi_reqrights(od); @@ -3202,7 +3202,7 @@ conn = flap_connection_getbytype(od, SNAC_FAMILY_BART); if (!conn) { if (!od->iconconnecting) { - aim_reqservice(od, SNAC_FAMILY_BART); + aim_srv_requestnew(od, SNAC_FAMILY_BART); od->iconconnecting = TRUE; } return FALSE; @@ -3527,7 +3527,7 @@ gaim_account_get_bool(account, "web_aware", OSCAR_DEFAULT_WEB_AWARE)); } - aim_reqservice(od, SNAC_FAMILY_CHATNAV); + aim_srv_requestnew(od, SNAC_FAMILY_CHATNAV); /* * The "if" statement here is a pathetic attempt to not attempt to @@ -3539,7 +3539,7 @@ * of an annoying error at signon for @anythingelse.com accounts. */ if ((od->authinfo->email != NULL) && ((strchr(gc->account->username, '@') == NULL))) - aim_reqservice(od, SNAC_FAMILY_ALERT); + aim_srv_requestnew(od, SNAC_FAMILY_ALERT); return 1; } @@ -4299,7 +4299,7 @@ else if (!strcmp(status_id, OSCAR_STATUS_ID_CUSTOM)) data |= AIM_ICQ_STATE_OUT | AIM_ICQ_STATE_AWAY; - aim_setextstatus(od, data); + aim_srv_setextstatus(od, data); } static void @@ -5174,7 +5174,7 @@ cr->exchange = atoi(exchange); cr->name = g_strdup(name); od->create_rooms = g_slist_prepend(od->create_rooms, cr); - aim_reqservice(od, SNAC_FAMILY_CHATNAV); + aim_srv_requestnew(od, SNAC_FAMILY_CHATNAV); } } @@ -5493,7 +5493,7 @@ if (!flap_connection_getbytype(od, SNAC_FAMILY_BART) && !od->iconconnecting) { od->iconconnecting = TRUE; od->set_icon = TRUE; - aim_reqservice(od, SNAC_FAMILY_BART); + aim_srv_requestnew(od, SNAC_FAMILY_BART); } else { struct stat st; char *iconfile = gaim_buddy_icons_get_full_path(gaim_account_get_buddy_icon(gaim_connection_get_account(gc))); @@ -5935,7 +5935,7 @@ if (!flap_connection_getbytype(od, SNAC_FAMILY_ADMIN)) { od->setnick = TRUE; od->newsn = g_strdup(nick); - aim_reqservice(od, SNAC_FAMILY_ADMIN); + aim_srv_requestnew(od, SNAC_FAMILY_ADMIN); } else { aim_admin_setnick(od, flap_connection_getbytype(od, SNAC_FAMILY_ADMIN), nick); } @@ -5969,7 +5969,7 @@ aim_admin_reqconfirm(od, conn); } else { od->conf = TRUE; - aim_reqservice(od, SNAC_FAMILY_ADMIN); + aim_srv_requestnew(od, SNAC_FAMILY_ADMIN); } } @@ -5983,7 +5983,7 @@ aim_admin_getinfo(od, conn, 0x11); } else { od->reqemail = TRUE; - aim_reqservice(od, SNAC_FAMILY_ADMIN); + aim_srv_requestnew(od, SNAC_FAMILY_ADMIN); } } @@ -5997,7 +5997,7 @@ } else { od->setemail = TRUE; od->email = g_strdup(email); - aim_reqservice(od, SNAC_FAMILY_ADMIN); + aim_srv_requestnew(od, SNAC_FAMILY_ADMIN); } } @@ -6328,7 +6328,7 @@ od->chpass = TRUE; od->oldp = g_strdup(old); od->newp = g_strdup(new); - aim_reqservice(od, SNAC_FAMILY_ADMIN); + aim_srv_requestnew(od, SNAC_FAMILY_ADMIN); } } } diff -r e0d70bba8290 -r f3573d941d66 libgaim/protocols/oscar/oscar.h --- a/libgaim/protocols/oscar/oscar.h Sat Dec 02 03:12:57 2006 +0000 +++ b/libgaim/protocols/oscar/oscar.h Sat Dec 02 08:03:45 2006 +0000 @@ -63,7 +63,6 @@ typedef struct _IcbmArgsCh2 IcbmArgsCh2; typedef guint32 aim_snacid_t; -typedef guint16 flap_seqnum_t; #include "snactypes.h" @@ -355,7 +354,7 @@ struct _FlapFrame { guint8 channel; - flap_seqnum_t seqnum; + guint16 seqnum; ByteStream data; /* payload stream */ }; @@ -382,7 +381,7 @@ guint16 type; guint16 subtype; - flap_seqnum_t seqnum; + guint16 seqnum; /**< The sequence number of most recent outgoing packet. */ guint32 status; GSList *groups; struct rateclass *rates; @@ -585,16 +584,10 @@ void flap_connection_send_keepalive(OscarData *od, FlapConnection *conn); FlapFrame *flap_frame_new(OscarData *od, guint16 channel, int datalen); - OscarData *oscar_data_new(void); void oscar_data_destroy(OscarData *); -/* 0x0001 - family_oservice.c */ -int aim_srv_setstatusmsg(OscarData *od, const char *msg); -int aim_srv_setidle(OscarData *od, guint32 idletime); - /* misc.c */ - #define AIM_VISIBILITYCHANGE_PERMITADD 0x05 #define AIM_VISIBILITYCHANGE_PERMITREMOVE 0x06 #define AIM_VISIBILITYCHANGE_DENYADD 0x07 @@ -605,14 +598,28 @@ #define AIM_WARN_ANON 0x01 -int aim_nop(OscarData *, FlapConnection *); -int aim_bos_changevisibility(OscarData *, FlapConnection *, int, const char *); -int aim_bos_setgroupperm(OscarData *, FlapConnection *, guint32 mask); -int aim_bos_setprivacyflags(OscarData *, FlapConnection *, guint32); -void aim_reqpersonalinfo(OscarData *, FlapConnection *); -int aim_reqservice(OscarData *, guint16); -void aim_bos_reqrights(OscarData *, FlapConnection *); -int aim_setextstatus(OscarData *od, guint32 status); + + +/* 0x0001 - family_oservice.c */ +/* 0x0004 */ void aim_srv_requestnew(OscarData *od, guint16 serviceid); +/* 0x0006 */ void aim_srv_reqrates(OscarData *od, FlapConnection *conn); +/* 0x0008 */ void aim_srv_rates_addparam(OscarData *od, FlapConnection *conn); +/* 0x0009 */ void aim_srv_rates_delparam(OscarData *od, FlapConnection *conn); +/* 0x000c */ void aim_srv_sendpauseack(OscarData *od, FlapConnection *conn); +/* 0x000e */ void aim_srv_reqpersonalinfo(OscarData *od, FlapConnection *conn); +/* 0x0011 */ void aim_srv_setidle(OscarData *od, guint32 idletime); +/* 0x0014 */ void aim_srv_setprivacyflags(OscarData *od, FlapConnection *conn, guint32); +/* 0x0016 */ void aim_srv_nop(OscarData *od, FlapConnection *conn); +/* 0x0017 */ void aim_srv_setversions(OscarData *od, FlapConnection *conn); +/* 0x001e */ int aim_srv_setstatusmsg(OscarData *od, const char *msg); +/* 0x001e */ int aim_srv_setextstatus(OscarData *od, guint32 status); + + +void aim_bos_reqrights(OscarData *od, FlapConnection *conn); +int aim_bos_changevisibility(OscarData *od, FlapConnection *conn, int, const char *); +void aim_bos_setgroupperm(OscarData *od, FlapConnection *conn, guint32 mask); + + #define AIM_CLIENTTYPE_UNKNOWN 0x0000 #define AIM_CLIENTTYPE_MC 0x0001 @@ -625,7 +632,7 @@ #define AIM_RATE_CODE_WARNING 0x0002 #define AIM_RATE_CODE_LIMIT 0x0003 #define AIM_RATE_CODE_CLEARLIMIT 0x0004 -int aim_ads_requestads(OscarData *od, FlapConnection *conn); +void aim_ads_requestads(OscarData *od, FlapConnection *conn); @@ -1292,7 +1299,7 @@ /* 0x0017 - family_auth.c */ void aim_sendcookie(OscarData *, FlapConnection *, const guint16 length, const guint8 *); int aim_admin_changepasswd(OscarData *, FlapConnection *, const char *newpw, const char *curpw); -int aim_admin_reqconfirm(OscarData *od, FlapConnection *conn); +void aim_admin_reqconfirm(OscarData *od, FlapConnection *conn); int aim_admin_getinfo(OscarData *od, FlapConnection *conn, guint16 info); int aim_admin_setemail(OscarData *od, FlapConnection *conn, const char *newemail); int aim_admin_setnick(OscarData *od, FlapConnection *conn, const char *newnick); @@ -1489,10 +1496,10 @@ int icq_modfirst(OscarData *od, aim_module_t *mod); int email_modfirst(OscarData *od, aim_module_t *mod); -int aim_genericreq_n(OscarData *, FlapConnection *conn, guint16 family, guint16 subtype); -void aim_genericreq_n_snacid(OscarData *, FlapConnection *conn, guint16 family, guint16 subtype); -int aim_genericreq_l(OscarData *, FlapConnection *conn, guint16 family, guint16 subtype, guint32 *); -int aim_genericreq_s(OscarData *, FlapConnection *conn, guint16 family, guint16 subtype, guint16 *); +void aim_genericreq_n(OscarData *od, FlapConnection *conn, guint16 family, guint16 subtype); +void aim_genericreq_n_snacid(OscarData *od, FlapConnection *conn, guint16 family, guint16 subtype); +void aim_genericreq_l(OscarData *od, FlapConnection *conn, guint16 family, guint16 subtype, guint32 *); +void aim_genericreq_s(OscarData *od, FlapConnection *conn, guint16 family, guint16 subtype, guint16 *); /* bstream.c */ int byte_stream_init(ByteStream *bs, guint8 *data, int len); @@ -1582,17 +1589,6 @@ void flap_connection_destroy_chat(OscarData *od, FlapConnection *conn); -/* These are all handled internally now. */ -void aim_setversions(OscarData *od, FlapConnection *conn); -void aim_reqrates(OscarData *, FlapConnection *); -void aim_rates_addparam(OscarData *, FlapConnection *); -void aim_rates_delparam(OscarData *, FlapConnection *); -void aim_sendpauseack(OscarData *od, FlapConnection *conn); - - - - - #ifdef __cplusplus } #endif