# HG changeset patch # User Eric Warmenhoven # Date 967892227 0 # Node ID 8d8ef8c3afe2b9e18ab65cf5979fb995b97424a0 # Parent 0142b4c66394f90465f5a4cf599325813d2a0cd3 [gaim-migrate @ 843] handle getting disconnected from chat more gracefully committer: Tailor Script diff -r 0142b4c66394 -r 8d8ef8c3afe2 src/oscar.c --- a/src/oscar.c Sat Sep 02 10:41:53 2000 +0000 +++ b/src/oscar.c Sat Sep 02 10:57:07 2000 +0000 @@ -70,6 +70,21 @@ return c; } +static struct chat_connection *find_oscar_chat_by_conn(struct aim_conn_t *conn) { + GList *g = oscar_chats; + struct chat_connection *c = NULL; + + while (g) { + c = (struct chat_connection *)g->data; + if (c->conn == conn) + break; + g = g->next; + c = NULL; + } + + return c; +} + static int gaim_parse_auth_resp (struct aim_session_t *, struct command_rx_struct *, ...); static int gaim_parse_login (struct aim_session_t *, struct command_rx_struct *, ...); static int gaim_server_ready (struct aim_session_t *, struct command_rx_struct *, ...); @@ -133,10 +148,17 @@ hide_login_progress(_("Disconnected.")); auth_failed(); } else if (conn->type == AIM_CONN_TYPE_CHAT) { - /* FIXME: we got disconnected from a chat room, but - * libfaim won't tell us which room */ - debug_print("connection error for chat...\n"); + struct chat_connection *c = find_oscar_chat_by_conn(conn); + char buf[BUF_LONG]; + sprintf(debug_buff, "disconnected from chat room %s\n", c->name); + debug_print(debug_buff); + c->conn = NULL; + gdk_input_remove(c->inpa); + c->inpa = -1; + c->fd = -1; aim_conn_kill(gaim_sess, &conn); + sprintf(buf, _("You have been disconnected from chat room %s."), c->name); + do_error_dialog(buf, _("Chat Error!")); } else if (conn->type == AIM_CONN_TYPE_CHATNAV) { gdk_input_remove(cnpa); cnpa = -1;