itsjunetime / smserver

An app to allow Jailbroken iPhones to send texts & attachments from their browser
GNU General Public License v3.0
157 stars 26 forks source link

Certain Contact not loading #48

Closed nate-moo closed 3 years ago

nate-moo commented 3 years ago

I have a contact in my phone with prob around 600 numbers and that contact wont load in the web view but it is in my messages app. I can send screenshots if you would like. Additional information can also be provided if you need like logs etc.

nate-moo commented 3 years ago

Device model - iPhone 8 Jailbreak (e.g. checkra1n, unc0ver, Chimera, etc) - Unc0ver iOS Version - 13.5 How you installed the app - Zebra A detailed description of what failed - Loading a specific contact What version of SMServer & libsmserver you're running - 0.5.1 & 0.4.0 And if the app crashed & you can get it, a crash log

itsjunetime commented 3 years ago

Just to clarify: When you say that it won't load, do you mean that it never appears on the list on the left side or that it does appear in the list but no texts load in when you click on it? Also, do any errors show in the browser's console when you run into this issue?

nate-moo commented 3 years ago

image All of the 410 numbers are supposed to be in one contact ^^ image Here is the console ^^

nate-moo commented 3 years ago

image The circled contact is what is supposed to show but instead I have all of those 410 numbers

itsjunetime commented 3 years ago

Yes, I'm following now — this is actually expected behavior. Each one of those numbers is stored as a separate conversation in the sms.db database on your phone (which SMServer communicates with), and SMServer doesn't list by contact, only by conversation. the iMessages app on your phone is smart and groups them all together based on contact, but SMServer is not that smart (yet).

Resolving this will take some time, since I'll have to figure out exactly how these two databases relate and how to figure out what numbers/emails fall under the same contact (Ideally, all those numbers would be listed under the same contact in your contacts database, but since all of their 'names' in the web interface are different, I'd guess not).

If you know how to use sqlite (gui or terminal version), though, and are willing to help, there are some things that you could run to help me out with this issue. Just let me know.

nate-moo commented 3 years ago

I could learn SQLite and help as much as I can, just tell me what I can do and I'll try to do it

itsjunetime commented 3 years ago

ok, so once you can run sqlite commands on your sms.db, run the following command and capture its output:

select c.c0First, c.c1Last, c.c2Middle, c.c3FirstPhonetic, c.c4MiddlePhonetic, c.c5LastPhonetic, c.c12Nickname, c.c15DisplayName, c.c16Phone, m.* from ABPersonFullTextSearch_content  c inner join ABMultiValue m on m.record_id = c.ROWID where c16Phone like "%1410100191%";

This command may output something that has some personal info, so if it does have some and you would rather not post it here, feel free to email it to me instead so that I can check it out.

nate-moo commented 3 years ago

It cant find a table named ABPersonFullTextSerach_content image

nate-moo commented 3 years ago

here are the tables in sms.db image

itsjunetime commented 3 years ago

so sorry, just realized I misspoke; this needs to be run on your AddressBook.sqlitedb database (at /private/var/mobile/Library/AddressBook/AddressBook.sqlitedb on your phone)

nate-moo commented 3 years ago

ah its fine lemme do that real quick then

nate-moo commented 3 years ago

image this doesn't seem right

nate-moo commented 3 years ago

so looking through that table there aren't any phone numbers in any of the contacts so that should be correct then

itsjunetime commented 3 years ago

Hmm well if there was a contact in your phone with the number "1410100191", that should've grabbed all the relevant information about them. Some more questions, then: is "Iamresponding" listed as that contact's first name, last name, nickname or middle name? Also, just to clarify, ABPersonFullTextSearch_content.c16Phone never contains a value? For any of your contacts? If that's the case, then you may just need to manually crawl through your AddressBook.sqlitedb to find where these phone numbers are stored, because ABPersonFullTextSearch_content.c16Phone and ABMultiValue.value are the only places that I see any phone numbers in my database.

nate-moo commented 3 years ago

Also, just to clarify, ABPersonFullTextSearch_content.c16Phone never contains a value?

yea nothing is there for any contact, it has all of the emails but no phone number

Some more questions, then: is "Iamresponding" listed as that contact's first name, last name, nickname or middle name?

it is the first name of the contact

nate-moo commented 3 years ago

ok now there are phone numbers, that was weird

itsjunetime commented 3 years ago

