comparison src/oscar.c @ 833:8d8ef8c3afe2

[gaim-migrate @ 843] handle getting disconnected from chat more gracefully committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Sat, 02 Sep 2000 10:57:07 +0000
parents 9a123b171f46
children bac7089491c1
comparison
equal deleted inserted replaced
832:0142b4c66394 833:8d8ef8c3afe2
60 struct chat_connection *c = NULL; 60 struct chat_connection *c = NULL;
61 61
62 while (g) { 62 while (g) {
63 c = (struct chat_connection *)g->data; 63 c = (struct chat_connection *)g->data;
64 if (!strcmp(name, c->name)) 64 if (!strcmp(name, c->name))
65 break;
66 g = g->next;
67 c = NULL;
68 }
69
70 return c;
71 }
72
73 static struct chat_connection *find_oscar_chat_by_conn(struct aim_conn_t *conn) {
74 GList *g = oscar_chats;
75 struct chat_connection *c = NULL;
76
77 while (g) {
78 c = (struct chat_connection *)g->data;
79 if (c->conn == conn)
65 break; 80 break;
66 g = g->next; 81 g = g->next;
67 c = NULL; 82 c = NULL;
68 } 83 }
69 84
131 debug_print(_("major connection error\n")); 146 debug_print(_("major connection error\n"));
132 signoff(); 147 signoff();
133 hide_login_progress(_("Disconnected.")); 148 hide_login_progress(_("Disconnected."));
134 auth_failed(); 149 auth_failed();
135 } else if (conn->type == AIM_CONN_TYPE_CHAT) { 150 } else if (conn->type == AIM_CONN_TYPE_CHAT) {
136 /* FIXME: we got disconnected from a chat room, but 151 struct chat_connection *c = find_oscar_chat_by_conn(conn);
137 * libfaim won't tell us which room */ 152 char buf[BUF_LONG];
138 debug_print("connection error for chat...\n"); 153 sprintf(debug_buff, "disconnected from chat room %s\n", c->name);
154 debug_print(debug_buff);
155 c->conn = NULL;
156 gdk_input_remove(c->inpa);
157 c->inpa = -1;
158 c->fd = -1;
139 aim_conn_kill(gaim_sess, &conn); 159 aim_conn_kill(gaim_sess, &conn);
160 sprintf(buf, _("You have been disconnected from chat room %s."), c->name);
161 do_error_dialog(buf, _("Chat Error!"));
140 } else if (conn->type == AIM_CONN_TYPE_CHATNAV) { 162 } else if (conn->type == AIM_CONN_TYPE_CHATNAV) {
141 gdk_input_remove(cnpa); 163 gdk_input_remove(cnpa);
142 cnpa = -1; 164 cnpa = -1;
143 debug_print("removing chatnav input watcher\n"); 165 debug_print("removing chatnav input watcher\n");
144 aim_conn_kill(gaim_sess, &conn); 166 aim_conn_kill(gaim_sess, &conn);