gboolean gabble_plugin_implements_sidecar ( GabblePlugin *plugin, const gchar *sidecar_interface) { GabblePluginInterface *iface = GABBLE_PLUGIN_GET_INTERFACE (plugin); return tp_strv_contains (iface->sidecar_interfaces, sidecar_interface); }
void empathy_call_handler_start_call (EmpathyCallHandler *handler) { EmpathyCallHandlerPriv *priv = GET_PRIV (handler); EmpathyDispatcher *dispatcher; TpConnection *connection; GStrv allowed; GValue *value; GHashTable *request; if (priv->call != NULL) { empathy_call_handler_start_tpfs (handler); empathy_tp_call_accept_incoming_call (priv->call); return; } g_assert (priv->contact != NULL); dispatcher = empathy_dispatcher_dup_singleton (); connection = empathy_contact_get_connection (priv->contact); allowed = empathy_dispatcher_find_channel_class (dispatcher, connection, TP_IFACE_CHANNEL_TYPE_STREAMED_MEDIA, TP_HANDLE_TYPE_CONTACT); if (!tp_strv_contains ((const gchar * const *) allowed, TP_IFACE_CHANNEL ".TargetHandle")) return; request = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, (GDestroyNotify) tp_g_value_slice_free); /* org.freedesktop.Telepathy.Channel.ChannelType */ value = tp_g_value_slice_new (G_TYPE_STRING); g_value_set_string (value, TP_IFACE_CHANNEL_TYPE_STREAMED_MEDIA); g_hash_table_insert (request, TP_IFACE_CHANNEL ".ChannelType", value); /* org.freedesktop.Telepathy.Channel.TargetHandleType */ value = tp_g_value_slice_new (G_TYPE_UINT); g_value_set_uint (value, TP_HANDLE_TYPE_CONTACT); g_hash_table_insert (request, TP_IFACE_CHANNEL ".TargetHandleType", value); /* org.freedesktop.Telepathy.Channel.TargetHandle*/ value = tp_g_value_slice_new (G_TYPE_UINT); g_value_set_uint (value, empathy_contact_get_handle (priv->contact)); g_hash_table_insert (request, TP_IFACE_CHANNEL ".TargetHandle", value); empathy_dispatcher_create_channel (dispatcher, connection, request, empathy_call_handler_request_cb, handler); g_object_unref (dispatcher); }
gboolean empathy_sasl_channel_supports_mechanism (TpChannel *channel, const gchar *mechanism) { GHashTable *props; const gchar * const *available_mechanisms; props = tp_channel_borrow_immutable_properties (channel); available_mechanisms = tp_asv_get_boxed (props, TP_PROP_CHANNEL_INTERFACE_SASL_AUTHENTICATION_AVAILABLE_MECHANISMS, G_TYPE_STRV); return tp_strv_contains (available_mechanisms, mechanism); }
static gboolean check_for_messages ( const gchar *object_path, const GHashTable *properties) { /* Create a TpTextChannel only if the channel supports Messages */ const gchar * const * interfaces; interfaces = tp_asv_get_strv (properties, TP_PROP_CHANNEL_INTERFACES); if (!tp_strv_contains (interfaces, TP_IFACE_CHANNEL_INTERFACE_MESSAGES)) { DEBUG ("channel %s doesn't implement Messages so we can't create " "a TpTextChannel", object_path); return FALSE; } return TRUE; }
/* When called from start_mechanism, initial_data can be NULL. When called * from D-Bus as StartMechanismWithData, it can't. */ static void gabble_server_sasl_channel_start_mechanism_with_data ( TpSvcChannelInterfaceSASLAuthentication *iface, const gchar *in_Mechanism, const GArray *in_InitialData, DBusGMethodInvocation *context) { GabbleServerSaslChannel *self = GABBLE_SERVER_SASL_CHANNEL (iface); GabbleServerSaslChannelPrivate *priv = self->priv; WockyAuthRegistryStartData *start_data; GSimpleAsyncResult *r = priv->result; GString *initial_data = NULL; if (self->priv->sasl_status != TP_SASL_STATUS_NOT_STARTED) { gabble_server_sasl_channel_raise (context, TP_ERROR_NOT_AVAILABLE, "Mechanisms can only be started in state Not_Started, not %u", self->priv->sasl_status); DEBUG ("cannot start: state %u != Not_Started", self->priv->sasl_status); return; } /* NotStarted state is entered by creating the channel: the caller must * call start_auth_async immediately */ g_assert (r != NULL); g_assert (g_simple_async_result_is_valid (G_ASYNC_RESULT (r), G_OBJECT (self), gabble_server_sasl_channel_start_auth_async)); if (tp_strv_contains ((const gchar * const *) priv->available_mechanisms, in_Mechanism)) { priv->result = NULL; if (in_InitialData != NULL) { /* The initial data might be secret (for PLAIN etc.), and also might * not be UTF-8 or even text, so we just output the length */ DEBUG ("Starting %s authentication with %u bytes of initial data", in_Mechanism, in_InitialData->len); initial_data = g_string_new_len (in_InitialData->data, in_InitialData->len); } else { DEBUG ("Starting %s authentication without initial data", in_Mechanism); } change_current_state (self, TP_SASL_STATUS_IN_PROGRESS, NULL, NULL); dbus_g_method_return (context); start_data = wocky_auth_registry_start_data_new (in_Mechanism, initial_data); g_simple_async_result_set_op_res_gpointer (r, start_data, (GDestroyNotify) wocky_auth_registry_start_data_free); g_simple_async_result_complete_in_idle (r); g_object_unref (r); if (initial_data != NULL) g_string_free (initial_data, TRUE); } else { DEBUG ("cannot start: %s is not a supported mechanism", in_Mechanism); gabble_server_sasl_channel_raise (context, TP_ERROR_NOT_IMPLEMENTED, "Selected mechanism is not available."); } }