Mercurial > pidgin
comparison src/protocols/oscar/txqueue.c @ 3952:07283934dedd
[gaim-migrate @ 4133]
Ok, big commit with little functionality change.
Most of it is me shuffling crap around because I'm one of them neat freaks. Lots of general code
cleanup too. I'm trying to move to that whole "one-family-per-file" thing.
The details...
I added libfaim support for aim's new search family, 0x000f. I only tested this briefly, so if
anyone uses it for anything, be aware that it could be buggy. I'll add oscar support sometime.
Advantages of this family are... when you search for someone, you get the directory info for that
person. So like, first name, middle name, last name, maiden name, city, state, country, zip,
address, interests, nickname, and maybe some other stuff. Basically all the info that they've set in
their directory info thing. Info. Oh, and I'm calling it "new search" because seach was already
taken, and cookie monster ate my right brain.
The reason I didn't add support to oscar.c... the new search family requires making a connection to
another server. While moving stuff around I realized that I didn't really like how new connections
are made. It's kind of sloppy. I'm thinking it would be nice to have an outgoing queue for each
type of connection, and then let the client queue messages as much as they want. Then, if libfaim
sees that there is a message for a certain type of connection, and there is no open connection of
that type, it will connect, and then flush the queue when the connection is made. This seems a lot
cleaner, but it also seems like a pain in the ass. I should do ssi for icq first, anyway :-)
Also, I think it would be neat if there was an ICBM file that handled channels 1 through 4. Then
im.c and chat.c could pass the ICBM part to the icbm stuff and it could get parsed there. im.c is
really huge right now.
I applied a patch from Graham Booker that paves the way for unicode in direct IMs. Thanks Graham.
Now we just need Paco-Paco to git a little free time and write a patch for this.
http://sourceforge.net/tracker/index.php?func=detail&aid=633589&group_id=235&atid=300235
I applied 2 patches from Will Mahan dealing with file transfer/oft/rendezous/whatever. Here's some
info on them, from The Man himself:
Patch 1
"Currently the Rendezvous code is rather messy; this
patch attempts to bring it up to speed with the rest of
the Oscar prpl. Its changes include:
* Rewrite several ft.c functions to use bstreams.
Apparently the code in question was written before
bstreams were implemented.
* Handle incoming Rendezvous packets through the
rxqueue like FLAP packets, rather than handling them as
a special case as soon as they are received. This
takes advantage of the bstream cleanup to unify some
code and simplify the aim_frame_t struct.
* Change some names used to try to clarify the
distinction between OFT, which refers specifically to
file transfer, and Rendezvous, which encompasses OFT as
well as other types of client-to-client connections."
Patch 2
"* Add some comments I inadvertently left out of my last patch.
* Fix a double-free that occurs when connections time out.
* Correct a bug causing filenames to be truncated by 4 characters on
some clients.
* Preserve directory structure when sending multiple files.
* Handle (throw away) resource forks sent by Mac clients."
I also changed all indents to tabs in ft.c.
And split all the bstream stuff from rxqueue.c and put it in bstream.c. It really is a separate
thing. Especially since it can be used for outgoing connections.
Also, I was going to look over the whole patch tonight to make sure it's all good, but it's like 6000
lines, so, uh, I'll do it later.
committer: Tailor Script <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Wed, 13 Nov 2002 07:01:37 +0000 |
parents | 9682c0e022c6 |
children | 858979ab3867 |
comparison
equal
deleted
inserted
replaced
3951:32942c49dced | 3952:07283934dedd |
---|---|
1 /* | 1 /* |
2 * aim_txqueue.c | 2 * txqueue.c |
3 * | 3 * |
4 * Herein lies all the mangement routines for the transmit (Tx) queue. | 4 * Herein lies all the mangement routines for the transmit (Tx) queue. |
5 * | 5 * |
6 */ | 6 */ |
7 | 7 |
61 | 61 |
62 fr->hdr.flap.type = chan; | 62 fr->hdr.flap.type = chan; |
63 | 63 |
64 } else if (fr->hdrtype == AIM_FRAMETYPE_OFT) { | 64 } else if (fr->hdrtype == AIM_FRAMETYPE_OFT) { |
65 | 65 |
66 fr->hdr.oft.type = chan; | 66 fr->hdr.rend.type = chan; |
67 fr->hdr.oft.hdr2len = 0; /* this will get setup by caller */ | |
68 | 67 |
69 } else | 68 } else |
70 faimdprintf(sess, 0, "tx_new: unknown framing\n"); | 69 faimdprintf(sess, 0, "tx_new: unknown framing\n"); |
71 | 70 |
72 if (datalen > 0) { | 71 if (datalen > 0) { |
314 fr->conn->lastactivity = time(NULL); | 313 fr->conn->lastactivity = time(NULL); |
315 | 314 |
316 return err; | 315 return err; |
317 } | 316 } |
318 | 317 |
319 static int sendframe_oft(aim_session_t *sess, aim_frame_t *fr) | 318 static int sendframe_rendezvous(aim_session_t *sess, aim_frame_t *fr) |
320 { | 319 { |
321 aim_bstream_t hbs; | 320 aim_bstream_t bs; |
322 fu8_t *hbs_raw; | 321 fu8_t *bs_raw; |
323 int hbslen; | |
324 int err = 0; | 322 int err = 0; |
325 | 323 int totlen = 8 + aim_bstream_curpos(&fr->data); |
326 hbslen = 8 + fr->hdr.oft.hdr2len; | 324 |
327 if (!(hbs_raw = malloc(hbslen))) | 325 if (!(bs_raw = malloc(totlen))) |
328 return -1; | 326 return -1; |
329 | 327 |
330 aim_bstream_init(&hbs, hbs_raw, hbslen); | 328 aim_bstream_init(&bs, bs_raw, totlen); |
331 | 329 |
332 aimbs_putraw(&hbs, fr->hdr.oft.magic, 4); | 330 aimbs_putraw(&bs, fr->hdr.rend.magic, 4); |
333 aimbs_put16(&hbs, fr->hdr.oft.hdr2len + 8); | 331 aimbs_put16(&bs, 8 + fr->hdr.rend.hdrlen); |
334 aimbs_put16(&hbs, fr->hdr.oft.type); | 332 aimbs_put16(&bs, fr->hdr.rend.type); |
335 aimbs_putraw(&hbs, fr->hdr.oft.hdr2, fr->hdr.oft.hdr2len); | 333 |
336 | 334 /* payload */ |
337 aim_bstream_rewind(&hbs); | 335 aim_bstream_rewind(&fr->data); |
338 | 336 aimbs_putbs(&bs, &fr->data, totlen - 8); |
339 | 337 |
340 if (aim_bstream_send(&hbs, fr->conn, hbslen) != hbslen) { | 338 aim_bstream_rewind(&bs); |
341 | 339 |
340 if (aim_bstream_send(&bs, fr->conn, totlen) != totlen) | |
342 err = -errno; | 341 err = -errno; |
343 | 342 |
344 } else if (aim_bstream_curpos(&fr->data)) { | 343 free(bs_raw); /* XXX aim_bstream_free */ |
345 int len; | |
346 | |
347 len = aim_bstream_curpos(&fr->data); | |
348 aim_bstream_rewind(&fr->data); | |
349 | |
350 if (aim_bstream_send(&fr->data, fr->conn, len) != len) | |
351 err = -errno; | |
352 } | |
353 | |
354 free(hbs_raw); /* XXX aim_bstream_free */ | |
355 | 344 |
356 fr->handled = 1; | 345 fr->handled = 1; |
357 fr->conn->lastactivity = time(NULL); | 346 fr->conn->lastactivity = time(NULL); |
358 | 347 |
359 | |
360 return err; | 348 return err; |
361 | |
362 | |
363 } | 349 } |
364 | 350 |
365 faim_internal int aim_tx_sendframe(aim_session_t *sess, aim_frame_t *fr) | 351 faim_internal int aim_tx_sendframe(aim_session_t *sess, aim_frame_t *fr) |
366 { | 352 { |
367 if (fr->hdrtype == AIM_FRAMETYPE_FLAP) | 353 if (fr->hdrtype == AIM_FRAMETYPE_FLAP) |
368 return sendframe_flap(sess, fr); | 354 return sendframe_flap(sess, fr); |
369 else if (fr->hdrtype == AIM_FRAMETYPE_OFT) | 355 else if (fr->hdrtype == AIM_FRAMETYPE_OFT) |
370 return sendframe_oft(sess, fr); | 356 return sendframe_rendezvous(sess, fr); |
371 return -1; | 357 return -1; |
372 } | 358 } |
373 | 359 |
374 faim_export int aim_tx_flushqueue(aim_session_t *sess) | 360 faim_export int aim_tx_flushqueue(aim_session_t *sess) |
375 { | 361 { |
441 * | 427 * |
442 * for now this simply marks all packets as sent and lets them | 428 * for now this simply marks all packets as sent and lets them |
443 * disappear without warning. | 429 * disappear without warning. |
444 * | 430 * |
445 */ | 431 */ |
446 faim_export void aim_tx_cleanqueue(aim_session_t *sess, aim_conn_t *conn) | 432 faim_internal void aim_tx_cleanqueue(aim_session_t *sess, aim_conn_t *conn) |
447 { | 433 { |
448 aim_frame_t *cur; | 434 aim_frame_t *cur; |
449 | 435 |
450 for (cur = sess->queue_outgoing; cur; cur = cur->next) { | 436 for (cur = sess->queue_outgoing; cur; cur = cur->next) { |
451 if (cur->conn == conn) | 437 if (cur->conn == conn) |
452 cur->handled = 1; | 438 cur->handled = 1; |
453 } | 439 } |
454 | 440 |
455 return; | 441 return; |
456 } | 442 } |
457 | |
458 |