| 59 _("Your new MSN friendly name is too long."), NULL); |
60 _("Your new MSN friendly name is too long."), NULL); |
| 60 return; |
61 return; |
| 61 } |
62 } |
| 62 |
63 |
| 63 g_snprintf(outparams, sizeof(outparams), "%s %s", |
64 g_snprintf(outparams, sizeof(outparams), "%s %s", |
| 64 gc->username, msn_url_encode(alias)); |
65 gaim_account_get_username(account), msn_url_encode(alias)); |
| 65 |
66 |
| 66 g_free(alias); |
67 g_free(alias); |
| 67 |
68 |
| 68 if (!msn_servconn_send_command(session->notification_conn, |
69 if (!msn_servconn_send_command(session->notification_conn, |
| 69 "REA", outparams)) { |
70 "REA", outparams)) { |
| 70 |
71 |
| 71 hide_login_progress(gc, _("Write error")); |
72 gaim_connection_error(gc, _("Write error")); |
| 72 signoff(gc); |
73 return; |
| 73 } |
74 } |
| 74 } |
75 } |
| 75 |
76 |
| 76 static void |
77 static void |
| 77 msn_set_prp(struct gaim_connection *gc, const char *type, const char *entry) |
78 msn_set_prp(GaimConnection *gc, const char *type, const char *entry) |
| 78 { |
79 { |
| 79 MsnSession *session = gc->proto_data; |
80 MsnSession *session = gc->proto_data; |
| 80 char outparams[MSN_BUF_LEN]; |
81 char outparams[MSN_BUF_LEN]; |
| 81 |
82 |
| 82 if (entry == NULL || *entry == '\0') |
83 if (entry == NULL || *entry == '\0') |
| 85 g_snprintf(outparams, sizeof(outparams), "%s %s", type, entry); |
86 g_snprintf(outparams, sizeof(outparams), "%s %s", type, entry); |
| 86 |
87 |
| 87 if (!msn_servconn_send_command(session->notification_conn, |
88 if (!msn_servconn_send_command(session->notification_conn, |
| 88 "PRP", outparams)) { |
89 "PRP", outparams)) { |
| 89 |
90 |
| 90 hide_login_progress(gc, _("Write error")); |
91 gaim_connection_error(gc, _("Write error")); |
| 91 signoff(gc); |
92 return; |
| 92 } |
93 } |
| 93 } |
94 } |
| 94 |
95 |
| 95 static void |
96 static void |
| 96 msn_set_home_phone_cb(struct gaim_connection *gc, const char *entry) |
97 msn_set_home_phone_cb(GaimConnection *gc, const char *entry) |
| 97 { |
98 { |
| 98 msn_set_prp(gc, "PHH", entry); |
99 msn_set_prp(gc, "PHH", entry); |
| 99 } |
100 } |
| 100 |
101 |
| 101 static void |
102 static void |
| 102 msn_set_work_phone_cb(struct gaim_connection *gc, const char *entry) |
103 msn_set_work_phone_cb(GaimConnection *gc, const char *entry) |
| 103 { |
104 { |
| 104 msn_set_prp(gc, "PHW", entry); |
105 msn_set_prp(gc, "PHW", entry); |
| 105 } |
106 } |
| 106 |
107 |
| 107 static void |
108 static void |
| 108 msn_set_mobile_phone_cb(struct gaim_connection *gc, const char *entry) |
109 msn_set_mobile_phone_cb(GaimConnection *gc, const char *entry) |
| 109 { |
110 { |
| 110 msn_set_prp(gc, "PHM", entry); |
111 msn_set_prp(gc, "PHM", entry); |
| 111 } |
112 } |
| 112 |
113 |
| 113 static void |
114 static void |
| 114 __enable_msn_pages_cb(struct gaim_connection *gc) |
115 __enable_msn_pages_cb(GaimConnection *gc) |
| 115 { |
116 { |
| 116 msn_set_prp(gc, "MOB", "Y"); |
117 msn_set_prp(gc, "MOB", "Y"); |
| 117 } |
118 } |
| 118 |
119 |
| 119 static void |
120 static void |
| 120 __disable_msn_pages_cb(struct gaim_connection *gc) |
121 __disable_msn_pages_cb(GaimConnection *gc) |
| 121 { |
122 { |
| 122 msn_set_prp(gc, "MOB", "N"); |
123 msn_set_prp(gc, "MOB", "N"); |
| 123 } |
124 } |
| 124 |
125 |
| 125 static void |
126 static void |
| 159 } |
159 } |
| 160 |
160 |
| 161 /* -- */ |
161 /* -- */ |
| 162 |
162 |
| 163 static void |
163 static void |
| 164 msn_show_set_friendly_name(struct gaim_connection *gc) |
164 msn_show_set_friendly_name(GaimConnection *gc) |
| 165 { |
165 { |
| 166 gaim_request_input(gc, NULL, _("Set your friendly name."), |
166 gaim_request_input(gc, NULL, _("Set your friendly name."), |
| 167 _("This is the name that other MSN buddies will " |
167 _("This is the name that other MSN buddies will " |
| 168 "see you as."), |
168 "see you as."), |
| 169 gc->displayname, FALSE, |
169 gaim_connection_get_display_name(gc), FALSE, |
| 170 _("OK"), G_CALLBACK(msn_act_id), |
170 _("OK"), G_CALLBACK(msn_act_id), |
| 171 _("Cancel"), NULL, gc); |
171 _("Cancel"), NULL, gc); |
| 172 } |
172 } |
| 173 |
173 |
| 174 static void |
174 static void |
| 175 msn_show_set_home_phone(struct gaim_connection *gc) |
175 msn_show_set_home_phone(GaimConnection *gc) |
| 176 { |
176 { |
| 177 MsnSession *session = gc->proto_data; |
177 MsnSession *session = gc->proto_data; |
| 178 |
178 |
| 179 gaim_request_input(gc, NULL, _("Set your home phone number."), NULL, |
179 gaim_request_input(gc, NULL, _("Set your home phone number."), NULL, |
| 180 msn_user_get_home_phone(session->user), FALSE, |
180 msn_user_get_home_phone(session->user), FALSE, |
| 181 _("OK"), G_CALLBACK(msn_set_home_phone_cb), |
181 _("OK"), G_CALLBACK(msn_set_home_phone_cb), |
| 182 _("Cancel"), NULL, gc); |
182 _("Cancel"), NULL, gc); |
| 183 } |
183 } |
| 184 |
184 |
| 185 static void |
185 static void |
| 186 msn_show_set_work_phone(struct gaim_connection *gc) |
186 msn_show_set_work_phone(GaimConnection *gc) |
| 187 { |
187 { |
| 188 MsnSession *session = gc->proto_data; |
188 MsnSession *session = gc->proto_data; |
| 189 |
189 |
| 190 gaim_request_input(gc, NULL, _("Set your work phone number."), NULL, |
190 gaim_request_input(gc, NULL, _("Set your work phone number."), NULL, |
| 191 msn_user_get_work_phone(session->user), FALSE, |
191 msn_user_get_work_phone(session->user), FALSE, |
| 192 _("OK"), G_CALLBACK(msn_set_work_phone_cb), |
192 _("OK"), G_CALLBACK(msn_set_work_phone_cb), |
| 193 _("Cancel"), NULL, gc); |
193 _("Cancel"), NULL, gc); |
| 194 } |
194 } |
| 195 |
195 |
| 196 static void |
196 static void |
| 197 msn_show_set_mobile_phone(struct gaim_connection *gc) |
197 msn_show_set_mobile_phone(GaimConnection *gc) |
| 198 { |
198 { |
| 199 MsnSession *session = gc->proto_data; |
199 MsnSession *session = gc->proto_data; |
| 200 |
200 |
| 201 gaim_request_input(gc, NULL, _("Set your mobile phone number."), NULL, |
201 gaim_request_input(gc, NULL, _("Set your mobile phone number."), NULL, |
| 202 msn_user_get_mobile_phone(session->user), FALSE, |
202 msn_user_get_mobile_phone(session->user), FALSE, |
| 203 _("OK"), G_CALLBACK(msn_set_mobile_phone_cb), |
203 _("OK"), G_CALLBACK(msn_set_mobile_phone_cb), |
| 204 _("Cancel"), NULL, gc); |
204 _("Cancel"), NULL, gc); |
| 205 } |
205 } |
| 206 |
206 |
| 207 static void |
207 static void |
| 208 msn_show_set_mobile_pages(struct gaim_connection *gc) |
208 msn_show_set_mobile_pages(GaimConnection *gc) |
| 209 { |
209 { |
| 210 gaim_request_action(gc, NULL, _("Allow MSN Mobile pages?"), |
210 gaim_request_action(gc, NULL, _("Allow MSN Mobile pages?"), |
| 211 _("Do you want to allow or disallow people on " |
211 _("Do you want to allow or disallow people on " |
| 212 "your buddy list to send you MSN Mobile pages " |
212 "your buddy list to send you MSN Mobile pages " |
| 213 "to your cell phone or other mobile device?"), |
213 "to your cell phone or other mobile device?"), |
| 393 |
393 |
| 394 return m; |
394 return m; |
| 395 } |
395 } |
| 396 |
396 |
| 397 static void |
397 static void |
| 398 msn_login(struct gaim_account *account) |
398 msn_login(GaimAccount *account) |
| 399 { |
399 { |
| 400 struct gaim_connection *gc; |
400 GaimConnection *gc; |
| 401 MsnSession *session; |
401 MsnSession *session; |
| |
402 const char *username; |
| 402 const char *server; |
403 const char *server; |
| 403 int port; |
404 int port; |
| 404 |
405 |
| 405 server = (*account->proto_opt[USEROPT_MSNSERVER] |
406 server = gaim_account_get_string(account, "server", MSN_SERVER); |
| 406 ? account->proto_opt[USEROPT_MSNSERVER] |
407 port = gaim_account_get_int(account, "port", MSN_PORT); |
| 407 : MSN_SERVER); |
408 |
| 408 port = (*account->proto_opt[USEROPT_MSNPORT] |
409 gc = gaim_account_get_connection(account); |
| 409 ? atoi(account->proto_opt[USEROPT_MSNPORT]) |
|
| 410 : MSN_PORT); |
|
| 411 |
|
| 412 |
|
| 413 gc = new_gaim_conn(account); |
|
| 414 |
410 |
| 415 session = msn_session_new(account, server, port); |
411 session = msn_session_new(account, server, port); |
| 416 session->prpl = my_protocol; |
412 session->prpl = my_protocol; |
| 417 |
413 |
| 418 gc->proto_data = session; |
414 gc->proto_data = session; |
| 419 |
415 |
| 420 set_login_progress(gc, 1, _("Connecting")); |
416 gaim_connection_update_progress(gc, _("Connecting"), 0, MSN_CONNECT_STEPS); |
| 421 |
417 |
| 422 g_snprintf(gc->username, sizeof(gc->username), "%s", |
418 /* Hmm, I don't like this. */ |
| 423 msn_normalize(gc->username)); |
419 username = msn_normalize(gaim_account_get_username(account)); |
| |
420 |
| |
421 if (strcmp(username, gaim_account_get_username(account))) |
| |
422 gaim_account_set_username(account, username); |
| 424 |
423 |
| 425 if (!msn_session_connect(session)) { |
424 if (!msn_session_connect(session)) { |
| 426 hide_login_progress(gc, _("Unable to connect")); |
425 gaim_connection_error(gc, _("Unable to connect")); |
| 427 signoff(gc); |
426 |
| 428 } |
427 return; |
| 429 } |
428 } |
| 430 |
429 } |
| 431 static void |
430 |
| 432 msn_close(struct gaim_connection *gc) |
431 static void |
| |
432 msn_close(GaimConnection *gc) |
| 433 { |
433 { |
| 434 MsnSession *session = gc->proto_data; |
434 MsnSession *session = gc->proto_data; |
| 435 |
435 |
| 436 msn_session_destroy(session); |
436 msn_session_destroy(session); |
| 437 |
437 |
| 438 gc->proto_data = NULL; |
438 gc->proto_data = NULL; |
| 439 } |
439 } |
| 440 |
440 |
| 441 static int |
441 static int |
| 442 msn_send_im(struct gaim_connection *gc, const char *who, const char *message, |
442 msn_send_im(GaimConnection *gc, const char *who, const char *message, |
| 443 int len, int flags) |
443 int len, int flags) |
| 444 { |
444 { |
| |
445 GaimAccount *account = gaim_connection_get_account(gc); |
| 445 MsnSession *session = gc->proto_data; |
446 MsnSession *session = gc->proto_data; |
| 446 MsnSwitchBoard *swboard; |
447 MsnSwitchBoard *swboard; |
| 447 |
448 |
| 448 swboard = msn_session_find_switch_with_passport(session, who); |
449 swboard = msn_session_find_switch_with_passport(session, who); |
| 449 |
450 |
| 450 if (g_ascii_strcasecmp(who, gc->username)) { |
451 if (g_ascii_strcasecmp(who, gaim_account_get_username(account))) { |
| 451 MsnMessage *msg; |
452 MsnMessage *msg; |
| 452 MsnUser *user; |
453 MsnUser *user; |
| 453 |
454 |
| 454 user = msn_user_new(session, who, NULL); |
455 user = msn_user_new(session, who, NULL); |
| 455 |
456 |
| 521 msg = msn_message_new(); |
522 msg = msn_message_new(); |
| 522 msn_message_set_content_type(msg, "text/x-msmsgscontrol"); |
523 msn_message_set_content_type(msg, "text/x-msmsgscontrol"); |
| 523 msn_message_set_receiver(msg, user); |
524 msn_message_set_receiver(msg, user); |
| 524 msn_message_set_charset(msg, NULL); |
525 msn_message_set_charset(msg, NULL); |
| 525 msn_message_set_flag(msg, 'U'); |
526 msn_message_set_flag(msg, 'U'); |
| 526 msn_message_set_attr(msg, "TypingUser", gc->username); |
527 msn_message_set_attr(msg, "TypingUser", |
| |
528 gaim_account_get_username(account)); |
| 527 msn_message_set_attr(msg, "User-Agent", NULL); |
529 msn_message_set_attr(msg, "User-Agent", NULL); |
| 528 msn_message_set_body(msg, "\r\n"); |
530 msn_message_set_body(msg, "\r\n"); |
| 529 |
531 |
| 530 if (!msn_switchboard_send_msg(swboard, msg)) |
532 if (!msn_switchboard_send_msg(swboard, msg)) |
| 531 msn_switchboard_destroy(swboard); |
533 msn_switchboard_destroy(swboard); |
| 575 away = "IDL"; |
577 away = "IDL"; |
| 576 else |
578 else |
| 577 away = "NLN"; |
579 away = "NLN"; |
| 578 |
580 |
| 579 if (!msn_servconn_send_command(session->notification_conn, "CHG", away)) { |
581 if (!msn_servconn_send_command(session->notification_conn, "CHG", away)) { |
| 580 hide_login_progress(gc, _("Write error")); |
582 gaim_connection_error(gc, _("Write error")); |
| 581 signoff(gc); |
583 return; |
| 582 } |
584 } |
| 583 } |
585 } |
| 584 |
586 |
| 585 static void |
587 static void |
| 586 msn_set_idle(struct gaim_connection *gc, int idle) |
588 msn_set_idle(GaimConnection *gc, int idle) |
| 587 { |
589 { |
| 588 MsnSession *session = gc->proto_data; |
590 MsnSession *session = gc->proto_data; |
| 589 |
591 |
| 590 if (gc->away != NULL) |
592 if (gc->away != NULL) |
| 591 return; |
593 return; |
| 592 |
594 |
| 593 if (!msn_servconn_send_command(session->notification_conn, "CHG", |
595 if (!msn_servconn_send_command(session->notification_conn, "CHG", |
| 594 (idle ? "IDL" : "NLN"))) { |
596 (idle ? "IDL" : "NLN"))) { |
| 595 |
597 |
| 596 hide_login_progress(gc, _("Write error")); |
598 gaim_connection_error(gc, _("Write error")); |
| 597 signoff(gc); |
599 return; |
| 598 } |
600 } |
| 599 } |
601 } |
| 600 |
602 |
| 601 static void |
603 static void |
| 602 msn_add_buddy(struct gaim_connection *gc, const char *name) |
604 msn_add_buddy(GaimConnection *gc, const char *name) |
| 603 { |
605 { |
| 604 MsnSession *session = gc->proto_data; |
606 MsnSession *session = gc->proto_data; |
| 605 char *who; |
607 char *who; |
| 606 char outparams[MSN_BUF_LEN]; |
608 char outparams[MSN_BUF_LEN]; |
| 607 GSList *l; |
609 GSList *l; |
| 626 g_snprintf(outparams, sizeof(outparams), |
628 g_snprintf(outparams, sizeof(outparams), |
| 627 "FL %s %s", who, who); |
629 "FL %s %s", who, who); |
| 628 |
630 |
| 629 if (!msn_servconn_send_command(session->notification_conn, |
631 if (!msn_servconn_send_command(session->notification_conn, |
| 630 "ADD", outparams)) { |
632 "ADD", outparams)) { |
| 631 hide_login_progress(gc, _("Write error")); |
633 gaim_connection_error(gc, _("Write error")); |
| 632 signoff(gc); |
634 return; |
| 633 } |
635 } |
| 634 } |
636 } |
| 635 |
637 |
| 636 static void |
638 static void |
| 637 msn_rem_buddy(struct gaim_connection *gc, char *who, char *group) |
639 msn_rem_buddy(GaimConnection *gc, char *who, char *group) |
| 638 { |
640 { |
| 639 MsnSession *session = gc->proto_data; |
641 MsnSession *session = gc->proto_data; |
| 640 char outparams[MSN_BUF_LEN]; |
642 char outparams[MSN_BUF_LEN]; |
| 641 |
643 |
| 642 g_snprintf(outparams, sizeof(outparams), "FL %s", who); |
644 g_snprintf(outparams, sizeof(outparams), "FL %s", who); |
| 643 |
645 |
| 644 if (!msn_servconn_send_command(session->notification_conn, |
646 if (!msn_servconn_send_command(session->notification_conn, |
| 645 "REM", outparams)) { |
647 "REM", outparams)) { |
| 646 |
648 |
| 647 hide_login_progress(gc, _("Write error")); |
649 gaim_connection_error(gc, _("Write error")); |
| 648 signoff(gc); |
650 return; |
| 649 } |
651 } |
| 650 } |
652 } |
| 651 |
653 |
| 652 static void |
654 static void |
| 653 msn_add_permit(struct gaim_connection *gc, const char *who) |
655 msn_add_permit(GaimConnection *gc, const char *who) |
| 654 { |
656 { |
| 655 MsnSession *session = gc->proto_data; |
657 MsnSession *session = gc->proto_data; |
| 656 char buf[MSN_BUF_LEN]; |
658 char buf[MSN_BUF_LEN]; |
| 657 |
659 |
| 658 if (!strchr(who, '@')) { |
660 if (!strchr(who, '@')) { |
| 674 g_snprintf(buf, sizeof(buf), "BL %s", who); |
676 g_snprintf(buf, sizeof(buf), "BL %s", who); |
| 675 |
677 |
| 676 if (!msn_servconn_send_command(session->notification_conn, |
678 if (!msn_servconn_send_command(session->notification_conn, |
| 677 "REM", buf)) { |
679 "REM", buf)) { |
| 678 |
680 |
| 679 hide_login_progress(gc, _("Write error")); |
681 gaim_connection_error(gc, _("Write error")); |
| 680 signoff(gc); |
|
| 681 return; |
682 return; |
| 682 } |
683 } |
| 683 } |
684 } |
| 684 |
685 |
| 685 g_snprintf(buf, sizeof(buf), "AL %s %s", who, who); |
686 g_snprintf(buf, sizeof(buf), "AL %s %s", who, who); |
| 686 |
687 |
| 687 if (!msn_servconn_send_command(session->notification_conn, "ADD", buf)) { |
688 if (!msn_servconn_send_command(session->notification_conn, "ADD", buf)) { |
| 688 hide_login_progress(gc, _("Write error")); |
689 gaim_connection_error(gc, _("Write error")); |
| 689 signoff(gc); |
690 return; |
| 690 } |
691 } |
| 691 } |
692 } |
| 692 |
693 |
| 693 static void |
694 static void |
| 694 msn_add_deny(struct gaim_connection *gc, const char *who) |
695 msn_add_deny(GaimConnection *gc, const char *who) |
| 695 { |
696 { |
| 696 MsnSession *session = gc->proto_data; |
697 MsnSession *session = gc->proto_data; |
| 697 char buf[MSN_BUF_LEN]; |
698 char buf[MSN_BUF_LEN]; |
| 698 |
699 |
| 699 if (!strchr(who, '@')) { |
700 if (!strchr(who, '@')) { |
| 716 g_snprintf(buf, sizeof(buf), "AL %s", who); |
717 g_snprintf(buf, sizeof(buf), "AL %s", who); |
| 717 |
718 |
| 718 if (!msn_servconn_send_command(session->notification_conn, |
719 if (!msn_servconn_send_command(session->notification_conn, |
| 719 "REM", buf)) { |
720 "REM", buf)) { |
| 720 |
721 |
| 721 hide_login_progress(gc, _("Write error")); |
722 gaim_connection_error(gc, _("Write error")); |
| 722 signoff(gc); |
|
| 723 return; |
723 return; |
| 724 } |
724 } |
| 725 } |
725 } |
| 726 |
726 |
| 727 g_snprintf(buf, sizeof(buf), "BL %s %s", who, who); |
727 g_snprintf(buf, sizeof(buf), "BL %s %s", who, who); |
| 728 |
728 |
| 729 if (!msn_servconn_send_command(session->notification_conn, "ADD", buf)) { |
729 if (!msn_servconn_send_command(session->notification_conn, "ADD", buf)) { |
| 730 hide_login_progress(gc, _("Write error")); |
730 gaim_connection_error(gc, _("Write error")); |
| 731 signoff(gc); |
731 return; |
| 732 return; |
732 } |
| 733 } |
733 } |
| 734 } |
734 |
| 735 |
735 static void |
| 736 static void |
736 msn_rem_permit(GaimConnection *gc, const char *who) |
| 737 msn_rem_permit(struct gaim_connection *gc, const char *who) |
|
| 738 { |
737 { |
| 739 MsnSession *session = gc->proto_data; |
738 MsnSession *session = gc->proto_data; |
| 740 char buf[MSN_BUF_LEN]; |
739 char buf[MSN_BUF_LEN]; |
| 741 |
740 |
| 742 g_snprintf(buf, sizeof(buf), "AL %s", who); |
741 g_snprintf(buf, sizeof(buf), "AL %s", who); |
| 743 |
742 |
| 744 if (!msn_servconn_send_command(session->notification_conn, "REM", buf)) { |
743 if (!msn_servconn_send_command(session->notification_conn, "REM", buf)) { |
| 745 hide_login_progress(gc, _("Write error")); |
744 gaim_connection_error(gc, _("Write error")); |
| 746 signoff(gc); |
|
| 747 return; |
745 return; |
| 748 } |
746 } |
| 749 |
747 |
| 750 gaim_privacy_deny_add(gc->account, who); |
748 gaim_privacy_deny_add(gc->account, who); |
| 751 |
749 |
| 752 g_snprintf(buf, sizeof(buf), "BL %s %s", who, who); |
750 g_snprintf(buf, sizeof(buf), "BL %s %s", who, who); |
| 753 |
751 |
| 754 if (!msn_servconn_send_command(session->notification_conn, "ADD", buf)) { |
752 if (!msn_servconn_send_command(session->notification_conn, "ADD", buf)) { |
| 755 hide_login_progress(gc, _("Write error")); |
753 gaim_connection_error(gc, _("Write error")); |
| 756 signoff(gc); |
754 return; |
| 757 return; |
755 } |
| 758 } |
756 } |
| 759 } |
757 |
| 760 |
758 static void |
| 761 static void |
759 msn_rem_deny(GaimConnection *gc, const char *who) |
| 762 msn_rem_deny(struct gaim_connection *gc, const char *who) |
|
| 763 { |
760 { |
| 764 MsnSession *session = gc->proto_data; |
761 MsnSession *session = gc->proto_data; |
| 765 char buf[MSN_BUF_LEN]; |
762 char buf[MSN_BUF_LEN]; |
| 766 |
763 |
| 767 g_snprintf(buf, sizeof(buf), "BL %s", who); |
764 g_snprintf(buf, sizeof(buf), "BL %s", who); |
| 768 |
765 |
| 769 if (!msn_servconn_send_command(session->notification_conn, "REM", buf)) { |
766 if (!msn_servconn_send_command(session->notification_conn, "REM", buf)) { |
| 770 hide_login_progress(gc, _("Write error")); |
767 gaim_connection_error(gc, _("Write error")); |
| 771 signoff(gc); |
|
| 772 return; |
768 return; |
| 773 } |
769 } |
| 774 |
770 |
| 775 gaim_privacy_permit_add(gc->account, who); |
771 gaim_privacy_permit_add(gc->account, who); |
| 776 |
772 |
| 777 g_snprintf(buf, sizeof(buf), "AL %s %s", who, who); |
773 g_snprintf(buf, sizeof(buf), "AL %s %s", who, who); |
| 778 |
774 |
| 779 if (!msn_servconn_send_command(session->notification_conn, "ADD", buf)) { |
775 if (!msn_servconn_send_command(session->notification_conn, "ADD", buf)) { |
| 780 hide_login_progress(gc, _("Write error")); |
776 gaim_connection_error(gc, _("Write error")); |
| 781 signoff(gc); |
777 return; |
| 782 return; |
778 } |
| 783 } |
779 } |
| 784 } |
780 |
| 785 |
781 static void |
| 786 static void |
782 msn_set_permit_deny(GaimConnection *gc) |
| 787 msn_set_permit_deny(struct gaim_connection *gc) |
783 { |
| 788 { |
784 GaimAccount *account = gaim_connection_get_account(gc); |
| 789 MsnSession *session = gc->proto_data; |
785 MsnSession *session = gc->proto_data; |
| 790 char buf[MSN_BUF_LEN]; |
786 char buf[MSN_BUF_LEN]; |
| 791 GSList *s, *t = NULL; |
787 GSList *s, *t = NULL; |
| 792 |
788 |
| 793 if (gc->account->permdeny == PERMIT_ALL || |
789 if (account->perm_deny == PERMIT_ALL || |
| 794 gc->account->permdeny == DENY_SOME) { |
790 account->perm_deny == DENY_SOME) { |
| 795 |
791 |
| 796 strcpy(buf, "AL"); |
792 strcpy(buf, "AL"); |
| 797 } |
793 } |
| 798 else |
794 else |
| 799 strcpy(buf, "BL"); |
795 strcpy(buf, "BL"); |
| 800 |
796 |
| 801 if (!msn_servconn_send_command(session->notification_conn, "BLP", buf)) { |
797 if (!msn_servconn_send_command(session->notification_conn, "BLP", buf)) { |
| 802 hide_login_progress(gc, _("Write error")); |
798 gaim_connection_error(gc, _("Write error")); |
| 803 signoff(gc); |
|
| 804 return; |
799 return; |
| 805 } |
800 } |
| 806 |
801 |
| 807 /* |
802 /* |
| 808 * This is safe because we'll always come here after we've gotten |
803 * This is safe because we'll always come here after we've gotten |
| 963 return 0; |
957 return 0; |
| 964 } |
958 } |
| 965 |
959 |
| 966 msn_message_destroy(msg); |
960 msn_message_destroy(msg); |
| 967 |
961 |
| 968 serv_got_chat_in(gc, id, gc->username, 0, message, time(NULL)); |
962 serv_got_chat_in(gc, id, (char *)gaim_account_get_username(account), |
| |
963 0, message, time(NULL)); |
| 969 |
964 |
| 970 return 0; |
965 return 0; |
| 971 } |
966 } |
| 972 |
967 |
| 973 static void |
968 static void |
| 974 msn_keepalive(struct gaim_connection *gc) |
969 msn_keepalive(GaimConnection *gc) |
| 975 { |
970 { |
| 976 MsnSession *session = gc->proto_data; |
971 MsnSession *session = gc->proto_data; |
| 977 char buf[MSN_BUF_LEN]; |
972 char buf[MSN_BUF_LEN]; |
| 978 |
973 |
| 979 g_snprintf(buf, sizeof(buf), "PNG\r\n"); |
974 g_snprintf(buf, sizeof(buf), "PNG\r\n"); |
| 980 |
975 |
| 981 if (msn_servconn_write(session->notification_conn, |
976 if (msn_servconn_write(session->notification_conn, |
| 982 buf, strlen(buf)) < 0) { |
977 buf, strlen(buf)) < 0) { |
| 983 |
978 |
| 984 hide_login_progress(gc, _("Write error")); |
979 gaim_connection_error(gc, _("Write error")); |
| 985 signoff(gc); |
980 return; |
| 986 return; |
981 } |
| 987 } |
982 } |
| 988 } |
983 |
| 989 |
984 static void |
| 990 static void |
985 msn_group_buddy(GaimConnection *gc, const char *who, |
| 991 msn_group_buddy(struct gaim_connection *gc, const char *who, |
|
| 992 const char *old_group_name, const char *new_group_name) |
986 const char *old_group_name, const char *new_group_name) |
| 993 { |
987 { |
| 994 MsnSession *session = gc->proto_data; |
988 MsnSession *session = gc->proto_data; |
| 995 char outparams[MSN_BUF_LEN]; |
989 char outparams[MSN_BUF_LEN]; |
| 996 MsnGroup *old_group, *new_group; |
990 MsnGroup *old_group, *new_group; |
| 1025 g_snprintf(outparams, sizeof(outparams), "FL %s %s %d", |
1018 g_snprintf(outparams, sizeof(outparams), "FL %s %s %d", |
| 1026 who, who, msn_group_get_id(new_group)); |
1019 who, who, msn_group_get_id(new_group)); |
| 1027 |
1020 |
| 1028 if (!msn_servconn_send_command(session->notification_conn, |
1021 if (!msn_servconn_send_command(session->notification_conn, |
| 1029 "ADD", outparams)) { |
1022 "ADD", outparams)) { |
| 1030 hide_login_progress(gc, _("Write error")); |
1023 gaim_connection_error(gc, _("Write error")); |
| 1031 signoff(gc); |
|
| 1032 return; |
1024 return; |
| 1033 } |
1025 } |
| 1034 } |
1026 } |
| 1035 |
1027 |
| 1036 if (old_group != NULL) { |
1028 if (old_group != NULL) { |
| 1037 g_snprintf(outparams, sizeof(outparams), "FL %s %d", |
1029 g_snprintf(outparams, sizeof(outparams), "FL %s %d", |
| 1038 who, msn_group_get_id(old_group)); |
1030 who, msn_group_get_id(old_group)); |
| 1039 |
1031 |
| 1040 if (!msn_servconn_send_command(session->notification_conn, |
1032 if (!msn_servconn_send_command(session->notification_conn, |
| 1041 "REM", outparams)) { |
1033 "REM", outparams)) { |
| 1042 hide_login_progress(gc, _("Write error")); |
1034 gaim_connection_error(gc, _("Write error")); |
| 1043 signoff(gc); |
|
| 1044 return; |
1035 return; |
| 1045 } |
1036 } |
| 1046 |
1037 |
| 1047 if (msn_users_get_count(msn_group_get_users(old_group)) <= 0) { |
1038 if (msn_users_get_count(msn_group_get_users(old_group)) <= 0) { |
| 1048 g_snprintf(outparams, sizeof(outparams), "%d", |
1039 g_snprintf(outparams, sizeof(outparams), "%d", |
| 1049 msn_group_get_id(old_group)); |
1040 msn_group_get_id(old_group)); |
| 1050 |
1041 |
| 1051 if (!msn_servconn_send_command(session->notification_conn, |
1042 if (!msn_servconn_send_command(session->notification_conn, |
| 1052 "RMG", outparams)) { |
1043 "RMG", outparams)) { |
| 1053 |
1044 |
| 1054 hide_login_progress(gc, _("Write error")); |
1045 gaim_connection_error(gc, _("Write error")); |
| 1055 signoff(gc); |
|
| 1056 return; |
1046 return; |
| 1057 } |
1047 } |
| 1058 } |
1048 } |
| 1059 } |
1049 } |
| 1060 } |
1050 } |
| 1061 |
1051 |
| 1062 static void |
1052 static void |
| 1063 msn_rename_group(struct gaim_connection *gc, const char *old_group_name, |
1053 msn_rename_group(GaimConnection *gc, const char *old_group_name, |
| 1064 const char *new_group_name, GList *members) |
1054 const char *new_group_name, GList *members) |
| 1065 { |
1055 { |
| 1066 MsnSession *session = gc->proto_data; |
1056 MsnSession *session = gc->proto_data; |
| 1067 char outparams[MSN_BUF_LEN]; |
1057 char outparams[MSN_BUF_LEN]; |
| 1068 MsnGroup *old_group; |
1058 MsnGroup *old_group; |
| 1104 b->proto_data = NULL; |
1092 b->proto_data = NULL; |
| 1105 } |
1093 } |
| 1106 } |
1094 } |
| 1107 |
1095 |
| 1108 static void |
1096 static void |
| 1109 msn_convo_closed(struct gaim_connection *gc, char *who) |
1097 msn_convo_closed(GaimConnection *gc, char *who) |
| 1110 { |
1098 { |
| |
1099 GaimAccount *account = gaim_connection_get_account(gc); |
| 1111 MsnSession *session = gc->proto_data; |
1100 MsnSession *session = gc->proto_data; |
| 1112 MsnSwitchBoard *swboard; |
1101 MsnSwitchBoard *swboard; |
| 1113 |
1102 |
| 1114 swboard = msn_session_find_switch_with_passport(session, who); |
1103 swboard = msn_session_find_switch_with_passport(session, who); |
| 1115 |
1104 |
| 1116 if (swboard != NULL) { |
1105 if (swboard != NULL) { |
| 1117 char sendbuf[256]; |
1106 char sendbuf[256]; |
| 1118 |
1107 |
| 1119 g_snprintf(sendbuf, sizeof(sendbuf), "BYE %s\r\n", gc->username); |
1108 g_snprintf(sendbuf, sizeof(sendbuf), "BYE %s\r\n", |
| |
1109 gaim_account_get_username(account)); |
| 1120 |
1110 |
| 1121 msn_servconn_write(swboard->servconn, sendbuf, strlen(sendbuf)); |
1111 msn_servconn_write(swboard->servconn, sendbuf, strlen(sendbuf)); |
| 1122 |
1112 |
| 1123 msn_switchboard_destroy(swboard); |
1113 msn_switchboard_destroy(swboard); |
| 1124 } |
1114 } |