[gnome-shell] TelepathyClient: stop handling room invitations
- From: Giovanni Campagna <gcampagna src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] TelepathyClient: stop handling room invitations
- Date: Tue, 3 Mar 2015 22:33:21 +0000 (UTC)
commit 707cc9e31502ae283ff49fc21e5865d910410b4c
Author: Giovanni Campagna <scampa giovanni gmail com>
Date: Tue Mar 3 00:27:48 2015 -0800
TelepathyClient: stop handling room invitations
Let empathy deal with these
https://bugzilla.gnome.org/show_bug.cgi?id=745503
js/ui/components/telepathyClient.js | 125 +++++------------------------------
src/shell-tp-client.c | 9 ---
2 files changed, 16 insertions(+), 118 deletions(-)
---
diff --git a/js/ui/components/telepathyClient.js b/js/ui/components/telepathyClient.js
index b6baa63..314e7d0 100644
--- a/js/ui/components/telepathyClient.js
+++ b/js/ui/components/telepathyClient.js
@@ -208,33 +208,6 @@ const TelepathyClient = new Lang.Class({
}
},
- _displayRoomInvitation: function(conn, channel, dispatchOp, context) {
- // We can only approve the rooms if we have been invited to it
- let selfContact = channel.group_get_self_contact();
- if (selfContact == null) {
- context.fail(new Tp.Error({ code: Tp.Error.INVALID_ARGUMENT,
- message: 'Not invited to the room' }));
- return;
- }
-
- let [invited, inviter, reason, msg] = channel.group_get_local_pending_contact_info(selfContact);
- if (!invited) {
- context.fail(new Tp.Error({ code: Tp.Error.INVALID_ARGUMENT,
- message: 'Not invited to the room' }));
- return;
- }
-
- // FIXME: We don't have a 'chat room' icon (bgo #653737) use
- // system-users for now as Empathy does.
- let source = new ApproverSource(dispatchOp, _("Invitation"),
- Gio.icon_new_for_string('system-users'));
- Main.messageTray.add(source);
-
- let notif = new RoomInviteNotification(source, dispatchOp, channel, inviter);
- source.notify(notif);
- context.accept();
- },
-
_approveChannels: function(approver, account, conn, channels,
dispatchOp, context) {
let channel = channels[0];
@@ -256,21 +229,23 @@ const TelepathyClient = new Lang.Class({
_approveTextChannel: function(account, conn, channel, dispatchOp, context) {
let [targetHandle, targetHandleType] = channel.get_handle();
- if (targetHandleType == Tp.HandleType.CONTACT) {
- // Approve private text channels right away as we are going to handle it
- dispatchOp.claim_with_async(this._tpClient,
- Lang.bind(this, function(dispatchOp, result) {
- try {
- dispatchOp.claim_with_finish(result);
- this._handlingChannels(account, conn, [channel], false);
- } catch (err) {
- throw new Error('Failed to Claim channel: ' + err);
- }}));
-
- context.accept();
- } else {
- this._displayRoomInvitation(conn, channel, dispatchOp, context);
+ if (targetHandleType != Tp.HandleType.CONTACT) {
+ context.fail(new Tp.Error({ code: Tp.Error.INVALID_ARGUMENT,
+ message: 'Unsupported handle type' }));
+ return;
}
+
+ // Approve private text channels right away as we are going to handle it
+ dispatchOp.claim_with_async(this._tpClient, Lang.bind(this, function(dispatchOp, result) {
+ try {
+ dispatchOp.claim_with_finish(result);
+ this._handlingChannels(account, conn, [channel], false);
+ } catch (err) {
+ log('Failed to Claim channel: ' + err);
+ }
+ }));
+
+ context.accept();
},
_delegatedChannelsCb: function(client, channels) {
@@ -937,72 +912,4 @@ const ChatNotification = new Lang.Class({
}
});
-const ApproverSource = new Lang.Class({
- Name: 'ApproverSource',
- Extends: MessageTray.Source,
-
- _init: function(dispatchOp, text, gicon) {
- this._gicon = gicon;
-
- this.parent(text);
-
- this._dispatchOp = dispatchOp;
-
- // Destroy the source if the channel dispatch operation is invalidated
- // as we can't approve any more.
- this._invalidId = dispatchOp.connect('invalidated',
- Lang.bind(this, function(domain, code, msg) {
- this.destroy();
- }));
- },
-
- _createPolicy: function() {
- return new MessageTray.NotificationApplicationPolicy('empathy');
- },
-
- destroy: function() {
- if (this._invalidId != 0) {
- this._dispatchOp.disconnect(this._invalidId);
- this._invalidId = 0;
- }
-
- this.parent();
- },
-
- getIcon: function() {
- return this._gicon;
- }
-});
-
-const RoomInviteNotification = new Lang.Class({
- Name: 'RoomInviteNotification',
- Extends: MessageTray.Notification,
-
- _init: function(source, dispatchOp, channel, inviter) {
- this.parent(source,
- /* translators: argument is a room name like
- * room jabber org for example. */
- _("Invitation to %s").format(channel.get_identifier()),
- /* translators: first argument is the name of a contact and the second
- * one the name of a room. "Alice is inviting you to join room jabber org
- * for example. */
- _("%s is inviting you to join %s").format(inviter.get_alias(),
channel.get_identifier()));
- this.setResident(true);
-
-
- this.addAction(_("Decline"), Lang.bind(this, function() {
- dispatchOp.leave_channels_async(Tp.ChannelGroupChangeReason.NONE, '', function(src, result) {
- src.leave_channels_finish(result);
- });
- this.destroy();
- }));
- this.addAction(_("Accept"), Lang.bind(this, function() {
- dispatchOp.handle_with_time_async('', global.get_current_time(), function(src, result) {
- src.handle_with_time_finish(result);
- });
- this.destroy();
- }));
- }
-});
-
const Component = TelepathyClient;
diff --git a/src/shell-tp-client.c b/src/shell-tp-client.c
index 5ea3e76..a20987d 100644
--- a/src/shell-tp-client.c
+++ b/src/shell-tp-client.c
@@ -103,15 +103,6 @@ shell_tp_client_init (ShellTpClient *self)
/* Approver */
tp_base_client_add_approver_filter (TP_BASE_CLIENT (self), filter);
- /* Approve room invitations. We don't handle or observe room channels so
- * just register this filter for the approver. */
- tp_base_client_take_approver_filter (TP_BASE_CLIENT (self), tp_asv_new (
- TP_PROP_CHANNEL_CHANNEL_TYPE, G_TYPE_STRING,
- TP_IFACE_CHANNEL_TYPE_TEXT,
- TP_PROP_CHANNEL_TARGET_HANDLE_TYPE, G_TYPE_UINT,
- TP_HANDLE_TYPE_ROOM,
- NULL));
-
/* Handler */
tp_base_client_add_handler_filter (TP_BASE_CLIENT (self), filter);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]