View Single Post
Posts: 53 | Thanked: 20 times | Joined on Jan 2010
#114
In case it helps, here is a bash snippet which adds a text message to the database. I don't know how safe it is, but it /does/ appear in the conversations window after some variable delay. I was planning to use this with my own SMS script but never quite finished the SMS part (I got stuck on sending >160-char texts).

Code:
# $number is like '+447123456789'

# the end bit of the number. this seems to be used in the group_uid field -- no idea what for
partialnumber=$(echo $number | sed -r 's/.*([0-9]{7})$/\1/')

# $message is the message
message=${message//\'/\'\'} #replace singlequotes with double-singlequotes for sqlite

# build query
query="insert into Events (service_id, event_type_id, storage_time, start_time, end_time, is_read, flags, bytes_sent, bytes_received, local_uid, local_name, remote_uid, free_text, group_uid, outgoing, mc_profile) values (3, 7, strftime('%s', 'now'), strftime('%s', 'now'), 0, 1, 0, 0, 0, 'ring/tel/ring', '<SelfHandle>', '$number', '$message', '$partialnumber', 1, 0);"
echo "$query" | sqlite3 $HOME/.rtcom-eventlogger/el-v1.db
 

The Following 3 Users Say Thank You to tremby For This Useful Post: