[polari] application: Add: reconnect-room action



commit 6668338b5df8002f39de45265527b2f0305f11f4
Author: Daronion <stefanosdimos 98 gmail com>
Date:   Tue May 21 18:50:01 2019 +0300

    application: Add: reconnect-room action
    
    Added an action that retries establishing connection with
    a given room. Will be usable when errors take place.
    
    https://gitlab.gnome.org/GNOME/polari/issues/17

 src/application.js     | 3 +++
 src/telepathyClient.js | 9 +++++++++
 2 files changed, 12 insertions(+)
---
diff --git a/src/application.js b/src/application.js
index 1d8631d..c241d8e 100644
--- a/src/application.js
+++ b/src/application.js
@@ -207,6 +207,9 @@ var Application = GObject.registerClass({
             activate: this._onLeaveCurrentRoom.bind(this),
             create_hook: (a) => a.enabled = false,
             accels: ['<Primary>w']
+        }, {
+            name: 'reconnect-room',
+            parameter_type: GLib.VariantType.new('s')
         }, {
             name: 'authenticate-account',
             parameter_type: GLib.VariantType.new('(os)')
diff --git a/src/telepathyClient.js b/src/telepathyClient.js
index 494ade7..137c94d 100644
--- a/src/telepathyClient.js
+++ b/src/telepathyClient.js
@@ -185,6 +185,9 @@ class TelepathyClient extends Tp.BaseClient {
         }, {
             name: 'leave-room',
             handler: this._onLeaveActivated.bind(this)
+        }, {
+            name: 'reconnect-room',
+            handler: this._onReconnectRoomActivated.bind(this)
         }, {
             name: 'connect-account',
             handler: this._onConnectAccountActivated.bind(this)
@@ -510,6 +513,12 @@ class TelepathyClient extends Tp.BaseClient {
         this._app.withdraw_notification(this._getIdentifyNotificationID(accountPath));
     }
 
+    _onReconnectRoomActivated(action, parameter) {
+        let roomId = parameter.deep_unpack();
+        let room = this._roomManager.lookupRoom(roomId);
+        this._connectRoom(room);
+    }
+
     _isAuthChannel(channel) {
         let channelType = channel.get_channel_type();
         return channelType == Tp.IFACE_CHANNEL_TYPE_SERVER_AUTHENTICATION;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]