Drop code for forwarding messages to Telepathy

Telepathy has been dead for quite some time now
This commit is contained in:
Nicolas Fella 2024-10-19 23:47:39 +02:00
parent a60945921d
commit 05963bae29
2 changed files with 0 additions and 24 deletions

View file

@ -27,7 +27,6 @@ K_PLUGIN_CLASS_WITH_JSON(SmsPlugin, "kdeconnect_sms.json")
SmsPlugin::SmsPlugin(QObject *parent, const QVariantList &args) SmsPlugin::SmsPlugin(QObject *parent, const QVariantList &args)
: KdeConnectPlugin(parent, args) : KdeConnectPlugin(parent, args)
, m_telepathyInterface(QStringLiteral("org.freedesktop.Telepathy.ConnectionManager.kdeconnect"), QStringLiteral("/kdeconnect"))
, m_conversationInterface(new ConversationsDbusInterface(this)) , m_conversationInterface(new ConversationsDbusInterface(this))
{ {
} }
@ -112,20 +111,6 @@ void SmsPlugin::requestAttachment(const qint64 &partID, const QString &uniqueIde
sendPacket(np); sendPacket(np);
} }
void SmsPlugin::forwardToTelepathy(const ConversationMessage &message)
{
// If we don't have a valid Telepathy interface, bail out
if (!(m_telepathyInterface.isValid()))
return;
qCDebug(KDECONNECT_PLUGIN_SMS) << "Passing a text message to the telepathy interface";
connect(&m_telepathyInterface, SIGNAL(messageReceived(QString, QString)), this, SLOT(sendSms(QString, QString)), Qt::UniqueConnection);
const QString messageBody = message.body();
const QString contactName; // TODO: When telepathy support is improved, look up the contact with KPeople
const QString phoneNumber = message.addresses()[0].address();
m_telepathyInterface.call(QDBus::NoBlock, QStringLiteral("sendMessage"), phoneNumber, contactName, messageBody);
}
bool SmsPlugin::handleBatchMessages(const NetworkPacket &np) bool SmsPlugin::handleBatchMessages(const NetworkPacket &np)
{ {
const auto messages = np.get<QVariantList>(QStringLiteral("messages")); const auto messages = np.get<QVariantList>(QStringLiteral("messages"));
@ -134,9 +119,6 @@ bool SmsPlugin::handleBatchMessages(const NetworkPacket &np)
for (const QVariant &body : messages) { for (const QVariant &body : messages) {
ConversationMessage message(body.toMap()); ConversationMessage message(body.toMap());
if (message.containsTextBody()) {
forwardToTelepathy(message);
}
messagesList.append(message); messagesList.append(message);
} }

View file

@ -177,11 +177,6 @@ public Q_SLOTS:
Q_SCRIPTABLE void getAttachment(const qint64 &partID, const QString &uniqueIdentifier); Q_SCRIPTABLE void getAttachment(const qint64 &partID, const QString &uniqueIdentifier);
private: private:
/**
* Send to the telepathy plugin if it is available
*/
void forwardToTelepathy(const ConversationMessage &message);
/** /**
* Handle a packet which contains many messages, such as PACKET_TYPE_TELEPHONY_MESSAGE * Handle a packet which contains many messages, such as PACKET_TYPE_TELEPHONY_MESSAGE
*/ */
@ -197,6 +192,5 @@ private:
*/ */
Attachment createAttachmentFromUrl(const QString &url); Attachment createAttachmentFromUrl(const QString &url);
QDBusInterface m_telepathyInterface;
ConversationsDbusInterface *m_conversationInterface; ConversationsDbusInterface *m_conversationInterface;
}; };