Clear chat states on own/contact disconnect

fixes #197
This commit is contained in:
fiaxh 2017-12-17 13:15:53 +01:00
parent b4bb0912fc
commit 8cbc4e7f89
2 changed files with 2 additions and 1 deletions

View file

@ -27,9 +27,11 @@ public class CounterpartInteractionManager : StreamInteractionModule, Object {
stream_interactor.account_added.connect(on_account_added); stream_interactor.account_added.connect(on_account_added);
stream_interactor.get_module(MessageProcessor.IDENTITY).message_received.connect(on_message_received); stream_interactor.get_module(MessageProcessor.IDENTITY).message_received.connect(on_message_received);
stream_interactor.get_module(MessageProcessor.IDENTITY).message_sent.connect(check_if_got_marker); stream_interactor.get_module(MessageProcessor.IDENTITY).message_sent.connect(check_if_got_marker);
stream_interactor.stream_negotiated.connect(() => chat_states.clear() );
} }
public string? get_chat_state(Account account, Jid jid) { public string? get_chat_state(Account account, Jid jid) {
if (stream_interactor.connection_manager.get_state(account) != ConnectionManager.ConnectionState.CONNECTED) return null;
return chat_states[jid]; return chat_states[jid];
} }

View file

@ -39,7 +39,6 @@ public class DefaultFileDisplay : Plugins.MetaConversationItem {
public override Object? get_widget(Plugins.WidgetType widget_type) { public override Object? get_widget(Plugins.WidgetType widget_type) {
Box main_box = new Box(Orientation.HORIZONTAL, 4) { halign=Align.START, visible=true }; Box main_box = new Box(Orientation.HORIZONTAL, 4) { halign=Align.START, visible=true };
string? content_type = ContentType.from_mime_type(file_transfer.mime_type);
string? icon_name = ContentType.get_generic_icon_name(file_transfer.mime_type); string? icon_name = ContentType.get_generic_icon_name(file_transfer.mime_type);
Image content_type_image = new Image.from_icon_name(icon_name, IconSize.DND) { visible=true }; Image content_type_image = new Image.from_icon_name(icon_name, IconSize.DND) { visible=true };
main_box.add(content_type_image); main_box.add(content_type_image);