comparison src/oscar.c @ 1186:c00fc3adfd66

[gaim-migrate @ 1196] mostly libfaim updates, and a fix for something i broke in the import dialog. committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Sat, 02 Dec 2000 18:41:58 +0000
parents 984cbc219724
children 004d472be8a3
comparison
equal deleted inserted replaced
1185:47cf56b72d4b 1186:c00fc3adfd66
74 GSList *getfiles; 74 GSList *getfiles;
75 }; 75 };
76 76
77 struct chat_connection { 77 struct chat_connection {
78 char *name; 78 char *name;
79 int exchange;
79 int fd; /* this is redundant since we have the conn below */ 80 int fd; /* this is redundant since we have the conn below */
80 struct aim_conn_t *conn; 81 struct aim_conn_t *conn;
81 int inpa; 82 int inpa;
83 int id;
82 }; 84 };
83 85
84 struct direct_im { 86 struct direct_im {
85 struct gaim_connection *gc; 87 struct gaim_connection *gc;
86 char name[80]; 88 char name[80];
149 } 151 }
150 152
151 return n; 153 return n;
152 } 154 }
153 155
154 struct chat_connection *find_oscar_chat(struct gaim_connection *gc, char *name) { 156 struct chat_connection *find_oscar_chat(struct gaim_connection *gc, int id) {
155 GSList *g = ((struct oscar_data *)gc->proto_data)->oscar_chats; 157 GSList *g = ((struct oscar_data *)gc->proto_data)->oscar_chats;
156 struct chat_connection *c = NULL; 158 struct chat_connection *c = NULL;
157 if (gc->protocol != PROTO_OSCAR) return NULL; 159 if (gc->protocol != PROTO_OSCAR) return NULL;
158 160
159 while (g) { 161 while (g) {
160 c = (struct chat_connection *)g->data; 162 c = (struct chat_connection *)g->data;
161 if (!strcmp(name, c->name)) 163 if (c->id == id)
162 break; 164 break;
163 g = g->next; 165 g = g->next;
164 c = NULL; 166 c = NULL;
165 } 167 }
166 168
567 569
568 int gaim_server_ready(struct aim_session_t *sess, 570 int gaim_server_ready(struct aim_session_t *sess,
569 struct command_rx_struct *command, ...) { 571 struct command_rx_struct *command, ...) {
570 static int id = 1; 572 static int id = 1;
571 struct gaim_connection *gc = find_gaim_conn_by_aim_sess(sess); 573 struct gaim_connection *gc = find_gaim_conn_by_aim_sess(sess);
574 struct chat_connection *chatcon;
572 switch (command->conn->type) { 575 switch (command->conn->type) {
573 case AIM_CONN_TYPE_BOS: 576 case AIM_CONN_TYPE_BOS:
574 aim_setversions(sess, command->conn); 577 aim_setversions(sess, command->conn);
575 aim_bos_reqrate(sess, command->conn); /* request rate info */ 578 aim_bos_reqrate(sess, command->conn); /* request rate info */
576 debug_print("done with BOS ServerReady\n"); 579 debug_print("done with BOS ServerReady\n");
590 aim_conn_addhandler(sess, command->conn, AIM_CB_FAM_CHT, AIM_CB_CHT_ROOMINFOUPDATE, gaim_chat_info_update, 0); 593 aim_conn_addhandler(sess, command->conn, AIM_CB_FAM_CHT, AIM_CB_CHT_ROOMINFOUPDATE, gaim_chat_info_update, 0);
591 aim_conn_addhandler(sess, command->conn, AIM_CB_FAM_CHT, AIM_CB_CHT_INCOMINGMSG, gaim_chat_incoming_msg, 0); 594 aim_conn_addhandler(sess, command->conn, AIM_CB_FAM_CHT, AIM_CB_CHT_INCOMINGMSG, gaim_chat_incoming_msg, 0);
592 aim_bos_reqrate(sess, command->conn); 595 aim_bos_reqrate(sess, command->conn);
593 aim_bos_ackrateresp(sess, command->conn); 596 aim_bos_ackrateresp(sess, command->conn);
594 aim_chat_clientready(sess, command->conn); 597 aim_chat_clientready(sess, command->conn);
598 chatcon = find_oscar_chat_by_conn(gc, command->conn);
599 chatcon->id = id;
595 serv_got_joined_chat(gc, id++, aim_chat_getname(command->conn)); 600 serv_got_joined_chat(gc, id++, aim_chat_getname(command->conn));
596 break; 601 break;
597 case AIM_CONN_TYPE_RENDEZVOUS: 602 case AIM_CONN_TYPE_RENDEZVOUS:
598 break; 603 break;
599 default: /* huh? */ 604 default: /* huh? */
649 break; 654 break;
650 case 0xe: /* Chat */ 655 case 0xe: /* Chat */
651 { 656 {
652 struct aim_conn_t *tstconn = aim_newconn(sess, AIM_CONN_TYPE_CHAT, ip); 657 struct aim_conn_t *tstconn = aim_newconn(sess, AIM_CONN_TYPE_CHAT, ip);
653 char *roomname = va_arg(ap, char *); 658 char *roomname = va_arg(ap, char *);
659 int exchange = va_arg(ap, int);
654 struct chat_connection *ccon; 660 struct chat_connection *ccon;
655 if (tstconn == NULL || tstconn->status & AIM_CONN_STATUS_RESOLVERR) { 661 if (tstconn == NULL || tstconn->status & AIM_CONN_STATUS_RESOLVERR) {
656 debug_print("unable to connect to chat server\n"); 662 debug_print("unable to connect to chat server\n");
657 return 1; 663 return 1;
658 } 664 }
659 sprintf(debug_buff, "Connected to chat room %s\n", roomname); 665 sprintf(debug_buff, "Connected to chat room %s exchange %d\n", roomname, exchange);
660 debug_print(debug_buff); 666 debug_print(debug_buff);
661 667
662 ccon = g_new0(struct chat_connection, 1); 668 ccon = g_new0(struct chat_connection, 1);
663 ccon->conn = tstconn; 669 ccon->conn = tstconn;
664 ccon->fd = tstconn->fd; 670 ccon->fd = tstconn->fd;
665 ccon->name = g_strdup(roomname); 671 ccon->name = g_strdup(roomname);
672 ccon->exchange = exchange;
666 673
667 ccon->inpa = gdk_input_add(tstconn->fd, 674 ccon->inpa = gdk_input_add(tstconn->fd,
668 GDK_INPUT_READ | GDK_INPUT_EXCEPTION, 675 GDK_INPUT_READ | GDK_INPUT_EXCEPTION,
669 oscar_callback, tstconn); 676 oscar_callback, tstconn);
670 677
1753 1760
1754 sprintf(debug_buff, "Attempting to leave room %s (currently in %d rooms)\n", 1761 sprintf(debug_buff, "Attempting to leave room %s (currently in %d rooms)\n",
1755 b->name, count); 1762 b->name, count);
1756 debug_print(debug_buff); 1763 debug_print(debug_buff);
1757 1764
1758 c = find_oscar_chat(g, b->name); 1765 c = find_oscar_chat(g, b->id);
1759 if (c != NULL) { 1766 if (c != NULL) {
1760 if (odata) 1767 if (odata)
1761 odata->oscar_chats = g_slist_remove(odata->oscar_chats, c); 1768 odata->oscar_chats = g_slist_remove(odata->oscar_chats, c);
1762 gdk_input_remove(c->inpa); 1769 gdk_input_remove(c->inpa);
1763 if (g && odata->sess) 1770 if (g && odata->sess)