| 553 * This is the callback from the "ok clicked" for "set vCard" |
553 * This is the callback from the "ok clicked" for "set vCard" |
| 554 * |
554 * |
| 555 * Sets the vCard with data from PurpleRequestFields. |
555 * Sets the vCard with data from PurpleRequestFields. |
| 556 */ |
556 */ |
| 557 static void |
557 static void |
| 558 jabber_format_info(PurpleConnection *gc, PurpleRequestFields *fields) |
558 jabber_format_info(PurpleConnection *gc, PurpleRequestPage *page) { |
| 559 { |
|
| 560 PurpleXmlNode *vc_node; |
559 PurpleXmlNode *vc_node; |
| 561 PurpleRequestField *field; |
560 PurpleRequestField *field; |
| 562 PurpleProtocol *protocol = NULL; |
561 PurpleProtocol *protocol = NULL; |
| 563 const char *text; |
562 const char *text; |
| 564 char *p; |
563 char *p; |
| 572 |
571 |
| 573 for (vc_tp = vcard_template_data; vc_tp->label != NULL; vc_tp++) { |
572 for (vc_tp = vcard_template_data; vc_tp->label != NULL; vc_tp++) { |
| 574 if (*vc_tp->label == '\0') |
573 if (*vc_tp->label == '\0') |
| 575 continue; |
574 continue; |
| 576 |
575 |
| 577 field = purple_request_fields_get_field(fields, vc_tp->tag); |
576 field = purple_request_page_get_field(page, vc_tp->tag); |
| 578 text = purple_request_field_string_get_value(field); |
577 text = purple_request_field_string_get_value(field); |
| 579 |
578 |
| 580 |
579 |
| 581 if (text != NULL && *text != '\0') { |
580 if (text != NULL && *text != '\0') { |
| 582 PurpleXmlNode *xp; |
581 PurpleXmlNode *xp; |
| 617 { |
616 { |
| 618 const char *account_id = NULL; |
617 const char *account_id = NULL; |
| 619 PurpleAccountManager *manager = NULL; |
618 PurpleAccountManager *manager = NULL; |
| 620 PurpleAccount *account = NULL; |
619 PurpleAccount *account = NULL; |
| 621 PurpleConnection *connection = NULL; |
620 PurpleConnection *connection = NULL; |
| 622 PurpleRequestFields *fields; |
621 PurpleRequestPage *page; |
| 623 PurpleRequestGroup *group; |
622 PurpleRequestGroup *group; |
| 624 PurpleRequestField *field; |
623 PurpleRequestField *field; |
| 625 const struct vcard_template *vc_tp; |
624 const struct vcard_template *vc_tp; |
| 626 const char *user_info; |
625 const char *user_info; |
| 627 char *cdata = NULL; |
626 char *cdata = NULL; |
| 635 account_id = g_variant_get_string(parameter, NULL); |
634 account_id = g_variant_get_string(parameter, NULL); |
| 636 manager = purple_account_manager_get_default(); |
635 manager = purple_account_manager_get_default(); |
| 637 account = purple_account_manager_find_by_id(manager, account_id); |
636 account = purple_account_manager_find_by_id(manager, account_id); |
| 638 connection = purple_account_get_connection(account); |
637 connection = purple_account_get_connection(account); |
| 639 |
638 |
| 640 fields = purple_request_fields_new(); |
639 page = purple_request_page_new(); |
| 641 group = purple_request_group_new(NULL); |
640 group = purple_request_group_new(NULL); |
| 642 purple_request_fields_add_group(fields, group); |
641 purple_request_page_add_group(page, group); |
| 643 |
642 |
| 644 /* |
643 /* |
| 645 * Get existing, XML-formatted, user info |
644 * Get existing, XML-formatted, user info |
| 646 */ |
645 */ |
| 647 if((user_info = purple_account_get_user_info(account)) != NULL) { |
646 if((user_info = purple_account_get_user_info(account)) != NULL) { |
| 689 |
688 |
| 690 purple_request_fields(connection, _("Edit XMPP vCard"), |
689 purple_request_fields(connection, _("Edit XMPP vCard"), |
| 691 _("Edit XMPP vCard"), |
690 _("Edit XMPP vCard"), |
| 692 _("All items below are optional. Enter only the " |
691 _("All items below are optional. Enter only the " |
| 693 "information with which you feel comfortable."), |
692 "information with which you feel comfortable."), |
| 694 fields, |
693 page, |
| 695 _("Save"), G_CALLBACK(jabber_format_info), |
694 _("Save"), G_CALLBACK(jabber_format_info), |
| 696 _("Cancel"), NULL, |
695 _("Cancel"), NULL, |
| 697 purple_request_cpar_from_connection(connection), |
696 purple_request_cpar_from_connection(connection), |
| 698 connection); |
697 connection); |
| 699 } |
698 } |