telepathyClient: Remove some obsolete wrappers

gjs can handle these cases natively now

https://bugzilla.gnome.org/show_bug.cgi?id=682045
This commit is contained in:
Jasper St. Pierre 2012-08-14 16:21:10 -03:00
parent 8f129e1c9d
commit addb247c33
3 changed files with 11 additions and 34 deletions

View File

@ -132,7 +132,7 @@ const Client = new Lang.Class({
let channel = channels[i];
let [targetHandle, targetHandleType] = channel.get_handle();
if (Shell.is_channel_invalidated(channel))
if (channel.get_invalidated())
continue;
/* Only observe contact text channels */
@ -184,7 +184,7 @@ const Client = new Lang.Class({
continue;
}
if (Shell.is_channel_invalidated(channel))
if (channel.get_invalidated())
continue;
// 'notify' will be true when coming from an actual HandleChannels
@ -211,13 +211,15 @@ const Client = new Lang.Class({
// We can only approve the rooms if we have been invited to it
let selfContact = channel.group_get_self_contact();
if (selfContact == null) {
Shell.decline_dispatch_op(context, 'Not invited to the room');
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) {
Shell.decline_dispatch_op(context, 'Not invited to the room');
context.fail(new Tp.Error({ code: Tp.Error.INVALID_ARGUMENT,
message: 'Not invited to the room' }));
return;
}
@ -237,8 +239,9 @@ const Client = new Lang.Class({
let channel = channels[0];
let chanType = channel.get_channel_type();
if (Shell.is_channel_invalidated(channel)) {
Shell.decline_dispatch_op(context, 'Channel is invalidated');
if (channel.get_invalidated()) {
context.fail(new Tp.Error({ code: Tp.Error.INVALID_ARGUMENT,
message: 'Channel is invalidated' }));
return;
}
@ -249,7 +252,8 @@ const Client = new Lang.Class({
else if (chanType == Tp.IFACE_CHANNEL_TYPE_FILE_TRANSFER)
this._approveFileTransfer(account, conn, channel, dispatchOp, context);
else
Shell.decline_dispatch_op(context, 'Unsupported channel type');
context.fail(new Tp.Error({ code: Tp.Error.INVALID_ARGUMENT,
message: 'Unsupported channel type' }));
},
_approveTextChannel: function(account, conn, channel, dispatchOp, context) {

View File

@ -327,23 +327,3 @@ shell_tp_client_grab_contact_list_changed (ShellTpClient *self,
G_CALLBACK (on_contact_list_changed),
self);
}
/* Telepathy utility functions */
/* gjs doesn't allow us to craft a GError so we need a C wrapper */
void
shell_decline_dispatch_op (TpAddDispatchOperationContext *context,
const gchar *message)
{
GError *error = g_error_new_literal (TP_ERRORS, TP_ERROR_INVALID_ARGUMENT,
message);
tp_add_dispatch_operation_context_fail (context, error);
g_error_free (error);
}
/* gjs doesn't cope with tp_proxy_get_invalidated() returning a GError */
gboolean shell_is_channel_invalidated (TpChannel *channel)
{
return tp_proxy_get_invalidated (channel) != NULL;
}

View File

@ -100,12 +100,5 @@ void shell_tp_client_set_contact_list_changed_func (ShellTpClient *self,
void shell_tp_client_grab_contact_list_changed (ShellTpClient *self,
TpConnection *conn);
/* Telepathy utility functions */
void shell_decline_dispatch_op (TpAddDispatchOperationContext *context,
const gchar *message);
gboolean shell_is_channel_invalidated (TpChannel *channel);
G_END_DECLS
#endif /* __SHELL_TP_CLIENT_H__ */