summarylogtreecommitdiffstats
path: root/display-multiple-addresses.diff
diff options
context:
space:
mode:
Diffstat (limited to 'display-multiple-addresses.diff')
-rw-r--r--display-multiple-addresses.diff86
1 files changed, 86 insertions, 0 deletions
diff --git a/display-multiple-addresses.diff b/display-multiple-addresses.diff
new file mode 100644
index 000000000000..444673506e13
--- /dev/null
+++ b/display-multiple-addresses.diff
@@ -0,0 +1,86 @@
+Display multiple addresses present in a vCard, along with their "TYPE" arguments
+
+ -- Rafael Laboissiere <rafael@debian.org> Sat, 20 Sep 2008 21:35:22 +0200
+
+--- a/src/view.c
++++ b/src/view.c
+@@ -226,6 +226,8 @@
+ view_geo ()
+ {
+ vc_component *vc = NULL;
++ vc_component_param *vcp = NULL;
++ char *type = NULL;
+ char *str = NULL;
+ char *val = NULL;
+ int x = 0;
+@@ -261,38 +263,46 @@
+
+ wprintw (sub, "\n");
+
+- vc = vc_get_next_by_name (g_v, VC_ADDRESS);
+- val = vc_get_value (vc);
++ vc = g_v;
++ while (vc = vc_get_next_by_name (vc, VC_ADDRESS)) {
+
+- str = get_val_struct_part (val, ADR_PO_BOX);
+- wprintw (sub, "Post Office Box : %s\n", str ? str : "");
+- free (str);
++ vcp = vc ? vc_param_get_by_name (vc_get_param (vc), "type") : NULL;
++ type = vcp ? vc_param_get_value (vcp) : NULL;
++ wprintw (sub, type ? "[%s]\n" : "%s", type ? type : "");
+
+- str = get_val_struct_part (val, ADR_EXT_ADDRESS);
+- wprintw (sub, "Extended Address : %s\n", str ? str : "");
+- free (str);
++ val = vc_get_value (vc);
+
+- str = get_val_struct_part (val, ADR_STREET);
+- wprintw (sub, "Street Address : %s\n", str ? str : "");
+- free (str);
++ str = get_val_struct_part (val, ADR_PO_BOX);
++ wprintw (sub, "Post Office Box : %s\n", str ? str : "");
++ free (str);
+
+- str = get_val_struct_part (val, ADR_LOCALITY);
+- wprintw (sub, "Locality : %s\n", str ? str : "");
+- free (str);
++ str = get_val_struct_part (val, ADR_EXT_ADDRESS);
++ wprintw (sub, "Extended Address : %s\n", str ? str : "");
++ free (str);
+
+- str = get_val_struct_part (val, ADR_REGION);
+- wprintw (sub, "Region : %s\n", str ? str : "");
+- free (str);
++ str = get_val_struct_part (val, ADR_STREET);
++ wprintw (sub, "Street Address : %s\n", str ? str : "");
++ free (str);
+
+- str = get_val_struct_part (val, ADR_POSTAL_CODE);
+- wprintw (sub, "Postal Code : %s\n", str ? str : "");
+- free (str);
++ str = get_val_struct_part (val, ADR_LOCALITY);
++ wprintw (sub, "Locality : %s\n", str ? str : "");
++ free (str);
+
+- str = get_val_struct_part (val, ADR_COUNTRY);
+- wprintw (sub, "Country : %s\n", str ? str : "");
+- free (str);
++ str = get_val_struct_part (val, ADR_REGION);
++ wprintw (sub, "Region : %s\n", str ? str : "");
++ free (str);
++
++ str = get_val_struct_part (val, ADR_POSTAL_CODE);
++ wprintw (sub, "Postal Code : %s\n", str ? str : "");
++ free (str);
++
++ str = get_val_struct_part (val, ADR_COUNTRY);
++ wprintw (sub, "Country : %s\n", str ? str : "");
++ free (str);
++
++ wprintw (sub, "\n");
++ }
+
+- wprintw (sub, "\n");
+ touchwin (win);
+ wrefresh (sub);
+ wrefresh (win);