From a1b875bb25d9711e25e8904a1c479783aa6fd276 Mon Sep 17 00:00:00 2001
From: David Baker <dave@matrix.org>
Date: Tue, 15 Mar 2016 10:48:16 +0000
Subject: [PATCH] Handle the new Session.logged_out event. Log the user out and
 display a message telling them they've been logged out.

Requires https://github.com/matrix-org/matrix-js-sdk/pull/100 (but safe without)
Fixes https://github.com/vector-im/vector-web/issues/414
---
 src/components/structures/MatrixChat.js | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/src/components/structures/MatrixChat.js b/src/components/structures/MatrixChat.js
index e50669c26a..2e22511924 100644
--- a/src/components/structures/MatrixChat.js
+++ b/src/components/structures/MatrixChat.js
@@ -621,6 +621,16 @@ module.exports = React.createClass({
                 call: call
             });
         });
+        cli.on('Session.logged_out', function(call) {
+            var ErrorDialog = sdk.getComponent("dialogs.ErrorDialog");
+            Modal.createDialog(ErrorDialog, {
+                title: "Logged Out",
+                description: "For security, this session has been logged out. Please log in again."
+            });
+            dis.dispatch({
+                action: 'logout'
+            });
+        });
         Notifier.start();
         UserActivity.start();
         Presence.start();
-- 
GitLab