lucc / khard

Console vcard client
https://khard.readthedocs.io/en/latest/
GNU General Public License v3.0
595 stars 66 forks source link

Values not picked up from item1.X-ABRELATEDNAMES fields #286

Closed dinojr closed 3 years ago

dinojr commented 3 years ago

Google contacts uses item1.X-ABRELATEDNAMES and item1.X-ABLABEL fields for child/spouse/... relations (see https://github.com/scheibler/khard/issues/273#issuecomment-781947931_). Even though it's not the proper way to handle it (there are RELATED fields for that) khard should be able to search the value of item1.X-ABRELATEDNAMES but it doesn't on my system.

I've tried the latest official release (0.17.0) and the tip of the git branch (0.17.1.dev47+g57b5bbc) with a test vcard:

BEGIN:VCARD
VERSION:3.0
UID:bgd94fikayue7f0yn88fk9d4w1v3sxuov17m
FN:John Smith
N:Smith;John;;;
REV:20210219T111150Z
item1.X-ABLABEL:Child
item1.X-ABRELATEDNAMES:Jenny
END:VCARD

Both find John smith but not Jenny.

d7415 commented 3 years ago

Just to confirm my (working) command line and results:

$ khard jenny
Address book: main
Index    Name          Phone    Email    Uid   
1        John Smith                      b
$ khard show jenny
Name: John Smith
Full name: John Smith
Address book: main
Private:
    ABRELATEDNAMES: 
        - Child: Jenny
Miscellaneous
    UID: bgd94fikayue7f0yn88fk9d4w1v3sxuov17m
dinojr commented 3 years ago

Would you mind sharing your config file ? Here is mine:

[addressbooks]
# [[family]]
# path = ~/.contacts/family/
# [[friends]]
# path = ~/.contacts/friends/
[[default]]
path = ~/.contacts

[general]
debug = no
default_action = list
# These are either strings or comma seperated lists
editor = vim, -i, NONE
merge_editor = vimdiff

[contact table]
# display names by first or last name: first_name / last_name / formatted_name
display = first_name
# group by address book: yes / no
group_by_addressbook = no
# reverse table ordering: yes / no
reverse = no
# append nicknames to name column: yes / no
show_nicknames = no
# show uid table column: yes / no
show_uids = yes
# sort by first or last name: first_name / last_name / formatted_name
sort = last_name
# localize dates: yes / no
localize_dates = yes
# set a comma separated list of preferred phone number types in descending priority
# or nothing for non-filtered alphabetical order
preferred_phone_number_type = pref, cell, home
# set a comma separated list of preferred email address types in descending priority
# or nothing for non-filtered alphabetical order
preferred_email_address_type = pref, work, home

[vcard]
# extend contacts with your own private objects
# these objects are stored with a leading "X-" before the object name in the vcard files
# every object label may only contain letters, digits and the - character
# example:
#   private_objects = Jabber, Skype, Twitter
# default: ,  (the empty list)
private_objects = Jabber, Skype, Twitter
# preferred vcard version: 3.0 / 4.0
preferred_version = 3.0
# Look into source vcf files to speed up search queries: yes / no
search_in_source_files = no
# skip unparsable vcard files: yes / no
skip_unparsable = no
d7415 commented 3 years ago

That's it! I have:

private_objects = Jabber, Skype, Twitter, ABDATE, ABRELATEDNAMES

Changing to yours results in the behaviour you have.

Adding those also makes space for them in the template for new contacts.

dinojr commented 3 years ago

Works for me too, I'll add RELATED for good measure, in case someone starts using them. Although it seems the syntax RELATED;TYPE=child;VALUE=text:name_of_the_child isn't covered by the "Private" fields of khard.

d7415 commented 3 years ago

Great! It's probably not worth adding RELATED as that section only applies to private (X-*) fields.