Skip to content

Commit

Permalink
Updated kdeconnect-cli send-sms message to adapt sendSms interfce cha…
Browse files Browse the repository at this point in the history
…nges. This patch fixes the BUG: 425731
  • Loading branch information
anikket786 authored and nicolasfella committed Aug 28, 2020
1 parent f90d6a0 commit f778fc9
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion cli/kdeconnect-cli.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include "interfaces/notificationsmodel.h"
#include "interfaces/dbusinterfaces.h"
#include "interfaces/dbushelpers.h"
#include "interfaces/conversationmessage.h"
#include "kdeconnect-version.h"

#include <dbushelper.h>
Expand Down Expand Up @@ -247,8 +248,19 @@ int main(int argc, char** argv)
blockOnReply(DBusHelper::sessionBus().asyncCall(msg));
} else if(parser.isSet(QStringLiteral("send-sms"))) {
if (parser.isSet(QStringLiteral("destination"))) {
qDBusRegisterMetaType<ConversationAddress>();
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);
}

QDBusMessage msg = QDBusMessage::createMethodCall(QStringLiteral("org.kde.kdeconnect"), QStringLiteral("/modules/kdeconnect/devices/") + device + QStringLiteral("/sms"), QStringLiteral("org.kde.kdeconnect.device.sms"), QStringLiteral("sendSms"));
msg.setArguments({ parser.value(QStringLiteral("destination")), parser.value(QStringLiteral("send-sms"))});
const QString text = parser.value(QStringLiteral("send-sms"));
msg.setArguments(QVariantList() << QVariant::fromValue(addresses) << text);
blockOnReply(DBusHelper::sessionBus().asyncCall(msg));
} else {
QTextStream(stderr) << i18n("error: should specify the SMS's recipient by passing --destination <phone number>");
Expand Down

0 comments on commit f778fc9

Please sign in to comment.