[polari] ircParser: Use new join/leave actions
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [polari] ircParser: Use new join/leave actions
- Date: Thu, 8 Aug 2013 13:14:34 +0000 (UTC)
commit b446c1e4792777ff553232e8a3210b5610b2b399
Author: Florian Müllner <fmuellner gnome org>
Date: Thu Aug 1 14:20:50 2013 +0200
ircParser: Use new join/leave actions
src/ircParser.js | 53 +++++++++++++++++------------------------------------
1 files changed, 17 insertions(+), 36 deletions(-)
---
diff --git a/src/ircParser.js b/src/ircParser.js
index f03b298..e80f6b3 100644
--- a/src/ircParser.js
+++ b/src/ircParser.js
@@ -136,21 +136,14 @@ const IrcParser = new Lang.Class({
if (argv.length)
log('Excess arguments to JOIN command: ' + argv);
- let time = TP_CURRENT_TIME;
let account = this._room.channel.connection.get_account();
- let req = Tp.AccountChannelRequest.new_text(account, time);
- let preferredHandler = Tp.CLIENT_BUS_NAME_BASE + 'Polari';
- req.set_target_id(Tp.HandleType.ROOM, room);
- req.set_delegate_to_preferred_handler(true);
- req.ensure_channel_async(preferredHandler, null, Lang.bind(this,
- function(req, res) {
- try {
- req.ensure_channel_finish(res);
- } catch(e) {
- logError(e, 'Failed to join channel');
- }
- }));
+ let app = Gio.Application.get_default();
+ let action = app.lookup_action('join-room');
+ action.activate(GLib.Variant.new('(ssu)',
+ [ account.get_object_path(),
+ room,
+ TP_CURRENT_TIME ]));
break;
}
case 'KICK': {
@@ -220,16 +213,10 @@ const IrcParser = new Lang.Class({
argv.shift(); // first arg was a room name
else
room = this._room;
- let reason = Tp.ChannelGroupChangeReason.NONE;
- let message = argv.join(' ') || '';
- room.channel.leave_async(reason, message, Lang.bind(this,
- function(c, res) {
- try {
- c.leave_finish(res);
- } catch(e) {
- logError(e, 'Failed to leave channel');
- }
- }));
+
+ let app = Gio.Application.get_default();
+ let action = app.lookup_action('leave-room');
+ action.activate(GLib.Variant.new('s', room.id));
break;
}
case 'QUERY': {
@@ -239,20 +226,14 @@ const IrcParser = new Lang.Class({
break;
}
- let time = TP_CURRENT_TIME;
let account = this._room.channel.connection.get_account();
- let req = Tp.AccountChannelRequest.new_text(account, time);
- let preferredHandler = Tp.CLIENT_BUS_NAME_BASE + 'Polari';
- req.set_target_id(Tp.HandleType.CONTACT, nick);
- req.set_delegate_to_preferred_handler(true);
- req.ensure_channel_async(preferredHandler, null, Lang.bind(this,
- function(req, res) {
- try {
- req.ensure_channel_finish(res);
- } catch(e) {
- logError(e, 'Failed to open private chat');
- }
- }));
+
+ let app = Gio.Application.get_default();
+ let action = app.lookup_action('join-room');
+ action.activate(GLib.Variant.new('(ssu)',
+ [ account.get_object_path(),
+ nick,
+ TP_CURRENT_TIME ]));
break;
}
case 'QUIT': {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]