comparison src/protocols/oscar/oscar.c @ 8308:34e8ad866f12

[gaim-migrate @ 9032] Bring back the meaningless join chat icon on the join chat button in the join chat dialog. Hip hip, hoorah! Also give an error in oscar if trying to join a chat with no name. And rename g to gc in a few places. committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Sat, 21 Feb 2004 07:25:58 +0000
parents ef881489396e
children fec4c1fb2ac8
comparison
equal deleted inserted replaced
8307:068db3a28cf6 8308:34e8ad866f12
5361 m = g_list_append(m, pce); 5361 m = g_list_append(m, pce);
5362 5362
5363 return m; 5363 return m;
5364 } 5364 }
5365 5365
5366 static void oscar_join_chat(GaimConnection *g, GHashTable *data) { 5366 static void oscar_join_chat(GaimConnection *gc, GHashTable *data) {
5367 OscarData *od = (OscarData *)g->proto_data; 5367 OscarData *od = (OscarData *)gc->proto_data;
5368 aim_conn_t *cur; 5368 aim_conn_t *cur;
5369 char *name, *exchange; 5369 char *name, *exchange;
5370 5370
5371 name = g_hash_table_lookup(data, "room"); 5371 name = g_hash_table_lookup(data, "room");
5372 exchange = g_hash_table_lookup(data, "exchange"); 5372 exchange = g_hash_table_lookup(data, "exchange");
5373 5373
5374 gaim_debug(GAIM_DEBUG_INFO, "oscar", 5374 gaim_debug(GAIM_DEBUG_INFO, "oscar",
5375 "Attempting to join chat room %s.\n", name); 5375 "Attempting to join chat room %s.\n", name);
5376
5377 if ((name == NULL) || (*name == '\0')) {
5378 gaim_notify_error(gc, NULL, _("Invalid chat name specified."), NULL);
5379 return;
5380 }
5381
5376 if ((cur = aim_getconn_type(od->sess, AIM_CONN_TYPE_CHATNAV))) { 5382 if ((cur = aim_getconn_type(od->sess, AIM_CONN_TYPE_CHATNAV))) {
5377 gaim_debug(GAIM_DEBUG_INFO, "oscar", 5383 gaim_debug(GAIM_DEBUG_INFO, "oscar",
5378 "chatnav exists, creating room\n"); 5384 "chatnav exists, creating room\n");
5379 aim_chatnav_createroom(od->sess, cur, name, atoi(exchange)); 5385 aim_chatnav_createroom(od->sess, cur, name, atoi(exchange));
5380 } else { 5386 } else {
5387 od->create_rooms = g_slist_append(od->create_rooms, cr); 5393 od->create_rooms = g_slist_append(od->create_rooms, cr);
5388 aim_reqservice(od->sess, od->conn, AIM_CONN_TYPE_CHATNAV); 5394 aim_reqservice(od->sess, od->conn, AIM_CONN_TYPE_CHATNAV);
5389 } 5395 }
5390 } 5396 }
5391 5397
5392 static void oscar_chat_invite(GaimConnection *g, int id, const char *message, const char *name) { 5398 static void oscar_chat_invite(GaimConnection *gc, int id, const char *message, const char *name) {
5393 OscarData *od = (OscarData *)g->proto_data; 5399 OscarData *od = (OscarData *)gc->proto_data;
5394 struct chat_connection *ccon = find_oscar_chat(g, id); 5400 struct chat_connection *ccon = find_oscar_chat(gc, id);
5395 5401
5396 if (!ccon) 5402 if (!ccon)
5397 return; 5403 return;
5398 5404
5399 aim_im_sendch2_chatinvite(od->sess, name, message ? message : "", 5405 aim_im_sendch2_chatinvite(od->sess, name, message ? message : "",
5400 ccon->exchange, ccon->name, 0x0); 5406 ccon->exchange, ccon->name, 0x0);
5401 } 5407 }
5402 5408
5403 static void oscar_chat_leave(GaimConnection *g, int id) { 5409 static void oscar_chat_leave(GaimConnection *gc, int id) {
5404 OscarData *od = g ? (OscarData *)g->proto_data : NULL; 5410 OscarData *od = gc ? (OscarData *)gc->proto_data : NULL;
5405 GSList *bcs = g->buddy_chats; 5411 GSList *bcs = gc->buddy_chats;
5406 GaimConversation *b = NULL; 5412 GaimConversation *b = NULL;
5407 struct chat_connection *c = NULL; 5413 struct chat_connection *c = NULL;
5408 int count = 0; 5414 int count = 0;
5409 5415
5410 while (bcs) { 5416 while (bcs) {
5420 return; 5426 return;
5421 5427
5422 gaim_debug(GAIM_DEBUG_INFO, "oscar", 5428 gaim_debug(GAIM_DEBUG_INFO, "oscar",
5423 "Attempting to leave room %s (currently in %d rooms)\n", b->name, count); 5429 "Attempting to leave room %s (currently in %d rooms)\n", b->name, count);
5424 5430
5425 c = find_oscar_chat(g, gaim_conv_chat_get_id(GAIM_CONV_CHAT(b))); 5431 c = find_oscar_chat(gc, gaim_conv_chat_get_id(GAIM_CONV_CHAT(b)));
5426 if (c != NULL) { 5432 if (c != NULL) {
5427 if (od) 5433 if (od)
5428 od->oscar_chats = g_slist_remove(od->oscar_chats, c); 5434 od->oscar_chats = g_slist_remove(od->oscar_chats, c);
5429 if (c->inpa > 0) 5435 if (c->inpa > 0)
5430 gaim_input_remove(c->inpa); 5436 gaim_input_remove(c->inpa);
5431 if (g && od->sess) 5437 if (gc && od->sess)
5432 aim_conn_kill(od->sess, &c->conn); 5438 aim_conn_kill(od->sess, &c->conn);
5433 g_free(c->name); 5439 g_free(c->name);
5434 g_free(c->show); 5440 g_free(c->show);
5435 g_free(c); 5441 g_free(c);
5436 } 5442 }
5437 /* we do this because with Oscar it doesn't tell us we left */ 5443 /* we do this because with Oscar it doesn't tell us we left */
5438 serv_got_chat_left(g, gaim_conv_chat_get_id(GAIM_CONV_CHAT(b))); 5444 serv_got_chat_left(gc, gaim_conv_chat_get_id(GAIM_CONV_CHAT(b)));
5439 } 5445 }
5440 5446
5441 static int oscar_send_chat(GaimConnection *gc, int id, const char *message) { 5447 static int oscar_send_chat(GaimConnection *gc, int id, const char *message) {
5442 OscarData *od = (OscarData *)gc->proto_data; 5448 OscarData *od = (OscarData *)gc->proto_data;
5443 GError *err = NULL; 5449 GError *err = NULL;