Bug 630421 - Empathy fails to support multiple TEL fields in ContactInfo
Empathy fails to support multiple TEL fields in ContactInfo
Status: RESOLVED FIXED
Product: empathy
Classification: Core
Component: General
2.31.x
Other Linux
: Normal normal
: ---
Assigned To: empathy-maint
empathy-maint
:
Depends on:
Blocks: 631101
  Show dependency tree
 
Reported: 2010-09-23 14:53 UTC by Jonathon Jongsma
Modified: 2011-08-29 10:12 UTC (History)
2 users (show)

See Also:
GNOME target: ---
GNOME version: ---


Attachments
http://git.Collabora.co.uk/?p=user/cassidy/empathy;a=shortlog;h=refs/heads/contact-info-630421 (6.53 KB, patch)
2010-10-20 11:55 UTC, Guillaume Desmottes
reviewed Details | Diff | Review

Description Jonathon Jongsma 2010-09-23 14:53:16 UTC
If a CM supports multiple different telephone fields for the ContactInfo interface, empathy does not support them properly.  For example:

- CM returns 3 different telephone fields in ContactInfo.SupportedFields
  - TEL TYPE=HOME
  - TEL TYPE=WORK
  - TEL TYPE=CELL
- In empathy, open personal details (Edit > Personal Information)
- empathy queries the CM for ContactInfo
- the CM returns only a single TEL field with TYPE=HOME
- empathy displays 3 different "Phone Number:" fields, all containing the same phone number returned for TYPE=HOME
- When closing the "Personal Information" dialog, empathy calls SetContactInfo to set the user's ContactInfo
  - Since the home phone number is displayed in all three fields, the home phone number ends up being saved to the work and mobile phone numbers as well.
Comment 1 Guillaume Desmottes 2010-09-29 10:47:06 UTC
Could you test with this branch please?
http://git.Collabora.co.uk/?p=user/cassidy/empathy;a=shortlog;h=refs/heads/contact-info-630421
Comment 2 Jonathon Jongsma 2010-09-29 13:58:46 UTC
It does seem to fix my particular issue, but after looking at the code I don't think it's a complete fix.  For instance:

- field_spec_match_field() seems to assume that spec->flags == TP_CONTACT_INFO_FIELD_FLAG_PARAMETERS_EXACT when matching fields. If the flag is not specified, there might be more or less parameters in field->parameters than there are in spec->parameters.
- Even in the case that there are the same number of parameters in each list, field_spec_match_field() assumes that both field->parameters and spec->parameters are sorted in the same order.  I'm not sure that this is a valid assumption.
Comment 3 Guillaume Desmottes 2010-10-01 09:46:00 UTC
Right, I think we should just refactor this code to make it work in the other way. We should iterate over the fields returned by tp_contact_get_contact_info() and then add those from tp_connection_get_contact_info_supported_fields() which have not be set previoulsy.

But that's a big enough refactoring to not backport it to 2.32 so this specific bug won't be solved in 2.32.
Comment 4 Guillaume Desmottes 2010-10-20 11:55:34 UTC
Created attachment 172835 [details] [review]
http://git.Collabora.co.uk/?p=user/cassidy/empathy;a=shortlog;h=refs/heads/contact-info-630421

 libempathy-gtk/empathy-contact-widget.c |  152 ++++++++++++++++++++++---------
 1 files changed, 107 insertions(+), 45 deletions(-)
Comment 5 Guillaume Desmottes 2010-10-20 11:56:10 UTC
Here is a new version, can you take a look please?
Comment 6 Danielle Madeley 2010-11-03 23:51:27 UTC
Review of attachment 172835 [details] [review]:

Code looks fine. Didn't comprehensively test it.
Comment 7 Guillaume Desmottes 2010-11-04 08:17:23 UTC
Thanks; merged to master.

This problem has been fixed in the development version. The fix will be available in the next major software release. Thank you for your bug report.

Note You need to log in before you can comment on or make changes to this bug.