[polari] app: Make _ensureChannel() handle targetTypes other than ROOM



commit 13ffc11e6b785b8ca95bc20e1db979ba166aceac
Author: Volker Sobek <reklov live com>
Date:   Thu Aug 22 23:43:38 2013 +0200

    app: Make _ensureChannel() handle targetTypes other than ROOM
    
    When unifying all callers to ensure_channel() with the 'join-room' action,
    we broke the /query command which requires Tp.HandleType.CONTACT rather
    than Tp.HandleType.ROOM.
    Update _ensureChannel() to use an additional targetHandleType parameter
    in its request data, so we can reuse it to implement a new 'message-user'
    action (which we will also use eventually to implement the corresponding
    menu action).
    
    Based on a patch by Volker Sobek.

 src/application.js |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)
---
diff --git a/src/application.js b/src/application.js
index cc0b204..600c251 100644
--- a/src/application.js
+++ b/src/application.js
@@ -262,7 +262,7 @@ const Application = new Lang.Class({
         let account = requestData.account;
 
         let req = Tp.AccountChannelRequest.new_text(account, requestData.time);
-        req.set_target_id(Tp.HandleType.ROOM, requestData.target);
+        req.set_target_id(requestData.targetHandleType, requestData.targetId);
         req.set_delegate_to_preferred_handler(true);
         let preferredHandler = Tp.CLIENT_BUS_NAME_BASE + 'Polari';
         req.ensure_channel_async(preferredHandler, null,
@@ -300,7 +300,8 @@ const Application = new Lang.Class({
 
         if (requestData.retry > 0)
             this._updateAccountName(account, requestData.originalNick, null);
-        this._addSavedChannel(account, requestData.target);
+        if (requestData.targetHandleType == Tp.HandleType.ROOM)
+            this._addSavedChannel(account, requestData.targetId);
     },
 
     _onJoinRoom: function(action, parameter) {
@@ -311,7 +312,8 @@ const Application = new Lang.Class({
 
         let requestData = {
           account: account,
-          target: channelName,
+          targetHandleType: Tp.HandleType.ROOM,
+          targetId: channelName,
           time: time,
           retry: 0,
           originalNick: account.nickname };


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