[SCM] ktp-common-internals packaging branch, master, updated. debian/15.12.1-2-1839-gf0635e9

Maximiliano Curia maxy at moszumanska.debian.org
Mon May 9 09:08:00 UTC 2016


Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-common-internals.git;a=commitdiff;h=f661897

The following commit has been merged in the master branch:
commit f661897486d989410ef7d0d65d6246f2ec9b6639
Author: Jan Stourac <stourac.jan at gmail.com>
Date:   Thu Feb 6 13:30:52 2014 +0100

    Fix for sending ini and exe files using Google Talk account
    
    Each file transfer is checked for using Google Talk and forbidden extensions.
    In that case, "_" character is appended to suggested file name. For all other
    cases transfer process remains the same.
    
    REVIEW: 115463
    BUG: 326786
    FIXED-IN: 0.8.0
---
 KTp/actions.cpp          | 35 +++++++++++++++++++++++++++++++++--
 data/ktelepathy.notifyrc | 10 ++++++++--
 2 files changed, 41 insertions(+), 4 deletions(-)

diff --git a/KTp/actions.cpp b/KTp/actions.cpp
index ec8a19e..c4c6f85 100644
--- a/KTp/actions.cpp
+++ b/KTp/actions.cpp
@@ -29,6 +29,8 @@
 #include <KToolInvocation>
 #include <KDebug>
 #include <KLocalizedString>
+#include <KNotification>
+#include <KAboutData>
 
 #define PREFERRED_TEXT_CHAT_HANDLER QLatin1String("org.freedesktop.Telepathy.Client.KTp.TextUi")
 #define PREFERRED_FILE_TRANSFER_HANDLER QLatin1String("org.freedesktop.Telepathy.Client.KTp.FileTransfer")
@@ -157,8 +159,37 @@ Tp::PendingChannelRequest* Actions::startFileTransfer(const Tp::AccountPtr &acco
 
     kDebug() << "Requesting file transfer of" << filePath << "to" << contact->id();
 
-    Tp::FileTransferChannelCreationProperties fileTransferProperties(
-                  filePath, KMimeType::findByFileContent(filePath)->name());
+    QFileInfo fileInfo(filePath);
+
+    Tp::FileTransferChannelCreationProperties fileTransferProperties;
+
+    if (account->serviceName() == QLatin1String("google-talk") &&
+        (fileInfo.suffix() == QLatin1String("exe") || fileInfo.suffix() == QLatin1String("ini"))) {
+
+        kDebug() << "Google Talk forbids transfering files with suffix \"ini\" or \"exe\". Renaming.";
+
+        QString fileName = fileInfo.fileName().append(QLatin1String("_"));
+
+        fileTransferProperties = Tp::FileTransferChannelCreationProperties(fileName,
+                                                                           KMimeType::findByFileContent(filePath)->name(),
+                                                                           fileInfo.size());
+
+        fileTransferProperties.setUri(QUrl::fromLocalFile(filePath).toString());
+        fileTransferProperties.setLastModificationTime(fileInfo.lastModified());
+
+        KNotification *notification = new KNotification (QLatin1String("googletalkExtensionsError"));
+        notification->setText(i18n("Transferring files with .exe or .ini extension is not allowed by Google Talk. It was sent with filename <i>%1</i>", fileName));
+        notification->setTitle(i18n("Transferred file renamed"));
+
+        KAboutData aboutData("ktelepathy", 0, KLocalizedString(), 0);
+        notification->setComponentData(KComponentData(aboutData));
+        notification->sendEvent();
+
+    } else {
+
+        fileTransferProperties = Tp::FileTransferChannelCreationProperties(
+                                    filePath, KMimeType::findByFileContent(filePath)->name());
+    }
 
     return account->createFileTransfer(contact,
                                        fileTransferProperties,
diff --git a/data/ktelepathy.notifyrc b/data/ktelepathy.notifyrc
index 1d2411d..3a95755 100644
--- a/data/ktelepathy.notifyrc
+++ b/data/ktelepathy.notifyrc
@@ -1094,7 +1094,7 @@ Comment[pt_BR]=Uma mensagem foi filtrada pelo plugin de privacidade
 Comment[ro]=Un mesaj a fost filtrat de către modulul de intimitate
 Comment[ru]=Сообщение отфильтровано модулем конфиденциальности
 Comment[sk]=Správa bola filtrovaná modulom pre súkromie
-Comment[sl]=Sporočilo je bilo filtrirano s strani vstavka za zasebnost 
+Comment[sl]=Sporočilo je bilo filtrirano s strani vstavka za zasebnost
 Comment[sr]=Порука је филтрирана помоћу прикључка за приватност
 Comment[sr at ijekavian]=Порука је филтрирана помоћу прикључка за приватност
 Comment[sr at ijekavianlatin]=Poruka je filtrirana pomoću priključka za privatnost
@@ -1672,7 +1672,7 @@ Name[sr at latin]=Komplet emotikona uspešno instaliran
 Name[sv]=Smilisar installerad med lyckat resultat
 Name[tr]=İfadeseti Başarıyla Kuruldu
 Name[uk]=Набір піктограм успішно встановлено
-Name[wa]=Djeu di xhinêyes astalé comifåt 
+Name[wa]=Djeu di xhinêyes astalé comifåt
 Name[x-test]=xxEmoticonset Installed Successfullyxx
 Name[zh_CN]=安装表情集成功
 Name[zh_TW]=表情符號集安裝成功
@@ -1805,3 +1805,9 @@ Comment[zh_CN]=联系人的状态已更改
 Comment[zh_TW]=聯絡人的狀態已變更
 Contexts=contact
 Action=None
+
+[Event/googletalkExtensionsError]
+Name=File renamed for sending with Google Talk
+Comment=An outgoing file with forbidden extension .exe or .ini has been renamed
+Action=Popup
+Flags=Persistent

-- 
ktp-common-internals packaging



More information about the pkg-kde-commits mailing list