EmpathyTLSCertificate *
empathy_tls_certificate_new (TpDBusDaemon *dbus,
    const gchar *bus_name,
    const gchar *object_path,
    GError **error)
{
  EmpathyTLSCertificate *retval = NULL;

  if (!tp_dbus_check_valid_bus_name (bus_name,
          TP_DBUS_NAME_TYPE_UNIQUE, error))
    goto finally;

  if (!tp_dbus_check_valid_object_path (object_path, error))
    goto finally;

  retval = g_object_new (EMPATHY_TYPE_TLS_CERTIFICATE,
      "dbus-daemon", dbus,
      "bus-name", bus_name,
      "object-path", object_path,
      NULL);

finally:
  if (*error != NULL)
    DEBUG ("Error while creating the TLS certificate: %s",
        (*error)->message);

  return retval;
}
TpStreamTubeChannel *
_tp_stream_tube_channel_new_with_factory (
    TpSimpleClientFactory *factory,
    TpConnection *conn,
    const gchar *object_path,
    const GHashTable *immutable_properties,
    GError **error)
{
  TpProxy *conn_proxy = (TpProxy *) conn;

  g_return_val_if_fail (TP_IS_CONNECTION (conn), NULL);
  g_return_val_if_fail (object_path != NULL, NULL);
  g_return_val_if_fail (immutable_properties != NULL, NULL);

  if (!tp_dbus_check_valid_object_path (object_path, error))
    return NULL;

  return g_object_new (TP_TYPE_STREAM_TUBE_CHANNEL,
      "connection", conn,
       "dbus-daemon", conn_proxy->dbus_daemon,
       "bus-name", conn_proxy->bus_name,
       "object-path", object_path,
       "handle-type", (guint) TP_UNKNOWN_HANDLE_TYPE,
       "channel-properties", immutable_properties,
       "factory", factory,
       NULL);
}
Esempio n. 3
0
/**
 * empathy_account_get_connection_for_path:
 * @account: a #EmpathyAccount
 * @patch: the path to connection object for #EmpathyAccount
 *
 * Get the connection of the account on path. This function does not return a
 * new ref. It is not guaranteed that the returned connection object is ready
 *
 * Returns: the connection of the account.
 **/
TpConnection *
empathy_account_get_connection_for_path (EmpathyAccount *account,
  const gchar *path)
{
  EmpathyAccountPriv *priv = GET_PRIV (account);

  /* double-check that the object path is valid */
  if (!tp_dbus_check_valid_object_path (path, NULL))
    return NULL;

  /* Should be a full object path, not the special "/" value */
  if (strlen (path) == 1)
    return NULL;

  _empathy_account_set_connection (account, path);

  return priv->connection;
}
GObject * hev_impathy_tls_certificate_new(TpDBusDaemon *dbus_daemon,
			const gchar *bus_name, const gchar *object_path,
			GError **error)
{
	g_debug("%s:%d[%s]", __FILE__, __LINE__, __FUNCTION__);

	if(!tp_dbus_check_valid_bus_name(bus_name,
					TP_DBUS_NAME_TYPE_UNIQUE, error))
	  return NULL;
	if(!tp_dbus_check_valid_object_path(object_path,
					error))
	  return NULL;

	return g_object_new(HEV_TYPE_IMPATHY_TLS_CERTIFICATE,
				"dbus-daemon", dbus_daemon,
				"bus-name", bus_name,
				"object-path", object_path,
				NULL);
}
Esempio n. 5
0
/**
 * tp_media_session_handler_new:
 * @dbus: a D-Bus daemon; may not be %NULL
 * @unique_name: the unique name of the connection process; may not be %NULL
 *  or a well-known name
 * @object_path: the object path of the media session handler; may not be %NULL
 * @error: used to indicate the error if %NULL is returned
 *
 * <!-- -->
 *
 * Returns: a new media session handler proxy, or %NULL on invalid arguments
 *
 * Since: 0.7.1
 */
TpMediaSessionHandler *
tp_media_session_handler_new (TpDBusDaemon *dbus,
                              const gchar *unique_name,
                              const gchar *object_path,
                              GError **error)
{
  TpMediaSessionHandler *ret = NULL;

  if (!tp_dbus_check_valid_bus_name (unique_name,
        TP_DBUS_NAME_TYPE_UNIQUE, error))
    goto finally;

  if (!tp_dbus_check_valid_object_path (object_path, error))
    goto finally;

  ret = TP_MEDIA_SESSION_HANDLER (g_object_new (TP_TYPE_MEDIA_SESSION_HANDLER,
        "dbus-daemon", dbus,
        "bus-name", unique_name,
        "object-path", object_path,
        NULL));

finally:
  return ret;
}
static void
chatroom_manager_parse_chatroom (EmpathyChatroomManager *manager,
    xmlNodePtr node)
{
  EmpathyChatroom *chatroom = NULL;
  TpAccount *account;
  xmlNodePtr child;
  gchar *str;
  gchar *name;
  gchar *room;
  gchar *account_id;
  gboolean auto_connect;
  gboolean always_urgent;
  EmpathyClientFactory *factory;
  GError *error = NULL;

  /* default values. */
  name = NULL;
  room = NULL;
  auto_connect = TRUE;
  always_urgent = FALSE;
  account_id = NULL;

  for (child = node->children; child; child = child->next)
    {
      gchar *tag;

      if (xmlNodeIsText (child))
        continue;

      tag = (gchar *) child->name;
      str = (gchar *) xmlNodeGetContent (child);

      if (strcmp (tag, "name") == 0)
        {
          name = g_strdup (str);
        }
      else if (strcmp (tag, "room") == 0)
        {
          room = g_strdup (str);
        }
      else if (strcmp (tag, "auto_connect") == 0)
        {
          if (strcmp (str, "yes") == 0)
            auto_connect = TRUE;
          else
            auto_connect = FALSE;
        }
      else if (!tp_strdiff (tag, "always_urgent"))
        {
          if (strcmp (str, "yes") == 0)
            always_urgent = TRUE;
          else
            always_urgent = FALSE;
        }
      else if (strcmp (tag, "account") == 0)
        {
          account_id = g_strdup (str);
        }

      xmlFree (str);
    }

  /* account has to be a valid Account object path */
  if (!tp_dbus_check_valid_object_path (account_id, NULL) ||
      !g_str_has_prefix (account_id, TP_ACCOUNT_OBJECT_PATH_BASE))
    goto out;

  factory = empathy_client_factory_dup ();

  account = tp_simple_client_factory_ensure_account (
          TP_SIMPLE_CLIENT_FACTORY (factory), account_id, NULL, &error);
  g_object_unref (factory);

  if (account == NULL)
    {
      DEBUG ("Failed to create account: %s", error->message);
      g_error_free (error);

      g_free (name);
      g_free (room);
      g_free (account_id);
      return;
    }

  chatroom = empathy_chatroom_new_full (account, room, name, auto_connect);
  empathy_chatroom_set_favorite (chatroom, TRUE);
  empathy_chatroom_set_always_urgent (chatroom, always_urgent);
  add_chatroom (manager, chatroom);
  g_signal_emit (manager, signals[CHATROOM_ADDED], 0, chatroom);

out:
  g_free (name);
  g_free (room);
  g_free (account_id);
  tp_clear_object (&chatroom);
}