From 070f3853cf51b02c5aae0de1c8db56371ef7b53d Mon Sep 17 00:00:00 2001 From: "Andres G. Aragoneses" Date: Sun, 16 Oct 2016 20:39:40 +0800 Subject: [PATCH] Engine(-Twitter),Frontend: avoid Close warning dialog (closes: #1093) There are some protocols, like Twitter, in which there are no consequences from disconnecting to the server: no unavailable status is shown to our contacts, and no chat buffers will be lost because all the info resides server-side. For these, there is not really any point in warning the user about current open chats when she intends to close the connection, so whitelist Twitter in this way to avoid the pointless dialog. --- .../Protocols/Twitter/TwitterProtocolManager.cs | 6 ++++++ src/Engine/Protocols/IProtocolManager.cs | 4 ++++ src/Engine/Protocols/ProtocolManagerBase.cs | 6 ++++++ src/Frontend-GNOME/Views/Chats/ProtocolChatView.cs | 2 +- 4 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/Engine-Twitter/Protocols/Twitter/TwitterProtocolManager.cs b/src/Engine-Twitter/Protocols/Twitter/TwitterProtocolManager.cs index 535741834..4c6fabecb 100644 --- a/src/Engine-Twitter/Protocols/Twitter/TwitterProtocolManager.cs +++ b/src/Engine-Twitter/Protocols/Twitter/TwitterProtocolManager.cs @@ -116,6 +116,12 @@ protected bool HasTokens { } } + public override bool HiddenPresenceStatus { + get { + return true; + } + } + public TwitterProtocolManager(Session session) : base(session) { Trace.Call(session); diff --git a/src/Engine/Protocols/IProtocolManager.cs b/src/Engine/Protocols/IProtocolManager.cs index 35ff6c93c..0722db254 100644 --- a/src/Engine/Protocols/IProtocolManager.cs +++ b/src/Engine/Protocols/IProtocolManager.cs @@ -67,6 +67,10 @@ PresenceStatus PresenceStatus { get; } + bool HiddenPresenceStatus { + get; + } + void Connect(FrontendManager frontendManager, ServerModel server); void Disconnect(FrontendManager frontendManager); void Reconnect(FrontendManager frontendManager); diff --git a/src/Engine/Protocols/ProtocolManagerBase.cs b/src/Engine/Protocols/ProtocolManagerBase.cs index 3b6e1ca06..5b7dc7dc6 100644 --- a/src/Engine/Protocols/ProtocolManagerBase.cs +++ b/src/Engine/Protocols/ProtocolManagerBase.cs @@ -86,6 +86,12 @@ public virtual PresenceStatus PresenceStatus { } } + public virtual bool HiddenPresenceStatus { + get { + return false; + } + } + public abstract string NetworkID { get; } diff --git a/src/Frontend-GNOME/Views/Chats/ProtocolChatView.cs b/src/Frontend-GNOME/Views/Chats/ProtocolChatView.cs index 32b1fc636..46eb3bb18 100644 --- a/src/Frontend-GNOME/Views/Chats/ProtocolChatView.cs +++ b/src/Frontend-GNOME/Views/Chats/ProtocolChatView.cs @@ -165,7 +165,7 @@ public override void Close() ownedChats++; } } - if (ownedChats > 1) { + if (!ProtocolManager.HiddenPresenceStatus && ownedChats > 1) { Gtk.MessageDialog md = new Gtk.MessageDialog( Frontend.MainWindow, Gtk.DialogFlags.Modal,