[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:18 UTC 2016
Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-common-internals.git;a=commitdiff;h=3ca9944
The following commit has been merged in the master branch:
commit 3ca9944b78a6fe2b4853c7a5fcb23021716398e8
Author: Marcin Ziemiński <zieminn at gmail.com>
Date: Fri Jul 11 21:04:47 2014 +0200
Simplified PendingCurryOperation
Signed-off-by: Marcin Ziemiński <zieminn at gmail.com>
---
otr-proxy/KTpProxy/otr-proxy-channel-adaptee.cpp | 24 +++++++++++-------------
otr-proxy/KTpProxy/pending-curry-operation.cpp | 20 ++++----------------
otr-proxy/KTpProxy/pending-curry-operation.h | 19 +++----------------
3 files changed, 18 insertions(+), 45 deletions(-)
diff --git a/otr-proxy/KTpProxy/otr-proxy-channel-adaptee.cpp b/otr-proxy/KTpProxy/otr-proxy-channel-adaptee.cpp
index 36eee77..4811edd 100644
--- a/otr-proxy/KTpProxy/otr-proxy-channel-adaptee.cpp
+++ b/otr-proxy/KTpProxy/otr-proxy-channel-adaptee.cpp
@@ -30,11 +30,12 @@
// TODO
// - add errors to spec
-class SendMessageExtractor : public Extractor
+class PendingSendMessageResult : public PendingCurryOperation
{
public:
- SendMessageExtractor()
- : token(QString::fromLatin1(""))
+ PendingSendMessageResult(Tp::PendingOperation *op, const Tp::TextChannelPtr &chan)
+ : PendingCurryOperation(op, Tp::SharedPtr<Tp::RefCounted>::dynamicCast(chan)),
+ token(QString::fromLatin1(""))
{ }
void setContext(const Tp::Service::ChannelProxyInterfaceOTRAdaptor::SendMessageContextPtr &context)
@@ -52,7 +53,7 @@ class SendMessageExtractor : public Extractor
return token;
}
- virtual void operator()(Tp::PendingOperation *op)
+ virtual void extract(Tp::PendingOperation *op)
{
token = dynamic_cast<Tp::PendingSendMessage*>(op)->sentMessageToken();
}
@@ -149,12 +150,10 @@ void OtrProxyChannel::Adaptee::sendMessage(const Tp::MessagePartList &message, u
return;
}
- SendMessageExtractor *mesEx = new SendMessageExtractor();
- mesEx->setContext(context);
- PendingCurryOperation *pending = new PendingCurryOperation(
+ PendingSendMessageResult *pending = new PendingSendMessageResult(
chan->send(message, (Tp::MessageSendingFlags) flags),
- mesEx,
- Tp::SharedPtr<Tp::RefCounted>::dynamicCast(chan));
+ chan);
+ pending->setContext(context);
connect(pending,
SIGNAL(finished(Tp::PendingOperation*)),
@@ -204,14 +203,13 @@ void OtrProxyChannel::Adaptee::onPendingMessageRemoved(const Tp::ReceivedMessage
void OtrProxyChannel::Adaptee::onPendingSendFinished(Tp::PendingOperation *op)
{
- PendingCurryOperation *pendingSend = dynamic_cast<PendingCurryOperation*>(op);
- SendMessageExtractor &ex = dynamic_cast<SendMessageExtractor&>(pendingSend->extractor());
+ PendingSendMessageResult *sendResult = dynamic_cast<PendingSendMessageResult*>(op);
- Tp::Service::ChannelProxyInterfaceOTRAdaptor::SendMessageContextPtr ctx = ex.getContext();
+ Tp::Service::ChannelProxyInterfaceOTRAdaptor::SendMessageContextPtr ctx = sendResult->getContext();
if(op->isError()) {
ctx->setFinishedWithError(op->errorName(), op->errorMessage());
} else {
- ctx->setFinished(ex.getToken());
+ ctx->setFinished(sendResult->getToken());
}
}
diff --git a/otr-proxy/KTpProxy/pending-curry-operation.cpp b/otr-proxy/KTpProxy/pending-curry-operation.cpp
index 13c3bfb..f5eee49 100644
--- a/otr-proxy/KTpProxy/pending-curry-operation.cpp
+++ b/otr-proxy/KTpProxy/pending-curry-operation.cpp
@@ -17,27 +17,15 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
***************************************************************************/
-
#include "pending-curry-operation.h"
-Extractor::~Extractor() { }
-
-PendingCurryOperation::PendingCurryOperation(Tp::PendingOperation *op, Extractor *ex, const Tp::SharedPtr<Tp::RefCounted> &obj)
-: Tp::PendingOperation(obj),
- ex(ex)
+PendingCurryOperation::PendingCurryOperation(Tp::PendingOperation *op, const Tp::SharedPtr<Tp::RefCounted> &obj)
+: Tp::PendingOperation(obj)
{
connect(op, SIGNAL(finished(Tp::PendingOperation*)), SLOT(onFinished(Tp::PendingOperation*)));
}
-PendingCurryOperation::~PendingCurryOperation()
-{
- delete ex;
-}
-
-Extractor& PendingCurryOperation::extractor()
-{
- return *ex;
-}
+PendingCurryOperation::~PendingCurryOperation() { }
void PendingCurryOperation::onFinished(Tp::PendingOperation *op)
{
@@ -45,6 +33,6 @@ void PendingCurryOperation::onFinished(Tp::PendingOperation *op)
setFinishedWithError(op->errorName(), op->errorMessage());
return;
}
- (*ex)(op);
+ extract(op);
setFinished();
}
diff --git a/otr-proxy/KTpProxy/pending-curry-operation.h b/otr-proxy/KTpProxy/pending-curry-operation.h
index 5c96e0a..80e3fcc 100644
--- a/otr-proxy/KTpProxy/pending-curry-operation.h
+++ b/otr-proxy/KTpProxy/pending-curry-operation.h
@@ -22,32 +22,19 @@
#include <TelepathyQt/PendingOperation>
-#include <QObject>
-
-
-class Extractor
-{
- public:
- virtual ~Extractor();
- virtual void operator()(Tp::PendingOperation *op) = 0;
-};
-
class PendingCurryOperation : public Tp::PendingOperation
{
Q_OBJECT
public:
- PendingCurryOperation(Tp::PendingOperation *op, Extractor *ex, const Tp::SharedPtr<Tp::RefCounted> &obj);
+ PendingCurryOperation(Tp::PendingOperation *op, const Tp::SharedPtr<Tp::RefCounted> &obj);
~PendingCurryOperation();
- Extractor& extractor();
+ protected:
+ virtual void extract(Tp::PendingOperation *op) = 0;
private Q_SLOTS:
void onFinished(Tp::PendingOperation *op);
-
- private:
- Extractor *ex;
-
};
#endif
--
ktp-common-internals packaging
More information about the pkg-kde-commits
mailing list