Skip to content

Commit

Permalink
Engine(-Twitter),Frontend: avoid Close warning dialog (closes: #1093)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
knocte committed Oct 23, 2016
1 parent c696edd commit 070f385
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,12 @@ protected bool HasTokens {
}
}

public override bool HiddenPresenceStatus {
get {
return true;
}
}

public TwitterProtocolManager(Session session) : base(session)
{
Trace.Call(session);
Expand Down
4 changes: 4 additions & 0 deletions src/Engine/Protocols/IProtocolManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ PresenceStatus PresenceStatus {
get;
}

bool HiddenPresenceStatus {
get;
}

void Connect(FrontendManager frontendManager, ServerModel server);
void Disconnect(FrontendManager frontendManager);
void Reconnect(FrontendManager frontendManager);
Expand Down
6 changes: 6 additions & 0 deletions src/Engine/Protocols/ProtocolManagerBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,12 @@ public virtual PresenceStatus PresenceStatus {
}
}

public virtual bool HiddenPresenceStatus {
get {
return false;
}
}

public abstract string NetworkID {
get;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Frontend-GNOME/Views/Chats/ProtocolChatView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 070f385

Please sign in to comment.