summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Klapetek <[email protected]>2015-08-04 17:22:46 +0200
committerMartin Klapetek <[email protected]>2015-08-04 17:22:46 +0200
commit92f773a6ec92e97595b5173cc8ca039d3bde998d (patch)
treec203a4bd4ab424bbdd2a3e88d8c78816ad8bdf2b
parentfd85d325369aef18fbde83ce5a2720b6dc33b24e (diff)
Delay reconnecting to previously opened channels
This mostly works around a gabble bug which returns incomplete data when reopening a channel immediately after gabble connects BUG: 318180 FIXED-IN: 15.08.0
-rw-r--r--app/chat-tab.cpp28
-rw-r--r--app/chat-tab.h1
2 files changed, 19 insertions, 10 deletions
diff --git a/app/chat-tab.cpp b/app/chat-tab.cpp
index 9f2d0f4..bf18945 100644
--- a/app/chat-tab.cpp
+++ b/app/chat-tab.cpp
@@ -85,21 +85,29 @@ void ChatTab::onConnectionStatusChanged(Tp::ConnectionStatus status)
{
// request a new text channel for the chat
+ if (status == Tp::ConnectionStatusConnected) {
+ // Delay the channels reopening for a little bit as it can result
+ // in displaying not accurate data received from gabble
+ // see https://bugs.kde.org/show_bug.cgi?id=318180 for details
+ QTimer::singleShot(2500, this, &ChatTab::setupChannelsTimeout);
+ }
+}
+
+void ChatTab::setupChannelsTimeout()
+{
Tp::ChannelRequestHints hints;
hints.setHint(QLatin1String("org.kde.telepathy"),QLatin1String("suppressWindowRaise"), QVariant(true));
- if (status == Tp::ConnectionStatusConnected) {
- if (textChannel()->targetHandleType() == Tp::HandleTypeContact) {
- account()->ensureTextChat(textChannel()->targetId(),
+ if (textChannel()->targetHandleType() == Tp::HandleTypeContact) {
+ account()->ensureTextChat(textChannel()->targetId(),
+ QDateTime::currentDateTime(),
+ QLatin1String(KTP_TEXTUI_CLIENT_PATH),
+ hints);
+ } else if (textChannel()->targetHandleType() == Tp::HandleTypeRoom) {
+
+ account()->ensureTextChatroom(textChannel()->targetId(),
QDateTime::currentDateTime(),
QLatin1String(KTP_TEXTUI_CLIENT_PATH),
hints);
- } else if (textChannel()->targetHandleType() == Tp::HandleTypeRoom) {
-
- account()->ensureTextChatroom(textChannel()->targetId(),
- QDateTime::currentDateTime(),
- QLatin1String(KTP_TEXTUI_CLIENT_PATH),
- hints);
- }
}
}
diff --git a/app/chat-tab.h b/app/chat-tab.h
index 0132d53..92bf8fe 100644
--- a/app/chat-tab.h
+++ b/app/chat-tab.h
@@ -56,6 +56,7 @@ private Q_SLOTS:
/** connect account's connection status.
* This re-enables open chats if user goes offline and then back online */
void onConnectionStatusChanged(Tp::ConnectionStatus);
+ void setupChannelsTimeout();
private:
/** pointer to chat window the tab is nested in */