peterhajas / Smissy

A visualizer for iOS SMS backups
14 stars 3 forks source link

Numbers without contacts don't show area code #12

Open decenv opened 13 years ago

decenv commented 13 years ago

See title. Probably an outgrowth of starting to ignore the area code, which was a good thing when you had to type the number into the shell, but now serves no purpose.

hortont424 commented 13 years ago

I stripped area codes for consistency, but I suppose taking the longest number we ever see for a contact isn't unreasonable.

decenv commented 13 years ago

what do you mean taking the longest number? I am referring to in the left pane list of numbers that have been texted. The ones that have a contact associated show the contact name (this is great), and the ones that don't have contacts (craigslist people that I texted like once and didn't add a contact for) only have the 7 digit number, not the 10 digit number with area code. I don't mean numbers sent as an actual SMS message.

OR was I misunderstanding you somehow?

hortont424 commented 13 years ago

Right, right. Right now we get numbers as they stand, and sometimes they're 10 digit, and sometimes they're 7 digit, and sometimes they're prefixed by a +, so we just strip all the non-digit characters and then everything down to the last 7 digits and use that (so a conflict could occur if you had two people with the same 7 digits in different area codes). Simplest fix is to keep around the longest number we see that reduces to each give 7 digit suffix and display that longest number in the UI. This doesn't fix potential conflicts, but gives you longer addresses. Fixing conflicts requires playing with address book more, and is Peter's job :-D

decenv commented 13 years ago

OK good, I thought you were talking about numbers sent as texts, and was very confused. I understand it all now.

Come on Peter, school is for squares, work on code! (don't do that, school is very important, don't end up like me)

g1smd commented 12 years ago

If you need to do any phone number manipulation, including seeing if two numbers in different formats actually point to the same telephone number, don't forget the libphonenumber library of functions at http://code.google.com/p/libphonenumber/

It now has number validation and number formatting for 228+ countries. This Java library has been ported to a number of languages including official C++ and javascript builds and unofficial C# and Python builds. Various people are working on Ruby, PHP and others.