Mercurial > pidgin.yaz
changeset 13609:5796551db930
[gaim-migrate @ 15995]
Inline FlapConnection->inside and change some functions to return
void instead of a meaningless int
committer: Tailor Script <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Mon, 10 Apr 2006 03:53:05 +0000 |
parents | 6c34fbb75bbd |
children | 060835af7634 |
files | src/protocols/oscar/family_bos.c src/protocols/oscar/family_buddy.c src/protocols/oscar/family_chatnav.c src/protocols/oscar/family_feedbag.c src/protocols/oscar/family_icbm.c src/protocols/oscar/family_locate.c src/protocols/oscar/family_oservice.c src/protocols/oscar/flap_connection.c src/protocols/oscar/misc.c src/protocols/oscar/oscar.h |
diffstat | 10 files changed, 57 insertions(+), 106 deletions(-) [+] |
line wrap: on
line diff
--- a/src/protocols/oscar/family_bos.c Mon Apr 10 03:37:37 2006 +0000 +++ b/src/protocols/oscar/family_bos.c Mon Apr 10 03:53:05 2006 +0000 @@ -29,9 +29,10 @@ #include <string.h> /* Subtype 0x0002 - Request BOS rights. */ -int aim_bos_reqrights(OscarData *od, FlapConnection *conn) +void +aim_bos_reqrights(OscarData *od, FlapConnection *conn) { - return aim_genericreq_n_snacid(od, conn, 0x0009, 0x0002); + aim_genericreq_n_snacid(od, conn, 0x0009, 0x0002); } /* Subtype 0x0003 - BOS Rights. */
--- a/src/protocols/oscar/family_buddy.c Mon Apr 10 03:37:37 2006 +0000 +++ b/src/protocols/oscar/family_buddy.c Mon Apr 10 03:53:05 2006 +0000 @@ -33,10 +33,10 @@ * Request Buddy List rights. * */ -int +void aim_buddylist_reqrights(OscarData *od, FlapConnection *conn) { - return aim_genericreq_n_snacid(od, conn, 0x0003, 0x0002); + aim_genericreq_n_snacid(od, conn, 0x0003, 0x0002); } /*
--- a/src/protocols/oscar/family_chatnav.c Mon Apr 10 03:37:37 2006 +0000 +++ b/src/protocols/oscar/family_chatnav.c Mon Apr 10 03:53:05 2006 +0000 @@ -35,9 +35,9 @@ * conn must be a chatnav connection! * */ -int aim_chatnav_reqrights(OscarData *od, FlapConnection *conn) +void aim_chatnav_reqrights(OscarData *od, FlapConnection *conn) { - return aim_genericreq_n_snacid(od, conn, 0x000d, 0x0002); + aim_genericreq_n_snacid(od, conn, 0x000d, 0x0002); } /*
--- a/src/protocols/oscar/family_feedbag.c Mon Apr 10 03:37:37 2006 +0000 +++ b/src/protocols/oscar/family_feedbag.c Mon Apr 10 03:53:05 2006 +0000 @@ -1168,7 +1168,9 @@ if (!od || !(conn = flap_connection_findbygroup(od, SNAC_FAMILY_FEEDBAG))) return -EINVAL; - return aim_genericreq_n_snacid(od, conn, SNAC_FAMILY_FEEDBAG, SNAC_SUBTYPE_FEEDBAG_REQRIGHTS); + aim_genericreq_n_snacid(od, conn, SNAC_FAMILY_FEEDBAG, SNAC_SUBTYPE_FEEDBAG_REQRIGHTS); + + return 0; } /* @@ -1223,7 +1225,9 @@ /* Free any current data, just in case */ aim_ssi_freelist(od); - return aim_genericreq_n_snacid(od, conn, SNAC_FAMILY_FEEDBAG, SNAC_SUBTYPE_FEEDBAG_REQDATA); + aim_genericreq_n_snacid(od, conn, SNAC_FAMILY_FEEDBAG, SNAC_SUBTYPE_FEEDBAG_REQDATA); + + return 0; } /*
--- a/src/protocols/oscar/family_icbm.c Mon Apr 10 03:37:37 2006 +0000 +++ b/src/protocols/oscar/family_icbm.c Mon Apr 10 03:53:05 2006 +0000 @@ -198,7 +198,9 @@ if (!od || !(conn = flap_connection_findbygroup(od, 0x0004))) return -EINVAL; - return aim_genericreq_n_snacid(od, conn, 0x0004, 0x0004); + aim_genericreq_n_snacid(od, conn, 0x0004, 0x0004); + + return 0; } /**
--- a/src/protocols/oscar/family_locate.c Mon Apr 10 03:37:37 2006 +0000 +++ b/src/protocols/oscar/family_locate.c Mon Apr 10 03:53:05 2006 +0000 @@ -998,7 +998,9 @@ if (!od || !(conn = flap_connection_findbygroup(od, SNAC_FAMILY_LOCATE))) return -EINVAL; - return aim_genericreq_n_snacid(od, conn, SNAC_FAMILY_LOCATE, SNAC_SUBTYPE_LOCATE_REQRIGHTS); + aim_genericreq_n_snacid(od, conn, SNAC_FAMILY_LOCATE, SNAC_SUBTYPE_LOCATE_REQRIGHTS); + + return 0; } /*
--- a/src/protocols/oscar/family_oservice.c Mon Apr 10 03:37:37 2006 +0000 +++ b/src/protocols/oscar/family_oservice.c Mon Apr 10 03:53:05 2006 +0000 @@ -28,17 +28,13 @@ #include "cipher.h" /* Subtype 0x0002 - Client Online */ -int +void aim_clientready(OscarData *od, FlapConnection *conn) { - aim_conn_inside_t *ins = (aim_conn_inside_t *)conn->inside; struct snacgroup *sg; FlapFrame *frame; aim_snacid_t snacid; - if (!ins) - return -EINVAL; - frame = flap_frame_new(od, 0x02, 1152); snacid = aim_cachesnac(od, 0x0001, 0x0002, 0x0000, NULL, 0); @@ -48,7 +44,8 @@ * Send only the tool versions that the server cares about (that it * marked as supporting in the server ready SNAC). */ - for (sg = ins->groups; sg; sg = sg->next) { + for (sg = conn->groups; sg; sg = sg->next) + { aim_module_t *mod; if ((mod = aim__findmodulebygroup(od, sg->group))) { @@ -61,8 +58,6 @@ } flap_connection_send(conn, frame); - - return 0; } /* @@ -215,10 +210,10 @@ } /* Subtype 0x0006 - Request Rate Information. */ -int +void aim_reqrates(OscarData *od, FlapConnection *conn) { - return aim_genericreq_n_snacid(od, conn, 0x0001, 0x0006); + aim_genericreq_n_snacid(od, conn, 0x0001, 0x0006); } /* @@ -326,11 +321,9 @@ static int rateresp(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) { - aim_conn_inside_t *ins = (aim_conn_inside_t *)conn->inside; guint16 numclasses, i; aim_rxcallback_t userfunc; - /* * First are the parameters for each rate class. */ @@ -359,7 +352,7 @@ if (mod->version >= 3) byte_stream_getrawbuf(bs, rc.unknown, sizeof(rc.unknown)); - rc_addclass(&ins->rates, &rc); + rc_addclass(&conn->rates, &rc); } /* @@ -373,7 +366,7 @@ classid = byte_stream_get16(bs); count = byte_stream_get16(bs); - rc = rc_findclass(&ins->rates, classid); + rc = rc_findclass(&conn->rates, classid); for (j = 0; j < count; j++) { guint16 group, subtype; @@ -404,15 +397,13 @@ if ((userfunc = aim_callhandler(od, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNINITDONE))) userfunc(od, conn, frame); - return 1; } /* Subtype 0x0008 - Add Rate Parameter */ -int +void aim_rates_addparam(OscarData *od, FlapConnection *conn) { - aim_conn_inside_t *ins = (aim_conn_inside_t *)conn->inside; FlapFrame *frame; aim_snacid_t snacid; struct rateclass *rc; @@ -422,19 +413,16 @@ snacid = aim_cachesnac(od, 0x0001, 0x0008, 0x0000, NULL, 0); aim_putsnac(&frame->data, 0x0001, 0x0008, 0x0000, snacid); - for (rc = ins->rates; rc; rc = rc->next) + for (rc = conn->rates; rc; rc = rc->next) byte_stream_put16(&frame->data, rc->classid); flap_connection_send(conn, frame); - - return 0; } /* Subtype 0x0009 - Delete Rate Parameter */ -int +void aim_rates_delparam(OscarData *od, FlapConnection *conn) { - aim_conn_inside_t *ins = (aim_conn_inside_t *)conn->inside; FlapFrame *frame; aim_snacid_t snacid; struct rateclass *rc; @@ -444,12 +432,10 @@ snacid = aim_cachesnac(od, 0x0001, 0x0009, 0x0000, NULL, 0); aim_putsnac(&frame->data, 0x0001, 0x0009, 0x0000, snacid); - for (rc = ins->rates; rc; rc = rc->next) + for (rc = conn->rates; rc; rc = rc->next) byte_stream_put16(&frame->data, rc->classid); flap_connection_send(conn, frame); - - return 0; } /* Subtype 0x000a - Rate Change */ @@ -515,12 +501,11 @@ * libfaim can cause. * */ -int +void aim_sendpauseack(OscarData *od, FlapConnection *conn) { FlapFrame *frame; aim_snacid_t snacid; - aim_conn_inside_t *ins = (aim_conn_inside_t *)conn->inside; struct snacgroup *sg; frame = flap_frame_new(od, 0x02, 1024); @@ -533,12 +518,10 @@ * Host Online / Server Ready said this host supports. And * we want them all back after the migration. */ - for (sg = ins->groups; sg; sg = sg->next) + for (sg = conn->groups; sg; sg = sg->next) byte_stream_put16(&frame->data, sg->group); flap_connection_send(conn, frame); - - return 0; } /* Subtype 0x000d - Service Resume */ @@ -555,10 +538,10 @@ } /* Subtype 0x000e - Request self-info */ -int +void aim_reqpersonalinfo(OscarData *od, FlapConnection *conn) { - return aim_genericreq_n_snacid(od, conn, 0x0001, 0x000e); + aim_genericreq_n_snacid(od, conn, 0x0001, 0x000e); } /* Subtype 0x000f - Self User Info */ @@ -760,17 +743,13 @@ * the rate information based on what version of group 1 we advertise here. * */ -int +void aim_setversions(OscarData *od, FlapConnection *conn) { - aim_conn_inside_t *ins = (aim_conn_inside_t *)conn->inside; struct snacgroup *sg; FlapFrame *frame; aim_snacid_t snacid; - if (!ins) - return -EINVAL; - frame = flap_frame_new(od, 0x02, 1152); snacid = aim_cachesnac(od, 0x0001, 0x0017, 0x0000, NULL, 0); @@ -780,7 +759,7 @@ * Send only the versions that the server cares about (that it * marked as supporting in the server ready SNAC). */ - for (sg = ins->groups; sg; sg = sg->next) { + for (sg = conn->groups; sg; sg = sg->next) { aim_module_t *mod; if ((mod = aim__findmodulebygroup(od, sg->group))) { @@ -791,8 +770,6 @@ } flap_connection_send(conn, frame); - - return 0; } /* Subtype 0x0018 - Host versions */
--- a/src/protocols/oscar/flap_connection.c Mon Apr 10 03:37:37 2006 +0000 +++ b/src/protocols/oscar/flap_connection.c Mon Apr 10 03:53:05 2006 +0000 @@ -119,7 +119,6 @@ conn = g_new0(FlapConnection, 1); conn->od = od; conn->buffer_outgoing = gaim_circ_buffer_new(0); - conn->inside = g_new0(aim_conn_inside_t, 1); conn->fd = -1; conn->subtype = -1; conn->type = type; @@ -152,16 +151,7 @@ conn->internal = src->internal; conn->lastactivity = src->lastactivity; - if (src->inside != NULL) - { - /* - * XXX should clone this section as well, but since currently - * this function only gets called for some of that rendezvous - * crap, and not on SNAC connections, its probably okay for - * now. - * - */ - } + /* TODO: Clone groups and rates */ return conn; } @@ -253,15 +243,8 @@ if (conn->type == SNAC_FAMILY_CHAT) flap_connection_destroy_chat(od, conn); - if (conn->inside != NULL) - { - aim_conn_inside_t *inside = (aim_conn_inside_t *)conn->inside; - - flap_connection_destroy_snacgroups(inside->groups); - flap_connection_destroy_rates(inside->rates); - - free(inside); - } + flap_connection_destroy_snacgroups(conn->groups); + flap_connection_destroy_rates(conn->rates); od->oscar_connections = g_list_remove(od->oscar_connections, conn); g_free(conn); @@ -375,7 +358,6 @@ void flap_connection_addgroup(FlapConnection *conn, guint16 group) { - aim_conn_inside_t *ins = (aim_conn_inside_t *)conn->inside; struct snacgroup *sg; sg = g_new0(struct snacgroup, 1); @@ -384,8 +366,8 @@ "of type 0x%04hx\n", group, conn->type); sg->group = group; - sg->next = ins->groups; - ins->groups = sg; + sg->next = conn->groups; + conn->groups = sg; } /** @@ -402,13 +384,11 @@ for (cur = od->oscar_connections; cur != NULL; cur = cur->next) { FlapConnection *conn; - aim_conn_inside_t *ins; struct snacgroup *sg; conn = cur->data; - ins = (aim_conn_inside_t *)conn->inside; - for (sg = ins->groups; sg != NULL; sg = sg->next) + for (sg = conn->groups; sg != NULL; sg = sg->next) { if (sg->group == group) return conn;
--- a/src/protocols/oscar/misc.c Mon Apr 10 03:37:37 2006 +0000 +++ b/src/protocols/oscar/misc.c Mon Apr 10 03:53:05 2006 +0000 @@ -19,11 +19,8 @@ */ /* - * misc.c - * * Random stuff. Basically just a few functions for sending * simple SNACs, and then the generic error handler. - * */ #include "oscar.h" @@ -54,7 +51,7 @@ return 0; } -int +void aim_genericreq_n_snacid(OscarData *od, FlapConnection *conn, guint16 family, guint16 subtype) { FlapFrame *frame; @@ -66,8 +63,6 @@ aim_putsnac(&frame->data, family, subtype, 0x0000, snacid); flap_connection_send(conn, frame); - - return 0; } int
--- a/src/protocols/oscar/oscar.h Mon Apr 10 03:37:37 2006 +0000 +++ b/src/protocols/oscar/oscar.h Mon Apr 10 03:53:05 2006 +0000 @@ -376,8 +376,10 @@ guint16 subtype; flap_seqnum_t seqnum; guint32 status; + struct snacgroup *groups; + struct rateclass *rates; + void *internal; /* internal conn-specific libfaim data */ - void *inside; /* only accessible from inside libfaim */ }; struct _IcbmCookie @@ -549,7 +551,7 @@ } chat; }; -int aim_clientready(OscarData *od, FlapConnection *conn); +void aim_clientready(OscarData *od, FlapConnection *conn); int aim_request_login(OscarData *od, FlapConnection *conn, const char *sn); int aim_send_login(OscarData *, FlapConnection *, const char *, const char *, ClientInfo *, const char *key); /* 0x000b */ int aim_auth_securid_send(OscarData *od, const char *securid); @@ -596,14 +598,13 @@ #define AIM_WARN_ANON 0x01 -int aim_sendpauseack(OscarData *od, FlapConnection *conn); 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); -int aim_reqpersonalinfo(OscarData *, FlapConnection *); +void aim_reqpersonalinfo(OscarData *, FlapConnection *); int aim_reqservice(OscarData *, guint16); -int aim_bos_reqrights(OscarData *, FlapConnection *); +void aim_bos_reqrights(OscarData *, FlapConnection *); int aim_setextstatus(OscarData *od, guint32 status); #define AIM_CLIENTTYPE_UNKNOWN 0x0000 @@ -1008,7 +1009,7 @@ /* 0x0003 - family_buddy.c */ -/* 0x0002 */ int aim_buddylist_reqrights(OscarData *, FlapConnection *); +/* 0x0002 */ void aim_buddylist_reqrights(OscarData *, FlapConnection *); /* 0x0004 */ int aim_buddylist_set(OscarData *, FlapConnection *, const char *); /* 0x0004 */ int aim_buddylist_addbuddy(OscarData *, FlapConnection *, const char *); /* 0x0005 */ int aim_buddylist_removebuddy(OscarData *, FlapConnection *, const char *); @@ -1047,7 +1048,7 @@ char *aim_chat_getname(FlapConnection *conn); FlapConnection *aim_chat_getconn(OscarData *, const char *name); -int aim_chatnav_reqrights(OscarData *od, FlapConnection *conn); +void aim_chatnav_reqrights(OscarData *od, FlapConnection *conn); int aim_chatnav_createroom(OscarData *od, FlapConnection *conn, const char *name, guint16 exchange); int aim_chat_leaveroom(OscarData *od, const char *name); @@ -1459,7 +1460,7 @@ int email_modfirst(OscarData *od, aim_module_t *mod); int aim_genericreq_n(OscarData *, FlapConnection *conn, guint16 family, guint16 subtype); -int aim_genericreq_n_snacid(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 *); @@ -1548,18 +1549,6 @@ struct rateclass *next; }; -/* - * This is inside every connection. But it is a void * to anything - * outside of libfaim. It should remain that way. It's called data - * abstraction. Maybe you've heard of it. (Probably not if you're a - * libfaim user.) - * - */ -typedef struct aim_conn_inside_s { - struct snacgroup *groups; - struct rateclass *rates; -} aim_conn_inside_t; - int aim_cachecookie(OscarData *od, IcbmCookie *cookie); IcbmCookie *aim_uncachecookie(OscarData *od, guint8 *cookie, int type); IcbmCookie *aim_mkcookie(guint8 *, int, void *); @@ -1573,10 +1562,11 @@ void flap_connection_destroy_chat(OscarData *od, FlapConnection *conn); /* These are all handled internally now. */ -int aim_setversions(OscarData *od, FlapConnection *conn); -int aim_reqrates(OscarData *, FlapConnection *); -int aim_rates_addparam(OscarData *, FlapConnection *); -int aim_rates_delparam(OscarData *, FlapConnection *); +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);