[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:24:51 UTC 2016


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

The following commit has been merged in the master branch:
commit 80e324ada1f93d3903bd86e6e1ea8e977845c81d
Author: Marcin Ziemiński <zieminn at gmail.com>
Date:   Wed Aug 20 19:53:44 2014 +0200

    Do not initiate OTR when offline
---
 lib/chat-widget.cpp | 63 ++++++++++++++++++++++++++++++++++-------------------
 1 file changed, 41 insertions(+), 22 deletions(-)

diff --git a/lib/chat-widget.cpp b/lib/chat-widget.cpp
index ca51489..dd3d9a0 100644
--- a/lib/chat-widget.cpp
+++ b/lib/chat-widget.cpp
@@ -678,11 +678,22 @@ void ChatWidget::blockTextInput(bool block)
 void ChatWidget::startOtrSession()
 {
     if(!d->channel->isOTRsuppored()) return;
+    if(!d->channel->isValid()) {
+        d->ui.messageWidget->removeAction(d->messageWidgetSwitchOnlineAction);
+        if (d->account->requestedPresence().type() == Tp::ConnectionPresenceTypeOffline) {
+            d->ui.messageWidget->addAction(d->messageWidgetSwitchOnlineAction);
+        }
+        d->ui.messageWidget->animatedShow();
+        return;
+    }
+
     d->channel->initializeOTR();
-    if(d->channel->otrTrustLevel() == Tp::OTRTrustLevelNotPrivate)
+    if(d->channel->otrTrustLevel() == Tp::OTRTrustLevelNotPrivate) {
         d->ui.chatArea->addStatusMessage(i18n("Attempting to start a private OTR session with %1", d->contactName));
-    else
+    }
+    else {
         d->ui.chatArea->addStatusMessage(i18n("Attempting to restart a private OTR session with %1", d->contactName));
+    }
 }
 
 void ChatWidget::stopOtrSession()
@@ -691,6 +702,15 @@ void ChatWidget::stopOtrSession()
     if(!d->channel->isOTRsuppored() || d->channel->otrTrustLevel() == Tp::OTRTrustLevelNotPrivate) {
         return;
     }
+    if(!d->channel->isValid()) {
+        d->ui.messageWidget->removeAction(d->messageWidgetSwitchOnlineAction);
+        if (d->account->requestedPresence().type() == Tp::ConnectionPresenceTypeOffline) {
+            d->ui.messageWidget->addAction(d->messageWidgetSwitchOnlineAction);
+        }
+        d->ui.messageWidget->animatedShow();
+        return;
+    }
+
     d->channel->stopOTR();
     d->ui.chatArea->addStatusMessage(i18n("Terminating OTR session"));
 }
@@ -1006,27 +1026,26 @@ void ChatWidget::sendMessage()
 
     if (!message.isEmpty()) {
         message = KTp::MessageProcessor::instance()->processOutgoingMessage(
-                    message, d->account, d->channel->textChannel()).text();
-
-	if (d->channel->isValid()) {
-	    if (d->channel->supportsMessageType(Tp::ChannelTextMessageTypeAction) && message.startsWith(QLatin1String("/me "))) {
-		//remove "/me " from the start of the message
-		message.remove(0,4);
+                message, d->account, d->channel->textChannel()).text();
 
-		d->channel->send(message, Tp::ChannelTextMessageTypeAction);
-	    } else {
-		d->channel->send(message);
-	    }
-	    d->ui.sendMessageBox->clear();
-	} else {
-	    d->ui.messageWidget->removeAction(d->messageWidgetSwitchOnlineAction);
-	    if (d->account->requestedPresence().type() == Tp::ConnectionPresenceTypeOffline) {
-		d->ui.messageWidget->addAction(d->messageWidgetSwitchOnlineAction);
-	    }
+        if (d->channel->isValid()) {
+            if (d->channel->supportsMessageType(Tp::ChannelTextMessageTypeAction) && message.startsWith(QLatin1String("/me "))) {
+                //remove "/me " from the start of the message
+                message.remove(0,4);
 
-	    d->ui.messageWidget->animatedShow();
+                d->channel->send(message, Tp::ChannelTextMessageTypeAction);
+            } else {
+                d->channel->send(message);
+            }
+            d->ui.sendMessageBox->clear();
+        } else {
+            d->ui.messageWidget->removeAction(d->messageWidgetSwitchOnlineAction);
+            if (d->account->requestedPresence().type() == Tp::ConnectionPresenceTypeOffline) {
+                d->ui.messageWidget->addAction(d->messageWidgetSwitchOnlineAction);
+            }
 
-	}
+            d->ui.messageWidget->animatedShow();
+        }
     }
 }
 
@@ -1039,8 +1058,8 @@ void ChatWidget::onChatStatusChanged(const Tp::ContactPtr & contact, Tp::Channel
 
     if (state == Tp::ChannelChatStateGone) {
         if (d->ui.chatArea->showJoinLeaveChanges()) {
-	    d->ui.chatArea->addStatusMessage(i18n("%1 has left the chat", contact->alias()), contact->alias());
-	}
+            d->ui.chatArea->addStatusMessage(i18n("%1 has left the chat", contact->alias()), contact->alias());
+        }
     }
 
     if (d->isGroupChat) {

-- 
ktp-text-ui packaging



More information about the pkg-kde-commits mailing list