Mercurial > pidgin
comparison libpurple/protocols/jabber/jabber.c @ 17881:a8b1159fd95b
Simplified registration callback per request of Sean.
author | Andreas Monitzer <pidgin@monitzer.com> |
---|---|
date | Fri, 22 Jun 2007 11:52:50 +0000 |
parents | ca0b86f3dbd2 |
children | 9a19c46adf66 |
comparison
equal
deleted
inserted
replaced
17880:ca0b86f3dbd2 | 17881:a8b1159fd95b |
---|---|
649 | 649 |
650 if(!strcmp(type, "result")) { | 650 if(!strcmp(type, "result")) { |
651 if(js->registration) { | 651 if(js->registration) { |
652 buf = g_strdup_printf(_("Registration of %s@%s successful"), | 652 buf = g_strdup_printf(_("Registration of %s@%s successful"), |
653 js->user->node, js->user->domain); | 653 js->user->node, js->user->domain); |
654 if(account->registration_cb) { | 654 if(account->registration_cb) |
655 char *jid = g_strdup_printf("%s@%s", js->user->node, js->user->domain); | 655 (account->registration_cb)(account, TRUE, account->registration_cb_user_data); |
656 (account->registration_cb)(account, TRUE, jid, js->password, account->registration_cb_user_data); | |
657 g_free(jid); | |
658 /* the password shouldn't be kept around longer than necessary */ | |
659 if(js->password) { | |
660 g_free(js->password); | |
661 js->password = NULL; | |
662 } | |
663 } | |
664 } | 656 } |
665 else | 657 else |
666 buf = g_strdup_printf(_("Registration to %s successful"), | 658 buf = g_strdup_printf(_("Registration to %s successful"), |
667 to); | 659 to); |
668 purple_notify_info(NULL, _("Registration Successful"), | 660 purple_notify_info(NULL, _("Registration Successful"), |
675 msg = g_strdup(_("Unknown Error")); | 667 msg = g_strdup(_("Unknown Error")); |
676 | 668 |
677 purple_notify_error(NULL, _("Registration Failed"), | 669 purple_notify_error(NULL, _("Registration Failed"), |
678 _("Registration Failed"), msg); | 670 _("Registration Failed"), msg); |
679 g_free(msg); | 671 g_free(msg); |
680 if(account->registration_cb) { | 672 if(account->registration_cb) |
681 char *jid = g_strdup_printf("%s@%s", js->user->node, js->user->domain); | 673 (account->registration_cb)(account, FALSE, account->registration_cb_user_data); |
682 (account->registration_cb)(account, FALSE, NULL, NULL, account->registration_cb_user_data); | |
683 g_free(jid); | |
684 /* the password shouldn't be kept around longer than necessary */ | |
685 if(js->password) { | |
686 g_free(js->password); | |
687 js->password = NULL; | |
688 } | |
689 } | |
690 } | 674 } |
691 g_free(to); | 675 g_free(to); |
692 if(js->registration) | 676 if(js->registration) |
693 jabber_connection_schedule_close(js); | 677 jabber_connection_schedule_close(js); |
694 } | 678 } |
753 if(cbdata->js->registration && !strcmp(id, "username")) { | 737 if(cbdata->js->registration && !strcmp(id, "username")) { |
754 if(cbdata->js->user->node) | 738 if(cbdata->js->user->node) |
755 g_free(cbdata->js->user->node); | 739 g_free(cbdata->js->user->node); |
756 cbdata->js->user->node = g_strdup(value); | 740 cbdata->js->user->node = g_strdup(value); |
757 } | 741 } |
758 if(cbdata->js->registration && !strcmp(id, "password")) { | 742 if(cbdata->js->registration && !strcmp(id, "password")) |
759 if(cbdata->js->password) | 743 purple_account_set_password(cbdata->js->gc->account, value); |
760 g_free(cbdata->js->password); | |
761 cbdata->js->password = g_strdup(value); | |
762 } | |
763 } | 744 } |
764 } | 745 } |
765 | 746 |
766 if(cbdata->js->registration) { | 747 if(cbdata->js->registration) { |
767 username = g_strdup_printf("%s@%s/%s", cbdata->js->user->node, cbdata->js->user->domain, | 748 username = g_strdup_printf("%s@%s/%s", cbdata->js->user->node, cbdata->js->user->domain, |
780 jabber_register_cancel_cb(JabberRegisterCBData *cbdata, PurpleRequestFields *fields) | 761 jabber_register_cancel_cb(JabberRegisterCBData *cbdata, PurpleRequestFields *fields) |
781 { | 762 { |
782 PurpleAccount *account = purple_connection_get_account(cbdata->js->gc); | 763 PurpleAccount *account = purple_connection_get_account(cbdata->js->gc); |
783 if(cbdata->js->registration) { | 764 if(cbdata->js->registration) { |
784 if(account->registration_cb) | 765 if(account->registration_cb) |
785 (account->registration_cb)(account, FALSE, NULL, NULL, account->registration_cb_user_data); | 766 (account->registration_cb)(account, FALSE, account->registration_cb_user_data); |
786 jabber_connection_schedule_close(cbdata->js); | 767 jabber_connection_schedule_close(cbdata->js); |
787 } | 768 } |
788 g_free(cbdata->who); | 769 g_free(cbdata->who); |
789 g_free(cbdata); | 770 g_free(cbdata); |
790 } | 771 } |
829 if(js->registration && xmlnode_get_child(query, "registered")) { | 810 if(js->registration && xmlnode_get_child(query, "registered")) { |
830 purple_notify_error(NULL, _("Already Registered"), | 811 purple_notify_error(NULL, _("Already Registered"), |
831 _("Already Registered"), NULL); | 812 _("Already Registered"), NULL); |
832 if(js->registration) { | 813 if(js->registration) { |
833 if(account->registration_cb) | 814 if(account->registration_cb) |
834 (account->registration_cb)(account, FALSE, NULL, NULL, account->registration_cb_user_data); | 815 (account->registration_cb)(account, FALSE, account->registration_cb_user_data); |
835 jabber_connection_schedule_close(js); | 816 jabber_connection_schedule_close(js); |
836 } | 817 } |
837 return; | 818 return; |
838 } | 819 } |
839 | 820 |
851 purple_notify_uri(NULL, href); | 832 purple_notify_uri(NULL, href); |
852 g_free(href); | 833 g_free(href); |
853 if(js->registration) { | 834 if(js->registration) { |
854 js->gc->wants_to_die = TRUE; | 835 js->gc->wants_to_die = TRUE; |
855 if(account->registration_cb) /* succeeded, but we have no login info */ | 836 if(account->registration_cb) /* succeeded, but we have no login info */ |
856 (account->registration_cb)(account, TRUE, NULL, NULL, account->registration_cb_user_data); | 837 (account->registration_cb)(account, TRUE, account->registration_cb_user_data); |
857 jabber_connection_schedule_close(js); | 838 jabber_connection_schedule_close(js); |
858 } | 839 } |
859 return; | 840 return; |
860 } | 841 } |
861 } | 842 } |
1132 if(js->sasl_cb) | 1113 if(js->sasl_cb) |
1133 g_free(js->sasl_cb); | 1114 g_free(js->sasl_cb); |
1134 #endif | 1115 #endif |
1135 if(js->serverFQDN) | 1116 if(js->serverFQDN) |
1136 g_free(js->serverFQDN); | 1117 g_free(js->serverFQDN); |
1137 if(js->password) | |
1138 g_free(js->password); | |
1139 g_free(js->server_name); | 1118 g_free(js->server_name); |
1140 g_free(js->gmail_last_time); | 1119 g_free(js->gmail_last_time); |
1141 g_free(js->gmail_last_tid); | 1120 g_free(js->gmail_last_tid); |
1142 if(js->old_msg) | 1121 if(js->old_msg) |
1143 g_free(js->old_msg); | 1122 g_free(js->old_msg); |