/** * tp_channel_group_get_self_handle: * @self: a channel * * Return the #TpChannel:group-self-handle property (see the description * of that property for notes on validity). * * Returns: the handle representing the user, or 0 * Since: 0.7.12 * Deprecated: New code should use tp_channel_group_get_self_contact() instead. */ TpHandle tp_channel_group_get_self_handle (TpChannel *self) { g_return_val_if_fail (TP_IS_CHANNEL (self), 0); return self->priv->group_self_handle; }
EmpathyTpTube * empathy_tp_tube_new (TpChannel *channel) { g_return_val_if_fail (TP_IS_CHANNEL (channel), NULL); return g_object_new (EMPATHY_TYPE_TP_TUBE, "channel", channel, NULL); }
/** * tp_channel_group_get_members: * @self: a channel * * If @self is a group and the %TP_CHANNEL_FEATURE_GROUP feature has been * prepared, return a #TpIntset containing its members. * * If @self is a group but %TP_CHANNEL_FEATURE_GROUP has not been prepared, * the result may either be a set of members, or %NULL. * * If @self is not a group, return %NULL. * * Returns: (transfer none): the members, or %NULL * Since: 0.7.12 * Deprecated: New code should use tp_channel_group_dup_members_contacts() * instead. */ const TpIntset * tp_channel_group_get_members (TpChannel *self) { g_return_val_if_fail (TP_IS_CHANNEL (self), NULL); return self->priv->group_members; }
/** * tp_channel_group_get_handle_owner: * @self: a channel * @handle: a handle which is a member of this channel * * Synopsis (see below for further explanation): * * - if @self is not a group or @handle is not a member of this channel, * result is undefined; * - if %TP_CHANNEL_FEATURE_GROUP has not yet been prepared, result is * undefined; * - if @self does not have flags that include * %TP_CHANNEL_GROUP_FLAG_PROPERTIES, * result is undefined; * - if @handle is channel-specific and its globally valid "owner" is known, * return that owner; * - if @handle is channel-specific and its globally valid "owner" is unknown, * return zero; * - if @handle is globally valid, return @handle itself * * Some channels (those with flags that include * %TP_CHANNEL_GROUP_FLAG_CHANNEL_SPECIFIC_HANDLES) have a concept of * "channel-specific handles". These are handles that only have meaning within * the context of the channel - for instance, in XMPP Multi-User Chat, * participants in a chatroom are identified by an in-room JID consisting * of the JID of the chatroom plus a local nickname. * * Depending on the protocol and configuration, it might be possible to find * out what globally valid handle (i.e. an identifier that you could add to * your contact list) "owns" a channel-specific handle. For instance, in * most XMPP MUC chatrooms, normal users cannot see what global JID * corresponds to an in-room JID, but moderators can. * * This is further complicated by the fact that channels with channel-specific * handles can sometimes have members with globally valid handles (for * instance, if you invite someone to an XMPP MUC using their globally valid * JID, you would expect to see the handle representing that JID in the * Group's remote-pending set). * * This function's result is undefined unless the channel is ready * and its flags include %TP_CHANNEL_GROUP_FLAG_PROPERTIES (an implementation * without extra D-Bus round trips is not possible using the older API). * * Returns: the global handle that owns the given handle, or 0 * Since: 0.7.12 * Deprecated: New code should use tp_channel_group_get_contact_owner() instead. */ TpHandle tp_channel_group_get_handle_owner (TpChannel *self, TpHandle handle) { gpointer key, value; g_return_val_if_fail (TP_IS_CHANNEL (self), 0); if (self->priv->group_handle_owners == NULL) { /* undefined result - pretending it's global is probably as good as * any other behaviour, since we can't know either way */ return handle; } if (g_hash_table_lookup_extended (self->priv->group_handle_owners, GUINT_TO_POINTER (handle), &key, &value)) { /* channel-specific, value is either owner or 0 if unknown */ return GPOINTER_TO_UINT (value); } else { /* either already globally valid, or not a member */ return handle; } }
/** * tp_channel_group_get_remote_pending: * @self: a channel * * If @self is a group and the %TP_CHANNEL_FEATURE_GROUP feature has been * prepared, return a #TpIntset containing its remote-pending members. * * If @self is a group but %TP_CHANNEL_FEATURE_GROUP has not been prepared, * the result may either be a set of remote-pending members, or %NULL. * * If @self is not a group, return %NULL. * * Returns: (transfer none): the remote-pending members, or %NULL * Since: 0.7.12 * Deprecated: New code should use * tp_channel_group_dup_remote_pending_contacts() instead. */ const TpIntset * tp_channel_group_get_remote_pending (TpChannel *self) { g_return_val_if_fail (TP_IS_CHANNEL (self), NULL); return self->priv->group_remote_pending; }
/** * tp_channel_group_get_flags: * @self: a channel * * Return the #TpChannel:group-flags property (see the description * of that property for notes on validity). * * Returns: the group flags, or 0 * Since: 0.7.12 */ TpChannelGroupFlags tp_channel_group_get_flags (TpChannel *self) { g_return_val_if_fail (TP_IS_CHANNEL (self), 0); return self->priv->group_flags; }
void empathy_uoa_auth_handler_start (EmpathyUoaAuthHandler *self, TpChannel *channel, TpAccount *tp_account) { const GValue *id_value; AgAccountId id; AgAccount *account; GList *l = NULL; AgAccountService *service; AuthContext *ctx; g_return_if_fail (TP_IS_CHANNEL (channel)); g_return_if_fail (TP_IS_ACCOUNT (tp_account)); g_return_if_fail (empathy_uoa_auth_handler_supports (self, channel, tp_account)); DEBUG ("Start UOA auth for account: %s", tp_proxy_get_object_path (tp_account)); id_value = tp_account_get_storage_identifier (tp_account); id = g_value_get_uint (id_value); account = ag_manager_get_account (self->priv->manager, id); if (account != NULL) l = ag_account_list_services_by_type (account, TPAW_UOA_SERVICE_TYPE); if (l == NULL) { DEBUG ("Couldn't find IM service for AgAccountId %u", id); g_object_unref (account); tp_channel_close_async (channel, NULL, NULL); return; } /* Assume there is only one IM service */ service = ag_account_service_new (account, l->data); ag_service_list_free (l); g_object_unref (account); ctx = auth_context_new (channel, service); if (ctx->session == NULL) { /* This (usually?) means we never stored credentials for this account. * To ask user to type his password SSO needs a SignonIdentity bound to * our account. Let's store an empty password. */ DEBUG ("Couldn't create a signon session"); tpaw_keyring_set_account_password_async (tp_account, "", FALSE, set_account_password_cb, ctx); } else { /* All is fine! Query UOA for more info */ signon_identity_query_info (ctx->identity, identity_query_info_cb, ctx); } g_object_unref (service); }
void empathy_tp_roomlist_stop (EmpathyTpRoomlist *list) { EmpathyTpRoomlistPriv *priv = GET_PRIV (list); g_return_if_fail (EMPATHY_IS_TP_ROOMLIST (list)); g_return_if_fail (TP_IS_CHANNEL (priv->channel)); tp_cli_channel_type_room_list_call_stop_listing (priv->channel, -1, NULL, NULL, NULL, NULL); }
void empathy_server_tls_handler_new_async (TpChannel *channel, GAsyncReadyCallback callback, gpointer user_data) { g_assert (TP_IS_CHANNEL (channel)); g_assert (channel != NULL); g_async_initable_new_async (EMPATHY_TYPE_SERVER_TLS_HANDLER, G_PRIORITY_DEFAULT, NULL, callback, user_data, "channel", channel, NULL); }
EmpathyTpStreamedMedia * empathy_tp_streamed_media_new (TpAccount *account, TpChannel *channel) { g_return_val_if_fail (TP_IS_ACCOUNT (account), NULL); g_return_val_if_fail (TP_IS_CHANNEL (channel), NULL); return g_object_new (EMPATHY_TYPE_TP_STREAMED_MEDIA, "account", account, "channel", channel, NULL); }
/** * empathy_tp_file_new: * @channel: a #TpChannel * @incoming: whether the file transfer is incoming or not * * Creates a new #EmpathyTpFile wrapping @channel. * The returned #EmpathyTpFile should be unrefed * with g_object_unref() when finished with. * * Return value: a new #EmpathyTpFile */ EmpathyTpFile * empathy_tp_file_new (TpChannel *channel) { EmpathyTpFile *self; g_return_val_if_fail (TP_IS_CHANNEL (channel), NULL); self = g_object_new (EMPATHY_TYPE_TP_FILE, "channel", channel, NULL); return self; }
/** * tp_channel_group_get_local_pending_info: * @self: a channel * @local_pending: the handle of a local-pending contact about whom more * information is needed * @actor: (out) (allow-none): either %NULL or a location to return the contact * who requested the change * @reason: (out) (allow-none): either %NULL or a location to return the reason * for the change * @message: (out) (transfer none) (allow-none): either %NULL or a location to * return the user-supplied message * * If @local_pending is actually the handle of a local-pending contact, * write additional information into @actor, @reason and @message and return * %TRUE. The handle and message are not referenced or copied, and can only be * assumed to remain valid until the main loop is re-entered. * * If @local_pending is not the handle of a local-pending contact, * write 0 into @actor, %TP_CHANNEL_GROUP_CHANGE_REASON_NONE into @reason * and "" into @message, and return %FALSE. * * Returns: %TRUE if the contact is in fact local-pending * Since: 0.7.12 * Deprecated: New code should use * tp_channel_group_get_local_pending_contact_info() instead. */ gboolean tp_channel_group_get_local_pending_info (TpChannel *self, TpHandle local_pending, TpHandle *actor, TpChannelGroupChangeReason *reason, const gchar **message) { gboolean ret = FALSE; TpHandle a = 0; TpChannelGroupChangeReason r = TP_CHANNEL_GROUP_CHANGE_REASON_NONE; const gchar *m = ""; g_return_val_if_fail (TP_IS_CHANNEL (self), FALSE); if (self->priv->group_local_pending != NULL) { /* it could conceivably be someone who is local-pending */ ret = tp_intset_is_member (self->priv->group_local_pending, local_pending); if (ret && self->priv->group_local_pending_info != NULL) { /* we might even have information about them */ LocalPendingInfo *info = g_hash_table_lookup ( self->priv->group_local_pending_info, GUINT_TO_POINTER (local_pending)); if (info != NULL) { a = info->actor; r = info->reason; if (info->message != NULL) m = info->message; } /* else we have no info, which means (0, NONE, NULL) */ } } if (actor != NULL) *actor = a; if (message != NULL) *message = m; if (reason != NULL) *reason = r; return ret; }
void empathy_server_sasl_handler_new_async (TpAccount *account, TpChannel *channel, GAsyncReadyCallback callback, gpointer user_data) { g_return_if_fail (TP_IS_ACCOUNT (account)); g_return_if_fail (TP_IS_CHANNEL (channel)); g_return_if_fail (callback != NULL); g_async_initable_new_async (EMPATHY_TYPE_SERVER_SASL_HANDLER, G_PRIORITY_DEFAULT, NULL, callback, user_data, "account", account, "channel", channel, NULL); }
void hev_impathy_server_sasl_handler_new_async( TpAccount *account, TpChannel *channel, GAsyncReadyCallback callback, gpointer user_data) { g_debug("%s:%d[%s]", __FILE__, __LINE__, __FUNCTION__); g_return_if_fail(TP_IS_ACCOUNT(account)); g_return_if_fail(TP_IS_CHANNEL(channel)); g_return_if_fail(NULL!=callback); g_async_initable_new_async(HEV_TYPE_IMPATHY_SERVER_SASL_HANDLER, G_PRIORITY_DEFAULT, NULL, callback, user_data, "account", account, "channel", channel, NULL); }
gboolean empathy_uoa_auth_handler_supports (EmpathyUoaAuthHandler *self, TpChannel *channel, TpAccount *account) { const gchar *provider; EmpathySaslMechanism mech; g_return_val_if_fail (TP_IS_CHANNEL (channel), FALSE); g_return_val_if_fail (TP_IS_ACCOUNT (account), FALSE); provider = tp_account_get_storage_provider (account); if (tp_strdiff (provider, EMPATHY_UOA_PROVIDER)) return FALSE; mech = empathy_sasl_channel_select_mechanism (channel); return mech == EMPATHY_SASL_MECHANISM_FACEBOOK || mech == EMPATHY_SASL_MECHANISM_WLM || mech == EMPATHY_SASL_MECHANISM_GOOGLE || mech == EMPATHY_SASL_MECHANISM_PASSWORD; }
GList * _mcd_client_registry_list_possible_handlers (McdClientRegistry *self, const gchar *preferred_handler, GVariant *request_props, TpChannel *channel, const gchar *must_have_unique_name) { GList *handlers = NULL; GList *handlers_iter; GHashTableIter client_iter; gpointer client_p; _mcd_client_registry_init_hash_iter (self, &client_iter); while (g_hash_table_iter_next (&client_iter, NULL, &client_p)) { McdClientProxy *client = MCD_CLIENT_PROXY (client_p); gsize quality; if (must_have_unique_name != NULL && tp_strdiff (must_have_unique_name, _mcd_client_proxy_get_unique_name (client))) { /* we're trying to redispatch to an existing handler, and this is * not it */ continue; } if (!tp_proxy_has_interface_by_id (client, TP_IFACE_QUARK_CLIENT_HANDLER)) { /* not a handler at all */ continue; } if (channel == NULL) { /* We don't know the channel's properties (the next part will not * execute), so we must work out the quality of match from the * channel request. We can assume that the request will return one * channel, with the requested properties, plus Requested == TRUE. */ g_assert (request_props != NULL); quality = _mcd_client_match_filters (request_props, _mcd_client_proxy_get_handler_filters (client), TRUE); } else { GVariant *properties; g_assert (TP_IS_CHANNEL (channel)); properties = tp_channel_dup_immutable_properties (channel); quality = _mcd_client_match_filters (properties, _mcd_client_proxy_get_handler_filters (client), FALSE); g_variant_unref (properties); } if (quality > 0) { PossibleHandler *ph = g_slice_new0 (PossibleHandler); ph->client = client; ph->bypass = _mcd_client_proxy_get_bypass_approval (client); ph->quality = quality; handlers = g_list_prepend (handlers, ph); } } /* if no handlers can take them all, fail - unless we're operating on * a request that specified a preferred handler, in which case assume * it's suitable */ if (handlers == NULL) { McdClientProxy *client; if (preferred_handler == NULL || preferred_handler[0] == '\0') { return NULL; } client = _mcd_client_registry_lookup (self, preferred_handler); if (client == NULL) { return NULL; } return g_list_append (NULL, client); } /* We have at least one handler that can take the whole batch. Sort * the possible handlers, most preferred first (i.e. sort by ascending * quality then reverse) */ handlers = g_list_sort (handlers, possible_handler_cmp); handlers = g_list_reverse (handlers); /* convert in-place from a list of PossibleHandler to a list of * McdClientProxy */ for (handlers_iter = handlers; handlers_iter != NULL; handlers_iter = handlers_iter->next) { PossibleHandler *ph = handlers_iter->data; handlers_iter->data = ph->client; g_slice_free (PossibleHandler, ph); } return handlers; }