[SCM] ktp-text-ui packaging branch, master, updated. debian/15.12.1-1-1918-gdf4b0ec

Maximiliano Curia maxy at moszumanska.debian.org
Sat May 28 00:23:12 UTC 2016


Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-text-ui.git;a=commitdiff;h=a012380

The following commit has been merged in the master branch:
commit a0123801b509c7f0e27f1618a5df920fc065000a
Author: David Edmundson <kde at davidedmundson.co.uk>
Date:   Sun Jan 20 16:33:18 2013 +0000

    Always check message.sender() before using it as it may be NULL
---
 lib/chat-widget.cpp | 24 +++++++++++++++---------
 1 file changed, 15 insertions(+), 9 deletions(-)

diff --git a/lib/chat-widget.cpp b/lib/chat-widget.cpp
index bbc8451..4df4a7a 100644
--- a/lib/chat-widget.cpp
+++ b/lib/chat-widget.cpp
@@ -583,7 +583,7 @@ void ChatWidget::handleIncomingMessage(const Tp::ReceivedMessage &message)
                 switch (reportDetails.error()) {
                 case Tp::ChannelTextSendErrorOffline:
                     if (reportDetails.hasEchoedMessage()) {
-                        if(message.sender()->isBlocked()) {
+                        if(message.sender() && message.sender()->isBlocked()) {
                             text = i18n("Delivery of the message \"%1\" "
                                         "failed because the remote contact is blocked",
                                         reportDetails.echoedMessage().text());
@@ -593,7 +593,7 @@ void ChatWidget::handleIncomingMessage(const Tp::ReceivedMessage &message)
                                         reportDetails.echoedMessage().text());
                          }
                     } else {
-                        if(message.sender()->isBlocked()) {
+                        if(message.sender() && message.sender()->isBlocked()) {
                             text = i18n("Delivery of a message failed "
                                         "because the remote contact is blocked");
                         } else {
@@ -743,12 +743,21 @@ void ChatWidget::notifyAboutIncomingMessage(const Tp::ReceivedMessage & message)
                                                     | KNotification::CloseWhenWidgetActivated
                                                     | KNotification::Persistent);
     notification->setComponentData(d->telepathyComponentData());
-    notification->setTitle(i18n("%1 has sent you a message", message.sender()->alias()));
+   
+    QString senderName;
 
-    QPixmap notificationPixmap;
-    if (notificationPixmap.load(message.sender()->avatarData().fileName)) {
-        notification->setPixmap(notificationPixmap);
+    if (message.sender().isNull()) {
+        senderName = message.senderNickname();
+    } else {
+        senderName = message.sender()->alias();
+        QPixmap notificationPixmap;
+        if (notificationPixmap.load(message.sender()->avatarData().fileName)) {
+            notification->setPixmap(notificationPixmap);
+        }
+        //allows per contact notifications
+        notification->addContext(QLatin1String("contact"), message.sender()->id());
     }
+    notification->setTitle(i18n("%1 has sent you a message", senderName));
 
     // Remove empty lines from message
     QString notifyText = message.text().simplified();
@@ -760,9 +769,6 @@ void ChatWidget::notifyAboutIncomingMessage(const Tp::ReceivedMessage & message)
         notification->setText(notifyText);
     }
 
-    //allows per contact notifications
-    notification->addContext(QLatin1String("contact"), message.sender()->id());
-    //TODO notification->addContext("group",... Requires KDE Telepathy Contact to work out which group they are in.
 
     notification->setActions(QStringList(i18n("View")));
     connect(notification, SIGNAL(activated(uint)), this, SIGNAL(notificationClicked()));

-- 
ktp-text-ui packaging



More information about the pkg-kde-commits mailing list