Skip to content

Implement Channel Interface MessageArchive support #1

Open
@Kaffeine

Description

@Kaffeine

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions