g_free (d->publish_request);
tp_handle_set_destroy (d->groups);
- tp_handle_unref (d->contact_repo, d->handle);
g_slice_free (ContactDetails, d);
}
d->groups = tp_handle_set_new (self->priv->group_repo);
d->handle = handle;
d->contact_repo = self->priv->contact_repo;
- tp_handle_ref (d->contact_repo, d->handle);
g_hash_table_insert (self->priv->contact_details,
GUINT_TO_POINTER (handle), d);
#include "simple-account-manager.h"
+#include <telepathy-glib/account.h>
#include <telepathy-glib/gtypes.h>
#include <telepathy-glib/interfaces.h>
#include <telepathy-glib/svc-generic.h>
};
static void
-tp_tests_simple_account_manager_create_account (TpSvcAccountManager *self,
+tp_tests_simple_account_manager_create_account (TpSvcAccountManager *svc,
const gchar *in_Connection_Manager,
const gchar *in_Protocol,
const gchar *in_Display_Name,
GHashTable *in_Properties,
DBusGMethodInvocation *context)
{
- const gchar *out_Account = "/some/fake/account/i/think";
-
- tp_svc_account_manager_return_from_create_account (context, out_Account);
+ TpTestsSimpleAccountManager *self = (TpTestsSimpleAccountManager *) svc;
+ const gchar *out = TP_ACCOUNT_OBJECT_PATH_BASE "gabble/jabber/lospolloshermanos";
+
+ /* if we have fail=yes as a parameter, make the call fail */
+ if (!tp_strdiff (tp_asv_get_string (in_Parameters, "fail"), "yes"))
+ {
+ GError e = { TP_ERROR, TP_ERROR_INVALID_ARGUMENT, "loldongs" };
+ dbus_g_method_return_error (context, &e);
+ return;
+ }
+
+ self->create_cm = g_strdup (in_Connection_Manager);
+ self->create_protocol = g_strdup (in_Protocol);
+ self->create_display_name = g_strdup (in_Display_Name);
+ self->create_parameters = g_hash_table_ref (in_Parameters);
+ self->create_properties = g_hash_table_ref (in_Properties);
+
+ tp_svc_account_manager_return_from_create_account (context, out);
}
static void
g_ptr_array_unref (self->priv->valid_accounts);
g_ptr_array_unref (self->priv->invalid_accounts);
+ tp_clear_pointer (&self->create_cm, g_free);
+ tp_clear_pointer (&self->create_protocol, g_free);
+ tp_clear_pointer (&self->create_display_name, g_free);
+ tp_clear_pointer (&self->create_parameters, g_hash_table_unref);
+ tp_clear_pointer (&self->create_properties, g_hash_table_unref);
+
G_OBJECT_CLASS (tp_tests_simple_account_manager_parent_class)->finalize (
object);
}
struct _TpTestsSimpleAccountManager {
GObject parent;
+ gchar *create_cm;
+ gchar *create_protocol;
+ gchar *create_display_name;
+ GHashTable *create_parameters;
+ GHashTable *create_properties;
+
TpTestsSimpleAccountManagerPrivate *priv;
};
g_free (self->priv->presence_status);
g_free (self->priv->presence_msg);
+ g_free (self->priv->connection_path);
G_OBJECT_CLASS (tp_tests_simple_account_parent_class)->finalize (object);
}
g_return_if_fail (handle != 0);
tp_base_connection_set_self_handle (conn, handle);
- tp_handle_unref (contact_repo, handle);
}
TpTestsSimpleConnection *
chan);
}
- tp_handle_unref (contact_repo, handle);
-
if (props != NULL)
*props = tp_tests_text_channel_get_props (chan);
g_main_loop_unref (loop);
}
-typedef struct {
- GMainLoop *loop;
- TpHandle handle;
-} HandleRequestResult;
-
-static void
-handles_requested_cb (TpConnection *connection G_GNUC_UNUSED,
- TpHandleType handle_type G_GNUC_UNUSED,
- guint n_handles,
- const TpHandle *handles,
- const gchar * const *ids G_GNUC_UNUSED,
- const GError *error,
- gpointer user_data,
- GObject *weak_object G_GNUC_UNUSED)
-{
- HandleRequestResult *result = user_data;
-
- g_assert_no_error ((GError *) error);
- g_assert_cmpuint (n_handles, ==, 1);
- result->handle = handles[0];
-}
-
-static void
-handle_request_result_finish (gpointer r)
-{
- HandleRequestResult *result = r;
-
- g_main_loop_quit (result->loop);
-}
-
-TpHandle
-tp_tests_connection_run_request_contact_handle (TpConnection *connection,
- const gchar *id)
-{
- HandleRequestResult result = { g_main_loop_new (NULL, FALSE), 0 };
- const gchar * const ids[] = { id, NULL };
-
- tp_connection_request_handles (connection, -1, TP_HANDLE_TYPE_CONTACT, ids,
- handles_requested_cb, &result, handle_request_result_finish, NULL);
- g_main_loop_run (result.loop);
- g_main_loop_unref (result.loop);
- return result.handle;
-}
-
void
_test_assert_empty_strv (const char *file,
int line,
}
static void
-one_contact_cb (TpConnection *connection,
- guint n_contacts,
- TpContact * const *contacts,
- const gchar * const *good_ids,
- GHashTable *bad_ids,
- const GError *error,
- gpointer user_data,
- GObject *weak_object)
+one_contact_cb (GObject *object,
+ GAsyncResult *result,
+ gpointer user_data)
{
+ TpConnection *connection = (TpConnection *) object;
TpContact **contact_loc = user_data;
+ GError *error = NULL;
- g_assert_no_error (error);
- g_assert_cmpuint (g_hash_table_size (bad_ids), ==, 0);
- g_assert_cmpuint (n_contacts, ==, 1);
- g_assert_cmpstr (good_ids[0], !=, NULL);
- g_assert (contacts[0] != NULL);
+ *contact_loc = tp_connection_dup_contact_by_id_finish (connection, result,
+ &error);
- *contact_loc = g_object_ref (contacts[0]);
+ g_assert_no_error (error);
+ g_assert (TP_IS_CONTACT (*contact_loc));
}
TpContact *
{
TpContact *contact = NULL;
- tp_connection_get_contacts_by_id (connection, 1, &id, n_features, features,
- one_contact_cb, &contact, NULL, NULL);
+ tp_connection_dup_contact_by_id_async (connection, id, n_features, features,
+ one_contact_cb, &contact);
while (contact == NULL)
g_main_context_iteration (NULL, TRUE);
void tp_tests_proxy_run_until_dbus_queue_processed (gpointer proxy);
-TpHandle tp_tests_connection_run_request_contact_handle (
- TpConnection *connection,
- const gchar *id);
-
void tp_tests_proxy_run_until_prepared (gpointer proxy,
const GQuark *features);
gboolean tp_tests_proxy_run_until_prepared_or_failed (gpointer proxy,