Changeset View
Changeset View
Standalone View
Standalone View
plugins/sms/smsplugin.cpp
1 | /** | 1 | /** | ||
---|---|---|---|---|---|
2 | * Copyright 2013 Albert Vaca <albertvaka@gmail.com> | 2 | * Copyright 2013 Albert Vaca <albertvaka@gmail.com> | ||
3 | * Copyright 2018 Simon Redman <simon@ergotech.com> | ||||
3 | * | 4 | * | ||
4 | * This program is free software; you can redistribute it and/or | 5 | * This program is free software; you can redistribute it and/or | ||
5 | * modify it under the terms of the GNU General Public License as | 6 | * modify it under the terms of the GNU General Public License as | ||
6 | * published by the Free Software Foundation; either version 2 of | 7 | * published by the Free Software Foundation; either version 2 of | ||
7 | * the License or (at your option) version 3 or any later version | 8 | * the License or (at your option) version 3 or any later version | ||
8 | * accepted by the membership of KDE e.V. (or its successor approved | 9 | * accepted by the membership of KDE e.V. (or its successor approved | ||
9 | * by the membership of KDE e.V.), which shall act as a proxy | 10 | * by the membership of KDE e.V.), which shall act as a proxy | ||
10 | * defined in Section 14 of version 3 of the license. | 11 | * defined in Section 14 of version 3 of the license. | ||
▲ Show 20 Lines • Show All 83 Lines • ▼ Show 20 Line(s) | 87 | { | |||
94 | const QString phoneNumber = message.address(); | 95 | const QString phoneNumber = message.address(); | ||
95 | m_telepathyInterface.call(QDBus::NoBlock, QStringLiteral("sendMessage"), phoneNumber, contactName, messageBody); | 96 | m_telepathyInterface.call(QDBus::NoBlock, QStringLiteral("sendMessage"), phoneNumber, contactName, messageBody); | ||
96 | } | 97 | } | ||
97 | 98 | | |||
98 | bool SmsPlugin::handleBatchMessages(const NetworkPacket& np) | 99 | bool SmsPlugin::handleBatchMessages(const NetworkPacket& np) | ||
99 | { | 100 | { | ||
100 | const auto messages = np.get<QVariantList>("messages"); | 101 | const auto messages = np.get<QVariantList>("messages"); | ||
101 | 102 | | |||
102 | for (const QVariant& body : messages) | 103 | for (const QVariant& body : messages) { | ||
103 | { | | |||
104 | ConversationMessage message(body.toMap()); | 104 | ConversationMessage message(body.toMap()); | ||
105 | forwardToTelepathy(message); | 105 | forwardToTelepathy(message); | ||
106 | m_conversationInterface->addMessage(message); | 106 | m_conversationInterface->addMessage(message); | ||
107 | } | 107 | } | ||
108 | 108 | | |||
109 | return true; | 109 | return true; | ||
110 | } | 110 | } | ||
111 | 111 | | |||
112 | 112 | | |||
113 | QString SmsPlugin::dbusPath() const | 113 | QString SmsPlugin::dbusPath() const | ||
114 | { | 114 | { | ||
115 | return "/modules/kdeconnect/devices/" + device()->id() + "/sms"; | 115 | return "/modules/kdeconnect/devices/" + device()->id() + "/sms"; | ||
116 | } | 116 | } | ||
117 | 117 | | |||
118 | #include "smsplugin.moc" | 118 | #include "smsplugin.moc" | ||
119 | 119 | |