static void new_chatroom_dialog_select_last_account (GSettings *gsettings, EmpathyAccountChooser *account_chooser) { const gchar *account_path; TpAccountManager *manager; TpSimpleClientFactory *factory; TpAccount *account; TpConnectionStatus status; account_path = g_settings_get_string (gsettings, EMPATHY_PREFS_CHAT_ROOM_LAST_ACCOUNT); DEBUG ("Selecting account path '%s'", account_path); manager = tp_account_manager_dup (); factory = tp_proxy_get_factory (manager); account = tp_simple_client_factory_ensure_account (factory, account_path, NULL, NULL); if (account != NULL) { status = tp_account_get_connection_status (account, NULL); if (status == TP_CONNECTION_STATUS_CONNECTED) { empathy_account_chooser_set_account (account_chooser, account); } g_object_unref (account); } g_object_unref (manager); }
static UniqueResponse unique_app_message_cb (UniqueApp *unique_app, gint command, UniqueMessageData *data, guint timestamp, gpointer user_data) { DEBUG ("Other instance launched, presenting the main window. " "Command=%d, timestamp %u", command, timestamp); if (command == UNIQUE_ACTIVATE) { TpAccountManager *account_manager; account_manager = tp_account_manager_dup (); empathy_accounts_show_accounts_ui (account_manager, NULL, G_CALLBACK (gtk_main_quit)); g_object_unref (account_manager); } else { g_warning (G_STRLOC "unhandled unique app command %d", command); return UNIQUE_RESPONSE_PASSTHROUGH; } return UNIQUE_RESPONSE_OK; }
static void import_widget_add_account (EmpathyImportWidget *self, EmpathyImportAccountData *data) { TpAccountManager *account_manager; gchar *display_name; GHashTable *properties; GValue *username; account_manager = tp_account_manager_dup (); DEBUG ("connection_manager: %s\n", data->connection_manager); /* Set the display name of the account */ username = g_hash_table_lookup (data->settings, "account"); display_name = g_strdup_printf ("%s (%s)", data->protocol, g_value_get_string (username)); DEBUG ("display name: %s\n", display_name); properties = tp_asv_new (NULL, NULL); tp_asv_set_boolean (properties, TP_IFACE_ACCOUNT ".Enabled", data->enabled); tp_account_manager_create_account_async (account_manager, (const gchar*) data->connection_manager, data->protocol, display_name, data->settings, properties, import_widget_create_account_cb, g_object_ref (self)); g_hash_table_unref (properties); g_free (display_name); g_object_unref (account_manager); }
static void empathy_notify_manager_init (EmpathyNotifyManager *self) { EmpathyNotifyManagerPriv *priv = G_TYPE_INSTANCE_GET_PRIVATE (self, EMPATHY_TYPE_NOTIFY_MANAGER, EmpathyNotifyManagerPriv); GList *list, *l; self->priv = priv; priv->capabilities = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL); /* fetch capabilities */ list = notify_get_server_caps (); for (l = list; l != NULL; l = g_list_next (l)) { gchar *cap = l->data; DEBUG ("add capability: %s", cap); /* owernship of the string is transfered to the hash table */ g_hash_table_insert (priv->capabilities, cap, GUINT_TO_POINTER (TRUE)); } g_list_free (list); priv->account_manager = tp_account_manager_dup (); tp_account_manager_prepare_async (priv->account_manager, NULL, account_manager_prepared_cb, self); }
static void import_widget_create_account_cb (GObject *source, GAsyncResult *result, gpointer user_data) { TpAccountManager *account_manager; TpAccount *account; GError *error = NULL; EmpathyImportWidget *self = user_data; account = tp_account_manager_create_account_finish ( TP_ACCOUNT_MANAGER (source), result, &error); if (account == NULL) { DEBUG ("Failed to create account: %s", error ? error->message : "No error given"); g_clear_error (&error); return; } DEBUG ("account created\n"); if (tp_account_is_enabled (account)) { account_manager = tp_account_manager_dup (); tpaw_connect_new_account (account, account_manager); g_object_unref (account_manager); } g_object_unref (self); }
static void empathy_account_chooser_init (EmpathyAccountChooser *self) { TpSimpleClientFactory *factory; self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, EMPATHY_TYPE_ACCOUNT_CHOOSER, EmpathyAccountChooserPriv); self->priv->set_active_item = FALSE; self->priv->account_manually_set = FALSE; self->priv->filter = NULL; self->priv->filter_data = NULL; self->priv->manager = tp_account_manager_dup (); tp_g_signal_connect_object (self->priv->manager, "account-validity-changed", G_CALLBACK (account_chooser_account_validity_changed_cb), self, 0); tp_g_signal_connect_object (self->priv->manager, "account-removed", G_CALLBACK (account_chooser_account_removed_cb), self, 0); /* Make sure we'll have the capabilities feature on TpAccount's connection */ factory = tp_proxy_get_factory (self->priv->manager); tp_simple_client_factory_add_account_features_varargs (factory, TP_ACCOUNT_FEATURE_CONNECTION, NULL); tp_simple_client_factory_add_connection_features_varargs (factory, TP_CONNECTION_FEATURE_CAPABILITIES, NULL); }
static void empathy_app_plugin_widget_constructed (GObject *object) { EmpathyAppPluginWidget *self = EMPATHY_APP_PLUGIN_WIDGET (object); void (*chain_up) (GObject *) = ((GObjectClass *) empathy_app_plugin_widget_parent_class)->constructed; GtkWidget *top; TpAccountManager *manager; if (chain_up != NULL) chain_up (object); g_assert (AG_IS_ACCOUNT (self->priv->account)); /* Top bar */ top = create_top_bar (self); gtk_widget_show (top); gtk_box_pack_start (GTK_BOX (self), top, FALSE, FALSE, 0); /* Prepare tp's account manager to find the TpAccount corresponding to our * AgAccount */ manager = tp_account_manager_dup (); tp_proxy_prepare_async (manager, NULL, manager_prepared_cb, tp_weak_ref_new (self, NULL, NULL)); g_object_unref (manager); }
int main (int argc, char **argv) { EmpathyClientFactory *factory; TpAccountManager *am; GMainLoop *loop; gtk_init (&argc, &argv); empathy_gtk_init (); /* The blocking dialog needs the contact list for the contacts completion * so we prepare it first. */ factory = empathy_client_factory_dup (); tp_simple_client_factory_add_connection_features_varargs ( TP_SIMPLE_CLIENT_FACTORY (factory), TP_CONNECTION_FEATURE_CONTACT_LIST, NULL); am = tp_account_manager_dup (); loop = g_main_loop_new (NULL, FALSE); tp_proxy_prepare_async (am, NULL, am_prepare_cb, loop); g_main_loop_run (loop); g_object_unref (am); return 0; }
static void anerley_presence_chooser_init (AnerleyPresenceChooser *self) { MxComboBox *combo = MX_COMBO_BOX (self); AnerleyPresenceChooserPrivate *priv = GET_PRIVATE (self); priv->am = tp_account_manager_dup (); g_signal_connect (priv->am, "most-available-presence-changed", G_CALLBACK (_account_manager_presence_changed), self); priv->combo_entries = g_array_sized_new (FALSE, TRUE, sizeof (ComboEntry), 7); /* add some entries */ _append_presence (combo, TP_CONNECTION_PRESENCE_TYPE_AVAILABLE); _append_presence (combo, TP_CONNECTION_PRESENCE_TYPE_BUSY); _append_presence (combo, TP_CONNECTION_PRESENCE_TYPE_AWAY); _append_presence (combo, TP_CONNECTION_PRESENCE_TYPE_OFFLINE); /* FIXME: Hidden ? */ g_signal_connect (self, "notify::index", G_CALLBACK (_combo_index_changed), NULL); tp_proxy_prepare_async (TP_PROXY (priv->am), NULL, (GAsyncReadyCallback)_account_manager_ready, self); }
int main (int argc, char **argv) { TpAccountManager *manager; TpSimpleClientFactory *factory; TpBaseClient *approver; GError *error = NULL; gtk_init (&argc, &argv); tp_debug_set_flags (g_getenv ("LIBO_APPROVER_DEBUG")); manager = tp_account_manager_dup (); factory = tp_proxy_get_factory (manager); /* We want the target contact on channels to be available... */ tp_simple_client_factory_add_channel_features_varargs (factory, TP_CHANNEL_FEATURE_CONTACTS, 0); /* ...and for it to have its alias and avatar available */ tp_simple_client_factory_add_contact_features_varargs (factory, TP_CONTACT_FEATURE_ALIAS, TP_CONTACT_FEATURE_AVATAR_DATA, TP_CONTACT_FEATURE_INVALID); approver = tp_simple_approver_new_with_am (manager, "LibreOfficeApprover", FALSE, add_dispatch_operation_cb, NULL, NULL); tp_base_client_take_approver_filter (approver, tp_asv_new ( TP_PROP_CHANNEL_CHANNEL_TYPE, G_TYPE_STRING, TP_IFACE_CHANNEL_TYPE_DBUS_TUBE, TP_PROP_CHANNEL_TARGET_HANDLE_TYPE, G_TYPE_UINT, TP_HANDLE_TYPE_CONTACT, TP_PROP_CHANNEL_TYPE_DBUS_TUBE_SERVICE_NAME, G_TYPE_STRING, LIBO_DTUBE_SERVICE, NULL)); if (!tp_base_client_register (approver, &error)) { g_warning ("Failed to register Approver: %s\n", error->message); g_error_free (error); goto out; } g_print ("Start approving\n"); mainloop = g_main_loop_new (NULL, FALSE); g_main_loop_run (mainloop); /* TODO: time out after 5 seconds of inactivity? */ if (mainloop != NULL) g_main_loop_unref (mainloop); out: g_object_unref (manager); g_object_unref (approver); return 0; }
static GtkWidget * panel_desktop_menu_item_create_menu (PanelDesktopMenuItem *desktop_item, gboolean append_lock_logout) { GtkWidget *desktop_menu; GtkWidget *item; #ifdef HAVE_TELEPATHY_GLIB gboolean added; #endif desktop_menu = panel_create_menu (); #ifdef HAVE_TELEPATHY_GLIB desktop_item->priv->account_manager = tp_account_manager_dup (); item = panel_menu_item_presence_new (desktop_item->priv->account_manager, PANEL_SESSION_MANAGER_PRESENCE_AVAILABLE, _("Available"), PANEL_ICON_USER_AVAILABLE, TRUE); if (item) { desktop_item->priv->presence_items = g_list_prepend (desktop_item->priv->presence_items, item); gtk_menu_shell_append (GTK_MENU_SHELL (desktop_menu), item); added = TRUE; } item = panel_menu_item_presence_new (desktop_item->priv->account_manager, PANEL_SESSION_MANAGER_PRESENCE_BUSY, _("Busy"), PANEL_ICON_USER_BUSY, TRUE); if (item) { desktop_item->priv->presence_items = g_list_prepend (desktop_item->priv->presence_items, item); gtk_menu_shell_append (GTK_MENU_SHELL (desktop_menu), item); added = TRUE; } if (added) add_menu_separator (desktop_menu); #endif item = panel_menu_item_desktop_new ("gnome-online-accounts-panel.desktop", NULL, FALSE); if (item) gtk_menu_shell_append (GTK_MENU_SHELL (desktop_menu), item); /* Do not force the string like in gnome-shell, but just use the one * from the .desktop file */ item = panel_menu_item_desktop_new ("gnome-control-center.desktop", NULL, FALSE); if (item) gtk_menu_shell_append (GTK_MENU_SHELL (desktop_menu), item); if (append_lock_logout) panel_menu_items_append_lock_logout (desktop_menu); return desktop_menu; }
static void import_widget_add_accounts_to_model (EmpathyImportWidget *self) { TpAccountManager *manager; GtkTreeModel *model; GList *l; EmpathyImportWidgetPriv *priv = GET_PRIV (self); gint min, natural; manager = tp_account_manager_dup (); model = gtk_tree_view_get_model (GTK_TREE_VIEW (priv->treeview)); for (l = priv->accounts; l; l = l->next) { GValue *value; EmpathyImportAccountData *data = l->data; gboolean import; GList *accounts; TpConnectionManager *cm = NULL; if (!empathy_import_protocol_is_supported (data->protocol, &cm)) continue; data->connection_manager = g_strdup ( tp_connection_manager_get_name (cm)); value = g_hash_table_lookup (data->settings, "account"); accounts = tp_account_manager_dup_valid_accounts (manager); /* Only set the "Import" cell to be active if there isn't already an * account set up with the same account id. */ import = !import_widget_account_id_in_list (accounts, g_value_get_string (value)); g_list_free_full (accounts, g_object_unref); gtk_list_store_insert_with_values (GTK_LIST_STORE (model), NULL, -1, COL_IMPORT, import, COL_PROTOCOL, data->protocol, COL_NAME, g_value_get_string (value), COL_SOURCE, data->source, COL_ACCOUNT_DATA, data, -1); } /* Display as much rows as possible */ gtk_widget_get_preferred_height (priv->treeview, &min, &natural); gtk_widget_set_size_request (priv->scrolledwindow, -1, MIN (natural, MAX_TREEVIEW_HEIGHT)); g_object_unref (manager); }
static void maybe_show_account_assistant (void) { TpAccountManager *manager; manager = tp_account_manager_dup (); if (!has_non_salut_accounts (manager)) empathy_account_assistant_show (GTK_WINDOW (empathy_main_window_get ())); g_object_unref (manager); }
static void empathy_connection_aggregator_init (EmpathyConnectionAggregator *self) { self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, EMPATHY_TYPE_CONNECTION_AGGREGATOR, EmpathyConnectionAggregatorPriv); self->priv->mgr = tp_account_manager_dup (); tp_proxy_prepare_async (self->priv->mgr, NULL, am_prepare_cb, g_object_ref (self)); }
static void create_salut_account_if_needed (EmpathyConnectionManagers *managers) { TpAccountManager *manager; manager = tp_account_manager_dup (); tp_account_manager_prepare_async (manager, NULL, create_salut_account_am_ready_cb, g_object_ref (managers)); g_object_unref (manager); }
static void import_widget_add_accounts_to_model (EmpathyImportWidget *self) { TpAccountManager *manager; manager = tp_account_manager_dup (); tp_proxy_prepare_async (manager, NULL, account_manager_prepared_cb, self); g_object_unref (manager); }
static void changed_accounts (TpConnectionPresenceType type) { TpAccountManager *am; am = tp_account_manager_dup (); tp_proxy_prepare_async (TP_PROXY (am), NULL, (GAsyncReadyCallback)_account_manager_ready_cb, GINT_TO_POINTER (type)); g_object_unref (am); }
static void empathy_contact_manager_init (EmpathyContactManager *manager) { EmpathyContactManagerPriv *priv = G_TYPE_INSTANCE_GET_PRIVATE (manager, EMPATHY_TYPE_CONTACT_MANAGER, EmpathyContactManagerPriv); TpDBusDaemon *bus; GError *error = NULL; manager->priv = priv; priv->lists = g_hash_table_new_full (empathy_proxy_hash, empathy_proxy_equal, (GDestroyNotify) g_object_unref, (GDestroyNotify) g_object_unref); priv->favourites = g_hash_table_new_full (g_str_hash, g_str_equal, (GDestroyNotify) g_free, (GDestroyNotify) g_hash_table_unref); priv->account_manager = tp_account_manager_dup (); priv->contact_monitor = NULL; tp_account_manager_prepare_async (priv->account_manager, NULL, account_manager_prepared_cb, manager); bus = tp_dbus_daemon_dup (&error); if (error == NULL) { priv->logger = g_object_new (TP_TYPE_PROXY, "bus-name", "org.freedesktop.Telepathy.Logger", "object-path", "/org/freedesktop/Telepathy/Logger", "dbus-daemon", bus, NULL); g_object_unref (bus); tp_proxy_add_interface_by_id (priv->logger, EMP_IFACE_QUARK_LOGGER); logger_favourite_contacts_setup (manager); priv->favourite_contacts_changed_signal = emp_cli_logger_connect_to_favourite_contacts_changed ( priv->logger, logger_favourite_contacts_changed_cb, NULL, NULL, G_OBJECT (manager), NULL); } else { DEBUG ("Failed to get telepathy-logger proxy: %s", error->message); g_clear_error (&error); } }
static gboolean migrate_logs (gpointer data) { TpAccountManager *account_manager; account_manager = tp_account_manager_dup (); tp_proxy_prepare_async (account_manager, NULL, migration_account_manager_prepared_cb, NULL); g_object_unref (account_manager); return FALSE; }
static void empathy_log_store_empathy_init (EmpathyLogStoreEmpathy *self) { EmpathyLogStoreEmpathyPriv *priv = G_TYPE_INSTANCE_GET_PRIVATE (self, EMPATHY_TYPE_LOG_STORE_EMPATHY, EmpathyLogStoreEmpathyPriv); self->priv = priv; priv->basedir = g_build_path (G_DIR_SEPARATOR_S, g_get_user_data_dir (), PACKAGE_NAME, "logs", NULL); priv->name = g_strdup ("Empathy"); priv->account_manager = tp_account_manager_dup (); }
static void empathy_presence_manager_init (EmpathyPresenceManager *self) { TpDBusDaemon *dbus; self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, EMPATHY_TYPE_PRESENCE_MANAGER, EmpathyPresenceManagerPrivate); self->priv->is_idle = FALSE; self->priv->manager = tp_account_manager_dup (); tp_account_manager_prepare_async (self->priv->manager, NULL, account_manager_ready_cb, self); tp_g_signal_connect_object (self->priv->manager, "most-available-presence-changed", G_CALLBACK (most_available_presence_changed), self, 0); dbus = tp_dbus_daemon_dup (NULL); self->priv->gs_proxy = dbus_g_proxy_new_for_name ( tp_proxy_get_dbus_connection (dbus), "org.gnome.SessionManager", "/org/gnome/SessionManager/Presence", "org.gnome.SessionManager.Presence"); if (self->priv->gs_proxy) { dbus_g_proxy_add_signal (self->priv->gs_proxy, "StatusChanged", G_TYPE_UINT, G_TYPE_INVALID); dbus_g_proxy_connect_signal (self->priv->gs_proxy, "StatusChanged", G_CALLBACK (session_status_changed_cb), self, NULL); } else { DEBUG ("Failed to get gs proxy"); } g_object_unref (dbus); self->priv->connectivity = empathy_connectivity_dup_singleton (); tp_g_signal_connect_object (self->priv->connectivity, "state-change", G_CALLBACK (state_change_cb), self, 0); self->priv->connect_times = g_hash_table_new (g_direct_hash, g_direct_equal); }
static TpAccount * find_tp_account (GoaObject *goa_object, GMainLoop *loop, GError **out_error) { GoaAccount *goa_account = NULL; const gchar *id = NULL; TpAccountManager *account_manager; GList *tp_accounts = NULL; GList *l = NULL; TpAccount *tp_account = NULL; GError *error = NULL; goa_account = goa_object_peek_account (goa_object); id = goa_account_get_identity (goa_account); account_manager = tp_account_manager_dup (); if (!prepare_tp_proxy (account_manager, NULL, loop, &error)) goto out; tp_accounts = tp_account_manager_dup_valid_accounts (account_manager); for (l = tp_accounts; l != NULL; l = l->next) { if (g_strcmp0 (tp_proxy_get_object_path (l->data), id) == 0) { tp_account = g_object_ref (l->data); break; } } if (tp_account == NULL) { g_set_error (&error, GOA_ERROR, GOA_ERROR_FAILED, _("Telepathy chat account not found")); goto out; } out: if (error != NULL) g_propagate_error (out_error, error); g_clear_error (&error); g_clear_object (&account_manager); g_list_free_full (tp_accounts, g_object_unref); return tp_account; }
static void app_activate (GApplication *app) { TpAccountManager *account_manager; empathy_gtk_init (); account_manager = tp_account_manager_dup (); /* Hold the application while preparing the AM */ g_application_hold (app); tp_proxy_prepare_async (account_manager, NULL, account_manager_ready_for_accounts_cb, app); g_object_unref (account_manager); }
static void show_accounts_ui (GtkWindow *window, gboolean force) { TpAccountManager *manager; if (!force) return; manager = tp_account_manager_dup (); tp_account_manager_prepare_async (manager, NULL, account_manager_ready_for_accounts_cb, window); g_object_unref (manager); }
static void empathy_status_icon_init (EmpathyStatusIcon *icon) { EmpathyStatusIconPriv *priv = G_TYPE_INSTANCE_GET_PRIVATE (icon, EMPATHY_TYPE_STATUS_ICON, EmpathyStatusIconPriv); icon->priv = priv; priv->icon = gtk_status_icon_new (); priv->account_manager = tp_account_manager_dup (); priv->event_manager = empathy_event_manager_dup_singleton (); tp_account_manager_prepare_async (priv->account_manager, NULL, account_manager_prepared_cb, icon); /* make icon listen and respond to MAIN_WINDOW_HIDDEN changes */ empathy_conf_notify_add (empathy_conf_get (), EMPATHY_PREFS_UI_MAIN_WINDOW_HIDDEN, status_icon_notify_visibility_cb, icon); status_icon_create_menu (icon); g_signal_connect_swapped (priv->account_manager, "most-available-presence-changed", G_CALLBACK (status_icon_presence_changed_cb), icon); g_signal_connect (priv->event_manager, "event-added", G_CALLBACK (status_icon_event_added_cb), icon); g_signal_connect (priv->event_manager, "event-removed", G_CALLBACK (status_icon_event_removed_cb), icon); g_signal_connect (priv->event_manager, "event-updated", G_CALLBACK (status_icon_event_updated_cb), icon); g_signal_connect (priv->icon, "activate", G_CALLBACK (status_icon_activate_cb), icon); g_signal_connect (priv->icon, "popup-menu", G_CALLBACK (status_icon_popup_menu_cb), icon); priv->notification = NULL; priv->notify_mgr = empathy_notify_manager_dup_singleton (); }
static void chat_conversations_list_init (ChatConversationsList *self) { ChatConversationsListPrivate *priv; self->priv = chat_conversations_list_get_instance_private (self); priv = self->priv; priv->accounts = g_hash_table_new_full (g_direct_hash, chat_conversations_list_accounts_key_equal_func, g_object_unref, chat_conversations_list_accounts_value_destroy_func); priv->am = tp_account_manager_dup (); tp_proxy_prepare_async (priv->am, NULL, chat_conversations_list_account_manager_prepare, g_object_ref (self)); priv->lm = tpl_log_manager_dup_singleton (); }
static void empathy_idle_init (EmpathyIdle *idle) { EmpathyIdlePriv *priv = G_TYPE_INSTANCE_GET_PRIVATE (idle, EMPATHY_TYPE_IDLE, EmpathyIdlePriv); TpDBusDaemon *dbus; idle->priv = priv; priv->is_idle = FALSE; priv->manager = tp_account_manager_dup (); tp_account_manager_prepare_async (priv->manager, NULL, account_manager_ready_cb, idle); priv->idle_presence_changed_id = g_signal_connect (priv->manager, "most-available-presence-changed", G_CALLBACK (idle_presence_changed_cb), idle); dbus = tp_dbus_daemon_dup (NULL); priv->gs_proxy = dbus_g_proxy_new_for_name ( tp_proxy_get_dbus_connection (dbus), "org.gnome.SessionManager", "/org/gnome/SessionManager/Presence", "org.gnome.SessionManager.Presence"); if (priv->gs_proxy) { dbus_g_proxy_add_signal (priv->gs_proxy, "StatusChanged", G_TYPE_UINT, G_TYPE_INVALID); dbus_g_proxy_connect_signal (priv->gs_proxy, "StatusChanged", G_CALLBACK (idle_session_status_changed_cb), idle, NULL); } else { DEBUG ("Failed to get gs proxy"); } g_object_unref (dbus); priv->connectivity = empathy_connectivity_dup_singleton (); priv->state_change_signal_id = g_signal_connect (priv->connectivity, "state-change", G_CALLBACK (idle_state_change_cb), idle); priv->connect_times = g_hash_table_new (g_direct_hash, g_direct_equal); }
static void empathy_call_observer_init (EmpathyCallObserver *self) { EmpathyCallObserverPriv *priv = G_TYPE_INSTANCE_GET_PRIVATE (self, EMPATHY_TYPE_CALL_OBSERVER, EmpathyCallObserverPriv); TpAccountManager *am; GError *error = NULL; self->priv = priv; self->priv->notify_mgr = empathy_notify_manager_dup_singleton (); am = tp_account_manager_dup (); self->priv->observer = tp_simple_observer_new_with_am (am, TRUE, "Empathy.CallObserver", FALSE, observe_channels, self, NULL); /* Observe Call and StreamedMedia channels */ tp_base_client_take_observer_filter (self->priv->observer, tp_asv_new ( TP_PROP_CHANNEL_CHANNEL_TYPE, G_TYPE_STRING, TP_IFACE_CHANNEL_TYPE_STREAMED_MEDIA, TP_PROP_CHANNEL_TARGET_HANDLE_TYPE, G_TYPE_UINT, TP_HANDLE_TYPE_CONTACT, NULL)); tp_base_client_take_observer_filter (self->priv->observer, tp_asv_new ( TP_PROP_CHANNEL_CHANNEL_TYPE, G_TYPE_STRING, TP_IFACE_CHANNEL_TYPE_CALL, TP_PROP_CHANNEL_TARGET_HANDLE_TYPE, G_TYPE_UINT, TP_HANDLE_TYPE_CONTACT, NULL)); tp_base_client_set_observer_delay_approvers (self->priv->observer, TRUE); if (!tp_base_client_register (self->priv->observer, &error)) { DEBUG ("Failed to register observer: %s", error->message); g_error_free (error); } g_object_unref (am); }
static void empathy_streamed_media_factory_init (EmpathyStreamedMediaFactory *obj) { EmpathyStreamedMediaFactoryPriv *priv = G_TYPE_INSTANCE_GET_PRIVATE (obj, EMPATHY_TYPE_STREAMED_MEDIA_FACTORY, EmpathyStreamedMediaFactoryPriv); TpAccountManager *am; obj->priv = priv; am = tp_account_manager_dup (); priv->handler = tp_simple_handler_new_with_am (am, FALSE, FALSE, EMPATHY_AV_BUS_NAME_SUFFIX, FALSE, handle_channels_cb, obj, NULL); tp_base_client_take_handler_filter (priv->handler, tp_asv_new ( TP_PROP_CHANNEL_CHANNEL_TYPE, G_TYPE_STRING, TP_IFACE_CHANNEL_TYPE_STREAMED_MEDIA, TP_PROP_CHANNEL_TARGET_HANDLE_TYPE, G_TYPE_UINT, TP_HANDLE_TYPE_CONTACT, NULL)); tp_base_client_take_handler_filter (priv->handler, tp_asv_new ( TP_PROP_CHANNEL_CHANNEL_TYPE, G_TYPE_STRING, TP_IFACE_CHANNEL_TYPE_STREAMED_MEDIA, TP_PROP_CHANNEL_TARGET_HANDLE_TYPE, G_TYPE_UINT, TP_HANDLE_TYPE_CONTACT, TP_PROP_CHANNEL_TYPE_STREAMED_MEDIA_INITIAL_AUDIO, G_TYPE_BOOLEAN, TRUE, NULL)); tp_base_client_take_handler_filter (priv->handler, tp_asv_new ( TP_PROP_CHANNEL_CHANNEL_TYPE, G_TYPE_STRING, TP_IFACE_CHANNEL_TYPE_STREAMED_MEDIA, TP_PROP_CHANNEL_TARGET_HANDLE_TYPE, G_TYPE_UINT, TP_HANDLE_TYPE_CONTACT, TP_PROP_CHANNEL_TYPE_STREAMED_MEDIA_INITIAL_VIDEO, G_TYPE_BOOLEAN, TRUE, NULL)); tp_base_client_add_handler_capabilities_varargs (priv->handler, "org.freedesktop.Telepathy.Channel.Interface.MediaSignalling/ice-udp", "org.freedesktop.Telepathy.Channel.Interface.MediaSignalling/gtalk-p2p", "org.freedesktop.Telepathy.Channel.Interface.MediaSignalling/video/h264", NULL); g_object_unref (am); }
static void empathy_chat_manager_init (EmpathyChatManager *self) { EmpathyChatManagerPriv *priv = GET_PRIV (self); TpAccountManager *am; GError *error = NULL; priv->closed_queue = g_queue_new (); priv->messages = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, (GDestroyNotify) g_hash_table_unref); am = tp_account_manager_dup (); priv->chatroom_mgr = empathy_chatroom_manager_dup_singleton (NULL); /* Text channels handler */ priv->handler = tp_simple_handler_new_with_am (am, FALSE, FALSE, EMPATHY_CHAT_BUS_NAME_SUFFIX, FALSE, handle_channels, self, NULL); g_object_unref (am); tp_base_client_take_handler_filter (priv->handler, tp_asv_new ( TP_PROP_CHANNEL_CHANNEL_TYPE, G_TYPE_STRING, TP_IFACE_CHANNEL_TYPE_TEXT, TP_PROP_CHANNEL_TARGET_HANDLE_TYPE, G_TYPE_UINT, TP_HANDLE_TYPE_CONTACT, NULL)); tp_base_client_take_handler_filter (priv->handler, tp_asv_new ( TP_PROP_CHANNEL_CHANNEL_TYPE, G_TYPE_STRING, TP_IFACE_CHANNEL_TYPE_TEXT, TP_PROP_CHANNEL_TARGET_HANDLE_TYPE, G_TYPE_UINT, TP_HANDLE_TYPE_ROOM, NULL)); tp_base_client_take_handler_filter (priv->handler, tp_asv_new ( TP_PROP_CHANNEL_CHANNEL_TYPE, G_TYPE_STRING, TP_IFACE_CHANNEL_TYPE_TEXT, TP_PROP_CHANNEL_TARGET_HANDLE_TYPE, G_TYPE_UINT, TP_HANDLE_TYPE_NONE, NULL)); if (!tp_base_client_register (priv->handler, &error)) { g_critical ("Failed to register text handler: %s", error->message); g_error_free (error); } }