Bug 270725 - An existing chat window/tab stops working when going offline and back online
Summary: An existing chat window/tab stops working when going offline and back online
Status: RESOLVED FIXED
Alias: None
Product: telepathy
Classification: Frameworks and Libraries
Component: text-ui (show other bugs)
Version: git-latest
Platform: Unlisted Binaries Linux
: NOR normal
Target Milestone: 0.4.0
Assignee: Telepathy Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-04-12 02:30 UTC by Lasse Liehu
Modified: 2012-07-06 12:47 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Lasse Liehu 2011-04-12 02:30:35 UTC
Version:           git-latest
OS:                Linux



Reproducible: Always

Steps to Reproduce:
1. Open a text chat with someone
2. Chat
3. Go offline (don't close the chat window/tab)
4. Go back online
5. Try to send a message from the same chat window/tab

Actual Results:  
The messages are "eaten". The send message box is cleared, but the messages don't appear in the chat area nor are they sent.

Expected Results:  
Sending messages should work.
Comment 1 David Edmundson 2011-04-12 12:45:59 UTC
Focussing purely on the "messages get eaten" part, as this is the most critical:

When the channel emits invalidated() we should disable the send button. (and possibly the text edit?). I think this would work. 

In the future we might want to try and re-establish a new channel, and make sure we re-use the same windows but that can wait.
Comment 2 Lasse Liehu 2011-04-13 23:32:46 UTC
The "eating" part is fixed in http://commits.kde.org/telepathy-chat-handler/dc1d38314b8d3703e2b05020caa78b7380af0fd2
Comment 3 David Edmundson 2011-04-23 13:31:30 UTC
For resuming in the same window we need the following:

 - a method in ChatWidget called setChannel(Tp::TextChannel) which will correctly replace the channel object for a new one, and update/reconnect _everything_. The original code wasn't designed for this, so this may be a tricky task. This should undo any disabling that happened when the first channel became invalidated.

 - a method in the ChatWidget to expose a set of contact IDs we are/were talking to.

 - The chat app needs to search through all the windows and look for anything with matching contacts _IDs_ (don't compare Tp::ContactPtrs as the first set become invalidated when you went offline)

We already have code that checks for matching channels, I'm not sure if we then should remove that, as it's doing effectively the same thing (in a faster+better way, but one that only works whilst the first channel is connected)

Possible future bug: if we do it like I described, there is a slim chance that if we join a room which just happens to have exactly the same people in it, it would open in the same window. Not sure how to fix that, maybe we should only do it for 1-1 chats?
Comment 4 David Edmundson 2011-04-23 14:53:07 UTC
We can use the (upcoming) targetID of the channel to identify where windows should match.

[13:59] <oggis_> what I'd do if I were you is to match all channels by their (targetHandleType(), targetId()) pair - except skip matching altogether if targetHandleType() == HandleTypeNone (in which case targetId will be empty as well)
Comment 5 Francesco Nwokeka 2011-04-30 19:43:11 UTC
Git commit aaed121605dc91aef945d7852575765c0a1b33f5 by Francesco Nwokeka.
Committed on 30/04/2011 at 20:04.
Pushed by nwokeka into branch 'master'.

Re-establish chat after going offline and back online PART 3 of 3

Final part of bug 270725: An existing chat window/tab stops working when going offline and back online. When
user goes offline, the chat is invalidated. If the user comes back online, and the previous chat window is
still open, the chat with that contact is re-established.

BUG: 270725
REVIEW: 101260
Reviewed by: David Edmundson

M  +17   -3    app/chat-tab.cpp     
M  +6    -1    app/chat-tab.h     
M  +6    -5    app/chat-window.cpp     
M  +2    -2    app/chat-window.h     
M  +1    -3    app/telepathy-chat-ui.cpp     
M  +9    -1    lib/chat-widget.cpp     
M  +4    -1    lib/chat-widget.h     

http://commits.kde.org/telepathy-chat-handler/aaed121605dc91aef945d7852575765c0a1b33f5