static void get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec) { TpTestsTextChannelGroup *self = TP_TESTS_TEXT_CHANNEL_GROUP (object); switch (property_id) { case PROP_OBJECT_PATH: g_value_set_string (value, self->priv->object_path); break; case PROP_CHANNEL_TYPE: g_value_set_static_string (value, TP_IFACE_CHANNEL_TYPE_TEXT); break; case PROP_HANDLE_TYPE: g_value_set_uint (value, TP_HANDLE_TYPE_NONE); break; case PROP_HANDLE: g_value_set_uint (value, 0); break; case PROP_TARGET_ID: g_value_set_static_string (value, ""); break; case PROP_REQUESTED: g_value_set_boolean (value, TRUE); break; case PROP_INITIATOR_HANDLE: g_value_set_uint (value, self->conn->self_handle); break; case PROP_INITIATOR_ID: { TpHandleRepoIface *contact_repo = tp_base_connection_get_handles ( self->conn, TP_HANDLE_TYPE_CONTACT); g_value_set_string (value, tp_handle_inspect (contact_repo, self->conn->self_handle)); } break; case PROP_INTERFACES: g_value_set_boxed (value, text_channel_group_interfaces); break; case PROP_CONNECTION: g_value_set_object (value, self->conn); break; case PROP_DETAILED: g_value_set_boolean (value, self->priv->detailed); break; case PROP_PROPERTIES: g_value_set_boolean (value, self->priv->properties); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); break; } }
const gchar * conn_util_get_bare_self_jid (GabbleConnection *conn) { TpBaseConnection *base = TP_BASE_CONNECTION (conn); TpHandleRepoIface *contact_handles = tp_base_connection_get_handles (base, TP_HANDLE_TYPE_CONTACT); TpHandle self = tp_base_connection_get_self_handle (base); return tp_handle_inspect (contact_handles, self); }
static IdleIMChannel * _im_manager_new_channel (IdleIMManager *mgr, TpHandle handle, TpHandle initiator, gpointer request) { IdleIMManagerPrivate *priv = IDLE_IM_MANAGER_GET_PRIVATE (mgr); TpBaseConnection *base_connection = TP_BASE_CONNECTION (priv->conn); TpHandleRepoIface *handle_repo = tp_base_connection_get_handles (base_connection, TP_HANDLE_TYPE_CONTACT); IdleIMChannel *chan; const gchar *name; GSList *requests = NULL; g_assert (g_hash_table_lookup (priv->channels, GUINT_TO_POINTER (handle)) == NULL); name = tp_handle_inspect (handle_repo, handle); IDLE_DEBUG ("Requested channel for handle: %u (%s)", handle, name); chan = g_object_new (IDLE_TYPE_IM_CHANNEL, "connection", priv->conn, "handle", handle, "initiator-handle", initiator, "requested", handle != initiator, NULL); tp_base_channel_register (TP_BASE_CHANNEL (chan)); g_hash_table_insert (priv->channels, GUINT_TO_POINTER (handle), chan); if (request != NULL) requests = g_slist_prepend (requests, request); tp_channel_manager_emit_new_channel (mgr, TP_EXPORTABLE_CHANNEL (chan), requests); g_slist_free (requests); g_signal_connect (chan, "closed", G_CALLBACK (_im_channel_closed_cb), mgr); return chan; }
/* * get_cached_location: * @conn: a connection * @handle: a handle, which must have been pre-validated. * * Returns: a new ref to a GHashTable containing @handle's location, or %NULL * if we have no cached location. */ static GHashTable * get_cached_location (GabbleConnection *conn, TpHandle handle) { TpBaseConnection *base = (TpBaseConnection *) conn; GHashTable *location; const gchar *jid; TpHandleRepoIface *contact_repo; contact_repo = tp_base_connection_get_handles (base, TP_HANDLE_TYPE_CONTACT); jid = tp_handle_inspect (contact_repo, handle); location = gabble_presence_cache_get_location (conn->presence_cache, handle); if (location != NULL) DEBUG (" - %s: cached", jid); else DEBUG (" - %s: unknown", jid); return location; }
static gboolean update_location_from_msg (GabbleConnection *conn, TpHandle contact, LmMessage *msg) { LmMessageNode *node; GHashTable *location = g_hash_table_new_full (g_direct_hash, g_direct_equal, g_free, (GDestroyNotify) tp_g_value_slice_free); TpHandleRepoIface *contact_repo = tp_base_connection_get_handles ( (TpBaseConnection *) conn, TP_HANDLE_TYPE_CONTACT); const gchar *from = tp_handle_inspect (contact_repo, contact); NodeIter i; const gchar *lang; node = lm_message_node_find_child (wocky_stanza_get_top_node (msg), "geoloc"); if (node == NULL) return FALSE; DEBUG ("LocationsUpdate for %s:", from); lang = lm_message_node_get_attribute (node, "xml:lang"); if (lang != NULL) { g_hash_table_insert (location, g_strdup ("language"), tp_g_value_slice_new_string (lang)); } build_mapping_tables (); for (i = node_iter (node); i; i = node_iter_next (i)) { LmMessageNode *subloc_node = node_iter_data (i); GValue *value = NULL; gchar *xmpp_name; const gchar *str; LocationMapping *mapping; xmpp_name = subloc_node->name; str = lm_message_node_get_value (subloc_node); if (str == NULL) continue; mapping = g_hash_table_lookup (xmpp_to_tp, xmpp_name); if (mapping == NULL) { DEBUG ("Unknown location attribute: %s\n", xmpp_name); continue; } if (mapping->type == G_TYPE_DOUBLE) { gdouble double_value; gchar *end; double_value = g_ascii_strtod (str, &end); if (end == str) continue; value = tp_g_value_slice_new_double (double_value); DEBUG ("\t - %s: %f", xmpp_name, double_value); } else if (strcmp (xmpp_name, "timestamp") == 0) { GTimeVal timeval; if (g_time_val_from_iso8601 (str, &timeval)) { value = tp_g_value_slice_new_int64 (timeval.tv_sec); DEBUG ("\t - %s: %s", xmpp_name, str); } else { DEBUG ("\t - %s: %s: unknown date format", xmpp_name, str); continue; } } else if (mapping->type == G_TYPE_STRING) { value = tp_g_value_slice_new_string (str); DEBUG ("\t - %s: %s", xmpp_name, str); } else { g_assert_not_reached (); } g_hash_table_insert (location, g_strdup (mapping->tp_name), value); } tp_svc_connection_interface_location_emit_location_updated (conn, contact, location); gabble_presence_cache_update_location (conn->presence_cache, contact, location); return TRUE; }
void gabble_tube_iface_publish_in_node (GabbleTubeIface *tube, TpBaseConnection *conn, WockyNode *node) { WockyNode *parameters_node; GHashTable *parameters; TpTubeType type; gchar *service, *id_str; guint tube_id; TpHandleRepoIface *contact_repo = tp_base_connection_get_handles ( conn, TP_HANDLE_TYPE_CONTACT); TpHandle initiator_handle; g_object_get (G_OBJECT (tube), "type", &type, "initiator-handle", &initiator_handle, "service", &service, "parameters", ¶meters, "id", &tube_id, NULL); id_str = g_strdup_printf ("%u", tube_id); wocky_node_set_attributes (node, "service", service, "id", id_str, NULL); g_free (id_str); switch (type) { case TP_TUBE_TYPE_DBUS: { gchar *name, *stream_id; g_object_get (G_OBJECT (tube), "stream-id", &stream_id, "dbus-name", &name, NULL); wocky_node_set_attributes (node, "type", "dbus", "stream-id", stream_id, "initiator", tp_handle_inspect (contact_repo, initiator_handle), NULL); if (name != NULL) wocky_node_set_attribute (node, "dbus-name", name); g_free (name); g_free (stream_id); } break; case TP_TUBE_TYPE_STREAM: { wocky_node_set_attribute (node, "type", "stream"); } break; default: { g_return_if_reached (); } } parameters_node = wocky_node_add_child_with_content (node, "parameters", NULL); lm_message_node_add_children_from_properties (parameters_node, parameters, "parameter"); g_free (service); g_hash_table_unref (parameters); }
static void get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec) { ExampleEchoChannel *self = EXAMPLE_ECHO_CHANNEL (object); switch (property_id) { case PROP_OBJECT_PATH: g_value_set_string (value, self->priv->object_path); break; case PROP_CHANNEL_TYPE: g_value_set_static_string (value, TP_IFACE_CHANNEL_TYPE_TEXT); break; case PROP_HANDLE_TYPE: g_value_set_uint (value, TP_HANDLE_TYPE_CONTACT); break; case PROP_HANDLE: g_value_set_uint (value, self->priv->handle); break; case PROP_TARGET_ID: { TpHandleRepoIface *contact_repo = tp_base_connection_get_handles ( self->priv->conn, TP_HANDLE_TYPE_CONTACT); g_value_set_string (value, tp_handle_inspect (contact_repo, self->priv->handle)); } break; case PROP_REQUESTED: g_value_set_boolean (value, (self->priv->initiator == self->priv->conn->self_handle)); break; case PROP_INITIATOR_HANDLE: g_value_set_uint (value, self->priv->initiator); break; case PROP_INITIATOR_ID: { TpHandleRepoIface *contact_repo = tp_base_connection_get_handles ( self->priv->conn, TP_HANDLE_TYPE_CONTACT); g_value_set_string (value, self->priv->initiator == 0 ? "" : tp_handle_inspect (contact_repo, self->priv->initiator)); } break; case PROP_CONNECTION: g_value_set_object (value, self->priv->conn); break; case PROP_INTERFACES: g_value_set_boxed (value, example_echo_channel_interfaces); break; case PROP_CHANNEL_DESTROYED: g_value_set_boolean (value, self->priv->closed); break; case PROP_CHANNEL_PROPERTIES: g_value_take_boxed (value, tp_dbus_properties_mixin_make_properties_hash (object, TP_IFACE_CHANNEL, "ChannelType", TP_IFACE_CHANNEL, "TargetHandleType", TP_IFACE_CHANNEL, "TargetHandle", TP_IFACE_CHANNEL, "TargetID", TP_IFACE_CHANNEL, "InitiatorHandle", TP_IFACE_CHANNEL, "InitiatorID", TP_IFACE_CHANNEL, "Requested", TP_IFACE_CHANNEL, "Interfaces", NULL)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); break; } }
static void get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec) { ExampleContactListBase *self = EXAMPLE_CONTACT_LIST_BASE (object); switch (property_id) { case PROP_OBJECT_PATH: g_value_set_string (value, self->priv->object_path); break; case PROP_CHANNEL_TYPE: g_value_set_static_string (value, TP_IFACE_CHANNEL_TYPE_CONTACT_LIST); break; case PROP_HANDLE_TYPE: g_value_set_uint (value, self->priv->handle_type); break; case PROP_HANDLE: g_value_set_uint (value, self->priv->handle); break; case PROP_TARGET_ID: { TpHandleRepoIface *handle_repo = tp_base_connection_get_handles ( self->priv->conn, self->priv->handle_type); g_value_set_string (value, tp_handle_inspect (handle_repo, self->priv->handle)); } break; case PROP_REQUESTED: g_value_set_boolean (value, FALSE); break; case PROP_INITIATOR_HANDLE: g_value_set_uint (value, 0); break; case PROP_INITIATOR_ID: g_value_set_static_string (value, ""); break; case PROP_CONNECTION: g_value_set_object (value, self->priv->conn); break; case PROP_MANAGER: g_value_set_object (value, self->priv->manager); break; case PROP_INTERFACES: g_value_set_boxed (value, contact_list_interfaces); break; case PROP_CHANNEL_DESTROYED: g_value_set_boolean (value, self->priv->closed); break; case PROP_CHANNEL_PROPERTIES: g_value_take_boxed (value, tp_dbus_properties_mixin_make_properties_hash (object, TP_IFACE_CHANNEL, "ChannelType", TP_IFACE_CHANNEL, "TargetHandleType", TP_IFACE_CHANNEL, "TargetHandle", TP_IFACE_CHANNEL, "TargetID", TP_IFACE_CHANNEL, "InitiatorHandle", TP_IFACE_CHANNEL, "InitiatorID", TP_IFACE_CHANNEL, "Requested", TP_IFACE_CHANNEL, "Interfaces", NULL)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); break; } }
static void get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec) { ExampleCallableMediaChannel *self = EXAMPLE_CALLABLE_MEDIA_CHANNEL (object); switch (property_id) { case PROP_OBJECT_PATH: g_value_set_string (value, self->priv->object_path); break; case PROP_CHANNEL_TYPE: g_value_set_static_string (value, TP_IFACE_CHANNEL_TYPE_STREAMED_MEDIA); break; case PROP_HANDLE_TYPE: g_value_set_uint (value, TP_HANDLE_TYPE_CONTACT); break; case PROP_HANDLE: g_value_set_uint (value, self->priv->handle); break; case PROP_TARGET_ID: { TpHandleRepoIface *contact_repo = tp_base_connection_get_handles ( self->priv->conn, TP_HANDLE_TYPE_CONTACT); g_value_set_string (value, tp_handle_inspect (contact_repo, self->priv->handle)); } break; case PROP_REQUESTED: g_value_set_boolean (value, self->priv->locally_requested); break; case PROP_INITIATOR_HANDLE: g_value_set_uint (value, self->priv->initiator); break; case PROP_INITIATOR_ID: { TpHandleRepoIface *contact_repo = tp_base_connection_get_handles ( self->priv->conn, TP_HANDLE_TYPE_CONTACT); g_value_set_string (value, tp_handle_inspect (contact_repo, self->priv->initiator)); } break; case PROP_CONNECTION: g_value_set_object (value, self->priv->conn); break; case PROP_INTERFACES: g_value_set_boxed (value, example_callable_media_channel_interfaces); break; case PROP_CHANNEL_DESTROYED: g_value_set_boolean (value, (self->priv->progress == PROGRESS_ENDED)); break; case PROP_CHANNEL_PROPERTIES: g_value_take_boxed (value, tp_dbus_properties_mixin_make_properties_hash (object, TP_IFACE_CHANNEL, "ChannelType", TP_IFACE_CHANNEL, "TargetHandleType", TP_IFACE_CHANNEL, "TargetHandle", TP_IFACE_CHANNEL, "TargetID", TP_IFACE_CHANNEL, "InitiatorHandle", TP_IFACE_CHANNEL, "InitiatorID", TP_IFACE_CHANNEL, "Requested", TP_IFACE_CHANNEL, "Interfaces", NULL)); break; case PROP_SIMULATION_DELAY: g_value_set_uint (value, self->priv->simulation_delay); break; case PROP_INITIAL_AUDIO: g_value_set_boolean (value, self->priv->initial_audio); break; case PROP_INITIAL_VIDEO: g_value_set_boolean (value, self->priv->initial_video); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); break; } }