Mercurial > pidgin
comparison src/protocols/yahoo/yahoochat.c @ 7118:bf630f7dfdcd
[gaim-migrate @ 7685]
Here's a commit that I think will make faceprint happy. GaimWindow ->
GaimConvWindow, GaimIm -> GaimConvIm, GaimChat -> GaimConvChat,
GaimBlistChat -> GaimChat, and updated the API functions as well. Plugin
authors are going to hunt me down and murder me. I can feel it..
committer: Tailor Script <tailor@pidgin.im>
| author | Christian Hammond <chipx86@chipx86.com> |
|---|---|
| date | Thu, 02 Oct 2003 02:54:07 +0000 |
| parents | 3ef17670e69f |
| children | 0da869011d8a |
comparison
equal
deleted
inserted
replaced
| 7117:943085b0ff8b | 7118:bf630f7dfdcd |
|---|---|
| 61 { | 61 { |
| 62 return strcmp(a, b); | 62 return strcmp(a, b); |
| 63 } | 63 } |
| 64 | 64 |
| 65 /* this is slow, and different from the gaim_* version in that it (hopefully) won't add a user twice */ | 65 /* this is slow, and different from the gaim_* version in that it (hopefully) won't add a user twice */ |
| 66 static void yahoo_chat_add_users(GaimChat *chat, GList *newusers) | 66 static void yahoo_chat_add_users(GaimConvChat *chat, GList *newusers) |
| 67 { | 67 { |
| 68 GList *users, *i, *j; | 68 GList *users, *i, *j; |
| 69 | 69 |
| 70 users = gaim_chat_get_users(chat); | 70 users = gaim_conv_chat_get_users(chat); |
| 71 | 71 |
| 72 for (i = newusers; i; i = i->next) { | 72 for (i = newusers; i; i = i->next) { |
| 73 j = g_list_find_custom(users, i->data, _mystrcmpwrapper); | 73 j = g_list_find_custom(users, i->data, _mystrcmpwrapper); |
| 74 if (j) | 74 if (j) |
| 75 continue; | 75 continue; |
| 76 gaim_chat_add_user(chat, i->data, NULL); | 76 gaim_conv_chat_add_user(chat, i->data, NULL); |
| 77 } | 77 } |
| 78 } | 78 } |
| 79 | 79 |
| 80 static void yahoo_chat_add_user(GaimChat *chat, const char *user, const char *reason) | 80 static void yahoo_chat_add_user(GaimConvChat *chat, const char *user, const char *reason) |
| 81 { | 81 { |
| 82 GList *users; | 82 GList *users; |
| 83 | 83 |
| 84 users = gaim_chat_get_users(chat); | 84 users = gaim_conv_chat_get_users(chat); |
| 85 | 85 |
| 86 if ((g_list_find_custom(users, user, _mystrcmpwrapper))) | 86 if ((g_list_find_custom(users, user, _mystrcmpwrapper))) |
| 87 return; | 87 return; |
| 88 | 88 |
| 89 gaim_chat_add_user(chat, user, reason); | 89 gaim_conv_chat_add_user(chat, user, reason); |
| 90 } | 90 } |
| 91 | 91 |
| 92 static GaimConversation *yahoo_find_conference(GaimConnection *gc, const char *name) | 92 static GaimConversation *yahoo_find_conference(GaimConnection *gc, const char *name) |
| 93 { | 93 { |
| 94 struct yahoo_data *yd; | 94 struct yahoo_data *yd; |
| 216 } | 216 } |
| 217 | 217 |
| 218 if (who && room) { | 218 if (who && room) { |
| 219 c = yahoo_find_conference(gc, room); | 219 c = yahoo_find_conference(gc, room); |
| 220 if (c) | 220 if (c) |
| 221 yahoo_chat_add_user(GAIM_CHAT(c), who, NULL); | 221 yahoo_chat_add_user(GAIM_CONV_CHAT(c), who, NULL); |
| 222 } | 222 } |
| 223 } | 223 } |
| 224 | 224 |
| 225 void yahoo_process_conference_logoff(GaimConnection *gc, struct yahoo_packet *pkt) | 225 void yahoo_process_conference_logoff(GaimConnection *gc, struct yahoo_packet *pkt) |
| 226 { | 226 { |
| 243 } | 243 } |
| 244 | 244 |
| 245 if (who && room) { | 245 if (who && room) { |
| 246 c = yahoo_find_conference(gc, room); | 246 c = yahoo_find_conference(gc, room); |
| 247 if (c) | 247 if (c) |
| 248 gaim_chat_remove_user(GAIM_CHAT(c), who, NULL); | 248 gaim_conv_chat_remove_user(GAIM_CONV_CHAT(c), who, NULL); |
| 249 } | 249 } |
| 250 } | 250 } |
| 251 | 251 |
| 252 void yahoo_process_conference_message(GaimConnection *gc, struct yahoo_packet *pkt) | 252 void yahoo_process_conference_message(GaimConnection *gc, struct yahoo_packet *pkt) |
| 253 { | 253 { |
| 276 if (room && who && msg) { | 276 if (room && who && msg) { |
| 277 c = yahoo_find_conference(gc, room); | 277 c = yahoo_find_conference(gc, room); |
| 278 if (!c) | 278 if (!c) |
| 279 return; | 279 return; |
| 280 msg = yahoo_codes_to_html(msg); | 280 msg = yahoo_codes_to_html(msg); |
| 281 serv_got_chat_in(gc, gaim_chat_get_id(GAIM_CHAT(c)), who, 0, msg, time(NULL)); | 281 serv_got_chat_in(gc, gaim_conv_chat_get_id(GAIM_CONV_CHAT(c)), who, 0, msg, time(NULL)); |
| 282 g_free(msg); | 282 g_free(msg); |
| 283 } | 283 } |
| 284 | 284 |
| 285 } | 285 } |
| 286 | 286 |
| 374 c = gaim_find_chat(gc, YAHOO_CHAT_ID); | 374 c = gaim_find_chat(gc, YAHOO_CHAT_ID); |
| 375 | 375 |
| 376 if (!c) { | 376 if (!c) { |
| 377 c = serv_got_joined_chat(gc, YAHOO_CHAT_ID, room); | 377 c = serv_got_joined_chat(gc, YAHOO_CHAT_ID, room); |
| 378 if (topic) | 378 if (topic) |
| 379 gaim_chat_set_topic(GAIM_CHAT(c), NULL, topic); | 379 gaim_conv_chat_set_topic(GAIM_CONV_CHAT(c), NULL, topic); |
| 380 yd->in_chat = 1; | 380 yd->in_chat = 1; |
| 381 yd->chat_name = g_strdup(room); | 381 yd->chat_name = g_strdup(room); |
| 382 gaim_chat_add_users(GAIM_CHAT(c), members); | 382 gaim_conv_chat_add_users(GAIM_CONV_CHAT(c), members); |
| 383 } else { | 383 } else { |
| 384 yahoo_chat_add_users(GAIM_CHAT(c), members); | 384 yahoo_chat_add_users(GAIM_CONV_CHAT(c), members); |
| 385 } | 385 } |
| 386 | 386 |
| 387 g_list_free(members); | 387 g_list_free(members); |
| 388 } | 388 } |
| 389 | 389 |
| 404 | 404 |
| 405 | 405 |
| 406 if (who) { | 406 if (who) { |
| 407 GaimConversation *c = gaim_find_chat(gc, YAHOO_CHAT_ID); | 407 GaimConversation *c = gaim_find_chat(gc, YAHOO_CHAT_ID); |
| 408 if (c) | 408 if (c) |
| 409 gaim_chat_remove_user(GAIM_CHAT(c), who, NULL); | 409 gaim_conv_chat_remove_user(GAIM_CONV_CHAT(c), who, NULL); |
| 410 | 410 |
| 411 } | 411 } |
| 412 } | 412 } |
| 413 | 413 |
| 414 void yahoo_process_chat_message(GaimConnection *gc, struct yahoo_packet *pkt) | 414 void yahoo_process_chat_message(GaimConnection *gc, struct yahoo_packet *pkt) |
| 580 if (memarr) { | 580 if (memarr) { |
| 581 for(i = 0 ; memarr[i]; i++) { | 581 for(i = 0 ; memarr[i]; i++) { |
| 582 if (!strcmp(memarr[i], "") || !strcmp(memarr[i], dn)) | 582 if (!strcmp(memarr[i], "") || !strcmp(memarr[i], dn)) |
| 583 continue; | 583 continue; |
| 584 yahoo_packet_hash(pkt, 3, memarr[i]); | 584 yahoo_packet_hash(pkt, 3, memarr[i]); |
| 585 gaim_chat_add_user(GAIM_CHAT(c), memarr[i], NULL); | 585 gaim_conv_chat_add_user(GAIM_CONV_CHAT(c), memarr[i], NULL); |
| 586 } | 586 } |
| 587 } | 587 } |
| 588 yahoo_send_packet(yd, pkt); | 588 yahoo_send_packet(yd, pkt); |
| 589 | 589 |
| 590 yahoo_packet_free(pkt); | 590 yahoo_packet_free(pkt); |
| 597 const char *dn, const char *buddy, const char *room, const char *msg) | 597 const char *dn, const char *buddy, const char *room, const char *msg) |
| 598 { | 598 { |
| 599 struct yahoo_packet *pkt; | 599 struct yahoo_packet *pkt; |
| 600 GList *members; | 600 GList *members; |
| 601 | 601 |
| 602 members = gaim_chat_get_users(GAIM_CHAT(c)); | 602 members = gaim_conv_chat_get_users(GAIM_CONV_CHAT(c)); |
| 603 | 603 |
| 604 pkt = yahoo_packet_new(YAHOO_SERVICE_CONFADDINVITE, YAHOO_STATUS_AVAILABLE, 0); | 604 pkt = yahoo_packet_new(YAHOO_SERVICE_CONFADDINVITE, YAHOO_STATUS_AVAILABLE, 0); |
| 605 | 605 |
| 606 yahoo_packet_hash(pkt, 1, dn); | 606 yahoo_packet_hash(pkt, 1, dn); |
| 607 yahoo_packet_hash(pkt, 51, buddy); | 607 yahoo_packet_hash(pkt, 51, buddy); |
| 786 if (!c) | 786 if (!c) |
| 787 return; | 787 return; |
| 788 | 788 |
| 789 if (id != YAHOO_CHAT_ID) { | 789 if (id != YAHOO_CHAT_ID) { |
| 790 yahoo_conf_leave(yd, gaim_conversation_get_name(c), | 790 yahoo_conf_leave(yd, gaim_conversation_get_name(c), |
| 791 gaim_connection_get_display_name(gc), gaim_chat_get_users(GAIM_CHAT(c))); | 791 gaim_connection_get_display_name(gc), gaim_conv_chat_get_users(GAIM_CONV_CHAT(c))); |
| 792 yd->confs = g_slist_remove(yd->confs, c); | 792 yd->confs = g_slist_remove(yd->confs, c); |
| 793 } else { | 793 } else { |
| 794 yahoo_chat_leave(yd, gaim_conversation_get_name(c), gaim_connection_get_display_name(gc)); | 794 yahoo_chat_leave(yd, gaim_conversation_get_name(c), gaim_connection_get_display_name(gc)); |
| 795 } | 795 } |
| 796 | 796 |
| 811 if (!c) | 811 if (!c) |
| 812 return -1; | 812 return -1; |
| 813 | 813 |
| 814 if (id != YAHOO_CHAT_ID) { | 814 if (id != YAHOO_CHAT_ID) { |
| 815 ret = yahoo_conf_send(yd, gaim_connection_get_display_name(gc), | 815 ret = yahoo_conf_send(yd, gaim_connection_get_display_name(gc), |
| 816 gaim_conversation_get_name(c), gaim_chat_get_users(GAIM_CHAT(c)), what); | 816 gaim_conversation_get_name(c), gaim_conv_chat_get_users(GAIM_CONV_CHAT(c)), what); |
| 817 } else { | 817 } else { |
| 818 ret = yahoo_chat_send(yd, gaim_connection_get_display_name(gc), | 818 ret = yahoo_chat_send(yd, gaim_connection_get_display_name(gc), |
| 819 gaim_conversation_get_name(c), what); | 819 gaim_conversation_get_name(c), what); |
| 820 if (!ret) | 820 if (!ret) |
| 821 serv_got_chat_in(gc, gaim_chat_get_id(GAIM_CHAT(c)), | 821 serv_got_chat_in(gc, gaim_conv_chat_get_id(GAIM_CONV_CHAT(c)), |
| 822 gaim_connection_get_display_name(gc), 0, what, time(NULL)); | 822 gaim_connection_get_display_name(gc), 0, what, time(NULL)); |
| 823 } | 823 } |
| 824 return ret; | 824 return ret; |
| 825 } | 825 } |
| 826 | 826 |
| 861 | 861 |
| 862 if ((type = g_hash_table_lookup(data, "type")) && !strcmp(type, "Conference")) { | 862 if ((type = g_hash_table_lookup(data, "type")) && !strcmp(type, "Conference")) { |
| 863 id = yd->conf_id++; | 863 id = yd->conf_id++; |
| 864 c = serv_got_joined_chat(gc, id, room); | 864 c = serv_got_joined_chat(gc, id, room); |
| 865 yd->confs = g_slist_prepend(yd->confs, c); | 865 yd->confs = g_slist_prepend(yd->confs, c); |
| 866 gaim_chat_set_topic(GAIM_CHAT(c), gaim_connection_get_display_name(gc), topic); | 866 gaim_conv_chat_set_topic(GAIM_CONV_CHAT(c), gaim_connection_get_display_name(gc), topic); |
| 867 yahoo_conf_join(yd, c, gaim_connection_get_display_name(gc), room, topic, members); | 867 yahoo_conf_join(yd, c, gaim_connection_get_display_name(gc), room, topic, members); |
| 868 return; | 868 return; |
| 869 } else { | 869 } else { |
| 870 if (yd->in_chat) | 870 if (yd->in_chat) |
| 871 yahoo_c_leave(gc, YAHOO_CHAT_ID); | 871 yahoo_c_leave(gc, YAHOO_CHAT_ID); |
