maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Applications (https://talk.maemo.org/forumdisplay.php?f=41)
-   -   SMS from CLI (Command Line)? (https://talk.maemo.org/showthread.php?t=36148)

sakya 2011-02-10 09:48

Re: SMS from CLI (Command Line)?
 
The problem with autosend is that the conversation app always popups showing the sent message, there's no way in QtMobility to avoid this.
I can easily add this feature, but is it what you want/need?

To avoid simultaneous database writes I'll add an "IMMEDIATE TRANSACTION", thanks.

hutchinsfairy 2011-02-10 09:56

Re: SMS from CLI (Command Line)?
 
I would want it to pop up, I think that would be the expected behaviour for me! I use smssend over ssh at work so I'm not obviously using my phone but I can still look at it for replies. I also schedule (alarmd) sms messages if I'm up in the night (kids) and don't want to wake people so it's useful to get that feedback that it was sent!

sakya 2011-02-10 10:04

Re: SMS from CLI (Command Line)?
 
Ok, I'll add this feature soon. ;)

hutchinsfairy 2011-02-10 13:16

Re: SMS from CLI (Command Line)?
 
0.1.4 Works a charm! Thank you very much.

sakya 2011-02-10 13:24

Re: SMS from CLI (Command Line)?
 
Many thanks for the feedback. :)

tremby 2011-02-10 15:58

Re: SMS from CLI (Command Line)?
 
I'll definitely be trying this at some point soon. But hutchinsfairy, I might have something that interests you so you can check your replies without looking at your phone...

http://sprunge.us/HMQH?sh
(plain text: http://sprunge.us/HMQH)

Help message:
Code:

<user@t900:~> texts --help
Usage: texts [-h|--help] [-n <contact name>] [-d <date of earliest message to be returned>|--latest|--recent]
--latest or --recent switch gives last 24 hours' worth

Last 24 hours' worth (piped to tail to get last 3 messages):
Code:

<user@t900:~>$ texts --latest | tail -n 3
2011-02-09 1748        Simon        <        Running by Tesco on my way home. Anything you guys need? Si :-)
2011-02-09 1801        Simon        >        vitamins, if it's not too late
2011-02-09 1907        Rikki        <        Http://innocentdrinks.com/recipearchive

As you can see, it puts the date and time, their number or their name if it knows it (from an optional mapping file, tab-separated number to name), then < for incoming or > for outgoing, then the message.

First three messages from a particular date from a particular person (it looks at an optional mapping file to turn numbers into names):
Code:

<user@t900:~>$ texts -d 2010-04-01 -n Kiwi | head -n 3
2010-04-02 1507        Kiwi        <        Are your faces going to be at Claires tomorrow? Looking forward to seeing you if the are. Xx
2010-04-02 1509        Kiwi        >        didn't know Claire had a thing. kinda want to see Tiny anyway.
2010-04-02 1511        Kiwi        <        Is Tiny visiting? Bring him to Claires!? How are you? X

There are a lot of ways this could be improved (it'd be very nice for instance to be able to use the N900's contacts database itself rather than a mapping file, but I don't know how) but this does the trick for now.

Hope it helps.

sakya 2011-02-11 10:24

Re: SMS from CLI (Command Line)?
 
To promote the smssend package please test and rate for karma
http://maemo.org/packages/package_in...smssend/0.1.5/

sakya 2011-02-14 13:17

Re: SMS from CLI (Command Line)?
 
If someone cares this is the code to save a sms in the sent folder using rtcom-eventlogger:
Code:

bool SmsSender::saveMsgToSentFolder(QString number, QString message)
{
    bool result = false;
    QString partNumber = number.right(7);

    RTComElEvent* ev = rtcom_el_event_new();

    RTCOM_EL_EVENT_SET_FIELD(ev, service, g_strdup(QString("RTCOM_EL_SERVICE_SMS").toLatin1().data()));
    RTCOM_EL_EVENT_SET_FIELD(ev, event_type, g_strdup(QString("RTCOM_EL_EVENTTYPE_SMS_OUTBOUND").toLatin1().data()));
    RTCOM_EL_EVENT_SET_FIELD(ev, start_time, time(NULL));
    RTCOM_EL_EVENT_SET_FIELD(ev, end_time, time(NULL));
    RTCOM_EL_EVENT_SET_FIELD(ev, is_read, TRUE);
    RTCOM_EL_EVENT_SET_FIELD(ev, remote_ebook_uid, 0);
    RTCOM_EL_EVENT_SET_FIELD(ev, local_uid, g_strdup(QString("ring/tel/ring").toLatin1().data()));
    RTCOM_EL_EVENT_SET_FIELD(ev, local_name, g_strdup(QString("<SelfHandle>").toLatin1().data()));
    RTCOM_EL_EVENT_SET_FIELD(ev, remote_uid, number.toLatin1().data());
    RTCOM_EL_EVENT_SET_FIELD(ev, remote_name, g_strdup(QString("").toLatin1().data()));
    RTCOM_EL_EVENT_SET_FIELD(ev, group_uid, g_strdup(partNumber.toLatin1().data()));
    RTCOM_EL_EVENT_SET_FIELD(ev, free_text, g_strdup(message.toUtf8().data()));

    int id = rtcom_el_add_event(m_El, ev, NULL);
    if (id >= 0){
        QUuid uid = QUuid::createUuid();
        rtcom_el_add_header(m_El, id, QString("message-token").toLatin1().data(), uid.toString().toLatin1().data(), NULL);
        result = true;
    }

    rtcom_el_event_free(ev);

    return result;
}


tremby 2011-02-14 14:24

Re: SMS from CLI (Command Line)?
 
Sakya, do you have any plans to try to figure out longer-than-160-char texts?

laustmcgregor 2011-02-28 13:46

Re: SMS from CLI (Command Line)?
 
Hi,

I get
Code:

ERR: Failed to send at+cmgf command
From a comment in the source I understand (or think so) that it's because my SIM card is PIN protected.

I don't want to remove the PIN from my card, and I guess that the PIN code must be stored somewhere in the device for use when the "normal" sms application needs it.

-> Have you planned to search on that subject? I'll also search on my side and let you know if I find something.


All times are GMT. The time now is 03:31.

vBulletin® Version 3.8.8