Hi all
I am revisiting a Sailfish OS app that I have not touched for over a year!

Despite many Sailfish updates in that time, most of it still worked, apart from its most important function: sending SMSes.

The SMS functionality was achieved by a few lines of C++ calling Telepathy. The code is at the bottom of this post.

I now get the error
[D] TelepathyHelper::onSendMessageFinished:72 - Error sending message: "org.freedesktop.Telepathy.Error.NotImplemented" - "Channel Dispatcher implementation (e.g. mission-control), does not support interface CD.I.Messages"

I am a little stumped by this: At the moment I guess either something in Telepathy /used by Telepathy has changed. or I am missing a library that was previously on the Jolla (perhaps installed by me).

Any ideas?

mfg

Chris

/////////////////////////////////////////
telepathyhelper.h
/////////////////////////////////////////


#ifndef TELEPATHYHELPER_H
#define TELEPATHYHELPER_H

#include <TelepathyQt/Types>

#include <QObject>
#include <QString>

namespace Tp
{
    class PendingOperation;
}

class TelepathyHelper : public QObject
{
    Q_OBJECT

public:
    explicit TelepathyHelper(QObject *parent = 0);
    ~TelepathyHelper();
Q_INVOKABLE void sendSMS(const QString &contactIdentifier, const QString &message);

signals:
    void stateMsg(const QString &statemsg);
    void errorMsg(const QString &errormsg);

private Q_SLOTS:
    void onSendMessageFinished(Tp::PendingOperation *op);

private:
    Tp::ContactMessengerPtr messenger;
};

#endif // TELEPATHYHELPER_H

/////////////////////////////////////////
telepathyhelper.cpp
/////////////////////////////////////////

#include "telepathyhelper.h"

#include <TelepathyQt/Account>
#include <TelepathyQt/Debug>
#include <TelepathyQt/Constants>
#include <TelepathyQt/ContactMessenger>
#include <TelepathyQt/PendingSendMessage>
#include <TelepathyQt/Types>


TelepathyHelper::TelepathyHelper(QObject *parent) :
    QObject(parent)
{
    Tp::registerTypes();
    Tp::enableDebug(true);
    Tp::enableWarnings(true);

}

TelepathyHelper::~TelepathyHelper()
{
}

void TelepathyHelper::sendSMS(const QString &contactIdentifier, const QString &message)
{

Tp::AccountPtr acc = Tp::Account::create(TP_QT_ACCOUNT_MANAGER_BUS_NAME, QLatin1String("/org/freedesktop/Telepathy/Account/ring/tel/account0"));

    messenger = Tp::ContactMessenger::create(acc, contactIdentifier);

    connect(messenger->sendMessage(message),
            SIGNAL(finished(Tp::PendingOperation*)),
            SLOT(onSendMessageFinished(Tp::PendingOperation*)));

}

void TelepathyHelper::onSendMessageFinished(Tp::PendingOperation *op)
{
    qDebug() << "TelepathyHelper::onSendMessageFinished";
    if (op->isError()) {
qDebug() << "Error sending message:" << op->errorName() << "-" << op->errorMessage();
        emit errorMsg("Error sending message");
        return;
    }

Tp::PendingSendMessage *psm = qobject_cast<Tp::PendingSendMessage *>(op);
    qDebug() << "Message sent, token is" << psm->sentMessageToken();
    emit stateMsg("FinishedState");
}

/////////////////////////////////////////

_______________________________________________
SailfishOS.org Devel mailing list
To unsubscribe, please send a mail to devel-unsubscr...@lists.sailfishos.org

Reply via email to