Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement Channel Interface MessageArchive support #1

Open
Kaffeine opened this issue Oct 10, 2016 · 0 comments
Open

Implement Channel Interface MessageArchive support #1

Kaffeine opened this issue Oct 10, 2016 · 0 comments

Comments

@Kaffeine
Copy link
Member

Kaffeine commented Oct 10, 2016

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.

@Kaffeine Kaffeine changed the title Implement scrollback messages support Implement Channel Interface MessageArchive support Oct 10, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant