[SailfishDevel] Sending SMS Messages from Sailfish Alpha 2

John Brooks john.brooks at jollamobile.com
Wed Aug 7 18:19:38 UTC 2013


On Aug 7, 2013, at 2:19 AM, christopher.lamb at thurweb.ch wrote:

> Hi All
> 
> I am in the middle of migrating one of my apps "Landed" to the new Alpha 2.
> 
> The primary function of Landed is to send SMSes.

Cool :)

> 
> In the good old days of the first Alpha and Qt4 to do this I used a bit of code modelled on the solution here:
> http://www.developer.nokia.com/Community/Wiki/QML_SMShelper_Plugin
> 
> i.e. I was using QMessaging from Qt Mobility.
> 
> As Qt Mobility is not yet migrated to Qt 5 this begs the question, what is now the recommended way to Sends SMSes from Sailfish on Qt5?
> 
> The excellent porting page  https://sailfishos.org/wiki/Porting/Harmattan points me to Qt5 Additional Modules, but I couldn't find anything there of use.

I don't expect we'll offer any API from Qt itself for this.

> The same porting page also suggests Nemo Mobile QML Plugins, so I had a look at these.
> 
> In GitHub I found the following
> 
> https://github.com/nemomobile/nemo-qml-plugins
> https://github.com/nemomobile/nemo-qml-plugin-messages
> https://github.com/nemomobile/qmlmessages
> 
> The nemo-qml-plugin-messages initially sounds promising, but the readme (at the bottom of this mail) indicates that it si for internal use only. It points to nemo-qml-plugins. But this is an empty project!
> 
> I have downloaded all 3 projects, but before I spend too much time investigating these further I thought I would double check here that I am not barking up the wrong tree.
> 
> So is this the recommended way to Send SMSes, or is there a "better" approach?

You're barking up the right tree. This is an area of the stack I want to change at some point, but for now, here's how it works:

Telepathy is used for SMS messaging along with all IM; SMS is sent and received using text channels for the ring/tel/account0 account. The nemo-qml-plugin-messages plugin implements the basic parts of Telepathy functionality needed for an application (like qmlmessages) to send those messages.

commhistory-daemon and libcommhistory monitor Telepathy and record events, including all sent and received messages. That's what qmlmessages and other clients are displaying.

Unfortunately, the README is right: nemo-qml-plugin-messages is only usable from one application at a time, because it registers a Telepathy handler (and registers it under a static name). That problem could be easily fixed.

After that, it would be possible to use the ConversationChannel API to establish a channel and send/receive messages on it from QML, like:

property var currentChannel: handler.getConversation("/org/freedesktop/Telepathy/Account/ring/tel/account0", "12345")
onClicked: currentChannel.sendMessage("Hello world")

Those messages and any responses to them would appear normally in the messaging client, as if the user had sent them manually.

So here's my question: What do you need in a basic messaging API? Is the above (once usable from multiple applications) sufficient, or do you need to prevent these messages from being in the user's message history? Would simple dbus calls somewhere be nicer to use?

> 
> m.f.g
> 
> Chris
> "
> This QML plugin implements logic for the qmlmessages application and other UI
> implementations. It is not meant to be used by any other applications, or by
> more than one process simultaniously. It is installed as org.nemomobile.messages.internal.
> 
> For external API, see nemo-qml-plugins, which provides org.nemomobile.messages.
> "
> 
> _______________________________________________
> SailfishOS.org Devel mailing list

--
John Brooks




More information about the Devel mailing list