raoergsls / miranda

Automatically exported from code.google.com/p/miranda
0 stars 1 forks source link

icq assertion when resolving contact's country code #667

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Miranda Version                  : 0.9.0 alpha build #6 Unicode [running 
inside WOW64]

Unicode Build                    : Yes
Test Build # (if applicable)     :
Plugin Version # (if applicable) :

What steps will reproduce the problem?
1. compile Miranda in debug mode
2. view a Slovak person's "Location" info in profile

What is the expected result?
Correctly looked up country?

What happens instead?
Miranda raises an assertion in icq_fieldnames.cpp's LookupFieldName().
This is caused by icqosc_svcs.cpp's CIcqProto::GetInfoSetting() when doing:
        if (code == 420) code = 42; // conversion of obsolete codes (OMG!)
        else if (code == 421) code = 4201;
        else if (code == 102) code = 1201;
        rc = LookupDatabaseSetting(countryField, code, cgs->pValue, type);

Not exactly sure about this, but if the codes mimic country calling codes, 
42 was czechoslovakia, and now 420 is czech and 421 is slovak. So if 
anything the operation should go the other way around. Either way, there's 
a nice big array of <country id, country name> pairs in icq_fieldnames.cpp 
called countryField[], and it has both 420 and 421, and no 42 nor 4201, 
nor 102 nor 1021. This makes the lookup guaranteed to always fail.
I traced this to r10984 (ghazan, 5 months ago, "merge for phone codes from 
the core"). Original code came from r8822 (jokusoftware, 15 months ago, 
"implemented new protocol for User Details").
I suggest removing this adapter code entirely, unless there is some reason 
to keep it (in which case it needs to be corrected). Maybe ask the author 
of the change to explain the reasoning behind this implementation.

Original issue reported on code.google.com by theultramage on 28 Mar 2010 at 9:28

GoogleCodeExporter commented 9 years ago

Original comment by sami%mir...@gtempaccount.com on 28 Mar 2010 at 10:02

GoogleCodeExporter commented 9 years ago
Well, that code was there because ICQ had changed the country code table... 
currently
contacts have 42, 4201 and 1201... that conversion mess was there to properly 
display
user details set with older clients (the old country code table). Unfortunately 
in
r10984, the ICQ country table was smashed... I plan to change the whole thing 
before
0.9 goes stable, so I did not bother to revert/fix that change.

Original comment by jokusoft...@gmail.com on 28 Mar 2010 at 9:58