Export to GitHub

miranda - issue #1614

[JABBER] Phone number received but not saved


Posted on Aug 14, 2012 by Swift Horse

Miranda Version : 0.9.52 x64

vCard has a telephone number: <TEL> <WORK /> <VOICE /> <NUMBER>5555</NUMBER> </TEL>

But this number not saved in miranda database, while other numbers correctly saved into fields "Phone" and "Cellular"

Here is log of vCard request and response:

<iq type="get" to="ivanov@company.com" id="mir_619"> <vCard xmlns="vcard-temp" prodid="-//HandGen//NONSGML vGen v1.0//EN" version="2.0" /> </iq> ­ <iq type="result" id="mir_619" from="ivanov@company.com" to="petrov@company.com/Work-x64"> <vCard xmlns="vcard-temp"> <N> <GIVEN>Иванов Иван Иванович</GIVEN> </N> <EMAIL> <INTERNET /> <USERID>ivanov@company.com</USERID> </EMAIL> <FN>Иванов Иван Иванович</FN> <ADR> <HOME /> <STREET /> <PCODE /> <CTRY /> </ADR> <ADR> <WORK /> <STREET /> <LOCALITY>Москва</LOCALITY> <REGION /> <PCODE /> <CTRY /> </ADR> <TEL> <HOME /> <VOICE /> <NUMBER /> </TEL> <TEL> <HOME /> <CELL /> <NUMBER>333-33-33</NUMBER> </TEL> <TEL> <WORK /> <VOICE /> <NUMBER>5555</NUMBER> </TEL> <TEL> <WORK /> <CELL /> <NUMBER>555-55-55</NUMBER> </TEL> <TEL> <WORK /> <FAX /> <NUMBER /> </TEL> <TEL> <WORK /> <PAGER /> <NUMBER /> </TEL> <TITLE>Старший специалист</TITLE> <ORG> <ORGUNIT>Группа разработки</ORGUNIT> </ORG> </vCard> </iq> ­

Comment #1

Posted on Aug 15, 2012 by Swift Horse

It seems that miranda incorrectly interprets phone type while storing it into db

The code: //jabber_iqid.cpp //onIqResultGetVcard()

if ( !hasFax && xmlGetChild( n , "FAX" )!=NULL ) { hasFax = TRUE; JSetStringT( hContact, "Fax", xmlGetText( m ) ); } if ( !hasCell && xmlGetChild( n , "CELL" )!=NULL ) { hasCell = TRUE; JSetStringT( hContact, "Cellular", xmlGetText( m ) ); } if ( !hasPhone && ( xmlGetChild( n , "HOME" )!=NULL || xmlGetChild( n , "WORK" )!=NULL || xmlGetChild( n , "VOICE" )!=NULL || ( xmlGetChild( n , "FAX" )==NULL && xmlGetChild( n , "PAGER" )==NULL && xmlGetChild( n , "MSG" )==NULL && xmlGetChild( n , "CELL" )==NULL && xmlGetChild( n , "VIDEO" )==NULL && xmlGetChild( n , "BBS" )==NULL && xmlGetChild( n , "MODEM" )==NULL && xmlGetChild( n , "ISDN" )==NULL && xmlGetChild( n , "PCS" )==NULL )) ) { hasPhone = TRUE; JSetStringT( hContact, "Phone", xmlGetText( m ) ); }

First number ( 333-33-33 ) stored in "Cellular" and "Phone" fields, "hasCell" and "hasPhone" setted to TRUE, and other number are ignored.

As quick fix it will be good to use "else" before second and third "if", it will allow to store the second number.

But in the future this code should be rewritten, to be able to store at least the main types of numbers - work-cell, work-voice, home-cell, home-voice etc.

Comment #2

Posted on Aug 18, 2012 by Helpful Cat

(No comment was entered for this change.)

Comment #3

Posted on Aug 22, 2012 by Swift Horse

quick patch

Attachments

Status: Assigned

Labels:
Type-Bug Priority-Medium Component-Protocol-Jabber