We have moved to a new Sailfish OS Forum. Please start new discussions there.
1

How to read last sms from specific sender - ssh preferably

asked 2020-04-09 16:34:44 +0200

greatneon gravatar image

Hi there. Any ideas how can I read last sms from specific sender? I searched around and found: https://sailfishos.org/wiki/Messaging#Messaging https://sailfishos.org/wiki/Telepathy_Framework https://git.merproject.org/mer-core/telepathy-ring

But that's it... I was hoping someone already played with this or is more keen with this then me.

edit retag flag offensive close delete

3 Answers

Sort by » oldest newest most voted
5

answered 2020-04-09 17:31:49 +0200

igor gravatar image

/home/nemo/.local/share/commhistory/commhistory.db is the sqlite database where all sort of messages are stored.

Then you can list all SMS messages with:

sqlite3 /home/nemo/.local/share/commhistory/commhistory.db "select remoteUid, freeText from events order by starttime desc limit 15"

or filter it by phone number and get the last one:

sqlite3 /home/nemo/.local/share/commhistory/commhistory.db "select freeText from events where remoteUid='+111111111' order by starttime desc limit 1"
edit flag offensive delete publish link more

Comments

@igor your first query shows the latest 15! to show all SMS just remote the "limit 15". Great answer anyway!

For people who don't have installed the sqlite3 command, you can add it from root shell with the following command:

pkcon install sqlite
nas ( 2020-04-10 14:16:55 +0200 )edit
1

@nas yeah, i know but i didn't want to put command which would dump a huge amount of output (possibly years of messages) if blindly copy-pasted :)

igor ( 2020-04-10 19:53:55 +0200 )edit
3

answered 2020-04-09 17:33:03 +0200

For debugging purpose, you can inspect the commhistory database. It contains all the SMS : sqlite3 ~/.local/share/commhistory/commhistory.db Then select freeText from events where remoteUid like "%the phone number or part of it%" order by rowid desc limit 1;. You can inspect the schema of the events table to see if you are interested into more fields than freeText: .schema events.

You can run this in one line to make it as a script if you need to also.

edit flag offensive delete publish link more
2

answered 2020-04-09 23:21:35 +0200

Piotr gravatar image

Not a ssh solution, but from time to time I use a silly solution: 1. Type whatever to that contact as new message. 2. Dont send the message, go „gesture” back to Messages. 3. Your „draft” message is on top, you can check latest messages easy. :)

Would love searching in SMS.

edit flag offensive delete publish link more
Login/Signup to Answer

Question tools

Follow
2 followers

Stats

Asked: 2020-04-09 16:34:44 +0200

Seen: 227 times

Last updated: Apr 09 '20