Mercurial > pidgin
diff src/protocols/oscar/snac.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/snac.c Fri Apr 07 01:05:48 2006 +0000 +++ b/src/protocols/oscar/snac.c Fri Apr 07 05:10:56 2006 +0000 @@ -37,21 +37,21 @@ /* * Called from oscar_session_new() to initialize the hash. */ -faim_internal void aim_initsnachash(OscarSession *sess) +void aim_initsnachash(OscarData *od) { int i; for (i = 0; i < FAIM_SNAC_HASH_SIZE; i++) - sess->snac_hash[i] = NULL; + od->snac_hash[i] = NULL; return; } -faim_internal aim_snacid_t aim_cachesnac(OscarSession *sess, const guint16 family, const guint16 type, const guint16 flags, const void *data, const int datalen) +aim_snacid_t aim_cachesnac(OscarData *od, const guint16 family, const guint16 type, const guint16 flags, const void *data, const int datalen) { aim_snac_t snac; - snac.id = sess->snacid_next++; + snac.id = od->snacid_next++; snac.family = family; snac.type = type; snac.flags = flags; @@ -63,14 +63,14 @@ } else snac.data = NULL; - return aim_newsnac(sess, &snac); + return aim_newsnac(od, &snac); } /* * Clones the passed snac structure and caches it in the * list/hash. */ -faim_internal aim_snacid_t aim_newsnac(OscarSession *sess, aim_snac_t *newsnac) +aim_snacid_t aim_newsnac(OscarData *od, aim_snac_t *newsnac) { aim_snac_t *snac; int index; @@ -85,27 +85,27 @@ index = snac->id % FAIM_SNAC_HASH_SIZE; - snac->next = (aim_snac_t *)sess->snac_hash[index]; - sess->snac_hash[index] = (void *)snac; + snac->next = (aim_snac_t *)od->snac_hash[index]; + od->snac_hash[index] = (void *)snac; return snac->id; } /* - * Finds a snac structure with the passed SNAC ID, + * Finds a snac structure with the passed SNAC ID, * removes it from the list/hash, and returns a pointer to it. * * The returned structure must be freed by the caller. * */ -faim_internal aim_snac_t *aim_remsnac(OscarSession *sess, aim_snacid_t id) +aim_snac_t *aim_remsnac(OscarData *od, aim_snacid_t id) { aim_snac_t *cur, **prev; int index; index = id % FAIM_SNAC_HASH_SIZE; - for (prev = (aim_snac_t **)&sess->snac_hash[index]; (cur = *prev); ) { + for (prev = (aim_snac_t **)&od->snac_hash[index]; (cur = *prev); ) { if (cur->id == id) { *prev = cur->next; if (cur->flags & AIM_SNACFLAGS_DESTRUCTOR) { @@ -127,7 +127,7 @@ * maxage is the _minimum_ age in seconds to keep SNACs. * */ -faim_export void aim_cleansnacs(OscarSession *sess, int maxage) +void aim_cleansnacs(OscarData *od, int maxage) { int i; @@ -135,12 +135,12 @@ aim_snac_t *cur, **prev; time_t curtime; - if (!sess->snac_hash[i]) + if (!od->snac_hash[i]) continue; curtime = time(NULL); /* done here in case we waited for the lock */ - for (prev = (aim_snac_t **)&sess->snac_hash[i]; (cur = *prev); ) { + for (prev = (aim_snac_t **)&od->snac_hash[i]; (cur = *prev); ) { if ((curtime - cur->issuetime) > maxage) { *prev = cur->next; @@ -155,13 +155,13 @@ return; } -faim_internal int aim_putsnac(ByteStream *bs, guint16 family, guint16 subtype, guint16 flags, aim_snacid_t snacid) +int aim_putsnac(ByteStream *bs, guint16 family, guint16 subtype, guint16 flags, aim_snacid_t snacid) { - aimbs_put16(bs, family); - aimbs_put16(bs, subtype); - aimbs_put16(bs, flags); - aimbs_put32(bs, snacid); + byte_stream_put16(bs, family); + byte_stream_put16(bs, subtype); + byte_stream_put16(bs, flags); + byte_stream_put32(bs, snacid); return 10; }