[sms] Restore compatibility with current Android release

The current code requires the multitarget support. This is only available in the yet-to-be-released Android version.
Fall back to the old style packet format as a quick fix for 20.08 before we can implement a proper solution in master.

BUG: 427266
This commit is contained in:
Nicolas Fella 2020-10-18 17:28:21 +02:00
parent 436607ff17
commit 4266834052

View file

@ -59,26 +59,15 @@ bool SmsPlugin::receivePacket(const NetworkPacket& np)
void SmsPlugin::sendSms(const QDBusVariant& addresses, const QString& messageBody, const qint64 subID)
{
QList<ConversationAddress> addressList = ConversationAddress::listfromDBus(addresses);
Q_UNUSED(subID)
const QList<ConversationAddress> addressList = ConversationAddress::listfromDBus(addresses);
QVariantList addressMapList;
for (const ConversationAddress address : addressList) {
QVariantMap addressMap({{QStringLiteral("address"), address.address()}});
addressMapList.append(addressMap);
qDebug() <<address.address();
if (addressList.isEmpty()) {
qCDebug(KDECONNECT_PLUGIN_SMS) << "Empty address list";
return;
}
QVariantMap packetMap({
{QStringLiteral("sendSms"), true},
{QStringLiteral("addresses"), addressMapList},
{QStringLiteral("messageBody"), messageBody}
});
if (subID != -1) {
packetMap[QStringLiteral("subID")] = subID;
}
NetworkPacket np(PACKET_TYPE_SMS_REQUEST, packetMap);
qCDebug(KDECONNECT_PLUGIN_SMS) << "Dispatching SMS send request to remote";
sendPacket(np);
sendSms(addressList.first().address(), messageBody);
}
void SmsPlugin::sendSms(const QString& address, const QString& messageBody)