comparison libpurple/protocols/oscar/flap_connection.c @ 22166:23d85a181575

disapproval of revision 'd77adf1b9a4b44f121620f20e2643602e3f6776e'
author Mark Doliner <mark@kingant.net>
date Mon, 21 Jan 2008 07:00:02 +0000
parents 5421a1dc36f6
children ce5ced43cd93
comparison
equal deleted inserted replaced
22165:5421a1dc36f6 22166:23d85a181575
30 #endif 30 #endif
31 31
32 #ifdef _WIN32 32 #ifdef _WIN32
33 #include "win32dep.h" 33 #include "win32dep.h"
34 #endif 34 #endif
35
36 static GList *flap_connections = NULL;
37 #define PURPLE_FLAP_CONNECTION_IS_VALID(conn) (g_list_find(flap_connections, (conn)) != NULL)
38 35
39 /** 36 /**
40 * This sends a channel 1 SNAC containing the FLAP version. 37 * This sends a channel 1 SNAC containing the FLAP version.
41 * The FLAP version is sent by itself at the beginning of every 38 * The FLAP version is sent by itself at the beginning of every
42 * connection to a FLAP server. It is always the very first 39 * connection to a FLAP server. It is always the very first
274 conn->subtype = -1; 271 conn->subtype = -1;
275 conn->type = type; 272 conn->type = type;
276 conn->queued_snacs = g_queue_new(); 273 conn->queued_snacs = g_queue_new();
277 274
278 od->oscar_connections = g_slist_prepend(od->oscar_connections, conn); 275 od->oscar_connections = g_slist_prepend(od->oscar_connections, conn);
279 flap_connections = g_list_append(flap_connections, conn);
280 276
281 return conn; 277 return conn;
282 } 278 }
283 279
284 /** 280 /**
361 OscarData *od; 357 OscarData *od;
362 PurpleAccount *account; 358 PurpleAccount *account;
363 aim_rxcallback_t userfunc; 359 aim_rxcallback_t userfunc;
364 360
365 conn = data; 361 conn = data;
366
367 if (!PURPLE_FLAP_CONNECTION_IS_VALID(conn))
368 return FALSE;
369
370 od = conn->od; 362 od = conn->od;
371 account = (PURPLE_CONNECTION_IS_VALID(od->gc) ? purple_connection_get_account(od->gc) : NULL); 363 account = (PURPLE_CONNECTION_IS_VALID(od->gc) ? purple_connection_get_account(od->gc) : NULL);
372 364
373 purple_debug_info("oscar", "Destroying oscar connection of " 365 purple_debug_info("oscar", "Destroying oscar connection of "
374 "type 0x%04hx. Disconnect reason is %d\n", 366 "type 0x%04hx. Disconnect reason is %d\n",
446 } 438 }
447 g_queue_free(conn->queued_snacs); 439 g_queue_free(conn->queued_snacs);
448 if (conn->queued_timeout > 0) 440 if (conn->queued_timeout > 0)
449 purple_timeout_remove(conn->queued_timeout); 441 purple_timeout_remove(conn->queued_timeout);
450 442
451 flap_connections = g_list_remove(flap_connections, conn);
452
453 g_free(conn); 443 g_free(conn);
454 444
455 return FALSE; 445 return FALSE;
456 } 446 }
457 447