src/protocols/jabber/buddy.c

changeset 12933
885970470a9b
parent 12919
519199cca273
child 13019
71d729443516
equal deleted inserted replaced
12932:63d706361608 12933:885970470a9b
695 _("Nickname"), text); 695 _("Nickname"), text);
696 } else if(text && !strcmp(child->name, "BDAY")) { 696 } else if(text && !strcmp(child->name, "BDAY")) {
697 g_string_append_printf(info_text, "<b>%s:</b> %s<br/>", 697 g_string_append_printf(info_text, "<b>%s:</b> %s<br/>",
698 _("Birthday"), text); 698 _("Birthday"), text);
699 } else if(!strcmp(child->name, "ADR")) { 699 } else if(!strcmp(child->name, "ADR")) {
700 /* show which address it is */ 700 gboolean address_line_added = FALSE;
701 if(child->child) 701
702 g_string_append_printf(info_text, "<b>%s:</b><br/>",
703 _("Address"));
704 for(child2 = child->child; child2; child2 = child2->next) 702 for(child2 = child->child; child2; child2 = child2->next)
705 { 703 {
706 char *text2; 704 char *text2;
707 705
708 if(child2->type != XMLNODE_TYPE_TAG) 706 if(child2->type != XMLNODE_TYPE_TAG)
709 continue; 707 continue;
710 708
711 text2 = xmlnode_get_data(child2); 709 text2 = xmlnode_get_data(child2);
712 if(text2 && !strcmp(child2->name, "POBOX")) { 710 if (text2 == NULL)
711 continue;
712
713 /* We do this here so that it's not added if all the child
714 * elements are empty. */
715 if (!address_line_added)
716 {
717 g_string_append_printf(info_text, "<b>%s:</b><br/>",
718 _("Address"));
719 address_line_added = TRUE;
720 }
721
722 if(!strcmp(child2->name, "POBOX")) {
713 g_string_append_printf(info_text, 723 g_string_append_printf(info_text,
714 "&nbsp;<b>%s:</b> %s<br/>", 724 "&nbsp;<b>%s:</b> %s<br/>",
715 _("P.O. Box"), text2); 725 _("P.O. Box"), text2);
716 } else if(text2 && !strcmp(child2->name, "EXTADR")) { 726 } else if(!strcmp(child2->name, "EXTADR")) {
717 g_string_append_printf(info_text, 727 g_string_append_printf(info_text,
718 "&nbsp;<b>%s:</b> %s<br/>", 728 "&nbsp;<b>%s:</b> %s<br/>",
719 _("Extended Address"), text2); 729 _("Extended Address"), text2);
720 } else if(text2 && !strcmp(child2->name, "STREET")) { 730 } else if(!strcmp(child2->name, "STREET")) {
721 g_string_append_printf(info_text, 731 g_string_append_printf(info_text,
722 "&nbsp;<b>%s:</b> %s<br/>", 732 "&nbsp;<b>%s:</b> %s<br/>",
723 _("Street Address"), text2); 733 _("Street Address"), text2);
724 } else if(text2 && !strcmp(child2->name, "LOCALITY")) { 734 } else if(!strcmp(child2->name, "LOCALITY")) {
725 g_string_append_printf(info_text, 735 g_string_append_printf(info_text,
726 "&nbsp;<b>%s:</b> %s<br/>", 736 "&nbsp;<b>%s:</b> %s<br/>",
727 _("Locality"), text2); 737 _("Locality"), text2);
728 } else if(text2 && !strcmp(child2->name, "REGION")) { 738 } else if(!strcmp(child2->name, "REGION")) {
729 g_string_append_printf(info_text, 739 g_string_append_printf(info_text,
730 "&nbsp;<b>%s:</b> %s<br/>", 740 "&nbsp;<b>%s:</b> %s<br/>",
731 _("Region"), text2); 741 _("Region"), text2);
732 } else if(text2 && !strcmp(child2->name, "PCODE")) { 742 } else if(!strcmp(child2->name, "PCODE")) {
733 g_string_append_printf(info_text, 743 g_string_append_printf(info_text,
734 "&nbsp;<b>%s:</b> %s<br/>", 744 "&nbsp;<b>%s:</b> %s<br/>",
735 _("Postal Code"), text2); 745 _("Postal Code"), text2);
736 } else if(text2 && (!strcmp(child2->name, "CTRY") 746 } else if(!strcmp(child2->name, "CTRY")
737 || !strcmp(child2->name, "COUNTRY"))) { 747 || !strcmp(child2->name, "COUNTRY")) {
738 g_string_append_printf(info_text, 748 g_string_append_printf(info_text,
739 "&nbsp;<b>%s:</b> %s<br/>", 749 "&nbsp;<b>%s:</b> %s<br/>",
740 _("Country"), text2); 750 _("Country"), text2);
741 } 751 }
742 g_free(text2); 752 g_free(text2);

mercurial