| 1662 type = xmlnode_get_attrib(packet, "type"); |
1662 type = xmlnode_get_attrib(packet, "type"); |
| 1663 |
1663 |
| 1664 if(type && !strcmp(type, "result")) { |
1664 if(type && !strcmp(type, "result")) { |
| 1665 purple_notify_info(js->gc, _("Password Changed"), _("Password Changed"), |
1665 purple_notify_info(js->gc, _("Password Changed"), _("Password Changed"), |
| 1666 _("Your password has been changed.")); |
1666 _("Your password has been changed.")); |
| |
1667 |
| |
1668 purple_account_set_password(js->gc->account, (char *)data); |
| 1667 } else { |
1669 } else { |
| 1668 char *msg = jabber_parse_error(js, packet); |
1670 char *msg = jabber_parse_error(js, packet); |
| 1669 |
1671 |
| 1670 purple_notify_error(js->gc, _("Error changing password"), |
1672 purple_notify_error(js->gc, _("Error changing password"), |
| 1671 _("Error changing password"), msg); |
1673 _("Error changing password"), msg); |
| 1672 g_free(msg); |
1674 g_free(msg); |
| 1673 } |
1675 } |
| |
1676 |
| |
1677 g_free(data); |
| 1674 } |
1678 } |
| 1675 |
1679 |
| 1676 static void jabber_password_change_cb(JabberStream *js, |
1680 static void jabber_password_change_cb(JabberStream *js, |
| 1677 PurpleRequestFields *fields) |
1681 PurpleRequestFields *fields) |
| 1678 { |
1682 { |
| 1697 y = xmlnode_new_child(query, "username"); |
1701 y = xmlnode_new_child(query, "username"); |
| 1698 xmlnode_insert_data(y, js->user->node, -1); |
1702 xmlnode_insert_data(y, js->user->node, -1); |
| 1699 y = xmlnode_new_child(query, "password"); |
1703 y = xmlnode_new_child(query, "password"); |
| 1700 xmlnode_insert_data(y, p1, -1); |
1704 xmlnode_insert_data(y, p1, -1); |
| 1701 |
1705 |
| 1702 jabber_iq_set_callback(iq, jabber_password_change_result_cb, NULL); |
1706 jabber_iq_set_callback(iq, jabber_password_change_result_cb, g_strdup(p1)); |
| 1703 |
1707 |
| 1704 jabber_iq_send(iq); |
1708 jabber_iq_send(iq); |
| 1705 |
|
| 1706 purple_account_set_password(js->gc->account, p1); |
|
| 1707 } |
1709 } |
| 1708 |
1710 |
| 1709 static void jabber_password_change(PurplePluginAction *action) |
1711 static void jabber_password_change(PurplePluginAction *action) |
| 1710 { |
1712 { |
| 1711 |
1713 |