Bug 318549 - Messages sent whilst offline aren't appearing in text-ui
Summary: Messages sent whilst offline aren't appearing in text-ui
Status: RESOLVED FIXED
Alias: None
Product: telepathy
Classification: Unmaintained
Component: text-ui (show other bugs)
Version: 0.6.1
Platform: Ubuntu Linux
: NOR major
Target Milestone: Future
Assignee: Telepathy Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-04-18 11:44 UTC by RussianNeuroMancer
Modified: 2013-05-15 21:31 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In: 0.6.2
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description RussianNeuroMancer 2013-04-18 11:44:37 UTC
When KDE-Telepathy goes online it receive messages that has been sent to me when I was in offline mode. After upgrade from KDE-Telepathy 0.6.0 to 0.6.1, text-ui show received messages only in first tab. Second and rest tabs are empty. Received messages visible only in log viewer.

Reproducible: Always

Steps to Reproduce:
1. Ask someone to send you messages when you will be in offline mode.
2. Go to offline mode.
3. Go to online mode.

Actual Results:  
text-ui show received messages only in first tab.

Expected Results:  
text-ui show all received messages.

OS; Kubuntu 13.04 x86_64
Packages from system repository.
Comment 1 David Edmundson 2013-04-18 13:17:46 UTC
This has nothing to do with being in the first tab or not. I think that may have been coincidence.

There definitely is something wrong.

On my local prosody setup:
2 accounts 1 on prosody, 1 in KTp

 - Send a message from PSI -> KTp
 - Disable my local account in KTp
 - Send a message from PSI -> KTp
 - Enable my local account in KTp
 - I get a notification from somewhere (not sure if approver or text-ui) 
 - it does not appear in the UI.
 - it is in the logger.
Comment 2 David Edmundson 2013-04-18 13:51:18 UTC
The cause of this is pretty obvious.

When we call setTextChannel() we don't check and process anything in the messageQueue.

We need to loop through this and add everything to the view.
Comment 3 Sven Brauch 2013-05-06 22:07:58 UTC
I just tried to reproduce this but couldn't, was it fixed?
Comment 4 Sven Brauch 2013-05-08 00:38:34 UTC
Okay, reproduced it now. It's even worse than described here if I get it right.

Can someone try this:
1. Have two accounts in pidgin (or whatever IM)
2. Go offline with your KTP account
3. Send messages from the Pidgin account(s) to the KTP account
4. Go online with your KTP account
5. Randomly, both or just one of the chat windows will be empty when opening ktp-text-ui.
Okay, so far that's what is described in the report already. Now:
6. From the account that has the empty view, send another message. For me, that message is not displayed either. Only if you send a message *to* the account with the empty window and then send another one *from* that account, it gets displayed again.
Can someone reproduce that?

I investigated the reason for this a bit, and I found that the empty view (which, as you might have noticed, don't have backlog either!) have no HTML <body>. It's just missing. Thus, the javascript which adds the message fails (the error message is discarded and the return value is not being checked either). I tried this with two different themes, a custom one and the default (I think?) Renkoo theme -- same thing for both.

I'll try to find out why that is tomorrow (too late for today *yawn*) but maybe someone has an idea in the meantime already which makes this easier? ;)
Comment 5 Sven Brauch 2013-05-08 00:42:17 UTC
Ah, I checked for what David said in comment #2 -- this does not seem to be the problem. I added debug output to AdiumThemeView::addMessage (quite at the bottom of the call stack for adding messages) and it gets called just fine for the offline messages.
Comment 6 Sven Brauch 2013-05-08 19:04:40 UTC
This is a "Heisenbug"... it disappears when adding enough debug output ;)

Anyways, after some investigation, the problem seems to be somewhere in KWebPage. Telling the KWebView constructor to not use a KWebPage, but the default instead (or assigning a custom QWebPage via setPage()) fixes the problem for me.

Could someone please test if this fix is reproducable? Here's the patch:
http://paste.kde.org/740102/raw/
Comment 7 David Edmundson 2013-05-10 13:07:39 UTC
Worth shipping anyway. Will make startup faster.

I don't see how this patch will fix the issue. (or at least what I thought the issue was)

As far as I can tell there will potentially be messages in the messageQueue when setTextChannel is called. These will never be processed.
Comment 8 Sven Brauch 2013-05-10 13:30:43 UTC
Git commit dd8ea96d3e9bf3dc1534c45bb433c56df36b8cf1 by Sven Brauch.
Committed on 08/05/2013 at 20:59.
Pushed by brauch into branch 'master'.

Use a QWebPage instead of a KWebPage in the text UI.

According to my tests, this fixes bug 318549, although
I have no idea why it does. But since using QWebPage is
preferable to KWebPage anyways (we don't use anything from
KWebPage), the change makes sense even without that.

M  +1    -1    lib/adium-theme-view.cpp

http://commits.kde.org/telepathy-text-ui/dd8ea96d3e9bf3dc1534c45bb433c56df36b8cf1
Comment 9 David Edmundson 2013-05-15 21:29:27 UTC
Git commit 02f5c46161ab558ef7a13eb153db998109224009 by David Edmundson.
Committed on 10/05/2013 at 20:44.
Pushed by davidedmundson into branch 'kde-telepathy-0.6'.

Fix messages not appearing when text channel reloads

REVIEWED-BY: Sven Brauch

M  +9    -1    lib/chat-widget.cpp

http://commits.kde.org/telepathy-text-ui/02f5c46161ab558ef7a13eb153db998109224009