static TpBaseConnection *
new_connection (TpBaseProtocol  *protocol,
                GHashTable      *asv,
                GError         **error)
{
  DurkaConnection *conn;
  const gchar *account;
  const gchar *password;
  const gchar *token;

  account = tp_asv_get_string (asv, "account");
  password = tp_asv_get_string (asv, "password");
  token = tp_asv_get_string (asv, "token");
  /* telepathy-glib checked this for us */
  g_assert (account != NULL);

  conn = DURKA_CONNECTION (
      g_object_new (DURKA_TYPE_CONNECTION,
                    "account", account,
                    "protocol", tp_base_protocol_get_name (protocol),
                    "password", password,
                    "token", token,
                    NULL));

  return (TpBaseConnection *) conn;
}
/**
 * tp_base_connection_manager_add_protocol:
 * @self: a connection manager object which has not yet registered on D-Bus
 *  (i.e. tp_base_connection_manager_register() must not have been called)
 * @protocol: a protocol object, which must not have the same protocol name as
 *  any that has already been added
 *
 * Add a protocol object to the set of supported protocols.
 */
void
tp_base_connection_manager_add_protocol (TpBaseConnectionManager *self,
    TpBaseProtocol *protocol)
{
  g_return_if_fail (TP_IS_BASE_CONNECTION_MANAGER (self));
  g_return_if_fail (!self->priv->registered);
  g_return_if_fail (TP_IS_BASE_PROTOCOL (protocol));

  g_hash_table_insert (self->priv->protocols,
      g_strdup (tp_base_protocol_get_name (protocol)),
      g_object_ref (protocol));
}
예제 #3
0
static TpBaseConnection *
new_connection (TpBaseProtocol *protocol,
    GHashTable *asv,
    GError **error)
{
  ExampleContactListConnection *conn;
  const gchar *account;
  guint sim_delay;

  account = tp_asv_get_string (asv, "account");
  /* telepathy-glib checked this for us */
  g_assert (account != NULL);

  sim_delay = tp_asv_get_uint32 (asv, "simulation-delay", NULL);

  conn = EXAMPLE_CONTACT_LIST_CONNECTION (
      g_object_new (EXAMPLE_TYPE_CONTACT_LIST_CONNECTION,
        "account", account,
        "protocol", tp_base_protocol_get_name (protocol),
        "simulation-delay", sim_delay,
        NULL));

  return (TpBaseConnection *) conn;
}