Commit 674e826b authored by Nicolas Fella's avatar Nicolas Fella

Work around SMS not being sent from cli

Something in the demarshalling of the address list is broken and I can't figure out why.
Instead expose a much simpler method that only takes one address string.
This removes the ability to send to multiple destinations from one command, but that's better than not working at all.

This patch is for 20.08 only as the marshalling works differently in master anyway.
parent 37f82dcc
Pipeline #37299 passed with stage
in 5 minutes and 59 seconds
......@@ -265,16 +265,11 @@ int main(int argc, char** argv)
QVariantList addresses;
const QStringList addressList = parser.value(QStringLiteral("destination")).split(QRegularExpression(QStringLiteral("\\s+")));
for (const QString& input : addressList) {
ConversationAddress address(input);
addresses << QVariant::fromValue(address);
const QString address = parser.value(QStringLiteral("destination"));
QDBusMessage msg = QDBusMessage::createMethodCall(QStringLiteral("org.kde.kdeconnect"), QStringLiteral("/modules/kdeconnect/devices/") + device + QStringLiteral("/sms"), QStringLiteral("org.kde.kdeconnect.device.sms"), QStringLiteral("sendSms"));
const QString text = parser.value(QStringLiteral("send-sms"));
msg.setArguments(QVariantList() << QVariant::fromValue(QDBusVariant(addresses)) << text);
msg.setArguments(QVariantList() << address << text);
} else {
QTextStream(stderr) << i18n("error: should specify the SMS's recipient by passing --destination <phone number>");
......@@ -81,6 +81,19 @@ void SmsPlugin::sendSms(const QDBusVariant& addresses, const QString& messageBod
void SmsPlugin::sendSms(const QString& address, const QString& messageBody)
QVariantMap packetMap({
{QStringLiteral("sendSms"), true},
{QStringLiteral("phoneNumber"), address},
{QStringLiteral("messageBody"), messageBody}
NetworkPacket np(PACKET_TYPE_SMS_REQUEST, packetMap);
qCDebug(KDECONNECT_PLUGIN_SMS) << "Dispatching SMS send request to remote";
void SmsPlugin::requestAllConversations()
......@@ -128,6 +128,7 @@ public:
public Q_SLOTS:
Q_SCRIPTABLE void sendSms(const QDBusVariant& addresses, const QString& messageBody, const qint64 subID = -1);
Q_SCRIPTABLE void sendSms(const QString& address, const QString& messageBody);
* Send a request to the remote for all of its conversations
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment