telepathyim / ktp-common-internals Goto Github PK
View Code? Open in Web Editor NEWThis project forked from kde/ktp-common-internals
Library for KTp
License: GNU Lesser General Public License v2.1
This project forked from kde/ktp-common-internals
Library for KTp
License: GNU Lesser General Public License v2.1
"Clients wishing to determine whether a new message with the scrollback header matches a previously-logged message with the same message-token SHOULD compare the message's sender, contents, message-sent or message-received timestamp, etc. Note that, in XMPP, the server only supplies a timestamp for scrollback messages, not for messages received while you are in a room; thus, non-scrollback messages will lack a message-sent timestamp."
Implementation for the interface in KTp/Logger/scrollback-manager can be as trivial as:
diff --git a/KTp/Logger/scrollback-manager.cpp b/KTp/Logger/scrollback-manager.cpp
index d9680ae..8f3ab43 100644
--- a/KTp/Logger/scrollback-manager.cpp
+++ b/KTp/Logger/scrollback-manager.cpp
@@ -105,11 +105,15 @@ void ScrollbackManager::fetchHistory(int n)
{
if (n > 0 && !d->account.isNull() && !d->textChannel.isNull()) {
if (d->contactEntity.isValid()) {
- KTp::LogManager *manager = KTp::LogManager::instance();
- KTp::PendingLoggerDates *dates = manager->queryDates(d->account, d->contactEntity);
- connect(dates, SIGNAL(finished(KTp::PendingLoggerOperation*)),
- this, SLOT(onDatesFinished(KTp::PendingLoggerOperation*)));
- return;
+ if (d->textChannel->hasArchiveInterface()) {
+ d->textChannel->getMessages();
+ } else {
+ KTp::LogManager *manager = KTp::LogManager::instance();
+ KTp::PendingLoggerDates *dates = manager->queryDates(d->account, d->contactEntity);
+ connect(dates, SIGNAL(finished(KTp::PendingLoggerOperation*)),
+ this, SLOT(onDatesFinished(KTp::PendingLoggerOperation*)));
+ return;
+ }
}
}
But, it would be much better to implement a proper plugin with KTp::AbstractLoggerPlugin inheritance.
I seem to have a somewhat messed up setup were AccountManager returns a nullptr for /org/freedesktop/Telepathy/Account/ring/tel/account0
MainLogModel::processQueryResults as well as Conversation both do not check the value of account and it therefore crashes later on
(this is mainly a note to myself, remind me if it gets stale ...)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.