Raphaël Droz [Wed, 2 Jan 2013 13:56:45 +0000 (14:56 +0100)]
* custom output format: fixes and enhancements
- support for the {groups} placeholder
- support for escaped characters (\n, \t, ...)
- removed the leading empty line from the output
- fix segfaults when an empty or a special format string
was provided
- referenced --outformatstr in --help
- code cleanup: use of built-in ITEM_FIELDS and standard_fields[]
to fetch standard fields numbering
* vcard output: removed the leading empty line
(which is mutt-specific)
* colors: added the has_colors() ncurses check
before actually initializing colors.
* Changelog, RELEASE_NOTES, AUTHORS and THANKS files updated
Raphaël Droz [Wed, 19 Dec 2012 01:55:28 +0000 (02:55 +0100)]
ldif: removed ldif_fix_string()
WARNING: this will change the default output file
encoding when importing a LDIF input!
- An LDIF input of UTF-8 entries is base64-encoded (RFC)
str_parse_line() already supports that pretty well.
- But ldif_fix_string(), present since the initial
CVS revision of abook, forces the conversion of utf-8
wide-chars to latin1.
- And that's why iconv exists
=> so let's drop it unless someone complains for a good reason.
Raphaël Droz [Wed, 19 Dec 2012 01:36:29 +0000 (02:36 +0100)]
ldif: deeply reworked LDIF fields processing!
* import: now relies on item_f*t() only when it's safe
Internal field assignation used to be very wrong what made the
LDIF import unreliable. This is not the case anymore
* import: ability to consider additional aliases of LDIF attributes,
eg: "zip" for "postalcode", "fax" for "facsimiletelephonenumber", ...
* import: multiple emails support (up to 2, naturally)
* import/export: added support for "description" (NOTES),
"anniversary" and "ou" (GROUPS)
* export: replaced the attribute named "xmozillaanyphone" by
the _more standard_ "telephonenumber"
Code has been heavily commented and hopefully opens the way
to a better and more extensible LDIF importer.
The last chunk of that patch is a bit unclear but very simple:
LDIF export got rid of some uneeded indirections: there's no point
in testing LDIF_ITEM_FIELDS and doing ldif_conv_table[] translations.
Iterating over j until ITEM_FIELDS to grab names from
ldif_field_names[j] is enough.
Other than new features, effective changes to LDIF export
brought by this commit are:
* attribute order is changed (eg: the URL attribute will
displayed after MOBILEPHONE)
* no more empty ",mail:" in the "dn:" when no email exists
* export now uses the "telephonenumber" attribute
instead of "xmozillaanyphone" previously
The LDIF import may be (undetectably) slower.
That being said, the results a the below command are now
far more reliable.
$ diff ~/.abook/addressbook
<( ./abook --convert --infile ~/.abook/addressbook --outformat ldif | \
./abook --convert --informat ldif --outformat abook )
Raphaël Droz [Thu, 13 Dec 2012 15:47:00 +0000 (16:47 +0100)]
ldif: support parsing from stdin
ldif parser used to seek in the file handler to grab multi-line
strings, thus creating buggy records when input was stdin.
It now reads-ahead the next line in order to work consistently with
unseekable streams like stdin.
Raphaël Droz [Thu, 13 Dec 2012 16:01:14 +0000 (17:01 +0100)]
ldif: cleanup ldif_convert()
* removed the "dirty hack" about LDIF_ITEM_FIELDS
* removed a useless free() causing segfaults
* don't process "objectclass" fields as we don't do anything about them
Raphaël Droz [Mon, 3 Dec 2012 13:28:58 +0000 (14:28 +0100)]
command-line containing --outformat is less-error prone.
Since --convert isn't mandatory anymore for --outformat to be used
(what was conflicting with --mutt-query), we removed the call to
set_convert_var() in 141acfcc.
We now need to test that one of MODE_CONVERT and MODE_QUERY is 'on'
before allowing the use of --outformat.
$ abook --outformat anyformat < file # won't hang anymore
Raphaël Droz [Tue, 6 Nov 2012 21:56:34 +0000 (22:56 +0100)]
vformat: vCard format can now be used in the context of --mutt-query
eg:
$ abook --mutt-query "Max" --outformat vcard
will only dump abook's entries matching "Max", using the vCard output format.
Raphaël Droz [Tue, 30 Aug 2011 14:27:44 +0000 (16:27 +0200)]
custom output format (3/4): added the --outformatstr option
* Allows the definition of a custom output format using placeholders.
* Registers the two functions: custom_export_database() and custom_print_item()
respectively for e_filters and u_filters.
--outformatstr only applies if --outformat=custom has been specified and
if we are querying the database (presence of the --mutt-query option)
If the first character of --outformatstr is a '!', then each entry
is checked before output: it will be full skipped if any of its fields
among those requested is NULL.
Raphaël Droz [Tue, 30 Aug 2011 14:20:39 +0000 (16:20 +0200)]
custom output format (2/4): item-based and the other database-based output functions
* custom_export_database() takes care of building a field_types pointer
from the format string by calling parse_custom_format().
* custom_export_item() output each entry according to the format string
itself + the associated *field_types.
The default value for custom_format is: "{nick} ({name}): {mobile}"
Raphaël Droz [Tue, 30 Aug 2011 09:53:36 +0000 (11:53 +0200)]
convert (1/1): introduced prototypes for per-item filtering functions.
Filtering and output on a per-entry basis rather than in a main-loop is
needed as soon as we want both query + formatting.
The abook_output_item_filter is aimed to store query-compatible output filters.
For most output formats generate a strict and standard-compliant output and won't
need this.
But the goal is the have a generic customizable format compatible with an
hypothetic --query switch.
As a future example, --mutt-query could be seen as:
--query --format="{email} {name}"
* Select items in the main view by clicking and scrolling
* Go to the edit-form by double-clicking
* Edit fields by clicking on them
* Select tabs by clicking on them
* Return to main view/quit abook by clicking on the first row
* parse_date_string(): don't modify string argument in place, since most
if not all of the time this function is applied on a database entry.
Too prone to dangerous oversight.
* fixed bsdcal export not checking for validity of parsed date.
Cedric Duval [Sat, 5 Aug 2006 12:25:46 +0000 (12:25 +0000)]
* Added a string as translatable (reported by C. Stazzone).
* Updated translation files.
* Added translations for said string for de, fr, it, and sv
(checking with translators that it is ok).
* Really changed pointer for reporting strings bugs.