comparison libpurple/protocols/yahoo/yahoo.c @ 26248:bc31ebd391d3

use "msn/" rather than "wlm/"
author Sulabh Mahajan <sulabh@soc.pidgin.im>
date Wed, 28 Jan 2009 07:01:37 +0000
parents 1e02d4592894
children 94ffdbdd16fb
comparison
equal deleted inserted replaced
26247:74bb0836f164 26248:bc31ebd391d3
153 GSList *l = pkt->hash; 153 GSList *l = pkt->hash;
154 YahooFriend *f = NULL; 154 YahooFriend *f = NULL;
155 char *name = NULL; 155 char *name = NULL;
156 gboolean unicode = FALSE; 156 gboolean unicode = FALSE;
157 char *message = NULL; 157 char *message = NULL;
158 char *wlm_name = NULL; 158 char *msn_name = NULL;
159 159
160 if (pkt->service == YAHOO_SERVICE_LOGOFF && pkt->status == -1) { 160 if (pkt->service == YAHOO_SERVICE_LOGOFF && pkt->status == -1) {
161 if (!purple_account_get_remember_password(account)) 161 if (!purple_account_get_remember_password(account))
162 purple_account_set_password(account, NULL); 162 purple_account_set_password(account, NULL);
163 purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NAME_IN_USE, 163 purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NAME_IN_USE,
355 if(f && strtol(pair->value, NULL, 10)) 355 if(f && strtol(pair->value, NULL, 10))
356 f->version_id = strtol(pair->value, NULL, 10); 356 f->version_id = strtol(pair->value, NULL, 10);
357 break; 357 break;
358 case 241: /* protocol buddy belongs to */ 358 case 241: /* protocol buddy belongs to */
359 if(strtol(pair->value, NULL, 10) == 2) { 359 if(strtol(pair->value, NULL, 10) == 2) {
360 wlm_name = g_strconcat("wlm/", name, NULL); 360 msn_name = g_strconcat("msn/", name, NULL);
361 name = wlm_name; 361 name = msn_name;
362 } 362 }
363 break; 363 break;
364 default: 364 default:
365 purple_debug_warning("yahoo", 365 purple_debug_warning("yahoo",
366 "Unknown status key %d\n", pair->key); 366 "Unknown status key %d\n", pair->key);
511 511
512 break; 512 break;
513 case 301: /* This is 319 before all s/n's in a group after the first. It is followed by an identical 300. */ 513 case 301: /* This is 319 before all s/n's in a group after the first. It is followed by an identical 300. */
514 if(temp != NULL) { 514 if(temp != NULL) {
515 if(protocol == 2) 515 if(protocol == 2)
516 norm_bud = g_strconcat("wlm/", temp, NULL); 516 norm_bud = g_strconcat("msn/", temp, NULL);
517 else 517 else
518 norm_bud = g_strdup(temp); 518 norm_bud = g_strdup(temp);
519 519
520 if (yd->current_list15_grp) { 520 if (yd->current_list15_grp) {
521 /* This buddy is in a group */ 521 /* This buddy is in a group */
735 char *game = NULL; 735 char *game = NULL;
736 YahooFriend *f = NULL; 736 YahooFriend *f = NULL;
737 GSList *l = pkt->hash; 737 GSList *l = pkt->hash;
738 gint val_11 = 0; 738 gint val_11 = 0;
739 struct yahoo_data *yd = gc->proto_data; 739 struct yahoo_data *yd = gc->proto_data;
740 gboolean wlm = FALSE; 740 gboolean msn = FALSE;
741 char *wlm_from = NULL; 741 char *msn_from = NULL;
742 742
743 account = purple_connection_get_account(gc); 743 account = purple_connection_get_account(gc);
744 744
745 while (l) { 745 while (l) {
746 struct yahoo_pair *pair = l->data; 746 struct yahoo_pair *pair = l->data;
754 game = pair->value; 754 game = pair->value;
755 if (pair->key == 11) 755 if (pair->key == 11)
756 val_11 = strtol(pair->value, NULL, 10); 756 val_11 = strtol(pair->value, NULL, 10);
757 if (pair->key == 241) 757 if (pair->key == 241)
758 if(strtol(pair->value, NULL, 10) == 2) 758 if(strtol(pair->value, NULL, 10) == 2)
759 wlm = TRUE; 759 msn = TRUE;
760 l = l->next; 760 l = l->next;
761 } 761 }
762 762
763 if (!from || !msg) 763 if (!from || !msg)
764 return; 764 return;
769 /* remove from p2p connection lists, also calls yahoo_p2p_disconnect_destroy_data */ 769 /* remove from p2p connection lists, also calls yahoo_p2p_disconnect_destroy_data */
770 g_hash_table_remove(yd->peers, from); 770 g_hash_table_remove(yd->peers, from);
771 return; 771 return;
772 } 772 }
773 773
774 if(wlm) 774 if(msn)
775 wlm_from = g_strconcat("wlm/", from, NULL); 775 msn_from = g_strconcat("msn/", from, NULL);
776 776
777 if (!g_ascii_strncasecmp(msg, "TYPING", strlen("TYPING")) 777 if (!g_ascii_strncasecmp(msg, "TYPING", strlen("TYPING"))
778 && (purple_privacy_check(account, from))) 778 && (purple_privacy_check(account, from)))
779 { 779 {
780 if(wlm) { 780 if(msn) {
781 if (*stat == '1') 781 if (*stat == '1')
782 serv_got_typing(gc, wlm_from, 0, PURPLE_TYPING); 782 serv_got_typing(gc, msn_from, 0, PURPLE_TYPING);
783 else 783 else
784 serv_got_typing_stopped(gc, wlm_from); 784 serv_got_typing_stopped(gc, msn_from);
785 } 785 }
786 else { 786 else {
787 if (*stat == '1') 787 if (*stat == '1')
788 serv_got_typing(gc, from, 0, PURPLE_TYPING); 788 serv_got_typing(gc, from, 0, PURPLE_TYPING);
789 else 789 else
814 char *buf = g_strdup_printf(_("%s has sent you a webcam invite, which is not yet supported."), from); 814 char *buf = g_strdup_printf(_("%s has sent you a webcam invite, which is not yet supported."), from);
815 purple_conversation_write(conv, NULL, buf, PURPLE_MESSAGE_SYSTEM|PURPLE_MESSAGE_NOTIFY, time(NULL)); 815 purple_conversation_write(conv, NULL, buf, PURPLE_MESSAGE_SYSTEM|PURPLE_MESSAGE_NOTIFY, time(NULL));
816 g_free(buf); 816 g_free(buf);
817 } 817 }
818 818
819 g_free(wlm_from); 819 g_free(msn_from);
820 } 820 }
821 821
822 822
823 struct _yahoo_im { 823 struct _yahoo_im {
824 char *from; 824 char *from;
897 GSList *l = pkt->hash; 897 GSList *l = pkt->hash;
898 GSList *list = NULL; 898 GSList *list = NULL;
899 struct _yahoo_im *im = NULL; 899 struct _yahoo_im *im = NULL;
900 const char *imv = NULL; 900 const char *imv = NULL;
901 gint val_11 = 0; 901 gint val_11 = 0;
902 gboolean wlm = FALSE; 902 gboolean msn = FALSE;
903 char *wlm_from = NULL; 903 char *msn_from = NULL;
904 904
905 account = purple_connection_get_account(gc); 905 account = purple_connection_get_account(gc);
906 906
907 if (pkt->status <= 1 || pkt->status == 5 || pkt->status == YAHOO_STATUS_OFFLINE) { 907 if (pkt->status <= 1 || pkt->status == 5 || pkt->status == YAHOO_STATUS_OFFLINE) {
908 /* messages are received with status YAHOO_STATUS_OFFLINE in case of p2p */ 908 /* messages are received with status YAHOO_STATUS_OFFLINE in case of p2p */
928 if (im) 928 if (im)
929 im->msg = pair->value; 929 im->msg = pair->value;
930 } 930 }
931 if (pair->key == 241) { 931 if (pair->key == 241) {
932 if(strtol(pair->value, NULL, 10) == 2) 932 if(strtol(pair->value, NULL, 10) == 2)
933 wlm = TRUE; 933 msn = TRUE;
934 } 934 }
935 /* peer session id */ 935 /* peer session id */
936 if (pair->key == 11) { 936 if (pair->key == 11) {
937 if (im) 937 if (im)
938 val_11 = strtol(pair->value, NULL, 10); 938 val_11 = strtol(pair->value, NULL, 10);
947 } else if (pkt->status == 2) { 947 } else if (pkt->status == 2) {
948 purple_notify_error(gc, NULL, 948 purple_notify_error(gc, NULL,
949 _("Your Yahoo! message did not get sent."), NULL); 949 _("Your Yahoo! message did not get sent."), NULL);
950 } 950 }
951 951
952 if(wlm) 952 if(msn)
953 wlm_from = g_strconcat("wlm/", im->from, NULL); 953 msn_from = g_strconcat("msn/", im->from, NULL);
954 954
955 /* disconnect the peer if connected through p2p and sends wrong value for session id */ 955 /* disconnect the peer if connected through p2p and sends wrong value for session id */
956 if( (pkt_type == YAHOO_PKT_TYPE_P2P) && (val_11 != yd->session_id) ) { 956 if( (pkt_type == YAHOO_PKT_TYPE_P2P) && (val_11 != yd->session_id) ) {
957 purple_debug_warning("yahoo","p2p: %s sent us message with wrong session id. Disconnecting p2p connection to peer\n", im->from); 957 purple_debug_warning("yahoo","p2p: %s sent us message with wrong session id. Disconnecting p2p connection to peer\n", im->from);
958 /* remove from p2p connection lists, also calls yahoo_p2p_disconnect_destroy_data */ 958 /* remove from p2p connection lists, also calls yahoo_p2p_disconnect_destroy_data */
1018 g_free(m); 1018 g_free(m);
1019 m = m2; 1019 m = m2;
1020 purple_util_chrreplace(m, '\r', '\n'); 1020 purple_util_chrreplace(m, '\r', '\n');
1021 1021
1022 c = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, im->from, account); 1022 c = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, im->from, account);
1023 if ((c == NULL) && wlm) 1023 if ((c == NULL) && msn)
1024 c=purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, wlm_from, account); 1024 c=purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, msn_from, account);
1025 1025
1026 if (!strcmp(m, "<ding>")) { 1026 if (!strcmp(m, "<ding>")) {
1027 char *username; 1027 char *username;
1028 1028
1029 if(c == NULL) { 1029 if(c == NULL) {
1030 if(wlm) 1030 if(msn)
1031 c = purple_conversation_new(PURPLE_CONV_TYPE_IM, account, wlm_from); 1031 c = purple_conversation_new(PURPLE_CONV_TYPE_IM, account, msn_from);
1032 else 1032 else
1033 c = purple_conversation_new(PURPLE_CONV_TYPE_IM, account, im->from); 1033 c = purple_conversation_new(PURPLE_CONV_TYPE_IM, account, im->from);
1034 } 1034 }
1035 if(wlm) 1035 if(msn)
1036 username = g_markup_escape_text(wlm_from, -1); 1036 username = g_markup_escape_text(msn_from, -1);
1037 else 1037 else
1038 username = g_markup_escape_text(im->from, -1); 1038 username = g_markup_escape_text(im->from, -1);
1039 1039
1040 purple_prpl_got_attention(gc, username, YAHOO_BUZZ); 1040 purple_prpl_got_attention(gc, username, YAHOO_BUZZ);
1041 g_free(username); 1041 g_free(username);
1042 g_free(m); 1042 g_free(m);
1043 g_free(im); 1043 g_free(im);
1044 g_free(wlm_from); 1044 g_free(msn_from);
1045 continue; 1045 continue;
1046 } 1046 }
1047 1047
1048 m2 = yahoo_codes_to_html(m); 1048 m2 = yahoo_codes_to_html(m);
1049 g_free(m); 1049 g_free(m);
1050 1050
1051 if(wlm) 1051 if(msn)
1052 serv_got_im(gc, wlm_from, m2, 0, im->time); 1052 serv_got_im(gc, msn_from, m2, 0, im->time);
1053 else 1053 else
1054 serv_got_im(gc, im->from, m2, 0, im->time); 1054 serv_got_im(gc, im->from, m2, 0, im->time);
1055 1055
1056 g_free(m2); 1056 g_free(m2);
1057 1057
1058 /* laters : implement buddy icon for wlm friends */ 1058 /* laters : implement buddy icon for msn friends */
1059 if(!wlm) { 1059 if(!msn) {
1060 if ((f = yahoo_friend_find(gc, im->from)) && im->buddy_icon == 2) { 1060 if ((f = yahoo_friend_find(gc, im->from)) && im->buddy_icon == 2) {
1061 if (yahoo_friend_get_buddy_icon_need_request(f)) { 1061 if (yahoo_friend_get_buddy_icon_need_request(f)) {
1062 yahoo_send_picture_request(gc, im->from); 1062 yahoo_send_picture_request(gc, im->from);
1063 yahoo_friend_set_buddy_icon_need_request(f, FALSE); 1063 yahoo_friend_set_buddy_icon_need_request(f, FALSE);
1064 } 1064 }
1065 } 1065 }
1066 } 1066 }
1067 1067
1068 g_free(im); 1068 g_free(im);
1069 g_free(wlm_from); 1069 g_free(msn_from);
1070 } 1070 }
1071 g_slist_free(list); 1071 g_slist_free(list);
1072 } 1072 }
1073 1073
1074 static void yahoo_process_sysmessage(PurpleConnection *gc, struct yahoo_packet *pkt) 1074 static void yahoo_process_sysmessage(PurpleConnection *gc, struct yahoo_packet *pkt)
1230 } 1230 }
1231 1231
1232 if(protocol == 0) 1232 if(protocol == 0)
1233 who = temp; 1233 who = temp;
1234 else if(protocol == 2) 1234 else if(protocol == 2)
1235 who = g_strconcat("wlm/", temp, NULL); 1235 who = g_strconcat("msn/", temp, NULL);
1236 1236
1237 if (response == 1) /* Authorized */ 1237 if (response == 1) /* Authorized */
1238 purple_debug_info("yahoo", "Received authorization from buddy '%s'.\n", who ? who : "(Unknown Buddy)"); 1238 purple_debug_info("yahoo", "Received authorization from buddy '%s'.\n", who ? who : "(Unknown Buddy)");
1239 else if (response == 2) { /* Declined */ 1239 else if (response == 2) { /* Declined */
1240 purple_debug_info("yahoo", "Received authorization decline from buddy '%s'.\n", who ? who : "(Unknown Buddy)"); 1240 purple_debug_info("yahoo", "Received authorization decline from buddy '%s'.\n", who ? who : "(Unknown Buddy)");
1278 1278
1279 } 1279 }
1280 l = l->next; 1280 l = l->next;
1281 } 1281 }
1282 if(add_req->protocol == 2) 1282 if(add_req->protocol == 2)
1283 add_req->who = g_strconcat("wlm/", temp, NULL); 1283 add_req->who = g_strconcat("msn/", temp, NULL);
1284 else 1284 else
1285 add_req->who = g_strdup(temp); 1285 add_req->who = g_strdup(temp);
1286 1286
1287 if (add_req->id && add_req->who) { 1287 if (add_req->id && add_req->who) {
1288 char *alias = NULL, *dec_msg = NULL; 1288 char *alias = NULL, *dec_msg = NULL;
2380 char *buf; 2380 char *buf;
2381 YahooFriend *f; 2381 YahooFriend *f;
2382 GSList *l = pkt->hash; 2382 GSList *l = pkt->hash;
2383 struct yahoo_data *yd = gc->proto_data; 2383 struct yahoo_data *yd = gc->proto_data;
2384 int protocol = 0; 2384 int protocol = 0;
2385 gboolean wlm = FALSE; 2385 gboolean msn = FALSE;
2386 2386
2387 while (l) { 2387 while (l) {
2388 struct yahoo_pair *pair = l->data; 2388 struct yahoo_pair *pair = l->data;
2389 2389
2390 switch (pair->key) { 2390 switch (pair->key) {
2398 group = pair->value; 2398 group = pair->value;
2399 break; 2399 break;
2400 case 241: 2400 case 241:
2401 protocol = strtol(pair->value, NULL, 10); 2401 protocol = strtol(pair->value, NULL, 10);
2402 if(protocol == 2) 2402 if(protocol == 2)
2403 wlm = TRUE; 2403 msn = TRUE;
2404 break; 2404 break;
2405 } 2405 }
2406 2406
2407 l = l->next; 2407 l = l->next;
2408 } 2408 }
2410 if (!temp) 2410 if (!temp)
2411 return; 2411 return;
2412 if (!group) 2412 if (!group)
2413 group = ""; 2413 group = "";
2414 2414
2415 if(wlm) 2415 if(msn)
2416 who = g_strconcat("wlm/", temp, NULL); 2416 who = g_strconcat("msn/", temp, NULL);
2417 else 2417 else
2418 who = g_strdup(temp); 2418 who = g_strdup(temp);
2419 2419
2420 if (!err || (err == 2)) { /* 0 = ok, 2 = already on serv list */ 2420 if (!err || (err == 2)) { /* 0 = ok, 2 = already on serv list */
2421 f = yahoo_friend_find_or_new(gc, who); 2421 f = yahoo_friend_find_or_new(gc, who);
2423 if(protocol) 2423 if(protocol)
2424 f->protocol = protocol; 2424 f->protocol = protocol;
2425 2425
2426 if( !g_hash_table_lookup(yd->peers, who) ) { 2426 if( !g_hash_table_lookup(yd->peers, who) ) {
2427 /* we are not connected as client, so set friend to not connected */ 2427 /* we are not connected as client, so set friend to not connected */
2428 if(wlm) 2428 if(msn)
2429 yahoo_friend_set_p2p_status(f,YAHOO_P2PSTATUS_DO_NOT_CONNECT); 2429 yahoo_friend_set_p2p_status(f,YAHOO_P2PSTATUS_DO_NOT_CONNECT);
2430 else { 2430 else {
2431 yahoo_friend_set_p2p_status(f, YAHOO_P2PSTATUS_NOT_CONNECTED); 2431 yahoo_friend_set_p2p_status(f, YAHOO_P2PSTATUS_NOT_CONNECTED);
2432 f->p2p_packet_sent = 0; 2432 f->p2p_packet_sent = 0;
2433 } 2433 }
4443 int ret = 1; 4443 int ret = 1;
4444 YahooFriend *f = NULL; 4444 YahooFriend *f = NULL;
4445 gsize lenb = 0; 4445 gsize lenb = 0;
4446 glong lenc = 0; 4446 glong lenc = 0;
4447 struct yahoo_p2p_data *p2p_data; 4447 struct yahoo_p2p_data *p2p_data;
4448 gboolean wlm = FALSE; 4448 gboolean msn = FALSE;
4449 msg2 = yahoo_string_encode(gc, msg, &utf8); 4449 msg2 = yahoo_string_encode(gc, msg, &utf8);
4450 4450
4451 if(msg2) { 4451 if(msg2) {
4452 lenb = strlen(msg2); 4452 lenb = strlen(msg2);
4453 lenc = g_utf8_strlen(msg2, -1); 4453 lenc = g_utf8_strlen(msg2, -1);
4462 g_free(msg2); 4462 g_free(msg2);
4463 return -E2BIG; 4463 return -E2BIG;
4464 } 4464 }
4465 } 4465 }
4466 4466
4467 wlm = g_str_has_prefix(who, "wlm/") || g_str_has_prefix(who, "WLM/"); 4467 msn = g_str_has_prefix(who, "msn/") || g_str_has_prefix(who, "MSN/");
4468 4468
4469 if( strncmp(who, "+", 1) == 0 ) { 4469 if( strncmp(who, "+", 1) == 0 ) {
4470 /* we have an sms to be sent */ 4470 /* we have an sms to be sent */
4471 gchar *carrier = NULL; 4471 gchar *carrier = NULL;
4472 const char *alias = NULL; 4472 const char *alias = NULL;
4514 4514
4515 return ret; 4515 return ret;
4516 } 4516 }
4517 4517
4518 pkt = yahoo_packet_new(YAHOO_SERVICE_MESSAGE, YAHOO_STATUS_OFFLINE, 0); 4518 pkt = yahoo_packet_new(YAHOO_SERVICE_MESSAGE, YAHOO_STATUS_OFFLINE, 0);
4519 if(wlm) { 4519 if(msn) {
4520 yahoo_packet_hash(pkt, "ss", 1, purple_connection_get_display_name(gc), 5, who+4); 4520 yahoo_packet_hash(pkt, "ss", 1, purple_connection_get_display_name(gc), 5, who+4);
4521 yahoo_packet_hash_int(pkt, 241, 2); 4521 yahoo_packet_hash_int(pkt, 241, 2);
4522 } 4522 }
4523 else { 4523 else {
4524 yahoo_packet_hash(pkt, "ss", 1, purple_connection_get_display_name(gc), 5, who); 4524 yahoo_packet_hash(pkt, "ss", 1, purple_connection_get_display_name(gc), 5, who);
4563 yahoo_packet_hash_str(pkt, 206, "2"); 4563 yahoo_packet_hash_str(pkt, 206, "2");
4564 4564
4565 /* We may need to not send any packets over 2000 bytes, but I'm not sure yet. */ 4565 /* We may need to not send any packets over 2000 bytes, but I'm not sure yet. */
4566 if ((YAHOO_PACKET_HDRLEN + yahoo_packet_length(pkt)) <= 2000) { 4566 if ((YAHOO_PACKET_HDRLEN + yahoo_packet_length(pkt)) <= 2000) {
4567 /* if p2p link exists, send through it. To-do: key 15, time value to be sent in case of p2p */ 4567 /* if p2p link exists, send through it. To-do: key 15, time value to be sent in case of p2p */
4568 if( (p2p_data = g_hash_table_lookup(yd->peers, who)) && !wlm ) { 4568 if( (p2p_data = g_hash_table_lookup(yd->peers, who)) && !msn ) {
4569 yahoo_packet_hash_int(pkt, 11, p2p_data->session_id); 4569 yahoo_packet_hash_int(pkt, 11, p2p_data->session_id);
4570 yahoo_p2p_write_pkt(p2p_data->source, pkt); 4570 yahoo_p2p_write_pkt(p2p_data->source, pkt);
4571 } 4571 }
4572 else { 4572 else {
4573 yahoo_packet_send(pkt, yd); 4573 yahoo_packet_send(pkt, yd);
4574 if(!wlm) 4574 if(!msn)
4575 yahoo_send_p2p_pkt(gc, who, 0); /* send p2p packet, with val_13=0 */ 4575 yahoo_send_p2p_pkt(gc, who, 0); /* send p2p packet, with val_13=0 */
4576 } 4576 }
4577 } 4577 }
4578 else 4578 else
4579 ret = -E2BIG; 4579 ret = -E2BIG;
4588 4588
4589 static unsigned int yahoo_send_typing(PurpleConnection *gc, const char *who, PurpleTypingState state) 4589 static unsigned int yahoo_send_typing(PurpleConnection *gc, const char *who, PurpleTypingState state)
4590 { 4590 {
4591 struct yahoo_data *yd = gc->proto_data; 4591 struct yahoo_data *yd = gc->proto_data;
4592 struct yahoo_p2p_data *p2p_data; 4592 struct yahoo_p2p_data *p2p_data;
4593 gboolean wlm = (g_str_has_prefix(who, "wlm/") || g_str_has_prefix(who, "WLM/")); 4593 gboolean msn = (g_str_has_prefix(who, "msn/") || g_str_has_prefix(who, "MSN/"));
4594 struct yahoo_packet *pkt = NULL; 4594 struct yahoo_packet *pkt = NULL;
4595 4595
4596 /* Don't do anything if sms is being typed */ 4596 /* Don't do anything if sms is being typed */
4597 if( strncmp(who, "+", 1) == 0 ) 4597 if( strncmp(who, "+", 1) == 0 )
4598 return 0; 4598 return 0;
4599 4599
4600 pkt = yahoo_packet_new(YAHOO_SERVICE_NOTIFY, YAHOO_STATUS_TYPING, 0); 4600 pkt = yahoo_packet_new(YAHOO_SERVICE_NOTIFY, YAHOO_STATUS_TYPING, 0);
4601 4601
4602 /* check to see if p2p link exists, send through it */ 4602 /* check to see if p2p link exists, send through it */
4603 if( (p2p_data = g_hash_table_lookup(yd->peers, who)) && !wlm ) { 4603 if( (p2p_data = g_hash_table_lookup(yd->peers, who)) && !msn ) {
4604 yahoo_packet_hash(pkt, "sssssis", 49, "TYPING", 1, purple_connection_get_display_name(gc), 4604 yahoo_packet_hash(pkt, "sssssis", 49, "TYPING", 1, purple_connection_get_display_name(gc),
4605 14, " ", 13, state == PURPLE_TYPING ? "1" : "0", 4605 14, " ", 13, state == PURPLE_TYPING ? "1" : "0",
4606 5, who, 11, p2p_data->session_id, 1002, "1"); /* To-do: key 15 to be sent in case of p2p */ 4606 5, who, 11, p2p_data->session_id, 1002, "1"); /* To-do: key 15 to be sent in case of p2p */
4607 yahoo_p2p_write_pkt(p2p_data->source, pkt); 4607 yahoo_p2p_write_pkt(p2p_data->source, pkt);
4608 yahoo_packet_free(pkt); 4608 yahoo_packet_free(pkt);
4609 } 4609 }
4610 else { /* send through yahoo server */ 4610 else { /* send through yahoo server */
4611 if(wlm) 4611 if(msn)
4612 yahoo_packet_hash(pkt, "sssssss", 49, "TYPING", 1, purple_connection_get_display_name(gc), 4612 yahoo_packet_hash(pkt, "sssssss", 49, "TYPING", 1, purple_connection_get_display_name(gc),
4613 14, " ", 13, state == PURPLE_TYPING ? "1" : "0", 4613 14, " ", 13, state == PURPLE_TYPING ? "1" : "0",
4614 5, who+4, 1002, "1", 241, "2"); 4614 5, who+4, 1002, "1", 241, "2");
4615 else 4615 else
4616 yahoo_packet_hash(pkt, "ssssss", 49, "TYPING", 1, purple_connection_get_display_name(gc), 4616 yahoo_packet_hash(pkt, "ssssss", 49, "TYPING", 1, purple_connection_get_display_name(gc),
4848 struct yahoo_data *yd = (struct yahoo_data *)gc->proto_data; 4848 struct yahoo_data *yd = (struct yahoo_data *)gc->proto_data;
4849 struct yahoo_packet *pkt; 4849 struct yahoo_packet *pkt;
4850 const char *group = NULL; 4850 const char *group = NULL;
4851 char *group2; 4851 char *group2;
4852 YahooFriend *f; 4852 YahooFriend *f;
4853 gboolean wlm = FALSE; 4853 gboolean msn = FALSE;
4854 4854
4855 if (!yd->logged_in) 4855 if (!yd->logged_in)
4856 return; 4856 return;
4857 4857
4858 wlm = g_str_has_prefix(buddy->name, "wlm/") || g_str_has_prefix(buddy->name, "WLM/"); 4858 msn = g_str_has_prefix(buddy->name, "msn/") || g_str_has_prefix(buddy->name, "MSN/");
4859 4859
4860 if (!purple_privacy_check(purple_connection_get_account(gc), 4860 if (!purple_privacy_check(purple_connection_get_account(gc),
4861 purple_buddy_get_name(buddy))) 4861 purple_buddy_get_name(buddy)))
4862 return; 4862 return;
4863 4863
4869 else 4869 else
4870 group = "Buddies"; 4870 group = "Buddies";
4871 4871
4872 group2 = yahoo_string_encode(gc, group, NULL); 4872 group2 = yahoo_string_encode(gc, group, NULL);
4873 pkt = yahoo_packet_new(YAHOO_SERVICE_ADDBUDDY, YAHOO_STATUS_AVAILABLE, 0); 4873 pkt = yahoo_packet_new(YAHOO_SERVICE_ADDBUDDY, YAHOO_STATUS_AVAILABLE, 0);
4874 if(wlm) { 4874 if(msn) {
4875 yahoo_packet_hash(pkt, "sssssssssss", 4875 yahoo_packet_hash(pkt, "sssssssssss",
4876 14, "", 4876 14, "",
4877 65, group2, 4877 65, group2,
4878 97, "1", 4878 97, "1",
4879 1, purple_connection_get_display_name(gc), 4879 1, purple_connection_get_display_name(gc),
4912 GSList *buddies, *l; 4912 GSList *buddies, *l;
4913 PurpleGroup *g; 4913 PurpleGroup *g;
4914 gboolean remove = TRUE; 4914 gboolean remove = TRUE;
4915 char *cg; 4915 char *cg;
4916 YahooFriend *f = yahoo_friend_find(gc, buddy->name); 4916 YahooFriend *f = yahoo_friend_find(gc, buddy->name);
4917 gboolean wlm = FALSE; 4917 gboolean msn = FALSE;
4918 4918
4919 if (!f) 4919 if (!f)
4920 return; 4920 return;
4921 4921
4922 buddies = purple_find_buddies(purple_connection_get_account(gc), buddy->name); 4922 buddies = purple_find_buddies(purple_connection_get_account(gc), buddy->name);
4935 4935
4936 cg = yahoo_string_encode(gc, group->name, NULL); 4936 cg = yahoo_string_encode(gc, group->name, NULL);
4937 pkt = yahoo_packet_new(YAHOO_SERVICE_REMBUDDY, YAHOO_STATUS_AVAILABLE, 0); 4937 pkt = yahoo_packet_new(YAHOO_SERVICE_REMBUDDY, YAHOO_STATUS_AVAILABLE, 0);
4938 4938
4939 if(f->protocol == 2) 4939 if(f->protocol == 2)
4940 wlm = TRUE; 4940 msn = TRUE;
4941 if(wlm) 4941 if(msn)
4942 yahoo_packet_hash(pkt, "sss", 1, purple_connection_get_display_name(gc), 4942 yahoo_packet_hash(pkt, "sss", 1, purple_connection_get_display_name(gc),
4943 7, buddy->name+4, 65, cg); 4943 7, buddy->name+4, 65, cg);
4944 else 4944 else
4945 yahoo_packet_hash(pkt, "sss", 1, purple_connection_get_display_name(gc), 4945 yahoo_packet_hash(pkt, "sss", 1, purple_connection_get_display_name(gc),
4946 7, buddy->name, 65, cg); 4946 7, buddy->name, 65, cg);
5017 { 5017 {
5018 struct yahoo_data *yd = gc->proto_data; 5018 struct yahoo_data *yd = gc->proto_data;
5019 struct yahoo_packet *pkt; 5019 struct yahoo_packet *pkt;
5020 char *gpn, *gpo; 5020 char *gpn, *gpo;
5021 YahooFriend *f = yahoo_friend_find(gc, who); 5021 YahooFriend *f = yahoo_friend_find(gc, who);
5022 gboolean wlm = FALSE; 5022 gboolean msn = FALSE;
5023 const char *temp = NULL; 5023 const char *temp = NULL;
5024 5024
5025 /* Step 0: If they aren't on the server list anyway, 5025 /* Step 0: If they aren't on the server list anyway,
5026 * don't bother letting the server know. 5026 * don't bother letting the server know.
5027 */ 5027 */
5028 if (!f) 5028 if (!f)
5029 return; 5029 return;
5030 5030
5031 if(f->protocol == 2) { 5031 if(f->protocol == 2) {
5032 wlm = TRUE; 5032 msn = TRUE;
5033 temp = who+4; 5033 temp = who+4;
5034 } else 5034 } else
5035 temp = who; 5035 temp = who;
5036 5036
5037 /* If old and new are the same, we would probably 5037 /* If old and new are the same, we would probably