Hmm well then could you run

select c.c0First, c.c1Last, c.c2Middle, c.c3FirstPhonetic, c.c4MiddlePhonetic, c.c5LastPhonetic, c.c12Nickname, c.c15DisplayName, c.c16Phone, m.* from ABPersonFullTextSearch_content  c inner join ABMultiValue m on m.record_id = c.ROWID where c0First like "%Iamresponding%";

and paste the output?

Also, if you'd like a temporary solution, you can get the id values for all the conversations listed in the web interface and set a custom css file that sets all their display attributes to none, e.g.:

#1410100191 {
    display: none
}
nate-moo commented 3 years ago

so... it was too long for my terminal

itsjunetime commented 3 years ago

Would it be possible to output it to a file? e.g. run (from your shell):

sqlite3 ./AddressBook.sqlitedb 'select c.c0First, c.c1Last, c.c2Middle, c.c3FirstPhonetic, c.c4MiddlePhonetic, c.c5LastPhonetic, c.c12Nickname, c.c15DisplayName, c.c16Phone, m.* from ABPersonFullTextSearch_content c inner join ABMultiValue m on m.record_id = c.ROWID where c0First like "%Iamresponding%";' > output.txt
nate-moo commented 3 years ago

yea I just did that as you said that

nate-moo commented 3 years ago

it created a nice 45mb file

itsjunetime commented 3 years ago

That's significantly larger than I would've expected... is your AddressBook.sqlitedb file even 45mb itself? (mine is < 1mb) Also, is it all text or is there somehow like a hexdump in there somewhere? I doubt that whole file is relevant, so maybe you could poke through through it and try to see what's up?

nate-moo commented 3 years ago

I mean, it seems normal besides the weird spacing of the numbers

nate-moo commented 3 years ago

https://1drv.ms/t/s!Am_MW6x59iGrgbcR7NCM3Gxuw6feJQ?e=yDVkY3 here is a link to the file

nate-moo commented 3 years ago

might just want to download it and view it locally because onedrive's viewer has a seizure trying to read it

nate-moo commented 3 years ago

my address book is 1.8mb

itsjunetime commented 3 years ago

So it appears your phone contains ~1300 entries for this same contact, with thousands of phone numbers for each of them. The numbers are spaced out weird so that that field contains basically every possible substring of each of the contact's numbers, separated by spaces. I can definitely look into solutions to fix this problem and condense all the numbers into one contact, but I don't know if I'll be able to get it pushed out any time soon, and I would expect it to cause a noticeable performance hit in loading the list of chats (since it has to cross-reference all the numbers with the contact database). However, I may be able to do it without noticeably impacting performance; I'll keep my progress updated in this task. If you come across any more information that you feel is relevant or could help, feel free to put it here.

nate-moo commented 3 years ago

Jsyk the weird spacing was a fault of me as I just used a google sheet to add every number in for that contact instead of doing it manually. Other than that I dunno. There could be an option in the app which enables loading contacts with entries above a certain noticeable threshold. If it's unchecked it would do what it does now

itsjunetime commented 3 years ago

That's what I'm considering doing -- I doubt that most people are in a situation similar to yours, so I could add optional cross-checking with the Address book to concatenate contacts into a single conversation (for situations like yours), but leave it unchecked by default since most people don't need that increased level of accuracy and it would just hurt the app's speed for them.

nate-moo commented 3 years ago

Thanks for doing this though, I appreciate it a lot.

itsjunetime commented 3 years ago

This link contains a version that should hopefully implement this feature. Once you install it, you'll just have to enable the Merge contact addresses (slower) toggle in settings, load up the web interface, and hopefully all of those numbers will be shown as one entry on the list. Could you try it out and let me know if it worked? (I'm just sharing it here in cases it doesn't work at all with a contact book like yours; I'd like to verify at least base functionality for this feature before releasing it)

nate-moo commented 3 years ago

It didn't work, I toggled the option but nothing changed on the web server

itsjunetime commented 3 years ago

Version 0.6.0 is out now. Does it fix the issue at all once you've toggled the option on and reloaded the web interface?

itsjunetime commented 3 years ago

This issue was fixed in Version 0.6.0 and it's been stale for quite a while. Closing now.

nate-moo commented 3 years ago

I ended up switching to android. Thanks for all your help in the past though.

itsjunetime commented 3 years ago

Yeah, no problem. Thanks for supporting the project :)