[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:06:17 UTC 2016
Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-common-internals.git;a=commitdiff;h=e782757
The following commit has been merged in the master branch:
commit e782757d138cb05e19845d67080d7be1248f6927
Author: David Edmundson <kde at davidedmundson.co.uk>
Date: Sat Feb 2 17:19:56 2013 +0000
Correctly set message direction
---
KTp/message-context.h | 6 +++---
KTp/message-processor.h | 2 --
KTp/message.cpp | 19 +++++++++++++------
3 files changed, 16 insertions(+), 11 deletions(-)
diff --git a/KTp/message-context.h b/KTp/message-context.h
index 60bfc7c..4888bf8 100644
--- a/KTp/message-context.h
+++ b/KTp/message-context.h
@@ -30,8 +30,8 @@ namespace KTp
class KTP_EXPORT MessageContext
{
public:
- MessageContext(const Tp::AccountPtr &_account, const Tp::TextChannelPtr &_channel);
-
+ MessageContext(const Tp::AccountPtr &account, const Tp::TextChannelPtr &channel);
+
virtual ~MessageContext();
/** Account in which the message is sent
@@ -42,7 +42,7 @@ public:
@warning this may be null, and should always be checked before use
*/
Tp::TextChannelPtr channel() const;
-
+
private:
class Private;
Private *d;
diff --git a/KTp/message-processor.h b/KTp/message-processor.h
index e1609aa..7cd4d87 100644
--- a/KTp/message-processor.h
+++ b/KTp/message-processor.h
@@ -58,8 +58,6 @@ class KTP_EXPORT MessageProcessor : public QObject
KTp::Message processMessage(const Tp::ReceivedMessage &message, const Tp::AccountPtr &account, const Tp::TextChannelPtr &channel);
KTp::Message processMessage(const Tpl::TextEventPtr &message, const Tp::AccountPtr &account, const Tp::TextChannelPtr &channel);
-// Tp::PendingSendMessage* sendMessage(const QString textMessage, const Tp::AccountPtr &account, const Tp::TextChannelPtr &channel);
-
protected:
KTp::Message processMessage(KTp::Message message, const KTp::MessageContext &context);
explicit MessageProcessor();
diff --git a/KTp/message.cpp b/KTp/message.cpp
index 2ee7f96..7be60e0 100644
--- a/KTp/message.cpp
+++ b/KTp/message.cpp
@@ -25,6 +25,7 @@
#include <TelepathyQt/ContactManager>
#include <TelepathyQt/Connection>
+#include <TelepathyLoggerQt4/Entity>
using namespace KTp;
@@ -53,20 +54,21 @@ Message::Message(const Tp::Message &original, const KTp::MessageContext &context
d->token = original.messageToken();
d->messageType = original.messageType();
d->isHistory = false;
-
+ d->direction = KTp::Message::LocalToRemote;
setMainMessagePart(original.text());
}
-Message::Message(const Tp::ReceivedMessage &original, const KTp::MessageContext &context)
+Message::Message(const Tp::ReceivedMessage &original, const KTp::MessageContext &context) :
+ d(new Private)
{
+ Q_UNUSED(context)
d->sentTime = original.sent();
d->token = original.messageToken();
d->messageType = original.messageType();
d->isHistory = original.isScrollback();
+ d->direction = KTp::Message::RemoteToLocal;
-// if (original.sender() && original.sender()->manager()) {
-// d->direction = original.sender()->manager()->connection()->selfContact();
-// }
+ setMainMessagePart(original.text());
}
Message::Message(const Tpl::TextEventPtr &original, const KTp::MessageContext &context) :
@@ -76,7 +78,12 @@ Message::Message(const Tpl::TextEventPtr &original, const KTp::MessageContext &c
d->token = original->messageToken();
d->messageType = original->messageType();
d->isHistory = true;
-// original->
+
+ if (original->sender()->identifier() == context.account()->normalizedName()) {
+ d->direction = KTp::Message::LocalToRemote;
+ } else {
+ d->direction = KTp::Message::RemoteToLocal;
+ }
setMainMessagePart(original->message());
}
--
ktp-common-internals packaging
More information about the pkg-kde-commits
mailing list