Bug 274937 - kabcclient's mutt output repeats first name
Summary: kabcclient's mutt output repeats first name
Status: RESOLVED FIXED
Alias: None
Product: kdepim
Classification: Applications
Component: libkdepim (show other bugs)
Version: 4.4
Platform: FreeBSD Ports FreeBSD
: NOR normal
Target Milestone: ---
Assignee: kdepim bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-06-04 21:43 UTC by Fernando Schapachnik
Modified: 2011-08-03 18:14 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Solves problem and adds 'includenickname' functionality (6.94 KB, patch)
2011-06-04 21:43 UTC, Fernando Schapachnik
Details
Improved version of the patch (7.12 KB, patch)
2011-06-06 21:15 UTC, Fernando Schapachnik
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Fernando Schapachnik 2011-06-04 21:43:59 UTC
Created attachment 60628 [details]
Solves problem and adds 'includenickname' functionality

Version:           4.4 (using KDE 4.5.5) 
OS:                FreeBSD

kabcclient --list --of mutt reports
alias jdoe John John <jdoe@example.com>
instead of
alias jdoe John Doe <jdoe@example.com>

It behaves like that despite the 'altkeys' option being used or not.

Reproducible: Always

Steps to Reproduce:
Run kabcclient --list --of mutt

Actual Results:  
alias jdoe John John <jdoe@example.com>

Expected Results:  
alias jdoe John Doe <jdoe@example.com>

The code at kdepim-4.4.11.1/console/kabcclient/src/outputformatimpls.cpp
said:

stream << fromUnicode(m_codec, addressee.givenName()) << " "
       << fromUnicode(m_codec, addressee.familyName())<< " <"
       << fromUnicode(m_codec, *it)                   << ">";

For some reason the stream would get corrupted and either repeat the second parameter or put garbage instead of it (in some tests).

The solution was splitting the call to the stream as in:


stream << fromUnicode(m_codec, addressee.givenName()) << " ";
stream << fromUnicode(m_codec, addressee.familyName())<< " <"
       << fromUnicode(m_codec, *it)                   << ">";

Also, I wanted to have aliases for nicknames, so if John Doe has a nick name johnny, I can have also

alias johnny Joe Doe <jdoe@example.com>

To that purpose the attached patch adds the option 'includenickname'.

Thanks!
Comment 1 Fernando Schapachnik 2011-06-06 21:15:43 UTC
Created attachment 60711 [details]
Improved version of the patch

Some email addresses were still wrong.
Comment 2 Allen Winter 2011-06-09 00:16:23 UTC
CC'ing Kevin.
He might be interested in this patch.
Comment 3 Kevin Krammer 2011-06-14 23:26:17 UTC
Git commit 884830bb81780562acd7d0a8d691b48f61cac085 by Kevin Krammer.
Committed on 14/06/2011 at 23:23.
Pushed by krake into branch 'master'.

Fix ouput corruption

Returning the internal data of a QByteArray from a local function
caused strange results such as output being repeated.
Fix by returning the QByteArray and calling its constData() when
streaming into the Std C++ output stream
BUG: 274937

M  +32   -32   console/kabcclient/src/outputformatimpls.cpp     

http://commits.kde.org/kdepim/884830bb81780562acd7d0a8d691b48f61cac085
Comment 4 Kevin Krammer 2011-06-14 23:27:52 UTC
Git commit 09f807dfb1257ba500afea00a4b34bdb529fd8cf by Kevin Krammer.
Committed on 14/06/2011 at 23:23.
Pushed by krake into branch '4.6'.

Fix ouput corruption

Returning the internal data of a QByteArray from a local function
caused strange results such as output being repeated.
Fix by returning the QByteArray and calling its constData() when
streaming into the Std C++ output stream
BUG: 274937

M  +32   -32   console/kabcclient/src/outputformatimpls.cpp     

http://commits.kde.org/kdepim/09f807dfb1257ba500afea00a4b34bdb529fd8cf
Comment 5 Kevin Krammer 2011-08-02 14:03:13 UTC
Git commit 5f861c00ebae7390a3b938f6dbca39e342dce37b by Kevin Krammer.
Committed on 30/07/2011 at 13:25.
Pushed by krake into branch 'master'.

Add additional options to Mutt output

Incorporating an extension by Fernando Schapachnik which adds options
to Mutt output for using addressees' nick names instead or additional
to Mutt aliases.

FEATURE: 274937
CCMAIL: fernando@schapachnik.com.ar
DIGEST: Users who use kabcclient to access KDE's address book from Mutt
can now get a contact's nick name (if it exists) instead of or
additional to the usual alias key.

E.g. if there is a contact John "Jonny" Doe <j.doe@example.com>
the instead of

JohDoe John Doe <j.doe@example.com>

one can now get either (new option 'prefernick')

Jonny John Doe <j.doe@example.com>

or (new option 'alsonick')

JohDoe John Doe <j.doe@example.com>
followed by
Jonny John Doe <j.doe@example.com>

M  +87   -12   console/kabcclient/src/outputformatimpls.cpp
M  +39   -2    console/kabcclient/src/outputformatimpls.h

http://commits.kde.org/kdepim/5f861c00ebae7390a3b938f6dbca39e342dce37b
Comment 6 Torgny Nyblom 2011-08-03 18:14:01 UTC
Git commit b9af2b26277ae96ef4e84302665f8bd8767c383e by Torgny Nyblom, on behalf of Kevin Krammer.
Committed on 30/07/2011 at 13:25.
Pushed by tnyblom into branch 'htmlreplies'.

Add additional options to Mutt output

Incorporating an extension by Fernando Schapachnik which adds options
to Mutt output for using addressees' nick names instead or additional
to Mutt aliases.

FEATURE: 274937
CCMAIL: fernando@schapachnik.com.ar
DIGEST: Users who use kabcclient to access KDE's address book from Mutt
can now get a contact's nick name (if it exists) instead of or
additional to the usual alias key.

E.g. if there is a contact John "Jonny" Doe <j.doe@example.com>
the instead of

JohDoe John Doe <j.doe@example.com>

one can now get either (new option 'prefernick')

Jonny John Doe <j.doe@example.com>

or (new option 'alsonick')

JohDoe John Doe <j.doe@example.com>
followed by
Jonny John Doe <j.doe@example.com>

M  +87   -12   console/kabcclient/src/outputformatimpls.cpp
M  +39   -2    console/kabcclient/src/outputformatimpls.h

http://commits.kde.org/kdepim/b9af2b26277ae96ef4e84302665f8bd8767c383e