comparison libpurple/protocols/yahoo/libymsg.c @ 28726:291c89bfe040

merged with im.pidgin.pidgin
author Yoshiki Yazawa <yaz@honeyplanet.jp>
date Sun, 11 Oct 2009 00:51:47 +0900
parents a177a1cdfe4e dfabdc9cce88
children bd8a1dad7f1c
comparison
equal deleted inserted replaced
28662:4b3756ed1053 28726:291c89bfe040
981 981
982 /* disconnect the peer if connected through p2p and sends wrong value for session id */ 982 /* disconnect the peer if connected through p2p and sends wrong value for session id */
983 if( (pkt_type == YAHOO_PKT_TYPE_P2P) && (val_11 != yd->session_id) ) { 983 if( (pkt_type == YAHOO_PKT_TYPE_P2P) && (val_11 != yd->session_id) ) {
984 purple_debug_warning("yahoo","p2p: %s sent us message with wrong session id. Disconnecting p2p connection to peer\n", im ? im->from : "(im was null)"); 984 purple_debug_warning("yahoo","p2p: %s sent us message with wrong session id. Disconnecting p2p connection to peer\n", im ? im->from : "(im was null)");
985 /* remove from p2p connection lists, also calls yahoo_p2p_disconnect_destroy_data */ 985 /* remove from p2p connection lists, also calls yahoo_p2p_disconnect_destroy_data */
986 g_hash_table_remove(yd->peers, im->from); 986 if (im) {
987 g_hash_table_remove(yd->peers, im->from);
988 g_free(im);
989 }
987 return; 990 return;
988 } 991 }
989 992
990 /* TODO: It seems that this check should be per IM, not global */ 993 /* TODO: It seems that this check should be per IM, not global */
991 /* Check for the Doodle IMV */ 994 /* Check for the Doodle IMV */
1023 for (l = list; l; l = l->next) { 1026 for (l = list; l; l = l->next) {
1024 YahooFriend *f; 1027 YahooFriend *f;
1025 char *m, *m2; 1028 char *m, *m2;
1026 char *msn_from = NULL; 1029 char *msn_from = NULL;
1027 const char *from; 1030 const char *from;
1028 PurpleConversation *c;
1029 im = l->data; 1031 im = l->data;
1030 1032
1031 if (!im->from || !im->msg) { 1033 if (!im->from || !im->msg) {
1032 g_free(im); 1034 g_free(im);
1033 continue; 1035 continue;
1075 from = msn_from; 1077 from = msn_from;
1076 } else { 1078 } else {
1077 from = im->from; 1079 from = im->from;
1078 } 1080 }
1079 1081
1080 c = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, from, account);
1081
1082 if (!strcmp(m, "<ding>")) { 1082 if (!strcmp(m, "<ding>")) {
1083 char *username; 1083 char *username;
1084 1084
1085 if (c == NULL) {
1086 c = purple_conversation_new(PURPLE_CONV_TYPE_IM, account, from);
1087 }
1088 username = g_markup_escape_text(from, -1); 1085 username = g_markup_escape_text(from, -1);
1089 purple_prpl_got_attention(gc, username, YAHOO_BUZZ); 1086 purple_prpl_got_attention(gc, username, YAHOO_BUZZ);
1090 g_free(username); 1087 g_free(username);
1091 g_free(m); 1088 g_free(m);
1092 g_free(im); 1089 g_free(im);
4290 } 4287 }
4291 } 4288 }
4292 4289
4293 msn = !g_ascii_strncasecmp(who, "msn/", 4); 4290 msn = !g_ascii_strncasecmp(who, "msn/", 4);
4294 4291
4295 if( strncmp(who, "+", 1) == 0 ) { 4292 if (who[0] == '+') {
4296 /* we have an sms to be sent */ 4293 /* we have an sms to be sent */
4297 gchar *carrier = NULL; 4294 gchar *carrier = NULL;
4298 const char *alias = NULL; 4295 const char *alias = NULL;
4299 PurpleAccount *account = purple_connection_get_account(gc); 4296 PurpleAccount *account = purple_connection_get_account(gc);
4300 PurpleConversation *conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, who, account); 4297 PurpleConversation *conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, who, account);
4548 else if (!idle && yd->current_status == YAHOO_STATUS_IDLE) { 4545 else if (!idle && yd->current_status == YAHOO_STATUS_IDLE) {
4549 status = purple_presence_get_active_status(purple_account_get_presence(purple_connection_get_account(gc))); 4546 status = purple_presence_get_active_status(purple_account_get_presence(purple_connection_get_account(gc)));
4550 yd->current_status = get_yahoo_status_from_purple_status(status); 4547 yd->current_status = get_yahoo_status_from_purple_status(status);
4551 } 4548 }
4552 4549
4553 invisible = !( purple_presence_is_available(purple_account_get_presence(purple_connection_get_account(gc))) ); 4550 invisible = (yd->current_status == YAHOO_STATUS_INVISIBLE);
4554 4551
4555 pkt = yahoo_packet_new(YAHOO_SERVICE_Y6_STATUS_UPDATE, YAHOO_STATUS_AVAILABLE, yd->session_id); 4552 pkt = yahoo_packet_new(YAHOO_SERVICE_Y6_STATUS_UPDATE, YAHOO_STATUS_AVAILABLE, yd->session_id);
4556 4553
4557 if (!idle && invisible) 4554 if (!idle && invisible)
4558 yahoo_packet_hash_int(pkt, 10, YAHOO_STATUS_AVAILABLE); 4555 yahoo_packet_hash_int(pkt, 10, YAHOO_STATUS_AVAILABLE);