libpurple/protocols/irc/irc.c

changeset 37957
1c33866c1ae9
parent 37668
a658571d344d
child 37958
e03cbceed96a
equal deleted inserted replaced
37956:21cffc3446a0 37957:1c33866c1ae9
30 #include "conversation.h" 30 #include "conversation.h"
31 #include "debug.h" 31 #include "debug.h"
32 #include "notify.h" 32 #include "notify.h"
33 #include "protocol.h" 33 #include "protocol.h"
34 #include "plugins.h" 34 #include "plugins.h"
35 #include "purple-gio.h"
35 #include "tls-certificate.h" 36 #include "tls-certificate.h"
36 #include "util.h" 37 #include "util.h"
37 #include "version.h" 38 #include "version.h"
38 39
39 #include "irc.h" 40 #include "irc.h"
458 if (irc->cancellable != NULL) { 459 if (irc->cancellable != NULL) {
459 g_cancellable_cancel(irc->cancellable); 460 g_cancellable_cancel(irc->cancellable);
460 g_clear_object(&irc->cancellable); 461 g_clear_object(&irc->cancellable);
461 } 462 }
462 463
464 if (irc->conn != NULL) {
465 purple_gio_graceful_close(G_IO_STREAM(irc->conn),
466 G_INPUT_STREAM(irc->input),
467 G_OUTPUT_STREAM(irc->output));
468 }
469
463 g_clear_object(&irc->input); 470 g_clear_object(&irc->input);
464 g_clear_object(&irc->output); 471 g_clear_object(&irc->output);
465 472 g_clear_object(&irc->conn);
466 if (irc->conn != NULL) { 473
467 GError *error = NULL;
468
469 if (!g_io_stream_close(G_IO_STREAM(irc->conn), NULL, &error)) {
470 purple_debug_warning("irc",
471 "Error closing connection: %s",
472 error->message);
473 g_clear_error(&error);
474 }
475
476 g_clear_object(&irc->conn);
477 }
478 if (irc->timer) 474 if (irc->timer)
479 purple_timeout_remove(irc->timer); 475 purple_timeout_remove(irc->timer);
480 g_hash_table_destroy(irc->cmds); 476 g_hash_table_destroy(irc->cmds);
481 g_hash_table_destroy(irc->msgs); 477 g_hash_table_destroy(irc->msgs);
482 g_hash_table_destroy(irc->buddies); 478 g_hash_table_destroy(irc->buddies);

mercurial