comparison libfaim/txqueue.c @ 1593:ec31e23aadc7

[gaim-migrate @ 1603] libfaim updates and a bug fix for bad password. committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Fri, 16 Mar 2001 14:29:54 +0000
parents 1e2cc8c8bf3c
children
comparison
equal deleted inserted replaced
1592:41cecde078c1 1593:ec31e23aadc7
22 * 22 *
23 * framing = AIM_FRAMETYPE_OFT/OSCAR 23 * framing = AIM_FRAMETYPE_OFT/OSCAR
24 * chan = channel for OSCAR, hdrtype for OFT 24 * chan = channel for OSCAR, hdrtype for OFT
25 * 25 *
26 */ 26 */
27 faim_internal struct command_tx_struct *aim_tx_new(struct aim_session_t *sess, struct aim_conn_t *conn, unsigned char framing, int chan, int datalen) 27 faim_internal struct command_tx_struct *aim_tx_new(struct aim_session_t *sess,
28 struct aim_conn_t *conn,
29 unsigned char framing,
30 int chan,
31 int datalen)
28 { 32 {
29 struct command_tx_struct *newtx; 33 struct command_tx_struct *newtx;
30 34
31 if (!conn) { 35 if (!conn) {
32 faimdprintf(sess, 0, "aim_tx_new: ERROR: no connection specified\n"); 36 faimdprintf(sess, 0, "aim_tx_new: ERROR: no connection specified\n");
156 free(newpacket); 160 free(newpacket);
157 161
158 return 0; 162 return 0;
159 } 163 }
160 164
161 faim_export int aim_tx_setenqueue(struct aim_session_t *sess, int what, int (*func)(struct aim_session_t *, struct command_tx_struct *)) 165 faim_export int aim_tx_setenqueue(struct aim_session_t *sess,
166 int what,
167 int (*func)(struct aim_session_t *, struct command_tx_struct *))
162 { 168 {
163 if (!sess) 169 if (!sess)
164 return -1; 170 return -1;
165 171
166 if (what == AIM_TX_QUEUED) 172 if (what == AIM_TX_QUEUED)
427 if (cur == NULL) 433 if (cur == NULL)
428 break; 434 break;
429 } 435 }
430 return; 436 return;
431 } 437 }
438
439 /**
440 * aim_tx_cleanqueue - get rid of packets waiting for tx on a dying conn
441 * @sess: session
442 * @conn: connection that's dying
443 *
444 * for now this simply marks all packets as sent and lets them
445 * disappear without warning.
446 *
447 * doesn't respect command_tx_struct locks.
448 */
449
450 faim_export int aim_tx_cleanqueue(struct aim_session_t *sess, struct aim_conn_t *conn)
451 {
452 struct command_tx_struct *cur = NULL;
453
454 if(!sess || !conn)
455 return -1;
456
457 /* we don't respect locks here */
458 for(cur = sess->queue_outgoing; cur; cur = cur->next)
459 if(cur->conn == conn)
460 cur->sent = 1;
461
462 return 0;
463 }
464
465