comparison src/protocols/oscar/oscar.c @ 2822:744df95bf123

[gaim-migrate @ 2835] i think this is better. committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Sat, 01 Dec 2001 01:13:12 +0000
parents 9467e4ee81be
children cdbe6e2f0ff2
comparison
equal deleted inserted replaced
2821:9467e4ee81be 2822:744df95bf123
80 aim_conn_t *conn; 80 aim_conn_t *conn;
81 81
82 guint cnpa; 82 guint cnpa;
83 guint paspa; 83 guint paspa;
84 84
85 int create_exchange; 85 GSList *create_rooms;
86 char *create_name;
87 86
88 gboolean conf; 87 gboolean conf;
89 gboolean reqemail; 88 gboolean reqemail;
90 gboolean setemail; 89 gboolean setemail;
91 char *email; 90 char *email;
98 GSList *hasicons; 97 GSList *hasicons;
99 98
100 gboolean killme; 99 gboolean killme;
101 gboolean icq; 100 gboolean icq;
102 GSList *evilhack; 101 GSList *evilhack;
102 };
103
104 struct create_room {
105 char *name;
106 int exchange;
103 }; 107 };
104 108
105 struct chat_connection { 109 struct chat_connection {
106 char *name; 110 char *name;
107 char *show; /* AOL did something funny to us */ 111 char *show; /* AOL did something funny to us */
363 } else if (conn->type == AIM_CONN_TYPE_CHATNAV) { 367 } else if (conn->type == AIM_CONN_TYPE_CHATNAV) {
364 if (odata->cnpa > 0) 368 if (odata->cnpa > 0)
365 gaim_input_remove(odata->cnpa); 369 gaim_input_remove(odata->cnpa);
366 odata->cnpa = 0; 370 odata->cnpa = 0;
367 debug_printf("removing chatnav input watcher\n"); 371 debug_printf("removing chatnav input watcher\n");
368 if (odata->create_exchange) { 372 while (odata->create_rooms) {
369 odata->create_exchange = 0; 373 struct create_room *cr = odata->create_rooms->data;
370 g_free(odata->create_name); 374 g_free(cr->name);
371 odata->create_name = NULL; 375 odata->create_rooms =
376 g_slist_remove(odata->create_rooms, cr);
377 g_free(cr);
372 do_error_dialog(_("Chat is currently unavailable"), 378 do_error_dialog(_("Chat is currently unavailable"),
373 _("Gaim - Chat")); 379 _("Gaim - Chat"));
374 } 380 }
375 aim_conn_kill(odata->sess, &conn); 381 aim_conn_kill(odata->sess, &conn);
376 } else if (conn->type == AIM_CONN_TYPE_AUTH) { 382 } else if (conn->type == AIM_CONN_TYPE_AUTH) {
444 aim_session_t *sess; 450 aim_session_t *sess;
445 aim_conn_t *conn; 451 aim_conn_t *conn;
446 char buf[256]; 452 char buf[256];
447 struct gaim_connection *gc = new_gaim_conn(user); 453 struct gaim_connection *gc = new_gaim_conn(user);
448 struct oscar_data *odata = gc->proto_data = g_new0(struct oscar_data, 1); 454 struct oscar_data *odata = gc->proto_data = g_new0(struct oscar_data, 1);
449 odata->create_exchange = 0;
450 455
451 if (isdigit(*user->username)) { 456 if (isdigit(*user->username)) {
452 odata->icq = TRUE; 457 odata->icq = TRUE;
453 /* this is odd but it's necessary for a proper do_import and do_export */ 458 /* this is odd but it's necessary for a proper do_import and do_export */
454 gc->protocol = PROTO_ICQ; 459 gc->protocol = PROTO_ICQ;
524 } 529 }
525 while (odata->evilhack) { 530 while (odata->evilhack) {
526 g_free(odata->evilhack->data); 531 g_free(odata->evilhack->data);
527 odata->evilhack = g_slist_remove(odata->evilhack, odata->evilhack->data); 532 odata->evilhack = g_slist_remove(odata->evilhack, odata->evilhack->data);
528 } 533 }
529 if (odata->create_name) 534 while (odata->create_rooms) {
530 g_free(odata->create_name); 535 struct create_room *cr = odata->create_rooms->data;
536 g_free(cr->name);
537 odata->create_rooms = g_slist_remove(odata->create_rooms, cr);
538 g_free(cr);
539 }
531 if (odata->email) 540 if (odata->email)
532 g_free(odata->email); 541 g_free(odata->email);
533 if (odata->newp) 542 if (odata->newp)
534 g_free(odata->newp); 543 g_free(odata->newp);
535 if (odata->oldp) 544 if (odata->oldp)
1678 debug_printf("chat info: Chat Rights:\n"); 1687 debug_printf("chat info: Chat Rights:\n");
1679 debug_printf("chat info: \tMax Concurrent Rooms: %d\n", maxrooms); 1688 debug_printf("chat info: \tMax Concurrent Rooms: %d\n", maxrooms);
1680 debug_printf("chat info: \tExchange List: (%d total)\n", exchangecount); 1689 debug_printf("chat info: \tExchange List: (%d total)\n", exchangecount);
1681 for (i = 0; i < exchangecount; i++) 1690 for (i = 0; i < exchangecount; i++)
1682 debug_printf("chat info: \t\t%d\n", exchanges[i].number); 1691 debug_printf("chat info: \t\t%d\n", exchanges[i].number);
1683 if (odata->create_exchange) { 1692 while (odata->create_rooms) {
1684 debug_printf("creating room %s\n", odata->create_name); 1693 struct create_room *cr = odata->create_rooms->data;
1685 aim_chatnav_createroom(sess, fr->conn, odata->create_name, 1694 debug_printf("creating room %s\n", cr->name);
1686 odata->create_exchange); 1695 aim_chatnav_createroom(sess, fr->conn, cr->name, cr->exchange);
1687 odata->create_exchange = 0; 1696 g_free(cr->name);
1688 g_free(odata->create_name); 1697 odata->create_rooms = g_slist_remove(odata->create_rooms, cr);
1689 odata->create_name = NULL; 1698 g_free(cr);
1690 } 1699 }
1691 } 1700 }
1692 break; 1701 break;
1693 case 0x0008: { 1702 case 0x0008: {
1694 char *fqcn, *name, *ck; 1703 char *fqcn, *name, *ck;
2450 if ((cur = aim_getconn_type(odata->sess, AIM_CONN_TYPE_CHATNAV))) { 2459 if ((cur = aim_getconn_type(odata->sess, AIM_CONN_TYPE_CHATNAV))) {
2451 debug_printf("chatnav exists, creating room\n"); 2460 debug_printf("chatnav exists, creating room\n");
2452 aim_chatnav_createroom(odata->sess, cur, name, *exchange); 2461 aim_chatnav_createroom(odata->sess, cur, name, *exchange);
2453 } else { 2462 } else {
2454 /* this gets tricky */ 2463 /* this gets tricky */
2464 struct create_room *cr = g_new0(struct create_room, 1);
2455 debug_printf("chatnav does not exist, opening chatnav\n"); 2465 debug_printf("chatnav does not exist, opening chatnav\n");
2456 odata->create_exchange = *exchange; 2466 cr->exchange = *exchange;
2457 odata->create_name = g_strdup(name); 2467 cr->name = g_strdup(name);
2468 odata->create_rooms = g_slist_append(odata->create_rooms, cr);
2458 aim_reqservice(odata->sess, odata->conn, AIM_CONN_TYPE_CHATNAV); 2469 aim_reqservice(odata->sess, odata->conn, AIM_CONN_TYPE_CHATNAV);
2459 } 2470 }
2460 } 2471 }
2461 2472
2462 static void oscar_chat_invite(struct gaim_connection *g, int id, char *message, char *name) { 2473 static void oscar_chat_invite(struct gaim_connection *g, int id, char *message, char *name) {