From 23d90f884b28cabd3b9b986998c118314a9238f9 Mon Sep 17 00:00:00 2001 From: Guillaume Desmottes Date: Mon, 7 Mar 2011 14:02:52 +0100 Subject: rename empathy-dispatcher to empathy-request-util We don't have EmpathyDispatcher any more so this file just contains some utility functions now. --- libempathy/Makefile.am | 4 +- libempathy/empathy-chatroom-manager.h | 1 - libempathy/empathy-dispatcher.c | 107 ---------------------------------- libempathy/empathy-dispatcher.h | 49 ---------------- libempathy/empathy-request-util.c | 107 ++++++++++++++++++++++++++++++++++ libempathy/empathy-request-util.h | 48 +++++++++++++++ libempathy/empathy-utils.c | 1 - 7 files changed, 157 insertions(+), 160 deletions(-) delete mode 100644 libempathy/empathy-dispatcher.c delete mode 100644 libempathy/empathy-dispatcher.h create mode 100644 libempathy/empathy-request-util.c create mode 100644 libempathy/empathy-request-util.h (limited to 'libempathy') diff --git a/libempathy/Makefile.am b/libempathy/Makefile.am index 20225f7de..cfea24c0e 100644 --- a/libempathy/Makefile.am +++ b/libempathy/Makefile.am @@ -38,7 +38,6 @@ libempathy_headers = \ empathy-contact-manager.h \ empathy-contact.h \ empathy-debug.h \ - empathy-dispatcher.h \ empathy-ft-factory.h \ empathy-ft-handler.h \ empathy-gsettings.h \ @@ -50,6 +49,7 @@ libempathy_headers = \ empathy-keyring.h \ empathy-location.h \ empathy-message.h \ + empathy-request-util.h \ empathy-server-sasl-handler.h \ empathy-server-tls-handler.h \ empathy-status-presets.h \ @@ -79,7 +79,6 @@ libempathy_la_SOURCES = \ empathy-contact-manager.c \ empathy-contact.c \ empathy-debug.c \ - empathy-dispatcher.c \ empathy-ft-factory.c \ empathy-ft-handler.c \ empathy-presence-manager.c \ @@ -89,6 +88,7 @@ libempathy_la_SOURCES = \ empathy-irc-server.c \ empathy-keyring.c \ empathy-message.c \ + empathy-request-util.c \ empathy-server-sasl-handler.c \ empathy-server-tls-handler.c \ empathy-status-presets.c \ diff --git a/libempathy/empathy-chatroom-manager.h b/libempathy/empathy-chatroom-manager.h index 5afb2b474..be3301503 100644 --- a/libempathy/empathy-chatroom-manager.h +++ b/libempathy/empathy-chatroom-manager.h @@ -29,7 +29,6 @@ #include #include "empathy-chatroom.h" -#include "empathy-dispatcher.h" G_BEGIN_DECLS diff --git a/libempathy/empathy-dispatcher.c b/libempathy/empathy-dispatcher.c deleted file mode 100644 index 1f7d7f277..000000000 --- a/libempathy/empathy-dispatcher.c +++ /dev/null @@ -1,107 +0,0 @@ -/* * Copyright (C) 2007-2009 Collabora Ltd. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - * - * Authors: Xavier Claessens - * Sjoerd Simons - * Cosimo Cecchi - */ - -#include - -#include - -#include - -#include - -#include "empathy-dispatcher.h" -#include "empathy-utils.h" -#include "empathy-utils.h" - -#define DEBUG_FLAG EMPATHY_DEBUG_DISPATCHER -#include - -void -empathy_dispatcher_chat_with_contact (EmpathyContact *contact, - gint64 timestamp) -{ - empathy_dispatcher_chat_with_contact_id ( - empathy_contact_get_account (contact), empathy_contact_get_id (contact), - timestamp); -} - -static void -ensure_text_channel_cb (GObject *source, - GAsyncResult *result, - gpointer user_data) -{ - GError *error = NULL; - - if (!tp_account_channel_request_ensure_channel_finish ( - TP_ACCOUNT_CHANNEL_REQUEST (source), result, &error)) - { - DEBUG ("Failed to ensure text channel: %s", error->message); - g_error_free (error); - } -} - -void -empathy_dispatcher_chat_with_contact_id (TpAccount *account, - const gchar *contact_id, - gint64 timestamp) -{ - GHashTable *request; - TpAccountChannelRequest *req; - - request = 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, - TP_PROP_CHANNEL_TARGET_ID, G_TYPE_STRING, contact_id, - NULL); - - req = tp_account_channel_request_new (account, request, timestamp); - - tp_account_channel_request_ensure_channel_async (req, NULL, NULL, - ensure_text_channel_cb, NULL); - - g_hash_table_unref (request); - g_object_unref (req); -} - -void -empathy_dispatcher_join_muc (TpAccount *account, - const gchar *room_name, - gint64 timestamp) -{ - GHashTable *request; - TpAccountChannelRequest *req; - - request = 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, - TP_PROP_CHANNEL_TARGET_ID, G_TYPE_STRING, room_name, - NULL); - - req = tp_account_channel_request_new (account, request, timestamp); - - tp_account_channel_request_ensure_channel_async (req, NULL, NULL, - ensure_text_channel_cb, NULL); - - g_hash_table_unref (request); - g_object_unref (req); -} diff --git a/libempathy/empathy-dispatcher.h b/libempathy/empathy-dispatcher.h deleted file mode 100644 index 8c986ec1d..000000000 --- a/libempathy/empathy-dispatcher.h +++ /dev/null @@ -1,49 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * Copyright (C) 2007-2008 Collabora Ltd. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - * - * Authors: Xavier Claessens - */ - -#ifndef __EMPATHY_DISPATCHER_H__ -#define __EMPATHY_DISPATCHER_H__ - -#include -#include - -#include - -#include "empathy-contact.h" - -G_BEGIN_DECLS - -/* Requesting 1 to 1 text channels */ -void empathy_dispatcher_chat_with_contact_id (TpAccount *account, - const gchar *contact_id, - gint64 timestamp); - -void empathy_dispatcher_chat_with_contact (EmpathyContact *contact, - gint64 timestamp); - -/* Request a muc channel */ -void empathy_dispatcher_join_muc (TpAccount *account, - const gchar *roomname, - gint64 timestamp); - -G_END_DECLS - -#endif /* __EMPATHY_DISPATCHER_H__ */ diff --git a/libempathy/empathy-request-util.c b/libempathy/empathy-request-util.c new file mode 100644 index 000000000..c912cc1a2 --- /dev/null +++ b/libempathy/empathy-request-util.c @@ -0,0 +1,107 @@ +/* * Copyright (C) 2007-2010 Collabora Ltd. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + * Authors: Xavier Claessens + * Sjoerd Simons + * Cosimo Cecchi + */ + +#include + +#include + +#include + +#include + +#include "empathy-request-util.h" +#include "empathy-utils.h" +#include "empathy-utils.h" + +#define DEBUG_FLAG EMPATHY_DEBUG_DISPATCHER +#include + +void +empathy_chat_with_contact (EmpathyContact *contact, + gint64 timestamp) +{ + empathy_chat_with_contact_id ( + empathy_contact_get_account (contact), empathy_contact_get_id (contact), + timestamp); +} + +static void +ensure_text_channel_cb (GObject *source, + GAsyncResult *result, + gpointer user_data) +{ + GError *error = NULL; + + if (!tp_account_channel_request_ensure_channel_finish ( + TP_ACCOUNT_CHANNEL_REQUEST (source), result, &error)) + { + DEBUG ("Failed to ensure text channel: %s", error->message); + g_error_free (error); + } +} + +void +empathy_chat_with_contact_id (TpAccount *account, + const gchar *contact_id, + gint64 timestamp) +{ + GHashTable *request; + TpAccountChannelRequest *req; + + request = 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, + TP_PROP_CHANNEL_TARGET_ID, G_TYPE_STRING, contact_id, + NULL); + + req = tp_account_channel_request_new (account, request, timestamp); + + tp_account_channel_request_ensure_channel_async (req, NULL, NULL, + ensure_text_channel_cb, NULL); + + g_hash_table_unref (request); + g_object_unref (req); +} + +void +empathy_join_muc (TpAccount *account, + const gchar *room_name, + gint64 timestamp) +{ + GHashTable *request; + TpAccountChannelRequest *req; + + request = 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, + TP_PROP_CHANNEL_TARGET_ID, G_TYPE_STRING, room_name, + NULL); + + req = tp_account_channel_request_new (account, request, timestamp); + + tp_account_channel_request_ensure_channel_async (req, NULL, NULL, + ensure_text_channel_cb, NULL); + + g_hash_table_unref (request); + g_object_unref (req); +} diff --git a/libempathy/empathy-request-util.h b/libempathy/empathy-request-util.h new file mode 100644 index 000000000..1073f0d5e --- /dev/null +++ b/libempathy/empathy-request-util.h @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2007-2010 Collabora Ltd. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + * Authors: Xavier Claessens + */ + +#ifndef __EMPATHY_DISPATCHER_H__ +#define __EMPATHY_DISPATCHER_H__ + +#include +#include + +#include + +#include "empathy-contact.h" + +G_BEGIN_DECLS + +/* Requesting 1 to 1 text channels */ +void empathy_chat_with_contact_id (TpAccount *account, + const gchar *contact_id, + gint64 timestamp); + +void empathy_chat_with_contact (EmpathyContact *contact, + gint64 timestamp); + +/* Request a muc channel */ +void empathy_join_muc (TpAccount *account, + const gchar *roomname, + gint64 timestamp); + +G_END_DECLS + +#endif /* __EMPATHY_DISPATCHER_H__ */ diff --git a/libempathy/empathy-utils.c b/libempathy/empathy-utils.c index 775a320c7..86c0f20af 100644 --- a/libempathy/empathy-utils.c +++ b/libempathy/empathy-utils.c @@ -48,7 +48,6 @@ #include "empathy-utils.h" #include "empathy-contact-manager.h" #include "empathy-individual-manager.h" -#include "empathy-dispatcher.h" #include "empathy-presence-manager.h" #include "empathy-tp-contact-factory.h" -- cgit v1.2.3