diff options
Diffstat (limited to 'libempathy')
45 files changed, 1828 insertions, 1830 deletions
diff --git a/libempathy/Makefile.am b/libempathy/Makefile.am index 37bb98e09..00ce4233a 100644 --- a/libempathy/Makefile.am +++ b/libempathy/Makefile.am @@ -13,19 +13,19 @@ BUILT_SOURCES = \ noinst_LTLIBRARIES = libempathy.la libempathy_la_SOURCES = \ - gossip-conf.c gossip-conf.h \ - gossip-contact.c gossip-contact.h \ - gossip-avatar.c gossip-avatar.h \ - gossip-time.c gossip-time.h \ - gossip-presence.c gossip-presence.h \ - gossip-telepathy-group.c gossip-telepathy-group.h \ - gossip-debug.c gossip-debug.h \ - gossip-utils.c gossip-utils.h \ - gossip-message.c gossip-message.h \ - gossip-chatroom-manager.c gossip-chatroom-manager.h \ - gossip-chatroom.c gossip-chatroom.h \ + empathy-conf.c empathy-conf.h \ + empathy-contact.c empathy-contact.h \ + empathy-avatar.c empathy-avatar.h \ + empathy-time.c empathy-time.h \ + empathy-presence.c empathy-presence.h \ + empathy-debug.c empathy-debug.h \ + empathy-utils.c empathy-utils.h \ + empathy-message.c empathy-message.h \ + empathy-chatroom-manager.c empathy-chatroom-manager.h \ + empathy-chatroom.c empathy-chatroom.h \ empathy-contact-list.c empathy-contact-list.h \ empathy-contact-manager.c empathy-contact-manager.h \ + empathy-tp-group.c empathy-tp-group.h \ empathy-tp-contact-list.c empathy-tp-contact-list.h \ empathy-tp-chat.c empathy-tp-chat.h \ empathy-tp-chatroom.c empathy-tp-chatroom.h \ @@ -52,7 +52,7 @@ empathy-chandler-glue.h: empathy-chandler.xml dtddir = $(datadir)/empathy dtd_DATA = \ - gossip-chatroom-manager.dtd + empathy-chatroom-manager.dtd stylesheetdir = $(datadir)/empathy stylesheet_DATA = \ diff --git a/libempathy/gossip-avatar.c b/libempathy/empathy-avatar.c index 5c17a5176..e5a2a73a9 100644 --- a/libempathy/gossip-avatar.c +++ b/libempathy/empathy-avatar.c @@ -23,36 +23,36 @@ #include "config.h" -#include "gossip-avatar.h" +#include "empathy-avatar.h" #define DEBUG_DOMAIN "Avatar" GType -gossip_avatar_get_gtype (void) +empathy_avatar_get_gtype (void) { static GType type_id = 0; if (!type_id) { - type_id = g_boxed_type_register_static ("GossipAvatar", - (GBoxedCopyFunc) gossip_avatar_ref, - (GBoxedFreeFunc) gossip_avatar_unref); + type_id = g_boxed_type_register_static ("EmpathyAvatar", + (GBoxedCopyFunc) empathy_avatar_ref, + (GBoxedFreeFunc) empathy_avatar_unref); } return type_id; } -GossipAvatar * -gossip_avatar_new (guchar *data, +EmpathyAvatar * +empathy_avatar_new (guchar *data, gsize len, gchar *format) { - GossipAvatar *avatar; + EmpathyAvatar *avatar; g_return_val_if_fail (data != NULL, NULL); g_return_val_if_fail (len > 0, NULL); g_return_val_if_fail (format != NULL, NULL); - avatar = g_slice_new0 (GossipAvatar); + avatar = g_slice_new0 (EmpathyAvatar); avatar->data = g_memdup (data, len); avatar->len = len; avatar->format = g_strdup (format); @@ -62,7 +62,7 @@ gossip_avatar_new (guchar *data, } void -gossip_avatar_unref (GossipAvatar *avatar) +empathy_avatar_unref (EmpathyAvatar *avatar) { g_return_if_fail (avatar != NULL); @@ -70,12 +70,12 @@ gossip_avatar_unref (GossipAvatar *avatar) if (avatar->refcount == 0) { g_free (avatar->data); g_free (avatar->format); - g_slice_free (GossipAvatar, avatar); + g_slice_free (EmpathyAvatar, avatar); } } -GossipAvatar * -gossip_avatar_ref (GossipAvatar *avatar) +EmpathyAvatar * +empathy_avatar_ref (EmpathyAvatar *avatar) { g_return_val_if_fail (avatar != NULL, NULL); diff --git a/libempathy/gossip-avatar.h b/libempathy/empathy-avatar.h index 44fa9aba3..73d69cf79 100644 --- a/libempathy/gossip-avatar.h +++ b/libempathy/empathy-avatar.h @@ -18,31 +18,31 @@ * Boston, MA 02111-1307, USA. */ -#ifndef __GOSSIP_AVATAR_H__ -#define __GOSSIP_AVATAR_H__ +#ifndef __EMPATHY_AVATAR_H__ +#define __EMPATHY_AVATAR_H__ #include <glib-object.h> G_BEGIN_DECLS -#define GOSSIP_TYPE_AVATAR (gossip_avatar_get_gtype ()) +#define EMPATHY_TYPE_AVATAR (empathy_avatar_get_gtype ()) -typedef struct _GossipAvatar GossipAvatar; +typedef struct _EmpathyAvatar EmpathyAvatar; -struct _GossipAvatar { +struct _EmpathyAvatar { guchar *data; gsize len; gchar *format; guint refcount; }; -GType gossip_avatar_get_gtype (void) G_GNUC_CONST; -GossipAvatar * gossip_avatar_new (guchar *avatar, +GType empathy_avatar_get_gtype (void) G_GNUC_CONST; +EmpathyAvatar * empathy_avatar_new (guchar *avatar, gsize len, gchar *format); -GossipAvatar * gossip_avatar_ref (GossipAvatar *avatar); -void gossip_avatar_unref (GossipAvatar *avatar); +EmpathyAvatar * empathy_avatar_ref (EmpathyAvatar *avatar); +void empathy_avatar_unref (EmpathyAvatar *avatar); G_END_DECLS -#endif /* __GOSSIP_AVATAR_H__ */ +#endif /* __EMPATHY_AVATAR_H__ */ diff --git a/libempathy/empathy-chandler.c b/libempathy/empathy-chandler.c index 5e9ca82f3..9bef4b1e1 100644 --- a/libempathy/empathy-chandler.c +++ b/libempathy/empathy-chandler.c @@ -29,7 +29,7 @@ #include <libtelepathy/tp-chan.h> #include "empathy-chandler.h" -#include "gossip-debug.h" +#include "empathy-debug.h" #include "empathy-marshal.h" #define DEBUG_DOMAIN "EmpathyChandler" @@ -100,7 +100,7 @@ empathy_chandler_new (const gchar *bus_name, G_TYPE_INVALID, G_TYPE_UINT, &result, G_TYPE_INVALID)) { - gossip_debug (DEBUG_DOMAIN, + empathy_debug (DEBUG_DOMAIN, "Failed to request name: %s", error ? error->message : "No error given"); g_clear_error (&error); diff --git a/libempathy/gossip-chatroom-manager.c b/libempathy/empathy-chatroom-manager.c index cc6aa81ad..a0b6fbb26 100644 --- a/libempathy/gossip-chatroom-manager.c +++ b/libempathy/empathy-chatroom-manager.c @@ -31,30 +31,30 @@ #include <libxml/parser.h> #include <libxml/tree.h> -#include "gossip-debug.h" -#include "gossip-chatroom-manager.h" -#include "gossip-utils.h" +#include "empathy-debug.h" +#include "empathy-chatroom-manager.h" +#include "empathy-utils.h" #define DEBUG_DOMAIN "ChatroomManager" -#define GET_PRIV(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), GOSSIP_TYPE_CHATROOM_MANAGER, GossipChatroomManagerPriv)) +#define GET_PRIV(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), EMPATHY_TYPE_CHATROOM_MANAGER, EmpathyChatroomManagerPriv)) #define CHATROOMS_XML_FILENAME "chatrooms.xml" -#define CHATROOMS_DTD_FILENAME "gossip-chatroom-manager.dtd" +#define CHATROOMS_DTD_FILENAME "empathy-chatroom-manager.dtd" -struct _GossipChatroomManagerPriv { +struct _EmpathyChatroomManagerPriv { GList *chatrooms; }; -static void gossip_chatroom_manager_class_init (GossipChatroomManagerClass *klass); -static void gossip_chatroom_manager_init (GossipChatroomManager *manager); +static void empathy_chatroom_manager_class_init (EmpathyChatroomManagerClass *klass); +static void empathy_chatroom_manager_init (EmpathyChatroomManager *manager); static void chatroom_manager_finalize (GObject *object); -static gboolean chatroom_manager_get_all (GossipChatroomManager *manager); -static gboolean chatroom_manager_file_parse (GossipChatroomManager *manager, +static gboolean chatroom_manager_get_all (EmpathyChatroomManager *manager); +static gboolean chatroom_manager_file_parse (EmpathyChatroomManager *manager, const gchar *filename); -static void chatroom_manager_parse_chatroom (GossipChatroomManager *manager, +static void chatroom_manager_parse_chatroom (EmpathyChatroomManager *manager, xmlNodePtr node); -static gboolean chatroom_manager_file_save (GossipChatroomManager *manager); +static gboolean chatroom_manager_file_save (EmpathyChatroomManager *manager); enum { CHATROOM_ADDED, @@ -64,10 +64,10 @@ enum { static guint signals[LAST_SIGNAL]; -G_DEFINE_TYPE (GossipChatroomManager, gossip_chatroom_manager, G_TYPE_OBJECT); +G_DEFINE_TYPE (EmpathyChatroomManager, empathy_chatroom_manager, G_TYPE_OBJECT); static void -gossip_chatroom_manager_class_init (GossipChatroomManagerClass *klass) +empathy_chatroom_manager_class_init (EmpathyChatroomManagerClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); @@ -81,7 +81,7 @@ gossip_chatroom_manager_class_init (GossipChatroomManagerClass *klass) NULL, NULL, g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, - 1, GOSSIP_TYPE_CHATROOM); + 1, EMPATHY_TYPE_CHATROOM); signals[CHATROOM_REMOVED] = g_signal_new ("chatroom-removed", G_TYPE_FROM_CLASS (klass), @@ -90,16 +90,16 @@ gossip_chatroom_manager_class_init (GossipChatroomManagerClass *klass) NULL, NULL, g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, - 1, GOSSIP_TYPE_CHATROOM); + 1, EMPATHY_TYPE_CHATROOM); g_type_class_add_private (object_class, - sizeof (GossipChatroomManagerPriv)); + sizeof (EmpathyChatroomManagerPriv)); } static void -gossip_chatroom_manager_init (GossipChatroomManager *manager) +empathy_chatroom_manager_init (EmpathyChatroomManager *manager) { - GossipChatroomManagerPriv *priv; + EmpathyChatroomManagerPriv *priv; priv = GET_PRIV (manager); } @@ -107,25 +107,25 @@ gossip_chatroom_manager_init (GossipChatroomManager *manager) static void chatroom_manager_finalize (GObject *object) { - GossipChatroomManagerPriv *priv; + EmpathyChatroomManagerPriv *priv; priv = GET_PRIV (object); g_list_foreach (priv->chatrooms, (GFunc) g_object_unref, NULL); g_list_free (priv->chatrooms); - (G_OBJECT_CLASS (gossip_chatroom_manager_parent_class)->finalize) (object); + (G_OBJECT_CLASS (empathy_chatroom_manager_parent_class)->finalize) (object); } -GossipChatroomManager * -gossip_chatroom_manager_new (void) +EmpathyChatroomManager * +empathy_chatroom_manager_new (void) { - static GossipChatroomManager *manager = NULL; + static EmpathyChatroomManager *manager = NULL; if (!manager) { - GossipChatroomManagerPriv *priv; + EmpathyChatroomManagerPriv *priv; - manager = g_object_new (GOSSIP_TYPE_CHATROOM_MANAGER, NULL); + manager = g_object_new (EMPATHY_TYPE_CHATROOM_MANAGER, NULL); priv = GET_PRIV (manager); chatroom_manager_get_all (manager); @@ -138,20 +138,20 @@ gossip_chatroom_manager_new (void) } gboolean -gossip_chatroom_manager_add (GossipChatroomManager *manager, - GossipChatroom *chatroom) +empathy_chatroom_manager_add (EmpathyChatroomManager *manager, + EmpathyChatroom *chatroom) { - GossipChatroomManagerPriv *priv; + EmpathyChatroomManagerPriv *priv; - g_return_val_if_fail (GOSSIP_IS_CHATROOM_MANAGER (manager), FALSE); - g_return_val_if_fail (GOSSIP_IS_CHATROOM (chatroom), FALSE); + g_return_val_if_fail (EMPATHY_IS_CHATROOM_MANAGER (manager), FALSE); + g_return_val_if_fail (EMPATHY_IS_CHATROOM (chatroom), FALSE); priv = GET_PRIV (manager); /* don't add more than once */ - if (!gossip_chatroom_manager_find (manager, - gossip_chatroom_get_account (chatroom), - gossip_chatroom_get_room (chatroom))) { + if (!empathy_chatroom_manager_find (manager, + empathy_chatroom_get_account (chatroom), + empathy_chatroom_get_room (chatroom))) { priv->chatrooms = g_list_prepend (priv->chatrooms, g_object_ref (chatroom)); chatroom_manager_file_save (manager); @@ -164,23 +164,23 @@ gossip_chatroom_manager_add (GossipChatroomManager *manager, } void -gossip_chatroom_manager_remove (GossipChatroomManager *manager, - GossipChatroom *chatroom) +empathy_chatroom_manager_remove (EmpathyChatroomManager *manager, + EmpathyChatroom *chatroom) { - GossipChatroomManagerPriv *priv; + EmpathyChatroomManagerPriv *priv; GList *l; - g_return_if_fail (GOSSIP_IS_CHATROOM_MANAGER (manager)); - g_return_if_fail (GOSSIP_IS_CHATROOM (chatroom)); + g_return_if_fail (EMPATHY_IS_CHATROOM_MANAGER (manager)); + g_return_if_fail (EMPATHY_IS_CHATROOM (chatroom)); priv = GET_PRIV (manager); for (l = priv->chatrooms; l; l = l->next) { - GossipChatroom *this_chatroom; + EmpathyChatroom *this_chatroom; this_chatroom = l->data; - if (gossip_chatroom_equal (chatroom, this_chatroom)) { + if (empathy_chatroom_equal (chatroom, this_chatroom)) { priv->chatrooms = g_list_delete_link (priv->chatrooms, l); chatroom_manager_file_save (manager); @@ -192,31 +192,31 @@ gossip_chatroom_manager_remove (GossipChatroomManager *manager, } } -GossipChatroom * -gossip_chatroom_manager_find (GossipChatroomManager *manager, +EmpathyChatroom * +empathy_chatroom_manager_find (EmpathyChatroomManager *manager, McAccount *account, const gchar *room) { - GossipChatroomManagerPriv *priv; + EmpathyChatroomManagerPriv *priv; GList *l; - g_return_val_if_fail (GOSSIP_IS_CHATROOM_MANAGER (manager), NULL); + g_return_val_if_fail (EMPATHY_IS_CHATROOM_MANAGER (manager), NULL); g_return_val_if_fail (MC_IS_ACCOUNT (account), NULL); g_return_val_if_fail (room != NULL, NULL); priv = GET_PRIV (manager); for (l = priv->chatrooms; l; l = l->next) { - GossipChatroom *chatroom; + EmpathyChatroom *chatroom; McAccount *this_account; const gchar *this_room; chatroom = l->data; - this_account = gossip_chatroom_get_account (chatroom); - this_room = gossip_chatroom_get_room (chatroom); + this_account = empathy_chatroom_get_account (chatroom); + this_room = empathy_chatroom_get_room (chatroom); if (this_account && this_room && - gossip_account_equal (account, this_account) && + empathy_account_equal (account, this_account) && strcmp (this_room, room) == 0) { return chatroom; } @@ -226,13 +226,13 @@ gossip_chatroom_manager_find (GossipChatroomManager *manager, } GList * -gossip_chatroom_manager_get_chatrooms (GossipChatroomManager *manager, +empathy_chatroom_manager_get_chatrooms (EmpathyChatroomManager *manager, McAccount *account) { - GossipChatroomManagerPriv *priv; + EmpathyChatroomManagerPriv *priv; GList *chatrooms, *l; - g_return_val_if_fail (GOSSIP_IS_CHATROOM_MANAGER (manager), NULL); + g_return_val_if_fail (EMPATHY_IS_CHATROOM_MANAGER (manager), NULL); priv = GET_PRIV (manager); @@ -242,12 +242,12 @@ gossip_chatroom_manager_get_chatrooms (GossipChatroomManager *manager, chatrooms = NULL; for (l = priv->chatrooms; l; l = l->next) { - GossipChatroom *chatroom; + EmpathyChatroom *chatroom; chatroom = l->data; - if (gossip_account_equal (account, - gossip_chatroom_get_account (chatroom))) { + if (empathy_account_equal (account, + empathy_chatroom_get_account (chatroom))) { chatrooms = g_list_append (chatrooms, chatroom); } } @@ -256,14 +256,14 @@ gossip_chatroom_manager_get_chatrooms (GossipChatroomManager *manager, } guint -gossip_chatroom_manager_get_count (GossipChatroomManager *manager, +empathy_chatroom_manager_get_count (EmpathyChatroomManager *manager, McAccount *account) { - GossipChatroomManagerPriv *priv; + EmpathyChatroomManagerPriv *priv; GList *l; guint count = 0; - g_return_val_if_fail (GOSSIP_IS_CHATROOM_MANAGER (manager), 0); + g_return_val_if_fail (EMPATHY_IS_CHATROOM_MANAGER (manager), 0); priv = GET_PRIV (manager); @@ -272,12 +272,12 @@ gossip_chatroom_manager_get_count (GossipChatroomManager *manager, } for (l = priv->chatrooms; l; l = l->next) { - GossipChatroom *chatroom; + EmpathyChatroom *chatroom; chatroom = l->data; - if (gossip_account_equal (account, - gossip_chatroom_get_account (chatroom))) { + if (empathy_account_equal (account, + empathy_chatroom_get_account (chatroom))) { count++; } } @@ -286,9 +286,9 @@ gossip_chatroom_manager_get_count (GossipChatroomManager *manager, } void -gossip_chatroom_manager_store (GossipChatroomManager *manager) +empathy_chatroom_manager_store (EmpathyChatroomManager *manager) { - g_return_if_fail (GOSSIP_IS_CHATROOM_MANAGER (manager)); + g_return_if_fail (EMPATHY_IS_CHATROOM_MANAGER (manager)); chatroom_manager_file_save (manager); } @@ -298,9 +298,9 @@ gossip_chatroom_manager_store (GossipChatroomManager *manager) */ static gboolean -chatroom_manager_get_all (GossipChatroomManager *manager) +chatroom_manager_get_all (EmpathyChatroomManager *manager) { - GossipChatroomManagerPriv *priv; + EmpathyChatroomManagerPriv *priv; gchar *dir; gchar *file_with_path = NULL; @@ -327,10 +327,10 @@ chatroom_manager_get_all (GossipChatroomManager *manager) } static gboolean -chatroom_manager_file_parse (GossipChatroomManager *manager, +chatroom_manager_file_parse (EmpathyChatroomManager *manager, const gchar *filename) { - GossipChatroomManagerPriv *priv; + EmpathyChatroomManagerPriv *priv; xmlParserCtxtPtr ctxt; xmlDocPtr doc; xmlNodePtr chatrooms; @@ -338,7 +338,7 @@ chatroom_manager_file_parse (GossipChatroomManager *manager, priv = GET_PRIV (manager); - gossip_debug (DEBUG_DOMAIN, "Attempting to parse file:'%s'...", filename); + empathy_debug (DEBUG_DOMAIN, "Attempting to parse file:'%s'...", filename); ctxt = xmlNewParserCtxt (); @@ -350,7 +350,7 @@ chatroom_manager_file_parse (GossipChatroomManager *manager, return FALSE; } - if (!gossip_xml_validate (doc, CHATROOMS_DTD_FILENAME)) { + if (!empathy_xml_validate (doc, CHATROOMS_DTD_FILENAME)) { g_warning ("Failed to validate file:'%s'", filename); xmlFreeDoc(doc); xmlFreeParserCtxt (ctxt); @@ -366,7 +366,7 @@ chatroom_manager_file_parse (GossipChatroomManager *manager, } } - gossip_debug (DEBUG_DOMAIN, + empathy_debug (DEBUG_DOMAIN, "Parsed %d chatrooms", g_list_length (priv->chatrooms)); @@ -377,11 +377,11 @@ chatroom_manager_file_parse (GossipChatroomManager *manager, } static void -chatroom_manager_parse_chatroom (GossipChatroomManager *manager, +chatroom_manager_parse_chatroom (EmpathyChatroomManager *manager, xmlNodePtr node) { - GossipChatroomManagerPriv *priv; - GossipChatroom *chatroom; + EmpathyChatroomManagerPriv *priv; + EmpathyChatroom *chatroom; McAccount *account; xmlNodePtr child; gchar *str; @@ -436,7 +436,7 @@ chatroom_manager_parse_chatroom (GossipChatroomManager *manager, return; } - chatroom = gossip_chatroom_new_full (account, room, name, auto_connect); + chatroom = empathy_chatroom_new_full (account, room, name, auto_connect); priv->chatrooms = g_list_prepend (priv->chatrooms, chatroom); g_signal_emit (manager, signals[CHATROOM_ADDED], 0, chatroom); @@ -447,9 +447,9 @@ chatroom_manager_parse_chatroom (GossipChatroomManager *manager, } static gboolean -chatroom_manager_file_save (GossipChatroomManager *manager) +chatroom_manager_file_save (EmpathyChatroomManager *manager) { - GossipChatroomManagerPriv *priv; + EmpathyChatroomManagerPriv *priv; xmlDocPtr doc; xmlNodePtr root; GList *l; @@ -471,24 +471,24 @@ chatroom_manager_file_save (GossipChatroomManager *manager) xmlDocSetRootElement (doc, root); for (l = priv->chatrooms; l; l = l->next) { - GossipChatroom *chatroom; + EmpathyChatroom *chatroom; xmlNodePtr node; const gchar *account_id; chatroom = l->data; - account_id = mc_account_get_unique_name (gossip_chatroom_get_account (chatroom)); + account_id = mc_account_get_unique_name (empathy_chatroom_get_account (chatroom)); node = xmlNewChild (root, NULL, "chatroom", NULL); - xmlNewTextChild (node, NULL, "name", gossip_chatroom_get_name (chatroom)); - xmlNewTextChild (node, NULL, "room", gossip_chatroom_get_room (chatroom)); + xmlNewTextChild (node, NULL, "name", empathy_chatroom_get_name (chatroom)); + xmlNewTextChild (node, NULL, "room", empathy_chatroom_get_room (chatroom)); xmlNewTextChild (node, NULL, "account", account_id); - xmlNewTextChild (node, NULL, "auto_connect", gossip_chatroom_get_auto_connect (chatroom) ? "yes" : "no"); + xmlNewTextChild (node, NULL, "auto_connect", empathy_chatroom_get_auto_connect (chatroom) ? "yes" : "no"); } /* Make sure the XML is indented properly */ xmlIndentTreeOutput = 1; - gossip_debug (DEBUG_DOMAIN, "Saving file:'%s'", file); + empathy_debug (DEBUG_DOMAIN, "Saving file:'%s'", file); xmlSaveFormatFileEnc (file, doc, "utf-8", 1); xmlFreeDoc (doc); diff --git a/libempathy/gossip-chatroom-manager.dtd b/libempathy/empathy-chatroom-manager.dtd index 5d94a57c2..df6b953f6 100644 --- a/libempathy/gossip-chatroom-manager.dtd +++ b/libempathy/empathy-chatroom-manager.dtd @@ -1,5 +1,5 @@ <!-- - DTD for Gossips Chat Rooms. + DTD for Empathys Chat Rooms. by Martyn Russell <martyn@imendio.com> v0.2 --> diff --git a/libempathy/empathy-chatroom-manager.h b/libempathy/empathy-chatroom-manager.h new file mode 100644 index 000000000..758aa29c3 --- /dev/null +++ b/libempathy/empathy-chatroom-manager.h @@ -0,0 +1,72 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ +/* + * Copyright (C) 2004-2007 Imendio AB + * Copyright (C) 2007 Collabora Ltd. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This program 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 + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + * + * Authors: Xavier Claessens <xclaesse@gmail.com> + * Martyn Russell <martyn@imendio.com> + */ + +#ifndef __EMPATHY_CHATROOM_MANAGER_H__ +#define __EMPATHY_CHATROOM_MANAGER_H__ + +#include <glib-object.h> + +#include <libmissioncontrol/mc-account.h> + +#include "empathy-chatroom.h" + +G_BEGIN_DECLS + +#define EMPATHY_TYPE_CHATROOM_MANAGER (empathy_chatroom_manager_get_type ()) +#define EMPATHY_CHATROOM_MANAGER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), EMPATHY_TYPE_CHATROOM_MANAGER, EmpathyChatroomManager)) +#define EMPATHY_CHATROOM_MANAGER_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), EMPATHY_TYPE_CHATROOM_MANAGER, EmpathyChatroomManagerClass)) +#define EMPATHY_IS_CHATROOM_MANAGER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), EMPATHY_TYPE_CHATROOM_MANAGER)) +#define EMPATHY_IS_CHATROOM_MANAGER_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), EMPATHY_TYPE_CHATROOM_MANAGER)) +#define EMPATHY_CHATROOM_MANAGER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), EMPATHY_TYPE_CHATROOM_MANAGER, EmpathyChatroomManagerClass)) + +typedef struct _EmpathyChatroomManager EmpathyChatroomManager; +typedef struct _EmpathyChatroomManagerClass EmpathyChatroomManagerClass; +typedef struct _EmpathyChatroomManagerPriv EmpathyChatroomManagerPriv; + +struct _EmpathyChatroomManager { + GObject parent; +}; + +struct _EmpathyChatroomManagerClass { + GObjectClass parent_class; +}; + +GType empathy_chatroom_manager_get_type (void) G_GNUC_CONST; +EmpathyChatroomManager *empathy_chatroom_manager_new (void); +gboolean empathy_chatroom_manager_add (EmpathyChatroomManager *manager, + EmpathyChatroom *chatroom); +void empathy_chatroom_manager_remove (EmpathyChatroomManager *manager, + EmpathyChatroom *chatroom); +EmpathyChatroom * empathy_chatroom_manager_find (EmpathyChatroomManager *manager, + McAccount *account, + const gchar *room); +GList * empathy_chatroom_manager_get_chatrooms (EmpathyChatroomManager *manager, + McAccount *account); +guint empathy_chatroom_manager_get_count (EmpathyChatroomManager *manager, + McAccount *account); +void empathy_chatroom_manager_store (EmpathyChatroomManager *manager); + +G_END_DECLS + +#endif /* __EMPATHY_CHATROOM_MANAGER_H__ */ diff --git a/libempathy/gossip-chatroom.c b/libempathy/empathy-chatroom.c index 5b1760fdd..a2d8ae61e 100644 --- a/libempathy/gossip-chatroom.c +++ b/libempathy/empathy-chatroom.c @@ -26,20 +26,20 @@ #include <glib.h> -#include "gossip-chatroom.h" -#include "gossip-utils.h" +#include "empathy-chatroom.h" +#include "empathy-utils.h" -#define GET_PRIV(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), GOSSIP_TYPE_CHATROOM, GossipChatroomPriv)) +#define GET_PRIV(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), EMPATHY_TYPE_CHATROOM, EmpathyChatroomPriv)) -struct _GossipChatroomPriv { +struct _EmpathyChatroomPriv { McAccount *account; gchar *room; gchar *name; gboolean auto_connect; }; -static void gossip_chatroom_class_init (GossipChatroomClass *klass); -static void gossip_chatroom_init (GossipChatroom *chatroom); +static void empathy_chatroom_class_init (EmpathyChatroomClass *klass); +static void empathy_chatroom_init (EmpathyChatroom *chatroom); static void chatroom_finalize (GObject *object); static void chatroom_get_property (GObject *object, guint param_id, @@ -58,10 +58,10 @@ enum { PROP_AUTO_CONNECT, }; -G_DEFINE_TYPE (GossipChatroom, gossip_chatroom, G_TYPE_OBJECT); +G_DEFINE_TYPE (EmpathyChatroom, empathy_chatroom, G_TYPE_OBJECT); static void -gossip_chatroom_class_init (GossipChatroomClass *klass) +empathy_chatroom_class_init (EmpathyChatroomClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); @@ -102,18 +102,18 @@ gossip_chatroom_class_init (GossipChatroomClass *klass) G_PARAM_READWRITE)); - g_type_class_add_private (object_class, sizeof (GossipChatroomPriv)); + g_type_class_add_private (object_class, sizeof (EmpathyChatroomPriv)); } static void -gossip_chatroom_init (GossipChatroom *chatroom) +empathy_chatroom_init (EmpathyChatroom *chatroom) { } static void chatroom_finalize (GObject *object) { - GossipChatroomPriv *priv; + EmpathyChatroomPriv *priv; priv = GET_PRIV (object); @@ -121,7 +121,7 @@ chatroom_finalize (GObject *object) g_free (priv->room); g_free (priv->name); - (G_OBJECT_CLASS (gossip_chatroom_parent_class)->finalize) (object); + (G_OBJECT_CLASS (empathy_chatroom_parent_class)->finalize) (object); } static void @@ -130,7 +130,7 @@ chatroom_get_property (GObject *object, GValue *value, GParamSpec *pspec) { - GossipChatroomPriv *priv; + EmpathyChatroomPriv *priv; priv = GET_PRIV (object); @@ -159,25 +159,25 @@ chatroom_set_property (GObject *object, const GValue *value, GParamSpec *pspec) { - GossipChatroomPriv *priv; + EmpathyChatroomPriv *priv; priv = GET_PRIV (object); switch (param_id) { case PROP_ACCOUNT: - gossip_chatroom_set_account (GOSSIP_CHATROOM (object), + empathy_chatroom_set_account (EMPATHY_CHATROOM (object), g_value_get_object (value)); break; case PROP_ROOM: - gossip_chatroom_set_room (GOSSIP_CHATROOM (object), + empathy_chatroom_set_room (EMPATHY_CHATROOM (object), g_value_get_string (value)); break; case PROP_NAME: - gossip_chatroom_set_name (GOSSIP_CHATROOM (object), + empathy_chatroom_set_name (EMPATHY_CHATROOM (object), g_value_get_string (value)); break; case PROP_AUTO_CONNECT: - gossip_chatroom_set_auto_connect (GOSSIP_CHATROOM (object), + empathy_chatroom_set_auto_connect (EMPATHY_CHATROOM (object), g_value_get_boolean (value)); break; default: @@ -186,21 +186,21 @@ chatroom_set_property (GObject *object, }; } -GossipChatroom * -gossip_chatroom_new (McAccount *account, +EmpathyChatroom * +empathy_chatroom_new (McAccount *account, const gchar *room) { g_return_val_if_fail (MC_IS_ACCOUNT (account), NULL); g_return_val_if_fail (room != NULL, NULL); - return g_object_new (GOSSIP_TYPE_CHATROOM, + return g_object_new (EMPATHY_TYPE_CHATROOM, "account", account, "room", room, NULL); } -GossipChatroom * -gossip_chatroom_new_full (McAccount *account, +EmpathyChatroom * +empathy_chatroom_new_full (McAccount *account, const gchar *room, const gchar *name, gboolean auto_connect) @@ -208,7 +208,7 @@ gossip_chatroom_new_full (McAccount *account, g_return_val_if_fail (MC_IS_ACCOUNT (account), NULL); g_return_val_if_fail (room != NULL, NULL); - return g_object_new (GOSSIP_TYPE_CHATROOM, + return g_object_new (EMPATHY_TYPE_CHATROOM, "account", account, "room", room, "name", name, @@ -217,23 +217,23 @@ gossip_chatroom_new_full (McAccount *account, } McAccount * -gossip_chatroom_get_account (GossipChatroom *chatroom) +empathy_chatroom_get_account (EmpathyChatroom *chatroom) { - GossipChatroomPriv *priv; + EmpathyChatroomPriv *priv; - g_return_val_if_fail (GOSSIP_IS_CHATROOM (chatroom), NULL); + g_return_val_if_fail (EMPATHY_IS_CHATROOM (chatroom), NULL); priv = GET_PRIV (chatroom); return priv->account; } void -gossip_chatroom_set_account (GossipChatroom *chatroom, +empathy_chatroom_set_account (EmpathyChatroom *chatroom, McAccount *account) { - GossipChatroomPriv *priv; + EmpathyChatroomPriv *priv; - g_return_if_fail (GOSSIP_IS_CHATROOM (chatroom)); + g_return_if_fail (EMPATHY_IS_CHATROOM (chatroom)); g_return_if_fail (MC_IS_ACCOUNT (account)); priv = GET_PRIV (chatroom); @@ -250,23 +250,23 @@ gossip_chatroom_set_account (GossipChatroom *chatroom, } const gchar * -gossip_chatroom_get_room (GossipChatroom *chatroom) +empathy_chatroom_get_room (EmpathyChatroom *chatroom) { - GossipChatroomPriv *priv; + EmpathyChatroomPriv *priv; - g_return_val_if_fail (GOSSIP_IS_CHATROOM (chatroom), NULL); + g_return_val_if_fail (EMPATHY_IS_CHATROOM (chatroom), NULL); priv = GET_PRIV (chatroom); return priv->room; } void -gossip_chatroom_set_room (GossipChatroom *chatroom, +empathy_chatroom_set_room (EmpathyChatroom *chatroom, const gchar *room) { - GossipChatroomPriv *priv; + EmpathyChatroomPriv *priv; - g_return_if_fail (GOSSIP_IS_CHATROOM (chatroom)); + g_return_if_fail (EMPATHY_IS_CHATROOM (chatroom)); g_return_if_fail (room != NULL); priv = GET_PRIV (chatroom); @@ -278,11 +278,11 @@ gossip_chatroom_set_room (GossipChatroom *chatroom, } const gchar * -gossip_chatroom_get_name (GossipChatroom *chatroom) +empathy_chatroom_get_name (EmpathyChatroom *chatroom) { - GossipChatroomPriv *priv; + EmpathyChatroomPriv *priv; - g_return_val_if_fail (GOSSIP_IS_CHATROOM (chatroom), NULL); + g_return_val_if_fail (EMPATHY_IS_CHATROOM (chatroom), NULL); priv = GET_PRIV (chatroom); @@ -294,12 +294,12 @@ gossip_chatroom_get_name (GossipChatroom *chatroom) } void -gossip_chatroom_set_name (GossipChatroom *chatroom, +empathy_chatroom_set_name (EmpathyChatroom *chatroom, const gchar *name) { - GossipChatroomPriv *priv; + EmpathyChatroomPriv *priv; - g_return_if_fail (GOSSIP_IS_CHATROOM (chatroom)); + g_return_if_fail (EMPATHY_IS_CHATROOM (chatroom)); priv = GET_PRIV (chatroom); @@ -313,23 +313,23 @@ gossip_chatroom_set_name (GossipChatroom *chatroom, } gboolean -gossip_chatroom_get_auto_connect (GossipChatroom *chatroom) +empathy_chatroom_get_auto_connect (EmpathyChatroom *chatroom) { - GossipChatroomPriv *priv; + EmpathyChatroomPriv *priv; - g_return_val_if_fail (GOSSIP_IS_CHATROOM (chatroom), FALSE); + g_return_val_if_fail (EMPATHY_IS_CHATROOM (chatroom), FALSE); priv = GET_PRIV (chatroom); return priv->auto_connect; } void -gossip_chatroom_set_auto_connect (GossipChatroom *chatroom, +empathy_chatroom_set_auto_connect (EmpathyChatroom *chatroom, gboolean auto_connect) { - GossipChatroomPriv *priv; + EmpathyChatroomPriv *priv; - g_return_if_fail (GOSSIP_IS_CHATROOM (chatroom)); + g_return_if_fail (EMPATHY_IS_CHATROOM (chatroom)); priv = GET_PRIV (chatroom); @@ -339,7 +339,7 @@ gossip_chatroom_set_auto_connect (GossipChatroom *chatroom, } gboolean -gossip_chatroom_equal (gconstpointer v1, +empathy_chatroom_equal (gconstpointer v1, gconstpointer v2) { McAccount *account_a; @@ -347,16 +347,16 @@ gossip_chatroom_equal (gconstpointer v1, const gchar *room_a; const gchar *room_b; - g_return_val_if_fail (GOSSIP_IS_CHATROOM (v1), FALSE); - g_return_val_if_fail (GOSSIP_IS_CHATROOM (v2), FALSE); + g_return_val_if_fail (EMPATHY_IS_CHATROOM (v1), FALSE); + g_return_val_if_fail (EMPATHY_IS_CHATROOM (v2), FALSE); - account_a = gossip_chatroom_get_account (GOSSIP_CHATROOM (v1)); - account_b = gossip_chatroom_get_account (GOSSIP_CHATROOM (v2)); + account_a = empathy_chatroom_get_account (EMPATHY_CHATROOM (v1)); + account_b = empathy_chatroom_get_account (EMPATHY_CHATROOM (v2)); - room_a = gossip_chatroom_get_room (GOSSIP_CHATROOM (v1)); - room_b = gossip_chatroom_get_room (GOSSIP_CHATROOM (v2)); + room_a = empathy_chatroom_get_room (EMPATHY_CHATROOM (v1)); + room_b = empathy_chatroom_get_room (EMPATHY_CHATROOM (v2)); - return gossip_account_equal (account_a, account_b) && g_str_equal (room_a, room_b); + return empathy_account_equal (account_a, account_b) && g_str_equal (room_a, room_b); } diff --git a/libempathy/empathy-chatroom.h b/libempathy/empathy-chatroom.h new file mode 100644 index 000000000..20f98ecc6 --- /dev/null +++ b/libempathy/empathy-chatroom.h @@ -0,0 +1,78 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ +/* + * Copyright (C) 2007 Collabora Ltd. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This program 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 + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + * + * Authors: Xavier Claessens <xclaesse@gmail.com> + */ + +#ifndef __EMPATHY_CHATROOM_H__ +#define __EMPATHY_CHATROOM_H__ + +#include <glib-object.h> + +#include <libmissioncontrol/mc-account.h> + +G_BEGIN_DECLS + +#define EMPATHY_TYPE_CHATROOM (empathy_chatroom_get_type ()) +#define EMPATHY_CHATROOM(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), EMPATHY_TYPE_CHATROOM, EmpathyChatroom)) +#define EMPATHY_CHATROOM_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), EMPATHY_TYPE_CHATROOM, EmpathyChatroomClass)) +#define EMPATHY_IS_CHATROOM(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), EMPATHY_TYPE_CHATROOM)) +#define EMPATHY_IS_CHATROOM_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), EMPATHY_TYPE_CHATROOM)) +#define EMPATHY_CHATROOM_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), EMPATHY_TYPE_CHATROOM, EmpathyChatroomClass)) + +#define EMPATHY_TYPE_CHATROOM_INVITE (empathy_chatroom_invite_get_gtype ()) + +typedef struct _EmpathyChatroom EmpathyChatroom; +typedef struct _EmpathyChatroomClass EmpathyChatroomClass; +typedef struct _EmpathyChatroomPriv EmpathyChatroomPriv; + +struct _EmpathyChatroom { + GObject parent; +}; + +struct _EmpathyChatroomClass { + GObjectClass parent_class; +}; + +GType empathy_chatroom_get_type (void) G_GNUC_CONST; +EmpathyChatroom *empathy_chatroom_new (McAccount *account, + const gchar *room); +EmpathyChatroom *empathy_chatroom_new_full (McAccount *account, + const gchar *room, + const gchar *name, + gboolean auto_connect); +McAccount * empathy_chatroom_get_account (EmpathyChatroom *chatroom); +void empathy_chatroom_set_account (EmpathyChatroom *chatroom, + McAccount *account); +const gchar * empathy_chatroom_get_room (EmpathyChatroom *chatroom); +void empathy_chatroom_set_room (EmpathyChatroom *chatroom, + const gchar *room); +const gchar * empathy_chatroom_get_name (EmpathyChatroom *chatroom); +void empathy_chatroom_set_name (EmpathyChatroom *chatroom, + const gchar *name); +gboolean empathy_chatroom_get_auto_connect (EmpathyChatroom *chatroom); +void empathy_chatroom_set_auto_connect (EmpathyChatroom *chatroom, + gboolean auto_connect); +gboolean empathy_chatroom_equal (gconstpointer v1, + gconstpointer v2); + + +G_BEGIN_DECLS + +#endif /* __EMPATHY_CHATROOM_H__ */ diff --git a/libempathy/gossip-conf.c b/libempathy/empathy-conf.c index e788da6b4..71e520f72 100644 --- a/libempathy/gossip-conf.c +++ b/libempathy/empathy-conf.c @@ -26,34 +26,34 @@ #include <gconf/gconf-client.h> -#include "gossip-conf.h" -#include "gossip-debug.h" +#include "empathy-conf.h" +#include "empathy-debug.h" #define DEBUG_DOMAIN "Config" -#define GOSSIP_CONF_ROOT "/apps/empathy" +#define EMPATHY_CONF_ROOT "/apps/empathy" #define DESKTOP_INTERFACE_ROOT "/desktop/gnome/interface" -#define GET_PRIV(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), GOSSIP_TYPE_CONF, GossipConfPriv)) +#define GET_PRIV(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), EMPATHY_TYPE_CONF, EmpathyConfPriv)) typedef struct { GConfClient *gconf_client; -} GossipConfPriv; +} EmpathyConfPriv; typedef struct { - GossipConf *conf; - GossipConfNotifyFunc func; + EmpathyConf *conf; + EmpathyConfNotifyFunc func; gpointer user_data; -} GossipConfNotifyData; +} EmpathyConfNotifyData; static void conf_finalize (GObject *object); -G_DEFINE_TYPE (GossipConf, gossip_conf, G_TYPE_OBJECT); +G_DEFINE_TYPE (EmpathyConf, empathy_conf, G_TYPE_OBJECT); -static GossipConf *global_conf = NULL; +static EmpathyConf *global_conf = NULL; static void -gossip_conf_class_init (GossipConfClass *class) +empathy_conf_class_init (EmpathyConfClass *class) { GObjectClass *object_class; @@ -61,20 +61,20 @@ gossip_conf_class_init (GossipConfClass *class) object_class->finalize = conf_finalize; - g_type_class_add_private (object_class, sizeof (GossipConfPriv)); + g_type_class_add_private (object_class, sizeof (EmpathyConfPriv)); } static void -gossip_conf_init (GossipConf *conf) +empathy_conf_init (EmpathyConf *conf) { - GossipConfPriv *priv; + EmpathyConfPriv *priv; priv = GET_PRIV (conf); priv->gconf_client = gconf_client_get_default (); gconf_client_add_dir (priv->gconf_client, - GOSSIP_CONF_ROOT, + EMPATHY_CONF_ROOT, GCONF_CLIENT_PRELOAD_ONELEVEL, NULL); gconf_client_add_dir (priv->gconf_client, @@ -86,12 +86,12 @@ gossip_conf_init (GossipConf *conf) static void conf_finalize (GObject *object) { - GossipConfPriv *priv; + EmpathyConfPriv *priv; priv = GET_PRIV (object); gconf_client_remove_dir (priv->gconf_client, - GOSSIP_CONF_ROOT, + EMPATHY_CONF_ROOT, NULL); gconf_client_remove_dir (priv->gconf_client, DESKTOP_INTERFACE_ROOT, @@ -99,21 +99,21 @@ conf_finalize (GObject *object) g_object_unref (priv->gconf_client); - G_OBJECT_CLASS (gossip_conf_parent_class)->finalize (object); + G_OBJECT_CLASS (empathy_conf_parent_class)->finalize (object); } -GossipConf * -gossip_conf_get (void) +EmpathyConf * +empathy_conf_get (void) { if (!global_conf) { - global_conf = g_object_new (GOSSIP_TYPE_CONF, NULL); + global_conf = g_object_new (EMPATHY_TYPE_CONF, NULL); } return global_conf; } void -gossip_conf_shutdown (void) +empathy_conf_shutdown (void) { if (global_conf) { g_object_unref (global_conf); @@ -122,15 +122,15 @@ gossip_conf_shutdown (void) } gboolean -gossip_conf_set_int (GossipConf *conf, +empathy_conf_set_int (EmpathyConf *conf, const gchar *key, gint value) { - GossipConfPriv *priv; + EmpathyConfPriv *priv; - g_return_val_if_fail (GOSSIP_IS_CONF (conf), FALSE); + g_return_val_if_fail (EMPATHY_IS_CONF (conf), FALSE); - gossip_debug (DEBUG_DOMAIN, "Setting int:'%s' to %d", key, value); + empathy_debug (DEBUG_DOMAIN, "Setting int:'%s' to %d", key, value); priv = GET_PRIV (conf); @@ -141,16 +141,16 @@ gossip_conf_set_int (GossipConf *conf, } gboolean -gossip_conf_get_int (GossipConf *conf, +empathy_conf_get_int (EmpathyConf *conf, const gchar *key, gint *value) { - GossipConfPriv *priv; + EmpathyConfPriv *priv; GError *error = NULL; *value = 0; - g_return_val_if_fail (GOSSIP_IS_CONF (conf), FALSE); + g_return_val_if_fail (EMPATHY_IS_CONF (conf), FALSE); g_return_val_if_fail (value != NULL, FALSE); priv = GET_PRIV (conf); @@ -168,15 +168,15 @@ gossip_conf_get_int (GossipConf *conf, } gboolean -gossip_conf_set_bool (GossipConf *conf, +empathy_conf_set_bool (EmpathyConf *conf, const gchar *key, gboolean value) { - GossipConfPriv *priv; + EmpathyConfPriv *priv; - g_return_val_if_fail (GOSSIP_IS_CONF (conf), FALSE); + g_return_val_if_fail (EMPATHY_IS_CONF (conf), FALSE); - gossip_debug (DEBUG_DOMAIN, "Setting bool:'%s' to %d ---> %s", + empathy_debug (DEBUG_DOMAIN, "Setting bool:'%s' to %d ---> %s", key, value, value ? "true" : "false"); priv = GET_PRIV (conf); @@ -188,16 +188,16 @@ gossip_conf_set_bool (GossipConf *conf, } gboolean -gossip_conf_get_bool (GossipConf *conf, +empathy_conf_get_bool (EmpathyConf *conf, const gchar *key, gboolean *value) { - GossipConfPriv *priv; + EmpathyConfPriv *priv; GError *error = NULL; *value = FALSE; - g_return_val_if_fail (GOSSIP_IS_CONF (conf), FALSE); + g_return_val_if_fail (EMPATHY_IS_CONF (conf), FALSE); g_return_val_if_fail (value != NULL, FALSE); priv = GET_PRIV (conf); @@ -215,15 +215,15 @@ gossip_conf_get_bool (GossipConf *conf, } gboolean -gossip_conf_set_string (GossipConf *conf, +empathy_conf_set_string (EmpathyConf *conf, const gchar *key, const gchar *value) { - GossipConfPriv *priv; + EmpathyConfPriv *priv; - g_return_val_if_fail (GOSSIP_IS_CONF (conf), FALSE); + g_return_val_if_fail (EMPATHY_IS_CONF (conf), FALSE); - gossip_debug (DEBUG_DOMAIN, "Setting string:'%s' to '%s'", + empathy_debug (DEBUG_DOMAIN, "Setting string:'%s' to '%s'", key, value); priv = GET_PRIV (conf); @@ -235,16 +235,16 @@ gossip_conf_set_string (GossipConf *conf, } gboolean -gossip_conf_get_string (GossipConf *conf, +empathy_conf_get_string (EmpathyConf *conf, const gchar *key, gchar **value) { - GossipConfPriv *priv; + EmpathyConfPriv *priv; GError *error = NULL; *value = NULL; - g_return_val_if_fail (GOSSIP_IS_CONF (conf), FALSE); + g_return_val_if_fail (EMPATHY_IS_CONF (conf), FALSE); priv = GET_PRIV (conf); @@ -261,13 +261,13 @@ gossip_conf_get_string (GossipConf *conf, } gboolean -gossip_conf_set_string_list (GossipConf *conf, +empathy_conf_set_string_list (EmpathyConf *conf, const gchar *key, GSList *value) { - GossipConfPriv *priv; + EmpathyConfPriv *priv; - g_return_val_if_fail (GOSSIP_IS_CONF (conf), FALSE); + g_return_val_if_fail (EMPATHY_IS_CONF (conf), FALSE); priv = GET_PRIV (conf); @@ -279,16 +279,16 @@ gossip_conf_set_string_list (GossipConf *conf, } gboolean -gossip_conf_get_string_list (GossipConf *conf, +empathy_conf_get_string_list (EmpathyConf *conf, const gchar *key, GSList **value) { - GossipConfPriv *priv; + EmpathyConfPriv *priv; GError *error = NULL; *value = NULL; - g_return_val_if_fail (GOSSIP_IS_CONF (conf), FALSE); + g_return_val_if_fail (EMPATHY_IS_CONF (conf), FALSE); priv = GET_PRIV (conf); @@ -305,10 +305,10 @@ gossip_conf_get_string_list (GossipConf *conf, } static void -conf_notify_data_free (GossipConfNotifyData *data) +conf_notify_data_free (EmpathyConfNotifyData *data) { g_object_unref (data->conf); - g_slice_free (GossipConfNotifyData, data); + g_slice_free (EmpathyConfNotifyData, data); } static void @@ -317,7 +317,7 @@ conf_notify_func (GConfClient *client, GConfEntry *entry, gpointer user_data) { - GossipConfNotifyData *data; + EmpathyConfNotifyData *data; data = user_data; @@ -327,20 +327,20 @@ conf_notify_func (GConfClient *client, } guint -gossip_conf_notify_add (GossipConf *conf, +empathy_conf_notify_add (EmpathyConf *conf, const gchar *key, - GossipConfNotifyFunc func, + EmpathyConfNotifyFunc func, gpointer user_data) { - GossipConfPriv *priv; + EmpathyConfPriv *priv; guint id; - GossipConfNotifyData *data; + EmpathyConfNotifyData *data; - g_return_val_if_fail (GOSSIP_IS_CONF (conf), 0); + g_return_val_if_fail (EMPATHY_IS_CONF (conf), 0); priv = GET_PRIV (conf); - data = g_slice_new (GossipConfNotifyData); + data = g_slice_new (EmpathyConfNotifyData); data->func = func; data->user_data = user_data; data->conf = g_object_ref (conf); @@ -356,12 +356,12 @@ gossip_conf_notify_add (GossipConf *conf, } gboolean -gossip_conf_notify_remove (GossipConf *conf, +empathy_conf_notify_remove (EmpathyConf *conf, guint id) { - GossipConfPriv *priv; + EmpathyConfPriv *priv; - g_return_val_if_fail (GOSSIP_IS_CONF (conf), FALSE); + g_return_val_if_fail (EMPATHY_IS_CONF (conf), FALSE); priv = GET_PRIV (conf); diff --git a/libempathy/empathy-conf.h b/libempathy/empathy-conf.h new file mode 100644 index 000000000..7e8e60e25 --- /dev/null +++ b/libempathy/empathy-conf.h @@ -0,0 +1,87 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ +/* + * Copyright (C) 2006 Imendio AB + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This program 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 + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#ifndef __EMPATHY_CONF_H__ +#define __EMPATHY_CONF_H__ + +#include <glib-object.h> + +G_BEGIN_DECLS + +#define EMPATHY_TYPE_CONF (empathy_conf_get_type ()) +#define EMPATHY_CONF(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), EMPATHY_TYPE_CONF, EmpathyConf)) +#define EMPATHY_CONF_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), EMPATHY_TYPE_CONF, EmpathyConfClass)) +#define EMPATHY_IS_CONF(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), EMPATHY_TYPE_CONF)) +#define EMPATHY_IS_CONF_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), EMPATHY_TYPE_CONF)) +#define EMPATHY_CONF_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), EMPATHY_TYPE_CONF, EmpathyConfClass)) + +typedef struct _EmpathyConf EmpathyConf; +typedef struct _EmpathyConfClass EmpathyConfClass; + +struct _EmpathyConf { + GObject parent; +}; + +struct _EmpathyConfClass { + GObjectClass parent_class; +}; + +typedef void (*EmpathyConfNotifyFunc) (EmpathyConf *conf, + const gchar *key, + gpointer user_data); + +GType empathy_conf_get_type (void) G_GNUC_CONST; +EmpathyConf *empathy_conf_get (void); +void empathy_conf_shutdown (void); +guint empathy_conf_notify_add (EmpathyConf *conf, + const gchar *key, + EmpathyConfNotifyFunc func, + gpointer data); +gboolean empathy_conf_notify_remove (EmpathyConf *conf, + guint id); +gboolean empathy_conf_set_int (EmpathyConf *conf, + const gchar *key, + gint value); +gboolean empathy_conf_get_int (EmpathyConf *conf, + const gchar *key, + gint *value); +gboolean empathy_conf_set_bool (EmpathyConf *conf, + const gchar *key, + gboolean value); +gboolean empathy_conf_get_bool (EmpathyConf *conf, + const gchar *key, + gboolean *value); +gboolean empathy_conf_set_string (EmpathyConf *conf, + const gchar *key, + const gchar *value); +gboolean empathy_conf_get_string (EmpathyConf *conf, + const gchar *key, + gchar **value); +gboolean empathy_conf_set_string_list (EmpathyConf *conf, + const gchar *key, + GSList *value); +gboolean empathy_conf_get_string_list (EmpathyConf *conf, + const gchar *key, + GSList **value); + +G_END_DECLS + +#endif /* __EMPATHY_CONF_H__ */ + diff --git a/libempathy/empathy-contact-list.c b/libempathy/empathy-contact-list.c index 3dd398c06..cc388d7ec 100644 --- a/libempathy/empathy-contact-list.c +++ b/libempathy/empathy-contact-list.c @@ -60,7 +60,7 @@ contact_list_base_init (gpointer klass) NULL, NULL, g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, - 1, GOSSIP_TYPE_CONTACT); + 1, EMPATHY_TYPE_CONTACT); g_signal_new ("contact-removed", G_TYPE_FROM_CLASS (klass), @@ -69,7 +69,7 @@ contact_list_base_init (gpointer klass) NULL, NULL, g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, - 1, GOSSIP_TYPE_CONTACT); + 1, EMPATHY_TYPE_CONTACT); g_signal_new ("local-pending", G_TYPE_FROM_CLASS (klass), @@ -78,19 +78,19 @@ contact_list_base_init (gpointer klass) NULL, NULL, empathy_marshal_VOID__OBJECT_STRING, G_TYPE_NONE, - 2, GOSSIP_TYPE_CONTACT, G_TYPE_STRING); + 2, EMPATHY_TYPE_CONTACT, G_TYPE_STRING); initialized = TRUE; } } EmpathyContactListInfo * -empathy_contact_list_info_new (GossipContact *contact, +empathy_contact_list_info_new (EmpathyContact *contact, const gchar *message) { EmpathyContactListInfo *info; - g_return_val_if_fail (GOSSIP_IS_CONTACT (contact), NULL); + g_return_val_if_fail (EMPATHY_IS_CONTACT (contact), NULL); info = g_slice_new0 (EmpathyContactListInfo); info->contact = g_object_ref (contact); @@ -124,7 +124,7 @@ empathy_contact_list_setup (EmpathyContactList *list) } } -GossipContact * +EmpathyContact * empathy_contact_list_find (EmpathyContactList *list, const gchar *id) { @@ -139,7 +139,7 @@ empathy_contact_list_find (EmpathyContactList *list, void empathy_contact_list_add (EmpathyContactList *list, - GossipContact *contact, + EmpathyContact *contact, const gchar *message) { g_return_if_fail (EMPATHY_IS_CONTACT_LIST (list)); @@ -151,7 +151,7 @@ empathy_contact_list_add (EmpathyContactList *list, void empathy_contact_list_remove (EmpathyContactList *list, - GossipContact *contact, + EmpathyContact *contact, const gchar *message) { g_return_if_fail (EMPATHY_IS_CONTACT_LIST (list)); @@ -187,7 +187,7 @@ empathy_contact_list_get_local_pending (EmpathyContactList *list) void empathy_contact_list_process_pending (EmpathyContactList *list, - GossipContact *contact, + EmpathyContact *contact, gboolean accept) { g_return_if_fail (EMPATHY_IS_CONTACT_LIST (list)); diff --git a/libempathy/empathy-contact-list.h b/libempathy/empathy-contact-list.h index c1f9b41e4..959f5c51f 100644 --- a/libempathy/empathy-contact-list.h +++ b/libempathy/empathy-contact-list.h @@ -25,7 +25,7 @@ #include <glib-object.h> -#include "gossip-contact.h" +#include "empathy-contact.h" G_BEGIN_DECLS @@ -38,7 +38,7 @@ typedef struct _EmpathyContactList EmpathyContactList; typedef struct _EmpathyContactListIface EmpathyContactListIface; typedef struct { - GossipContact *contact; + EmpathyContact *contact; gchar *message; } EmpathyContactListInfo; @@ -47,38 +47,38 @@ struct _EmpathyContactListIface { /* VTabled */ void (*setup) (EmpathyContactList *list); - GossipContact * (*find) (EmpathyContactList *list, + EmpathyContact * (*find) (EmpathyContactList *list, const gchar *id); void (*add) (EmpathyContactList *list, - GossipContact *contact, + EmpathyContact *contact, const gchar *message); void (*remove) (EmpathyContactList *list, - GossipContact *contact, + EmpathyContact *contact, const gchar *message); GList * (*get_members) (EmpathyContactList *list); GList * (*get_local_pending) (EmpathyContactList *list); void (*process_pending) (EmpathyContactList *list, - GossipContact *contact, + EmpathyContact *contact, gboolean accept); }; GType empathy_contact_list_get_type (void) G_GNUC_CONST; -EmpathyContactListInfo *empathy_contact_list_info_new (GossipContact *contact, +EmpathyContactListInfo *empathy_contact_list_info_new (EmpathyContact *contact, const gchar *message); void empathy_contact_list_info_free (EmpathyContactListInfo *info); void empathy_contact_list_setup (EmpathyContactList *list); -GossipContact * empathy_contact_list_find (EmpathyContactList *list, +EmpathyContact * empathy_contact_list_find (EmpathyContactList *list, const gchar *id); void empathy_contact_list_add (EmpathyContactList *list, - GossipContact *contact, + EmpathyContact *contact, const gchar *message); void empathy_contact_list_remove (EmpathyContactList *list, - GossipContact *contact, + EmpathyContact *contact, const gchar *message); GList * empathy_contact_list_get_members (EmpathyContactList *list); GList * empathy_contact_list_get_local_pending (EmpathyContactList *list); void empathy_contact_list_process_pending (EmpathyContactList *list, - GossipContact *contact, + EmpathyContact *contact, gboolean accept); G_END_DECLS diff --git a/libempathy/empathy-contact-manager.c b/libempathy/empathy-contact-manager.c index 7f8cdfed5..cc00108c8 100644 --- a/libempathy/empathy-contact-manager.c +++ b/libempathy/empathy-contact-manager.c @@ -28,8 +28,8 @@ #include "empathy-contact-manager.h" #include "empathy-contact-list.h" -#include "gossip-utils.h" -#include "gossip-debug.h" +#include "empathy-utils.h" +#include "empathy-debug.h" #define GET_PRIV(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), \ EMPATHY_TYPE_CONTACT_MANAGER, EmpathyContactManagerPriv)) @@ -48,7 +48,7 @@ typedef struct { } ContactManagerRenameGroupData; typedef struct { - GossipContact *contact; + EmpathyContact *contact; const gchar *id; } ContactManagerFindData; @@ -57,18 +57,18 @@ static void contact_manager_iface_init (EmpathyContactListIf static void empathy_contact_manager_init (EmpathyContactManager *manager); static void contact_manager_finalize (GObject *object); static void contact_manager_setup (EmpathyContactList *manager); -static GossipContact *contact_manager_find (EmpathyContactList *manager, +static EmpathyContact *contact_manager_find (EmpathyContactList *manager, const gchar *id); static void contact_manager_add (EmpathyContactList *manager, - GossipContact *contact, + EmpathyContact *contact, const gchar *message); static void contact_manager_remove (EmpathyContactList *manager, - GossipContact *contact, + EmpathyContact *contact, const gchar *message); static GList * contact_manager_get_members (EmpathyContactList *manager); static GList * contact_manager_get_local_pending (EmpathyContactList *manager); static void contact_manager_process_pending (EmpathyContactList *manager, - GossipContact *contact, + EmpathyContact *contact, gboolean accept); static void contact_manager_setup_foreach (McAccount *account, EmpathyTpContactList *list, @@ -79,13 +79,13 @@ static gboolean contact_manager_find_foreach (McAccount static void contact_manager_add_account (EmpathyContactManager *manager, McAccount *account); static void contact_manager_added_cb (EmpathyTpContactList *list, - GossipContact *contact, + EmpathyContact *contact, EmpathyContactManager *manager); static void contact_manager_removed_cb (EmpathyTpContactList *list, - GossipContact *contact, + EmpathyContact *contact, EmpathyContactManager *manager); static void contact_manager_local_pending_cb (EmpathyTpContactList *list, - GossipContact *contact, + EmpathyContact *contact, const gchar *message, EmpathyContactManager *manager); static void contact_manager_destroy_cb (EmpathyTpContactList *list, @@ -143,12 +143,12 @@ empathy_contact_manager_init (EmpathyContactManager *manager) priv = GET_PRIV (manager); - priv->lists = g_hash_table_new_full (gossip_account_hash, - gossip_account_equal, + priv->lists = g_hash_table_new_full (empathy_account_hash, + empathy_account_equal, (GDestroyNotify) g_object_unref, (GDestroyNotify) g_object_unref); - priv->mc = gossip_mission_control_new (); + priv->mc = empathy_mission_control_new (); dbus_g_proxy_connect_signal (DBUS_G_PROXY (priv->mc), "AccountStatusChanged", @@ -215,7 +215,7 @@ contact_manager_setup (EmpathyContactList *manager) priv->setup = TRUE; } -static GossipContact * +static EmpathyContact * contact_manager_find (EmpathyContactList *manager, const gchar *id) { @@ -239,7 +239,7 @@ contact_manager_find (EmpathyContactList *manager, static void contact_manager_add (EmpathyContactList *manager, - GossipContact *contact, + EmpathyContact *contact, const gchar *message) { EmpathyContactManagerPriv *priv; @@ -247,11 +247,11 @@ contact_manager_add (EmpathyContactList *manager, McAccount *account; g_return_if_fail (EMPATHY_IS_CONTACT_MANAGER (manager)); - g_return_if_fail (GOSSIP_IS_CONTACT (contact)); + g_return_if_fail (EMPATHY_IS_CONTACT (contact)); priv = GET_PRIV (manager); - account = gossip_contact_get_account (contact); + account = empathy_contact_get_account (contact); list = g_hash_table_lookup (priv->lists, account); if (list) { @@ -261,7 +261,7 @@ contact_manager_add (EmpathyContactList *manager, static void contact_manager_remove (EmpathyContactList *manager, - GossipContact *contact, + EmpathyContact *contact, const gchar *message) { EmpathyContactManagerPriv *priv; @@ -269,11 +269,11 @@ contact_manager_remove (EmpathyContactList *manager, McAccount *account; g_return_if_fail (EMPATHY_IS_CONTACT_MANAGER (manager)); - g_return_if_fail (GOSSIP_IS_CONTACT (contact)); + g_return_if_fail (EMPATHY_IS_CONTACT (contact)); priv = GET_PRIV (manager); - account = gossip_contact_get_account (contact); + account = empathy_contact_get_account (contact); list = g_hash_table_lookup (priv->lists, account); if (list) { @@ -317,7 +317,7 @@ contact_manager_get_local_pending (EmpathyContactList *manager) static void contact_manager_process_pending (EmpathyContactList *manager, - GossipContact *contact, + EmpathyContact *contact, gboolean accept) { EmpathyContactManagerPriv *priv; @@ -325,11 +325,11 @@ contact_manager_process_pending (EmpathyContactList *manager, McAccount *account; g_return_if_fail (EMPATHY_IS_CONTACT_MANAGER (manager)); - g_return_if_fail (GOSSIP_IS_CONTACT (contact)); + g_return_if_fail (EMPATHY_IS_CONTACT (contact)); priv = GET_PRIV (manager); - account = gossip_contact_get_account (contact); + account = empathy_contact_get_account (contact); list = g_hash_table_lookup (priv->lists, account); if (list) { @@ -351,7 +351,7 @@ empathy_contact_manager_get_list (EmpathyContactManager *manager, return g_hash_table_lookup (priv->lists, account); } -GossipContact * +EmpathyContact * empathy_contact_manager_get_user (EmpathyContactManager *manager, McAccount *account) { @@ -372,7 +372,7 @@ empathy_contact_manager_get_user (EmpathyContactManager *manager, return empathy_tp_contact_list_get_user (list); } -GossipContact * +EmpathyContact * empathy_contact_manager_create (EmpathyContactManager *manager, McAccount *account, const gchar *id) @@ -470,7 +470,7 @@ contact_manager_add_account (EmpathyContactManager *manager, return; } - gossip_debug (DEBUG_DOMAIN, "Adding new account: %s", + empathy_debug (DEBUG_DOMAIN, "Adding new account: %s", mc_account_get_display_name (account)); list = empathy_tp_contact_list_new (account); @@ -501,7 +501,7 @@ contact_manager_add_account (EmpathyContactManager *manager, static void contact_manager_added_cb (EmpathyTpContactList *list, - GossipContact *contact, + EmpathyContact *contact, EmpathyContactManager *manager) { g_signal_emit_by_name (manager, "contact-added", contact); @@ -509,7 +509,7 @@ contact_manager_added_cb (EmpathyTpContactList *list, static void contact_manager_removed_cb (EmpathyTpContactList *list, - GossipContact *contact, + EmpathyContact *contact, EmpathyContactManager *manager) { g_signal_emit_by_name (manager, "contact-removed", contact); @@ -517,7 +517,7 @@ contact_manager_removed_cb (EmpathyTpContactList *list, static void contact_manager_local_pending_cb (EmpathyTpContactList *list, - GossipContact *contact, + EmpathyContact *contact, const gchar *message, EmpathyContactManager *manager) { @@ -535,7 +535,7 @@ contact_manager_destroy_cb (EmpathyTpContactList *list, account = empathy_tp_contact_list_get_account (list); - gossip_debug (DEBUG_DOMAIN, "Removing account: %s", + empathy_debug (DEBUG_DOMAIN, "Removing account: %s", mc_account_get_display_name (account)); /* Disconnect signals from the list */ diff --git a/libempathy/empathy-contact-manager.h b/libempathy/empathy-contact-manager.h index db893b486..768301ae7 100644 --- a/libempathy/empathy-contact-manager.h +++ b/libempathy/empathy-contact-manager.h @@ -27,7 +27,7 @@ #include <libmissioncontrol/mc-account.h> -#include "gossip-contact.h" +#include "empathy-contact.h" #include "empathy-tp-contact-list.h" G_BEGIN_DECLS @@ -55,9 +55,9 @@ GType empathy_contact_manager_get_type (void) G_GNUC_CONST; EmpathyContactManager *empathy_contact_manager_new (void); EmpathyTpContactList * empathy_contact_manager_get_list (EmpathyContactManager *manager, McAccount *account); -GossipContact * empathy_contact_manager_get_user (EmpathyContactManager *manager, +EmpathyContact * empathy_contact_manager_get_user (EmpathyContactManager *manager, McAccount *account); -GossipContact * empathy_contact_manager_create (EmpathyContactManager *manager, +EmpathyContact * empathy_contact_manager_create (EmpathyContactManager *manager, McAccount *account, const gchar *id); void empathy_contact_manager_rename_group (EmpathyContactManager *manager, diff --git a/libempathy/gossip-contact.c b/libempathy/empathy-contact.c index ba97fa758..774a18f77 100644 --- a/libempathy/gossip-contact.c +++ b/libempathy/empathy-contact.c @@ -27,30 +27,30 @@ #include <glib/gi18n.h> -#include "gossip-contact.h" -#include "gossip-utils.h" -#include "gossip-debug.h" +#include "empathy-contact.h" +#include "empathy-utils.h" +#include "empathy-debug.h" #define DEBUG_DOMAIN "Contact" -#define GET_PRIV(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), GOSSIP_TYPE_CONTACT, GossipContactPriv)) +#define GET_PRIV(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), EMPATHY_TYPE_CONTACT, EmpathyContactPriv)) -typedef struct _GossipContactPriv GossipContactPriv; +typedef struct _EmpathyContactPriv EmpathyContactPriv; -struct _GossipContactPriv { +struct _EmpathyContactPriv { gchar *id; gchar *name; - GossipAvatar *avatar; + EmpathyAvatar *avatar; McAccount *account; - GossipPresence *presence; + EmpathyPresence *presence; GList *groups; - GossipSubscription subscription; + EmpathySubscription subscription; guint handle; gboolean is_user; }; -static void contact_class_init (GossipContactClass *class); -static void contact_init (GossipContact *contact); +static void contact_class_init (EmpathyContactClass *class); +static void contact_init (EmpathyContact *contact); static void contact_finalize (GObject *object); static void contact_get_property (GObject *object, guint param_id, @@ -77,25 +77,25 @@ enum { static gpointer parent_class = NULL; GType -gossip_contact_get_gtype (void) +empathy_contact_get_gtype (void) { static GType type = 0; if (!type) { static const GTypeInfo info = { - sizeof (GossipContactClass), + sizeof (EmpathyContactClass), NULL, /* base_init */ NULL, /* base_finalize */ (GClassInitFunc) contact_class_init, NULL, /* class_finalize */ NULL, /* class_data */ - sizeof (GossipContact), + sizeof (EmpathyContact), 0, /* n_preallocs */ (GInstanceInitFunc) contact_init }; type = g_type_register_static (G_TYPE_OBJECT, - "GossipContact", + "EmpathyContact", &info, 0); } @@ -103,7 +103,7 @@ gossip_contact_get_gtype (void) } static void -contact_class_init (GossipContactClass *class) +contact_class_init (EmpathyContactClass *class) { GObjectClass *object_class; @@ -135,7 +135,7 @@ contact_class_init (GossipContactClass *class) g_param_spec_boxed ("avatar", "Avatar image", "The avatar image", - GOSSIP_TYPE_AVATAR, + EMPATHY_TYPE_AVATAR, G_PARAM_READWRITE)); g_object_class_install_property (object_class, @@ -151,7 +151,7 @@ contact_class_init (GossipContactClass *class) g_param_spec_object ("presence", "Contact presence", "Presence of contact", - GOSSIP_TYPE_PRESENCE, + EMPATHY_TYPE_PRESENCE, G_PARAM_READWRITE)); g_object_class_install_property (object_class, @@ -166,9 +166,9 @@ contact_class_init (GossipContactClass *class) g_param_spec_int ("subscription", "Contact Subscription", "The subscription status of the contact", - GOSSIP_SUBSCRIPTION_NONE, - GOSSIP_SUBSCRIPTION_BOTH, - GOSSIP_SUBSCRIPTION_NONE, + EMPATHY_SUBSCRIPTION_NONE, + EMPATHY_SUBSCRIPTION_BOTH, + EMPATHY_SUBSCRIPTION_NONE, G_PARAM_READWRITE)); @@ -189,28 +189,28 @@ contact_class_init (GossipContactClass *class) FALSE, G_PARAM_READWRITE)); - g_type_class_add_private (object_class, sizeof (GossipContactPriv)); + g_type_class_add_private (object_class, sizeof (EmpathyContactPriv)); } static void -contact_init (GossipContact *contact) +contact_init (EmpathyContact *contact) { } static void contact_finalize (GObject *object) { - GossipContactPriv *priv; + EmpathyContactPriv *priv; priv = GET_PRIV (object); - gossip_debug (DEBUG_DOMAIN, "finalize: %p", object); + empathy_debug (DEBUG_DOMAIN, "finalize: %p", object); g_free (priv->name); g_free (priv->id); if (priv->avatar) { - gossip_avatar_unref (priv->avatar); + empathy_avatar_unref (priv->avatar); } if (priv->presence) { @@ -235,18 +235,18 @@ contact_get_property (GObject *object, GValue *value, GParamSpec *pspec) { - GossipContactPriv *priv; + EmpathyContactPriv *priv; priv = GET_PRIV (object); switch (param_id) { case PROP_ID: g_value_set_string (value, - gossip_contact_get_id (GOSSIP_CONTACT (object))); + empathy_contact_get_id (EMPATHY_CONTACT (object))); break; case PROP_NAME: g_value_set_string (value, - gossip_contact_get_name (GOSSIP_CONTACT (object))); + empathy_contact_get_name (EMPATHY_CONTACT (object))); break; case PROP_AVATAR: g_value_set_boxed (value, priv->avatar); @@ -281,45 +281,45 @@ contact_set_property (GObject *object, const GValue *value, GParamSpec *pspec) { - GossipContactPriv *priv; + EmpathyContactPriv *priv; priv = GET_PRIV (object); switch (param_id) { case PROP_ID: - gossip_contact_set_id (GOSSIP_CONTACT (object), + empathy_contact_set_id (EMPATHY_CONTACT (object), g_value_get_string (value)); break; case PROP_NAME: - gossip_contact_set_name (GOSSIP_CONTACT (object), + empathy_contact_set_name (EMPATHY_CONTACT (object), g_value_get_string (value)); break; case PROP_AVATAR: - gossip_contact_set_avatar (GOSSIP_CONTACT (object), + empathy_contact_set_avatar (EMPATHY_CONTACT (object), g_value_get_boxed (value)); break; case PROP_ACCOUNT: - gossip_contact_set_account (GOSSIP_CONTACT (object), + empathy_contact_set_account (EMPATHY_CONTACT (object), MC_ACCOUNT (g_value_get_object (value))); break; case PROP_PRESENCE: - gossip_contact_set_presence (GOSSIP_CONTACT (object), - GOSSIP_PRESENCE (g_value_get_object (value))); + empathy_contact_set_presence (EMPATHY_CONTACT (object), + EMPATHY_PRESENCE (g_value_get_object (value))); break; case PROP_GROUPS: - gossip_contact_set_groups (GOSSIP_CONTACT (object), + empathy_contact_set_groups (EMPATHY_CONTACT (object), g_value_get_pointer (value)); break; case PROP_SUBSCRIPTION: - gossip_contact_set_subscription (GOSSIP_CONTACT (object), + empathy_contact_set_subscription (EMPATHY_CONTACT (object), g_value_get_int (value)); break; case PROP_HANDLE: - gossip_contact_set_handle (GOSSIP_CONTACT (object), + empathy_contact_set_handle (EMPATHY_CONTACT (object), g_value_get_uint (value)); break; case PROP_IS_USER: - gossip_contact_set_is_user (GOSSIP_CONTACT (object), + empathy_contact_set_is_user (EMPATHY_CONTACT (object), g_value_get_boolean (value)); break; default: @@ -328,20 +328,20 @@ contact_set_property (GObject *object, }; } -GossipContact * -gossip_contact_new (McAccount *account) +EmpathyContact * +empathy_contact_new (McAccount *account) { - return g_object_new (GOSSIP_TYPE_CONTACT, + return g_object_new (EMPATHY_TYPE_CONTACT, "account", account, NULL); } -GossipContact * -gossip_contact_new_full (McAccount *account, +EmpathyContact * +empathy_contact_new_full (McAccount *account, const gchar *id, const gchar *name) { - return g_object_new (GOSSIP_TYPE_CONTACT, + return g_object_new (EMPATHY_TYPE_CONTACT, "account", account, "name", name, "id", id, @@ -349,11 +349,11 @@ gossip_contact_new_full (McAccount *account, } const gchar * -gossip_contact_get_id (GossipContact *contact) +empathy_contact_get_id (EmpathyContact *contact) { - GossipContactPriv *priv; + EmpathyContactPriv *priv; - g_return_val_if_fail (GOSSIP_IS_CONTACT (contact), ""); + g_return_val_if_fail (EMPATHY_IS_CONTACT (contact), ""); priv = GET_PRIV (contact); @@ -365,27 +365,27 @@ gossip_contact_get_id (GossipContact *contact) } const gchar * -gossip_contact_get_name (GossipContact *contact) +empathy_contact_get_name (EmpathyContact *contact) { - GossipContactPriv *priv; + EmpathyContactPriv *priv; - g_return_val_if_fail (GOSSIP_IS_CONTACT (contact), ""); + g_return_val_if_fail (EMPATHY_IS_CONTACT (contact), ""); priv = GET_PRIV (contact); if (G_STR_EMPTY (priv->name)) { - return gossip_contact_get_id (contact); + return empathy_contact_get_id (contact); } return priv->name; } -GossipAvatar * -gossip_contact_get_avatar (GossipContact *contact) +EmpathyAvatar * +empathy_contact_get_avatar (EmpathyContact *contact) { - GossipContactPriv *priv; + EmpathyContactPriv *priv; - g_return_val_if_fail (GOSSIP_IS_CONTACT (contact), NULL); + g_return_val_if_fail (EMPATHY_IS_CONTACT (contact), NULL); priv = GET_PRIV (contact); @@ -393,23 +393,23 @@ gossip_contact_get_avatar (GossipContact *contact) } McAccount * -gossip_contact_get_account (GossipContact *contact) +empathy_contact_get_account (EmpathyContact *contact) { - GossipContactPriv *priv; + EmpathyContactPriv *priv; - g_return_val_if_fail (GOSSIP_IS_CONTACT (contact), NULL); + g_return_val_if_fail (EMPATHY_IS_CONTACT (contact), NULL); priv = GET_PRIV (contact); return priv->account; } -GossipPresence * -gossip_contact_get_presence (GossipContact *contact) +EmpathyPresence * +empathy_contact_get_presence (EmpathyContact *contact) { - GossipContactPriv *priv; + EmpathyContactPriv *priv; - g_return_val_if_fail (GOSSIP_IS_CONTACT (contact), NULL); + g_return_val_if_fail (EMPATHY_IS_CONTACT (contact), NULL); priv = GET_PRIV (contact); @@ -417,24 +417,24 @@ gossip_contact_get_presence (GossipContact *contact) } GList * -gossip_contact_get_groups (GossipContact *contact) +empathy_contact_get_groups (EmpathyContact *contact) { - GossipContactPriv *priv; + EmpathyContactPriv *priv; - g_return_val_if_fail (GOSSIP_IS_CONTACT (contact), NULL); + g_return_val_if_fail (EMPATHY_IS_CONTACT (contact), NULL); priv = GET_PRIV (contact); return priv->groups; } -GossipSubscription -gossip_contact_get_subscription (GossipContact *contact) +EmpathySubscription +empathy_contact_get_subscription (EmpathyContact *contact) { - GossipContactPriv *priv; + EmpathyContactPriv *priv; - g_return_val_if_fail (GOSSIP_IS_CONTACT (contact), - GOSSIP_SUBSCRIPTION_NONE); + g_return_val_if_fail (EMPATHY_IS_CONTACT (contact), + EMPATHY_SUBSCRIPTION_NONE); priv = GET_PRIV (contact); @@ -442,11 +442,11 @@ gossip_contact_get_subscription (GossipContact *contact) } guint -gossip_contact_get_handle (GossipContact *contact) +empathy_contact_get_handle (EmpathyContact *contact) { - GossipContactPriv *priv; + EmpathyContactPriv *priv; - g_return_val_if_fail (GOSSIP_IS_CONTACT (contact), 0); + g_return_val_if_fail (EMPATHY_IS_CONTACT (contact), 0); priv = GET_PRIV (contact); @@ -454,11 +454,11 @@ gossip_contact_get_handle (GossipContact *contact) } gboolean -gossip_contact_is_user (GossipContact *contact) +empathy_contact_is_user (EmpathyContact *contact) { - GossipContactPriv *priv; + EmpathyContactPriv *priv; - g_return_val_if_fail (GOSSIP_IS_CONTACT (contact), FALSE); + g_return_val_if_fail (EMPATHY_IS_CONTACT (contact), FALSE); priv = GET_PRIV (contact); @@ -466,12 +466,12 @@ gossip_contact_is_user (GossipContact *contact) } void -gossip_contact_set_id (GossipContact *contact, +empathy_contact_set_id (EmpathyContact *contact, const gchar *id) { - GossipContactPriv *priv; + EmpathyContactPriv *priv; - g_return_if_fail (GOSSIP_IS_CONTACT (contact)); + g_return_if_fail (EMPATHY_IS_CONTACT (contact)); g_return_if_fail (id != NULL); priv = GET_PRIV (contact); @@ -487,12 +487,12 @@ gossip_contact_set_id (GossipContact *contact, } void -gossip_contact_set_name (GossipContact *contact, +empathy_contact_set_name (EmpathyContact *contact, const gchar *name) { - GossipContactPriv *priv; + EmpathyContactPriv *priv; - g_return_if_fail (GOSSIP_IS_CONTACT (contact)); + g_return_if_fail (EMPATHY_IS_CONTACT (contact)); g_return_if_fail (name != NULL); priv = GET_PRIV (contact); @@ -508,12 +508,12 @@ gossip_contact_set_name (GossipContact *contact, } void -gossip_contact_set_avatar (GossipContact *contact, - GossipAvatar *avatar) +empathy_contact_set_avatar (EmpathyContact *contact, + EmpathyAvatar *avatar) { - GossipContactPriv *priv; + EmpathyContactPriv *priv; - g_return_if_fail (GOSSIP_IS_CONTACT (contact)); + g_return_if_fail (EMPATHY_IS_CONTACT (contact)); priv = GET_PRIV (contact); @@ -522,24 +522,24 @@ gossip_contact_set_avatar (GossipContact *contact, } if (priv->avatar) { - gossip_avatar_unref (priv->avatar); + empathy_avatar_unref (priv->avatar); priv->avatar = NULL; } if (avatar) { - priv->avatar = gossip_avatar_ref (avatar); + priv->avatar = empathy_avatar_ref (avatar); } g_object_notify (G_OBJECT (contact), "avatar"); } void -gossip_contact_set_account (GossipContact *contact, +empathy_contact_set_account (EmpathyContact *contact, McAccount *account) { - GossipContactPriv *priv; + EmpathyContactPriv *priv; - g_return_if_fail (GOSSIP_IS_CONTACT (contact)); + g_return_if_fail (EMPATHY_IS_CONTACT (contact)); g_return_if_fail (MC_IS_ACCOUNT (account)); priv = GET_PRIV (contact); @@ -557,12 +557,12 @@ gossip_contact_set_account (GossipContact *contact, } void -gossip_contact_set_presence (GossipContact *contact, - GossipPresence *presence) +empathy_contact_set_presence (EmpathyContact *contact, + EmpathyPresence *presence) { - GossipContactPriv *priv; + EmpathyContactPriv *priv; - g_return_if_fail (GOSSIP_IS_CONTACT (contact)); + g_return_if_fail (EMPATHY_IS_CONTACT (contact)); priv = GET_PRIV (contact); @@ -583,13 +583,13 @@ gossip_contact_set_presence (GossipContact *contact, } void -gossip_contact_set_groups (GossipContact *contact, +empathy_contact_set_groups (EmpathyContact *contact, GList *groups) { - GossipContactPriv *priv; + EmpathyContactPriv *priv; GList *old_groups, *l; - g_return_if_fail (GOSSIP_IS_CONTACT (contact)); + g_return_if_fail (EMPATHY_IS_CONTACT (contact)); priv = GET_PRIV (contact); @@ -608,12 +608,12 @@ gossip_contact_set_groups (GossipContact *contact, } void -gossip_contact_set_subscription (GossipContact *contact, - GossipSubscription subscription) +empathy_contact_set_subscription (EmpathyContact *contact, + EmpathySubscription subscription) { - GossipContactPriv *priv; + EmpathyContactPriv *priv; - g_return_if_fail (GOSSIP_IS_CONTACT (contact)); + g_return_if_fail (EMPATHY_IS_CONTACT (contact)); priv = GET_PRIV (contact); @@ -627,12 +627,12 @@ gossip_contact_set_subscription (GossipContact *contact, } void -gossip_contact_set_handle (GossipContact *contact, +empathy_contact_set_handle (EmpathyContact *contact, guint handle) { - GossipContactPriv *priv; + EmpathyContactPriv *priv; - g_return_if_fail (GOSSIP_IS_CONTACT (contact)); + g_return_if_fail (EMPATHY_IS_CONTACT (contact)); priv = GET_PRIV (contact); @@ -646,12 +646,12 @@ gossip_contact_set_handle (GossipContact *contact, } void -gossip_contact_set_is_user (GossipContact *contact, +empathy_contact_set_is_user (EmpathyContact *contact, gboolean is_user) { - GossipContactPriv *priv; + EmpathyContactPriv *priv; - g_return_if_fail (GOSSIP_IS_CONTACT (contact)); + g_return_if_fail (EMPATHY_IS_CONTACT (contact)); priv = GET_PRIV (contact); @@ -665,12 +665,12 @@ gossip_contact_set_is_user (GossipContact *contact, } void -gossip_contact_add_group (GossipContact *contact, +empathy_contact_add_group (EmpathyContact *contact, const gchar *group) { - GossipContactPriv *priv; + EmpathyContactPriv *priv; - g_return_if_fail (GOSSIP_IS_CONTACT (contact)); + g_return_if_fail (EMPATHY_IS_CONTACT (contact)); g_return_if_fail (group != NULL); priv = GET_PRIV (contact); @@ -682,13 +682,13 @@ gossip_contact_add_group (GossipContact *contact, } void -gossip_contact_remove_group (GossipContact *contact, +empathy_contact_remove_group (EmpathyContact *contact, const gchar *group) { - GossipContactPriv *priv; + EmpathyContactPriv *priv; GList *l; - g_return_if_fail (GOSSIP_IS_CONTACT (contact)); + g_return_if_fail (EMPATHY_IS_CONTACT (contact)); g_return_if_fail (group != NULL); priv = GET_PRIV (contact); @@ -702,11 +702,11 @@ gossip_contact_remove_group (GossipContact *contact, } gboolean -gossip_contact_is_online (GossipContact *contact) +empathy_contact_is_online (EmpathyContact *contact) { - GossipContactPriv *priv; + EmpathyContactPriv *priv; - g_return_val_if_fail (GOSSIP_IS_CONTACT (contact), FALSE); + g_return_val_if_fail (EMPATHY_IS_CONTACT (contact), FALSE); priv = GET_PRIV (contact); @@ -714,16 +714,16 @@ gossip_contact_is_online (GossipContact *contact) return FALSE; } - return (gossip_presence_get_state (priv->presence) > MC_PRESENCE_OFFLINE); + return (empathy_presence_get_state (priv->presence) > MC_PRESENCE_OFFLINE); } gboolean -gossip_contact_is_in_group (GossipContact *contact, +empathy_contact_is_in_group (EmpathyContact *contact, const gchar *group) { - GossipContactPriv *priv; + EmpathyContactPriv *priv; - g_return_val_if_fail (GOSSIP_IS_CONTACT (contact), FALSE); + g_return_val_if_fail (EMPATHY_IS_CONTACT (contact), FALSE); g_return_val_if_fail (!G_STR_EMPTY (group), FALSE); priv = GET_PRIV (contact); @@ -736,33 +736,33 @@ gossip_contact_is_in_group (GossipContact *contact, } const gchar * -gossip_contact_get_status (GossipContact *contact) +empathy_contact_get_status (EmpathyContact *contact) { - GossipContactPriv *priv; + EmpathyContactPriv *priv; - g_return_val_if_fail (GOSSIP_IS_CONTACT (contact), ""); + g_return_val_if_fail (EMPATHY_IS_CONTACT (contact), ""); priv = GET_PRIV (contact); if (priv->presence) { const gchar *status; - status = gossip_presence_get_status (priv->presence); + status = empathy_presence_get_status (priv->presence); if (!status) { McPresence state; - state = gossip_presence_get_state (priv->presence); - status = gossip_presence_state_get_default_status (state); + state = empathy_presence_get_state (priv->presence); + status = empathy_presence_state_get_default_status (state); } return status; } - return gossip_presence_state_get_default_status (MC_PRESENCE_OFFLINE); + return empathy_presence_state_get_default_status (MC_PRESENCE_OFFLINE); } gboolean -gossip_contact_equal (gconstpointer v1, +empathy_contact_equal (gconstpointer v1, gconstpointer v2) { McAccount *account_a; @@ -770,30 +770,30 @@ gossip_contact_equal (gconstpointer v1, const gchar *id_a; const gchar *id_b; - g_return_val_if_fail (GOSSIP_IS_CONTACT (v1), FALSE); - g_return_val_if_fail (GOSSIP_IS_CONTACT (v2), FALSE); + g_return_val_if_fail (EMPATHY_IS_CONTACT (v1), FALSE); + g_return_val_if_fail (EMPATHY_IS_CONTACT (v2), FALSE); - account_a = gossip_contact_get_account (GOSSIP_CONTACT (v1)); - account_b = gossip_contact_get_account (GOSSIP_CONTACT (v2)); + account_a = empathy_contact_get_account (EMPATHY_CONTACT (v1)); + account_b = empathy_contact_get_account (EMPATHY_CONTACT (v2)); - id_a = gossip_contact_get_id (GOSSIP_CONTACT (v1)); - id_b = gossip_contact_get_id (GOSSIP_CONTACT (v2)); + id_a = empathy_contact_get_id (EMPATHY_CONTACT (v1)); + id_b = empathy_contact_get_id (EMPATHY_CONTACT (v2)); - return gossip_account_equal (account_a, account_b) && g_str_equal (id_a, id_b); + return empathy_account_equal (account_a, account_b) && g_str_equal (id_a, id_b); } guint -gossip_contact_hash (gconstpointer key) +empathy_contact_hash (gconstpointer key) { - GossipContactPriv *priv; + EmpathyContactPriv *priv; guint hash; - g_return_val_if_fail (GOSSIP_IS_CONTACT (key), +1); + g_return_val_if_fail (EMPATHY_IS_CONTACT (key), +1); - priv = GET_PRIV (GOSSIP_CONTACT (key)); + priv = GET_PRIV (EMPATHY_CONTACT (key)); - hash = gossip_account_hash (gossip_contact_get_account (GOSSIP_CONTACT (key))); - hash += g_str_hash (gossip_contact_get_id (GOSSIP_CONTACT (key))); + hash = empathy_account_hash (empathy_contact_get_account (EMPATHY_CONTACT (key))); + hash += g_str_hash (empathy_contact_get_id (EMPATHY_CONTACT (key))); return hash; } diff --git a/libempathy/empathy-contact.h b/libempathy/empathy-contact.h new file mode 100644 index 000000000..b32d451bb --- /dev/null +++ b/libempathy/empathy-contact.h @@ -0,0 +1,106 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ +/* + * Copyright (C) 2004 Imendio AB + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This program 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 + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#ifndef __EMPATHY_CONTACT_H__ +#define __EMPATHY_CONTACT_H__ + +#include <glib-object.h> + +#include <libmissioncontrol/mc-account.h> + +#include "empathy-avatar.h" +#include "empathy-presence.h" + +G_BEGIN_DECLS + +#define EMPATHY_TYPE_CONTACT (empathy_contact_get_gtype ()) +#define EMPATHY_CONTACT(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), EMPATHY_TYPE_CONTACT, EmpathyContact)) +#define EMPATHY_CONTACT_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), EMPATHY_TYPE_CONTACT, EmpathyContactClass)) +#define EMPATHY_IS_CONTACT(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), EMPATHY_TYPE_CONTACT)) +#define EMPATHY_IS_CONTACT_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), EMPATHY_TYPE_CONTACT)) +#define EMPATHY_CONTACT_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), EMPATHY_TYPE_CONTACT, EmpathyContactClass)) + +typedef struct _EmpathyContact EmpathyContact; +typedef struct _EmpathyContactClass EmpathyContactClass; + +struct _EmpathyContact { + GObject parent; +}; + +struct _EmpathyContactClass { + GObjectClass parent_class; +}; + +typedef enum { + EMPATHY_SUBSCRIPTION_NONE = 0, + EMPATHY_SUBSCRIPTION_TO = 1 << 0, /* We send our presence to that contact */ + EMPATHY_SUBSCRIPTION_FROM = 1 << 1, /* That contact sends his presence to us */ + EMPATHY_SUBSCRIPTION_BOTH = EMPATHY_SUBSCRIPTION_TO | EMPATHY_SUBSCRIPTION_FROM +} EmpathySubscription; + +GType empathy_contact_get_gtype (void) G_GNUC_CONST; + +EmpathyContact * empathy_contact_new (McAccount *account); +EmpathyContact * empathy_contact_new_full (McAccount *account, + const gchar *id, + const gchar *name); +const gchar * empathy_contact_get_id (EmpathyContact *contact); +const gchar * empathy_contact_get_name (EmpathyContact *contact); +EmpathyAvatar * empathy_contact_get_avatar (EmpathyContact *contact); +McAccount * empathy_contact_get_account (EmpathyContact *contact); +EmpathyPresence * empathy_contact_get_presence (EmpathyContact *contact); +GList * empathy_contact_get_groups (EmpathyContact *contact); +EmpathySubscription empathy_contact_get_subscription (EmpathyContact *contact); +guint empathy_contact_get_handle (EmpathyContact *contact); +gboolean empathy_contact_is_user (EmpathyContact *contact); +void empathy_contact_set_id (EmpathyContact *contact, + const gchar *id); +void empathy_contact_set_name (EmpathyContact *contact, + const gchar *name); +void empathy_contact_set_avatar (EmpathyContact *contact, + EmpathyAvatar *avatar); +void empathy_contact_set_account (EmpathyContact *contact, + McAccount *account); +void empathy_contact_set_presence (EmpathyContact *contact, + EmpathyPresence *presence); +void empathy_contact_set_groups (EmpathyContact *contact, + GList *categories); +void empathy_contact_set_subscription (EmpathyContact *contact, + EmpathySubscription subscription); +void empathy_contact_set_handle (EmpathyContact *contact, + guint handle); +void empathy_contact_set_is_user (EmpathyContact *contact, + gboolean is_user); +void empathy_contact_add_group (EmpathyContact *contact, + const gchar *group); +void empathy_contact_remove_group (EmpathyContact *contact, + const gchar *group); +gboolean empathy_contact_is_online (EmpathyContact *contact); +gboolean empathy_contact_is_in_group (EmpathyContact *contact, + const gchar *group); +const gchar * empathy_contact_get_status (EmpathyContact *contact); +gboolean empathy_contact_equal (gconstpointer v1, + gconstpointer v2); +guint empathy_contact_hash (gconstpointer key); + +G_END_DECLS + +#endif /* __EMPATHY_CONTACT_H__ */ + diff --git a/libempathy/gossip-debug.c b/libempathy/empathy-debug.c index a6bbeea2a..2f5658499 100644 --- a/libempathy/gossip-debug.c +++ b/libempathy/empathy-debug.c @@ -32,7 +32,7 @@ * to get all debug output. */ -#include "gossip-debug.h" +#include "empathy-debug.h" static gchar **debug_strv; static gboolean all_domains = FALSE; @@ -65,7 +65,7 @@ debug_init (void) } void -gossip_debug_impl (const gchar *domain, const gchar *msg, ...) +empathy_debug_impl (const gchar *domain, const gchar *msg, ...) { gint i; diff --git a/libempathy/gossip-debug.h b/libempathy/empathy-debug.h index 39dae0f1c..19d2aa380 100644 --- a/libempathy/gossip-debug.h +++ b/libempathy/empathy-debug.h @@ -18,36 +18,36 @@ * Boston, MA 02111-1307, USA. */ -#ifndef __GOSSIP_DEBUG_H__ -#define __GOSSIP_DEBUG_H__ +#ifndef __EMPATHY_DEBUG_H__ +#define __EMPATHY_DEBUG_H__ #include <glib.h> G_BEGIN_DECLS #ifdef G_HAVE_ISO_VARARGS -# ifdef GOSSIP_DISABLE_DEBUG -# define gossip_debug(...) +# ifdef EMPATHY_DISABLE_DEBUG +# define empathy_debug(...) # else -# define gossip_debug(...) gossip_debug_impl (__VA_ARGS__) +# define empathy_debug(...) empathy_debug_impl (__VA_ARGS__) # endif #elif defined(G_HAVE_GNUC_VARARGS) -# if GOSSIP_DISABLE_DEBUG -# define gossip_debug(fmt...) +# if EMPATHY_DISABLE_DEBUG +# define empathy_debug(fmt...) # else -# define gossip_debug(fmt...) gossip_debug_impl(fmt) +# define empathy_debug(fmt...) empathy_debug_impl(fmt) # endif #else -# if GOSSIP_DISABLE_DEBUG -# define gossip_debug(x) +# if EMPATHY_DISABLE_DEBUG +# define empathy_debug(x) # else -# define gossip_debug gossip_debug_impl +# define empathy_debug empathy_debug_impl # endif #endif -void gossip_debug_impl (const gchar *domain, const gchar *msg, ...); +void empathy_debug_impl (const gchar *domain, const gchar *msg, ...); G_END_DECLS -#endif /* __GOSSIP_DEBUG_H__ */ +#endif /* __EMPATHY_DEBUG_H__ */ diff --git a/libempathy/empathy-idle.c b/libempathy/empathy-idle.c index 8150effd3..5b04d363f 100644 --- a/libempathy/empathy-idle.c +++ b/libempathy/empathy-idle.c @@ -30,8 +30,8 @@ #include <libtelepathy/tp-helpers.h> #include "empathy-idle.h" -#include "gossip-utils.h" -#include "gossip-debug.h" +#include "empathy-utils.h" +#include "empathy-debug.h" #define GET_PRIV(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), \ EMPATHY_TYPE_IDLE, EmpathyIdlePriv)) @@ -144,7 +144,7 @@ empathy_idle_init (EmpathyIdle *idle) priv = GET_PRIV (idle); priv->is_idle = FALSE; - priv->mc = gossip_mission_control_new (); + priv->mc = empathy_mission_control_new (); priv->state = mission_control_get_presence_actual (priv->mc, NULL); idle_presence_changed_cb (priv->mc, priv->state, idle); @@ -165,13 +165,13 @@ empathy_idle_init (EmpathyIdle *idle) G_CALLBACK (idle_session_idle_changed_cb), idle, NULL); } else { - gossip_debug (DEBUG_DOMAIN, "Failed to get gs proxy"); + empathy_debug (DEBUG_DOMAIN, "Failed to get gs proxy"); } system_bus = dbus_g_bus_get (DBUS_BUS_SYSTEM, &error); if (!system_bus) { - gossip_debug (DEBUG_DOMAIN, "Failed to get system bus: %s", + empathy_debug (DEBUG_DOMAIN, "Failed to get system bus: %s", error ? error->message : "No error given"); } else { priv->nm_proxy = dbus_g_proxy_new_for_name (system_bus, @@ -186,7 +186,7 @@ empathy_idle_init (EmpathyIdle *idle) G_CALLBACK (idle_nm_state_change_cb), idle, NULL); } else { - gossip_debug (DEBUG_DOMAIN, "Failed to get nm proxy"); + empathy_debug (DEBUG_DOMAIN, "Failed to get nm proxy"); } /* FIXME: get value */ priv->nm_connected = TRUE; @@ -310,7 +310,7 @@ empathy_idle_get_status (EmpathyIdle *idle) priv = GET_PRIV (idle); if (!priv->status) { - return gossip_presence_state_get_default_status (priv->state); + return empathy_presence_state_get_default_status (priv->state); } return priv->status; @@ -371,7 +371,7 @@ empathy_idle_set_presence (EmpathyIdle *idle, } /* Do not set translated default messages */ - default_status = gossip_presence_state_get_default_status (state); + default_status = empathy_presence_state_get_default_status (state); if (status && strcmp (status, default_status) == 0) { status = NULL; } @@ -413,7 +413,7 @@ idle_session_idle_changed_cb (DBusGProxy *gs_proxy, priv = GET_PRIV (idle); - gossip_debug (DEBUG_DOMAIN, "Session idle state changed, %s -> %s", + empathy_debug (DEBUG_DOMAIN, "Session idle state changed, %s -> %s", priv->is_idle ? "yes" : "no", is_idle ? "yes" : "no"); @@ -441,7 +441,7 @@ idle_session_idle_changed_cb (DBusGProxy *gs_proxy, priv->saved_status = g_strdup (priv->status); } - gossip_debug (DEBUG_DOMAIN, "Going to autoaway"); + empathy_debug (DEBUG_DOMAIN, "Going to autoaway"); empathy_idle_set_state (idle, new_state); idle_ext_away_start (idle); @@ -449,7 +449,7 @@ idle_session_idle_changed_cb (DBusGProxy *gs_proxy, /* We are no more idle, restore state */ idle_ext_away_stop (idle); - gossip_debug (DEBUG_DOMAIN, "Restoring state to %d %s", + empathy_debug (DEBUG_DOMAIN, "Restoring state to %d %s", priv->saved_state, priv->saved_status); @@ -473,7 +473,7 @@ idle_nm_state_change_cb (DBusGProxy *proxy, priv = GET_PRIV (idle); - gossip_debug (DEBUG_DOMAIN, "New network state (%d)", state); + empathy_debug (DEBUG_DOMAIN, "New network state (%d)", state); if (state != NM_STATE_CONNECTED && priv->state > MC_PRESENCE_OFFLINE) { @@ -529,7 +529,7 @@ idle_ext_away_cb (EmpathyIdle *idle) priv = GET_PRIV (idle); - gossip_debug (DEBUG_DOMAIN, "Going to extended autoaway"); + empathy_debug (DEBUG_DOMAIN, "Going to extended autoaway"); empathy_idle_set_state (idle, MC_PRESENCE_EXTENDED_AWAY); priv->ext_away_timeout = 0; diff --git a/libempathy/empathy-log-manager.c b/libempathy/empathy-log-manager.c index afb40a533..f7e3540fc 100644 --- a/libempathy/empathy-log-manager.c +++ b/libempathy/empathy-log-manager.c @@ -27,10 +27,10 @@ #include <glib/gstdio.h> #include "empathy-log-manager.h" -#include "gossip-contact.h" -#include "gossip-time.h" -#include "gossip-debug.h" -#include "gossip-utils.h" +#include "empathy-contact.h" +#include "empathy-time.h" +#include "empathy-debug.h" +#include "empathy-utils.h" #define GET_PRIV(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), \ EMPATHY_TYPE_LOG_MANAGER, EmpathyLogManagerPriv)) @@ -45,7 +45,7 @@ #define LOG_TIME_FORMAT "%Y%m%d" #define LOG_HEADER \ "<?xml version='1.0' encoding='utf-8'?>\n" \ - "<?xml-stylesheet type=\"text/xsl\" href=\"gossip-log.xsl\"?>\n" \ + "<?xml-stylesheet type=\"text/xsl\" href=\"empathy-log.xsl\"?>\n" \ "<log>\n" #define LOG_FOOTER \ @@ -78,7 +78,7 @@ static gchar * log_manager_get_filename_for_date (EmpathyLogMa gboolean chatroom, const gchar *date); static gchar * log_manager_get_timestamp_filename (void); -static gchar * log_manager_get_timestamp_from_message (GossipMessage *message); +static gchar * log_manager_get_timestamp_from_message (EmpathyMessage *message); static EmpathyLogSearchHit *log_manager_search_hit_new (EmpathyLogManager *manager, const gchar *filename); @@ -128,11 +128,11 @@ void empathy_log_manager_add_message (EmpathyLogManager *manager, const gchar *chat_id, gboolean chatroom, - GossipMessage *message) + EmpathyMessage *message) { FILE *file; McAccount *account; - GossipContact *sender; + EmpathyContact *sender; const gchar *body_str; const gchar *str; gchar *filename; @@ -144,11 +144,11 @@ empathy_log_manager_add_message (EmpathyLogManager *manager, g_return_if_fail (EMPATHY_IS_LOG_MANAGER (manager)); g_return_if_fail (chat_id != NULL); - g_return_if_fail (GOSSIP_IS_MESSAGE (message)); + g_return_if_fail (EMPATHY_IS_MESSAGE (message)); - sender = gossip_message_get_sender (message); - account = gossip_contact_get_account (sender); - body_str = gossip_message_get_body (message); + sender = empathy_message_get_sender (message); + account = empathy_contact_get_account (sender); + body_str = empathy_message_get_body (message); if (G_STR_EMPTY (body_str)) { return; @@ -157,13 +157,13 @@ empathy_log_manager_add_message (EmpathyLogManager *manager, filename = log_manager_get_filename (manager, account, chat_id, chatroom); basedir = g_path_get_dirname (filename); if (!g_file_test (basedir, G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR)) { - gossip_debug (DEBUG_DOMAIN, "Creating directory:'%s'", basedir); + empathy_debug (DEBUG_DOMAIN, "Creating directory:'%s'", basedir); g_mkdir_with_parents (basedir, LOG_DIR_CREATE_MODE); } g_free (basedir); - gossip_debug (DEBUG_DOMAIN, "Adding message: '%s' to file: '%s'", + empathy_debug (DEBUG_DOMAIN, "Adding message: '%s' to file: '%s'", body_str, filename); if (!g_file_test (filename, G_FILE_TEST_EXISTS)) { @@ -182,10 +182,10 @@ empathy_log_manager_add_message (EmpathyLogManager *manager, body = g_markup_escape_text (body_str, -1); timestamp = log_manager_get_timestamp_from_message (message); - str = gossip_contact_get_name (sender); + str = empathy_contact_get_name (sender); contact_name = g_markup_escape_text (str, -1); - str = gossip_contact_get_id (sender); + str = empathy_contact_get_id (sender); contact_id = g_markup_escape_text (str, -1); g_fprintf (file, @@ -193,7 +193,7 @@ empathy_log_manager_add_message (EmpathyLogManager *manager, timestamp, contact_id, contact_name, - gossip_contact_is_user (sender) ? "true" : "false", + empathy_contact_is_user (sender) ? "true" : "false", body); fclose (file); @@ -240,12 +240,12 @@ empathy_log_manager_get_dates (EmpathyLogManager *manager, directory = log_manager_get_dir (manager, account, chat_id, chatroom); dir = g_dir_open (directory, 0, NULL); if (!dir) { - gossip_debug (DEBUG_DOMAIN, "Could not open directory:'%s'", directory); + empathy_debug (DEBUG_DOMAIN, "Could not open directory:'%s'", directory); g_free (directory); return NULL; } - gossip_debug (DEBUG_DOMAIN, "Collating a list of dates in:'%s'", directory); + empathy_debug (DEBUG_DOMAIN, "Collating a list of dates in:'%s'", directory); while ((filename = g_dir_read_name (dir)) != NULL) { if (!g_str_has_suffix (filename, LOG_FILENAME_SUFFIX)) { @@ -264,7 +264,7 @@ empathy_log_manager_get_dates (EmpathyLogManager *manager, g_free (directory); g_dir_close (dir); - gossip_debug (DEBUG_DOMAIN, "Parsed %d dates", g_list_length (dates)); + empathy_debug (DEBUG_DOMAIN, "Parsed %d dates", g_list_length (dates)); return dates; } @@ -289,10 +289,10 @@ empathy_log_manager_get_messages_for_date (EmpathyLogManager *manager, filename = log_manager_get_filename_for_date (manager, account, chat_id, chatroom, date); - gossip_debug (DEBUG_DOMAIN, "Attempting to parse filename:'%s'...", filename); + empathy_debug (DEBUG_DOMAIN, "Attempting to parse filename:'%s'...", filename); if (!g_file_test (filename, G_FILE_TEST_EXISTS)) { - gossip_debug (DEBUG_DOMAIN, "Filename:'%s' does not exist", filename); + empathy_debug (DEBUG_DOMAIN, "Filename:'%s' does not exist", filename); g_free (filename); return NULL; } @@ -320,10 +320,10 @@ empathy_log_manager_get_messages_for_date (EmpathyLogManager *manager, /* Now get the messages. */ for (node = log_node->children; node; node = node->next) { - GossipMessage *message; - GossipContact *sender; + EmpathyMessage *message; + EmpathyContact *sender; gchar *time; - GossipTime t; + EmpathyTime t; gchar *sender_id; gchar *sender_name; gchar *body; @@ -344,13 +344,13 @@ empathy_log_manager_get_messages_for_date (EmpathyLogManager *manager, is_user = strcmp (is_user_str, "true") == 0; } - t = gossip_time_parse (time); + t = empathy_time_parse (time); - sender = gossip_contact_new_full (account, sender_id, sender_name); - gossip_contact_set_is_user (sender, is_user); - message = gossip_message_new (body); - gossip_message_set_sender (message, sender); - gossip_message_set_timestamp (message, t); + sender = empathy_contact_new_full (account, sender_id, sender_name); + empathy_contact_set_is_user (sender, is_user); + message = empathy_message_new (body); + empathy_message_set_sender (message, sender); + empathy_message_set_timestamp (message, t); messages = g_list_append (messages, message); @@ -361,7 +361,7 @@ empathy_log_manager_get_messages_for_date (EmpathyLogManager *manager, xmlFree (body); } - gossip_debug (DEBUG_DOMAIN, "Parsed %d messages", g_list_length (messages)); + empathy_debug (DEBUG_DOMAIN, "Parsed %d messages", g_list_length (messages)); g_free (filename); xmlFreeDoc (doc); @@ -430,7 +430,7 @@ empathy_log_manager_search_new (EmpathyLogManager *manager, text_casefold = g_utf8_casefold (text, -1); files = log_manager_get_all_files (manager, NULL); - gossip_debug (DEBUG_DOMAIN, "Found %d log files in total", + empathy_debug (DEBUG_DOMAIN, "Found %d log files in total", g_list_length (files)); for (l = files; l; l = l->next) { @@ -460,7 +460,7 @@ empathy_log_manager_search_new (EmpathyLogManager *manager, if (hit) { hits = g_list_prepend (hits, hit); - gossip_debug (DEBUG_DOMAIN, + empathy_debug (DEBUG_DOMAIN, "Found text:'%s' in file:'%s' on date:'%s'...", text, hit->filename, hit->date); } @@ -503,11 +503,11 @@ empathy_log_manager_search_free (GList *hits) gchar * empathy_log_manager_get_date_readable (const gchar *date) { - GossipTime t; + EmpathyTime t; - t = gossip_time_parse (date); + t = empathy_time_parse (date); - return gossip_time_to_string_local (t, "%a %d %b %Y"); + return empathy_time_to_string_local (t, "%a %d %b %Y"); } static const gchar * @@ -681,12 +681,12 @@ log_manager_get_filename_for_date (EmpathyLogManager *manager, static gchar * log_manager_get_timestamp_filename (void) { - GossipTime t; + EmpathyTime t; gchar *time_str; gchar *filename; - t = gossip_time_get_current (); - time_str = gossip_time_to_string_local (t, LOG_TIME_FORMAT); + t = empathy_time_get_current (); + time_str = empathy_time_to_string_local (t, LOG_TIME_FORMAT); filename = g_strconcat (time_str, LOG_FILENAME_SUFFIX, NULL); g_free (time_str); @@ -695,14 +695,14 @@ log_manager_get_timestamp_filename (void) } static gchar * -log_manager_get_timestamp_from_message (GossipMessage *message) +log_manager_get_timestamp_from_message (EmpathyMessage *message) { - GossipTime t; + EmpathyTime t; - t = gossip_message_get_timestamp (message); + t = empathy_message_get_timestamp (message); /* We keep the timestamps in the messages as UTC. */ - return gossip_time_to_string_utc (t, LOG_TIME_FORMAT_FULL); + return empathy_time_to_string_utc (t, LOG_TIME_FORMAT_FULL); } static EmpathyLogSearchHit * diff --git a/libempathy/empathy-log-manager.h b/libempathy/empathy-log-manager.h index d1a5f431d..67ec19d52 100644 --- a/libempathy/empathy-log-manager.h +++ b/libempathy/empathy-log-manager.h @@ -27,7 +27,7 @@ #include <libmissioncontrol/mc-account.h> -#include "gossip-message.h" +#include "empathy-message.h" G_BEGIN_DECLS @@ -64,7 +64,7 @@ EmpathyLogManager *empathy_log_manager_new (void); void empathy_log_manager_add_message (EmpathyLogManager *manager, const gchar *chat_id, gboolean chatroom, - GossipMessage *message); + EmpathyMessage *message); gboolean empathy_log_manager_exists (EmpathyLogManager *manager, McAccount *account, const gchar *chat_id, diff --git a/libempathy/gossip-message.c b/libempathy/empathy-message.c index a46a2a5dc..8b4751ee2 100644 --- a/libempathy/gossip-message.c +++ b/libempathy/empathy-message.c @@ -24,24 +24,24 @@ #include "config.h" -#include "gossip-message.h" +#include "empathy-message.h" -#define GET_PRIV(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), GOSSIP_TYPE_MESSAGE, GossipMessagePriv)) +#define GET_PRIV(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), EMPATHY_TYPE_MESSAGE, EmpathyMessagePriv)) -typedef struct _GossipMessagePriv GossipMessagePriv; +typedef struct _EmpathyMessagePriv EmpathyMessagePriv; -struct _GossipMessagePriv { - GossipMessageType type; - GossipContact *sender; - GossipContact *receiver; +struct _EmpathyMessagePriv { + EmpathyMessageType type; + EmpathyContact *sender; + EmpathyContact *receiver; gchar *body; - GossipTime timestamp; + EmpathyTime timestamp; }; -static void gossip_message_class_init (GossipMessageClass *class); -static void gossip_message_init (GossipMessage *message); -static void gossip_message_finalize (GObject *object); +static void empathy_message_class_init (EmpathyMessageClass *class); +static void empathy_message_init (EmpathyMessage *message); +static void empathy_message_finalize (GObject *object); static void message_get_property (GObject *object, guint param_id, GValue *value, @@ -63,25 +63,25 @@ enum { static gpointer parent_class = NULL; GType -gossip_message_get_gtype (void) +empathy_message_get_gtype (void) { static GType type = 0; if (!type) { static const GTypeInfo info = { - sizeof (GossipMessageClass), + sizeof (EmpathyMessageClass), NULL, /* base_init */ NULL, /* base_finalize */ - (GClassInitFunc) gossip_message_class_init, + (GClassInitFunc) empathy_message_class_init, NULL, /* class_finalize */ NULL, /* class_data */ - sizeof (GossipMessage), + sizeof (EmpathyMessage), 0, /* n_preallocs */ - (GInstanceInitFunc) gossip_message_init + (GInstanceInitFunc) empathy_message_init }; type = g_type_register_static (G_TYPE_OBJECT, - "GossipMessage", + "EmpathyMessage", &info, 0); } @@ -89,14 +89,14 @@ gossip_message_get_gtype (void) } static void -gossip_message_class_init (GossipMessageClass *class) +empathy_message_class_init (EmpathyMessageClass *class) { GObjectClass *object_class; object_class = G_OBJECT_CLASS (class); parent_class = g_type_class_peek_parent (class); - object_class->finalize = gossip_message_finalize; + object_class->finalize = empathy_message_finalize; object_class->get_property = message_get_property; object_class->set_property = message_set_property; @@ -105,23 +105,23 @@ gossip_message_class_init (GossipMessageClass *class) g_param_spec_int ("type", "Message Type", "The type of message", - GOSSIP_MESSAGE_TYPE_NORMAL, - GOSSIP_MESSAGE_TYPE_LAST, - GOSSIP_MESSAGE_TYPE_NORMAL, + EMPATHY_MESSAGE_TYPE_NORMAL, + EMPATHY_MESSAGE_TYPE_LAST, + EMPATHY_MESSAGE_TYPE_NORMAL, G_PARAM_READWRITE)); g_object_class_install_property (object_class, PROP_SENDER, g_param_spec_object ("sender", "Message Sender", "The sender of the message", - GOSSIP_TYPE_CONTACT, + EMPATHY_TYPE_CONTACT, G_PARAM_READWRITE)); g_object_class_install_property (object_class, PROP_RECEIVER, g_param_spec_object ("receiver", "Message Receiver", "The receiver of the message", - GOSSIP_TYPE_CONTACT, + EMPATHY_TYPE_CONTACT, G_PARAM_READWRITE)); g_object_class_install_property (object_class, PROP_BODY, @@ -141,24 +141,24 @@ gossip_message_class_init (GossipMessageClass *class) G_PARAM_READWRITE)); - g_type_class_add_private (object_class, sizeof (GossipMessagePriv)); + g_type_class_add_private (object_class, sizeof (EmpathyMessagePriv)); } static void -gossip_message_init (GossipMessage *message) +empathy_message_init (EmpathyMessage *message) { - GossipMessagePriv *priv; + EmpathyMessagePriv *priv; priv = GET_PRIV (message); - priv->timestamp = gossip_time_get_current (); + priv->timestamp = empathy_time_get_current (); } static void -gossip_message_finalize (GObject *object) +empathy_message_finalize (GObject *object) { - GossipMessagePriv *priv; + EmpathyMessagePriv *priv; priv = GET_PRIV (object); @@ -180,7 +180,7 @@ message_get_property (GObject *object, GValue *value, GParamSpec *pspec) { - GossipMessagePriv *priv; + EmpathyMessagePriv *priv; priv = GET_PRIV (object); @@ -209,25 +209,25 @@ message_set_property (GObject *object, const GValue *value, GParamSpec *pspec) { - GossipMessagePriv *priv; + EmpathyMessagePriv *priv; priv = GET_PRIV (object); switch (param_id) { case PROP_TYPE: - gossip_message_set_type (GOSSIP_MESSAGE (object), + empathy_message_set_type (EMPATHY_MESSAGE (object), g_value_get_int (value)); break; case PROP_SENDER: - gossip_message_set_sender (GOSSIP_MESSAGE (object), - GOSSIP_CONTACT (g_value_get_object (value))); + empathy_message_set_sender (EMPATHY_MESSAGE (object), + EMPATHY_CONTACT (g_value_get_object (value))); break; case PROP_RECEIVER: - gossip_message_set_receiver (GOSSIP_MESSAGE (object), - GOSSIP_CONTACT (g_value_get_object (value))); + empathy_message_set_receiver (EMPATHY_MESSAGE (object), + EMPATHY_CONTACT (g_value_get_object (value))); break; case PROP_BODY: - gossip_message_set_body (GOSSIP_MESSAGE (object), + empathy_message_set_body (EMPATHY_MESSAGE (object), g_value_get_string (value)); break; default: @@ -236,21 +236,21 @@ message_set_property (GObject *object, }; } -GossipMessage * -gossip_message_new (const gchar *body) +EmpathyMessage * +empathy_message_new (const gchar *body) { - return g_object_new (GOSSIP_TYPE_MESSAGE, + return g_object_new (EMPATHY_TYPE_MESSAGE, "body", body, NULL); } -GossipMessageType -gossip_message_get_type (GossipMessage *message) +EmpathyMessageType +empathy_message_get_type (EmpathyMessage *message) { - GossipMessagePriv *priv; + EmpathyMessagePriv *priv; - g_return_val_if_fail (GOSSIP_IS_MESSAGE (message), - GOSSIP_MESSAGE_TYPE_NORMAL); + g_return_val_if_fail (EMPATHY_IS_MESSAGE (message), + EMPATHY_MESSAGE_TYPE_NORMAL); priv = GET_PRIV (message); @@ -258,12 +258,12 @@ gossip_message_get_type (GossipMessage *message) } void -gossip_message_set_type (GossipMessage *message, - GossipMessageType type) +empathy_message_set_type (EmpathyMessage *message, + EmpathyMessageType type) { - GossipMessagePriv *priv; + EmpathyMessagePriv *priv; - g_return_if_fail (GOSSIP_IS_MESSAGE (message)); + g_return_if_fail (EMPATHY_IS_MESSAGE (message)); priv = GET_PRIV (message); @@ -272,12 +272,12 @@ gossip_message_set_type (GossipMessage *message, g_object_notify (G_OBJECT (message), "type"); } -GossipContact * -gossip_message_get_sender (GossipMessage *message) +EmpathyContact * +empathy_message_get_sender (EmpathyMessage *message) { - GossipMessagePriv *priv; + EmpathyMessagePriv *priv; - g_return_val_if_fail (GOSSIP_IS_MESSAGE (message), NULL); + g_return_val_if_fail (EMPATHY_IS_MESSAGE (message), NULL); priv = GET_PRIV (message); @@ -285,13 +285,13 @@ gossip_message_get_sender (GossipMessage *message) } void -gossip_message_set_sender (GossipMessage *message, GossipContact *contact) +empathy_message_set_sender (EmpathyMessage *message, EmpathyContact *contact) { - GossipMessagePriv *priv; - GossipContact *old_sender; + EmpathyMessagePriv *priv; + EmpathyContact *old_sender; - g_return_if_fail (GOSSIP_IS_MESSAGE (message)); - g_return_if_fail (GOSSIP_IS_CONTACT (contact)); + g_return_if_fail (EMPATHY_IS_MESSAGE (message)); + g_return_if_fail (EMPATHY_IS_CONTACT (contact)); priv = GET_PRIV (message); @@ -305,12 +305,12 @@ gossip_message_set_sender (GossipMessage *message, GossipContact *contact) g_object_notify (G_OBJECT (message), "sender"); } -GossipContact * -gossip_message_get_receiver (GossipMessage *message) +EmpathyContact * +empathy_message_get_receiver (EmpathyMessage *message) { - GossipMessagePriv *priv; + EmpathyMessagePriv *priv; - g_return_val_if_fail (GOSSIP_IS_MESSAGE (message), NULL); + g_return_val_if_fail (EMPATHY_IS_MESSAGE (message), NULL); priv = GET_PRIV (message); @@ -318,13 +318,13 @@ gossip_message_get_receiver (GossipMessage *message) } void -gossip_message_set_receiver (GossipMessage *message, GossipContact *contact) +empathy_message_set_receiver (EmpathyMessage *message, EmpathyContact *contact) { - GossipMessagePriv *priv; - GossipContact *old_receiver; + EmpathyMessagePriv *priv; + EmpathyContact *old_receiver; - g_return_if_fail (GOSSIP_IS_MESSAGE (message)); - g_return_if_fail (GOSSIP_IS_CONTACT (contact)); + g_return_if_fail (EMPATHY_IS_MESSAGE (message)); + g_return_if_fail (EMPATHY_IS_CONTACT (contact)); priv = GET_PRIV (message); @@ -339,11 +339,11 @@ gossip_message_set_receiver (GossipMessage *message, GossipContact *contact) } const gchar * -gossip_message_get_body (GossipMessage *message) +empathy_message_get_body (EmpathyMessage *message) { - GossipMessagePriv *priv; + EmpathyMessagePriv *priv; - g_return_val_if_fail (GOSSIP_IS_MESSAGE (message), NULL); + g_return_val_if_fail (EMPATHY_IS_MESSAGE (message), NULL); priv = GET_PRIV (message); @@ -351,22 +351,22 @@ gossip_message_get_body (GossipMessage *message) } void -gossip_message_set_body (GossipMessage *message, +empathy_message_set_body (EmpathyMessage *message, const gchar *body) { - GossipMessagePriv *priv; - GossipMessageType type; + EmpathyMessagePriv *priv; + EmpathyMessageType type; - g_return_if_fail (GOSSIP_IS_MESSAGE (message)); + g_return_if_fail (EMPATHY_IS_MESSAGE (message)); priv = GET_PRIV (message); g_free (priv->body); priv->body = NULL; - type = GOSSIP_MESSAGE_TYPE_NORMAL; + type = EMPATHY_MESSAGE_TYPE_NORMAL; if (g_str_has_prefix (body, "/me")) { - type = GOSSIP_MESSAGE_TYPE_ACTION; + type = EMPATHY_MESSAGE_TYPE_ACTION; body += 4; } else if (g_str_has_prefix (body, "/say")) { @@ -378,18 +378,18 @@ gossip_message_set_body (GossipMessage *message, } if (type != priv->type) { - gossip_message_set_type (message, type); + empathy_message_set_type (message, type); } g_object_notify (G_OBJECT (message), "body"); } -GossipTime -gossip_message_get_timestamp (GossipMessage *message) +EmpathyTime +empathy_message_get_timestamp (EmpathyMessage *message) { - GossipMessagePriv *priv; + EmpathyMessagePriv *priv; - g_return_val_if_fail (GOSSIP_IS_MESSAGE (message), -1); + g_return_val_if_fail (EMPATHY_IS_MESSAGE (message), -1); priv = GET_PRIV (message); @@ -397,18 +397,18 @@ gossip_message_get_timestamp (GossipMessage *message) } void -gossip_message_set_timestamp (GossipMessage *message, - GossipTime timestamp) +empathy_message_set_timestamp (EmpathyMessage *message, + EmpathyTime timestamp) { - GossipMessagePriv *priv; + EmpathyMessagePriv *priv; - g_return_if_fail (GOSSIP_IS_MESSAGE (message)); + g_return_if_fail (EMPATHY_IS_MESSAGE (message)); g_return_if_fail (timestamp >= -1); priv = GET_PRIV (message); if (timestamp <= 0) { - priv->timestamp = gossip_time_get_current (); + priv->timestamp = empathy_time_get_current (); } else { priv->timestamp = timestamp; } diff --git a/libempathy/empathy-message.h b/libempathy/empathy-message.h new file mode 100644 index 000000000..ba6f4c426 --- /dev/null +++ b/libempathy/empathy-message.h @@ -0,0 +1,82 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ +/* + * Copyright (C) 2004-2007 Imendio AB + * Copyright (C) 2007 Collabora Ltd. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This program 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 + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + * + * Authors: Mikael Hallendal <micke@imendio.com> + * Xavier Claessens <xclaesse@gmail.com> + */ + +#ifndef __EMPATHY_MESSAGE_H__ +#define __EMPATHY_MESSAGE_H__ + +#include <glib-object.h> + +#include "empathy-contact.h" +#include "empathy-time.h" + +G_BEGIN_DECLS + +#define EMPATHY_TYPE_MESSAGE (empathy_message_get_gtype ()) +#define EMPATHY_MESSAGE(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), EMPATHY_TYPE_MESSAGE, EmpathyMessage)) +#define EMPATHY_MESSAGE_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), EMPATHY_TYPE_MESSAGE, EmpathyMessageClass)) +#define EMPATHY_IS_MESSAGE(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), EMPATHY_TYPE_MESSAGE)) +#define EMPATHY_IS_MESSAGE_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), EMPATHY_TYPE_MESSAGE)) +#define EMPATHY_MESSAGE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), EMPATHY_TYPE_MESSAGE, EmpathyMessageClass)) + +typedef struct _EmpathyMessage EmpathyMessage; +typedef struct _EmpathyMessageClass EmpathyMessageClass; + +struct _EmpathyMessage { + GObject parent; +}; + +struct _EmpathyMessageClass { + GObjectClass parent_class; +}; + +typedef enum { + EMPATHY_MESSAGE_TYPE_NORMAL, + EMPATHY_MESSAGE_TYPE_ACTION, + EMPATHY_MESSAGE_TYPE_NOTICE, + EMPATHY_MESSAGE_TYPE_AUTO_REPLY, + EMPATHY_MESSAGE_TYPE_LAST +} EmpathyMessageType; + +GType empathy_message_get_gtype (void) G_GNUC_CONST; +EmpathyMessage * empathy_message_new (const gchar *body); +EmpathyMessageType empathy_message_get_type (EmpathyMessage *message); +void empathy_message_set_type (EmpathyMessage *message, + EmpathyMessageType type); +EmpathyContact * empathy_message_get_sender (EmpathyMessage *message); +void empathy_message_set_sender (EmpathyMessage *message, + EmpathyContact *contact); +EmpathyContact * empathy_message_get_receiver (EmpathyMessage *message); +void empathy_message_set_receiver (EmpathyMessage *message, + EmpathyContact *contact); +const gchar * empathy_message_get_body (EmpathyMessage *message); +void empathy_message_set_body (EmpathyMessage *message, + const gchar *body); +/* What return value should we have here? */ +EmpathyTime empathy_message_get_timestamp (EmpathyMessage *message); +void empathy_message_set_timestamp (EmpathyMessage *message, + EmpathyTime timestamp); + +G_END_DECLS + +#endif /* __EMPATHY_MESSAGE_H__ */ diff --git a/libempathy/gossip-presence.c b/libempathy/empathy-presence.c index 7add39669..158707a8b 100644 --- a/libempathy/gossip-presence.c +++ b/libempathy/empathy-presence.c @@ -26,17 +26,17 @@ #include <glib/gi18n.h> -#include "gossip-presence.h" -#include "gossip-time.h" +#include "empathy-presence.h" +#include "empathy-time.h" -#define GET_PRIV(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), GOSSIP_TYPE_PRESENCE, GossipPresencePriv)) +#define GET_PRIV(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), EMPATHY_TYPE_PRESENCE, EmpathyPresencePriv)) -typedef struct _GossipPresencePriv GossipPresencePriv; +typedef struct _EmpathyPresencePriv EmpathyPresencePriv; -struct _GossipPresencePriv { +struct _EmpathyPresencePriv { McPresence state; gchar *status; - GossipTime timestamp; + EmpathyTime timestamp; }; static void presence_finalize (GObject *object); @@ -55,10 +55,10 @@ enum { PROP_STATUS }; -G_DEFINE_TYPE (GossipPresence, gossip_presence, G_TYPE_OBJECT); +G_DEFINE_TYPE (EmpathyPresence, empathy_presence, G_TYPE_OBJECT); static void -gossip_presence_class_init (GossipPresenceClass *class) +empathy_presence_class_init (EmpathyPresenceClass *class) { GObjectClass *object_class; @@ -85,31 +85,31 @@ gossip_presence_class_init (GossipPresenceClass *class) NULL, G_PARAM_READWRITE)); - g_type_class_add_private (object_class, sizeof (GossipPresencePriv)); + g_type_class_add_private (object_class, sizeof (EmpathyPresencePriv)); } static void -gossip_presence_init (GossipPresence *presence) +empathy_presence_init (EmpathyPresence *presence) { - GossipPresencePriv *priv; + EmpathyPresencePriv *priv; priv = GET_PRIV (presence); priv->state = MC_PRESENCE_AVAILABLE; priv->status = NULL; - priv->timestamp = gossip_time_get_current (); + priv->timestamp = empathy_time_get_current (); } static void presence_finalize (GObject *object) { - GossipPresencePriv *priv; + EmpathyPresencePriv *priv; priv = GET_PRIV (object); g_free (priv->status); - (G_OBJECT_CLASS (gossip_presence_parent_class)->finalize) (object); + (G_OBJECT_CLASS (empathy_presence_parent_class)->finalize) (object); } static void @@ -118,7 +118,7 @@ presence_get_property (GObject *object, GValue *value, GParamSpec *pspec) { - GossipPresencePriv *priv; + EmpathyPresencePriv *priv; priv = GET_PRIV (object); @@ -128,7 +128,7 @@ presence_get_property (GObject *object, break; case PROP_STATUS: g_value_set_string (value, - gossip_presence_get_status (GOSSIP_PRESENCE (object))); + empathy_presence_get_status (EMPATHY_PRESENCE (object))); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec); @@ -141,7 +141,7 @@ presence_set_property (GObject *object, const GValue *value, GParamSpec *pspec) { - GossipPresencePriv *priv; + EmpathyPresencePriv *priv; priv = GET_PRIV (object); @@ -150,7 +150,7 @@ presence_set_property (GObject *object, priv->state = g_value_get_int (value); break; case PROP_STATUS: - gossip_presence_set_status (GOSSIP_PRESENCE (object), + empathy_presence_set_status (EMPATHY_PRESENCE (object), g_value_get_string (value)); break; default: @@ -159,28 +159,28 @@ presence_set_property (GObject *object, } } -GossipPresence * -gossip_presence_new (void) +EmpathyPresence * +empathy_presence_new (void) { - return g_object_new (GOSSIP_TYPE_PRESENCE, NULL); + return g_object_new (EMPATHY_TYPE_PRESENCE, NULL); } -GossipPresence * -gossip_presence_new_full (McPresence state, +EmpathyPresence * +empathy_presence_new_full (McPresence state, const gchar *status) { - return g_object_new (GOSSIP_TYPE_PRESENCE, + return g_object_new (EMPATHY_TYPE_PRESENCE, "state", state, "status", status, NULL); } const gchar * -gossip_presence_get_status (GossipPresence *presence) +empathy_presence_get_status (EmpathyPresence *presence) { - GossipPresencePriv *priv; + EmpathyPresencePriv *priv; - g_return_val_if_fail (GOSSIP_IS_PRESENCE (presence), + g_return_val_if_fail (EMPATHY_IS_PRESENCE (presence), _("Offline")); priv = GET_PRIV (presence); @@ -189,11 +189,11 @@ gossip_presence_get_status (GossipPresence *presence) } McPresence -gossip_presence_get_state (GossipPresence *presence) +empathy_presence_get_state (EmpathyPresence *presence) { - GossipPresencePriv *priv; + EmpathyPresencePriv *priv; - g_return_val_if_fail (GOSSIP_IS_PRESENCE (presence), + g_return_val_if_fail (EMPATHY_IS_PRESENCE (presence), MC_PRESENCE_AVAILABLE); priv = GET_PRIV (presence); @@ -202,12 +202,12 @@ gossip_presence_get_state (GossipPresence *presence) } void -gossip_presence_set_state (GossipPresence *presence, +empathy_presence_set_state (EmpathyPresence *presence, McPresence state) { - GossipPresencePriv *priv; + EmpathyPresencePriv *priv; - g_return_if_fail (GOSSIP_IS_PRESENCE (presence)); + g_return_if_fail (EMPATHY_IS_PRESENCE (presence)); priv = GET_PRIV (presence); @@ -217,13 +217,13 @@ gossip_presence_set_state (GossipPresence *presence, } void -gossip_presence_set_status (GossipPresence *presence, +empathy_presence_set_status (EmpathyPresence *presence, const gchar *status) { - GossipPresencePriv *priv; + EmpathyPresencePriv *priv; priv = GET_PRIV (presence); - g_return_if_fail (GOSSIP_IS_PRESENCE (presence)); + g_return_if_fail (EMPATHY_IS_PRESENCE (presence)); g_free (priv->status); @@ -237,15 +237,15 @@ gossip_presence_set_status (GossipPresence *presence, } gint -gossip_presence_sort_func (gconstpointer a, +empathy_presence_sort_func (gconstpointer a, gconstpointer b) { - GossipPresencePriv *priv_a; - GossipPresencePriv *priv_b; + EmpathyPresencePriv *priv_a; + EmpathyPresencePriv *priv_b; gint diff; - g_return_val_if_fail (GOSSIP_IS_PRESENCE (a), 0); - g_return_val_if_fail (GOSSIP_IS_PRESENCE (b), 0); + g_return_val_if_fail (EMPATHY_IS_PRESENCE (a), 0); + g_return_val_if_fail (EMPATHY_IS_PRESENCE (b), 0); priv_a = GET_PRIV (a); priv_b = GET_PRIV (b); @@ -267,7 +267,7 @@ gossip_presence_sort_func (gconstpointer a, } const gchar * -gossip_presence_state_get_default_status (McPresence state) +empathy_presence_state_get_default_status (McPresence state) { switch (state) { case MC_PRESENCE_AVAILABLE: @@ -289,7 +289,7 @@ gossip_presence_state_get_default_status (McPresence state) } const gchar * -gossip_presence_state_to_str (McPresence state) +empathy_presence_state_to_str (McPresence state) { switch (state) { case MC_PRESENCE_AVAILABLE: @@ -314,7 +314,7 @@ gossip_presence_state_to_str (McPresence state) } McPresence -gossip_presence_state_from_str (const gchar *str) +empathy_presence_state_from_str (const gchar *str) { if (strcmp (str, "available") == 0) { return MC_PRESENCE_AVAILABLE; diff --git a/libempathy/empathy-presence.h b/libempathy/empathy-presence.h new file mode 100644 index 000000000..940bf9ca6 --- /dev/null +++ b/libempathy/empathy-presence.h @@ -0,0 +1,67 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ +/* + * Copyright (C) 2004 Imendio AB + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This program 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 + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#ifndef __EMPATHY_PRESENCE_H__ +#define __EMPATHY_PRESENCE_H__ + +#include <glib-object.h> +#include <libmissioncontrol/mission-control.h> + +G_BEGIN_DECLS + +#define EMPATHY_TYPE_PRESENCE (empathy_presence_get_type ()) +#define EMPATHY_PRESENCE(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), EMPATHY_TYPE_PRESENCE, EmpathyPresence)) +#define EMPATHY_PRESENCE_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), EMPATHY_TYPE_PRESENCE, EmpathyPresenceClass)) +#define EMPATHY_IS_PRESENCE(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), EMPATHY_TYPE_PRESENCE)) +#define EMPATHY_IS_PRESENCE_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), EMPATHY_TYPE_PRESENCE)) +#define EMPATHY_PRESENCE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), EMPATHY_TYPE_PRESENCE, EmpathyPresenceClass)) + +typedef struct _EmpathyPresence EmpathyPresence; +typedef struct _EmpathyPresenceClass EmpathyPresenceClass; + +struct _EmpathyPresence { + GObject parent; +}; + +struct _EmpathyPresenceClass { + GObjectClass parent_class; +}; + +GType empathy_presence_get_type (void) G_GNUC_CONST; + +EmpathyPresence * empathy_presence_new (void); +EmpathyPresence * empathy_presence_new_full (McPresence state, + const gchar *status); +McPresence empathy_presence_get_state (EmpathyPresence *presence); +const gchar * empathy_presence_get_status (EmpathyPresence *presence); +void empathy_presence_set_state (EmpathyPresence *presence, + McPresence state); +void empathy_presence_set_status (EmpathyPresence *presence, + const gchar *status); +gint empathy_presence_sort_func (gconstpointer a, + gconstpointer b); +const gchar * empathy_presence_state_get_default_status (McPresence state); +const gchar * empathy_presence_state_to_str (McPresence state); +McPresence empathy_presence_state_from_str (const gchar *str); + +G_END_DECLS + +#endif /* __EMPATHY_PRESENCE_H__ */ + diff --git a/libempathy/gossip-time.c b/libempathy/empathy-time.c index a1956354e..0851add49 100644 --- a/libempathy/gossip-time.c +++ b/libempathy/empathy-time.c @@ -26,18 +26,18 @@ #include <stdlib.h> #include <string.h> -#include "gossip-time.h" +#include "empathy-time.h" -/* Note: GossipTime is always in UTC. */ +/* Note: EmpathyTime is always in UTC. */ -GossipTime -gossip_time_get_current (void) +EmpathyTime +empathy_time_get_current (void) { return time (NULL); } time_t -gossip_time_get_local_time (struct tm *tm) +empathy_time_get_local_time (struct tm *tm) { const gchar *timezone; time_t t; @@ -63,8 +63,8 @@ gossip_time_get_local_time (struct tm *tm) /* The format is: "20021209T23:51:30" and is in UTC. 0 is returned on * failure. The alternative format "20021209" is also accepted. */ -GossipTime -gossip_time_parse (const gchar *str) +EmpathyTime +empathy_time_parse (const gchar *str) { struct tm tm; gint year, month; @@ -83,12 +83,12 @@ gossip_time_parse (const gchar *str) tm.tm_mon = month - 1; tm.tm_isdst = -1; - return gossip_time_get_local_time (&tm); + return empathy_time_get_local_time (&tm); } /* Converts the UTC timestamp to a string, also in UTC. Returns NULL on failure. */ gchar * -gossip_time_to_string_utc (GossipTime t, +empathy_time_to_string_utc (EmpathyTime t, const gchar *format) { gchar stamp[128]; @@ -106,7 +106,7 @@ gossip_time_to_string_utc (GossipTime t, /* Converts the UTC timestamp to a string, in local time. Returns NULL on failure. */ gchar * -gossip_time_to_string_local (GossipTime t, +empathy_time_to_string_local (EmpathyTime t, const gchar *format) { gchar stamp[128]; diff --git a/libempathy/gossip-time.h b/libempathy/empathy-time.h index 06057aa52..0989391cd 100644 --- a/libempathy/gossip-time.h +++ b/libempathy/empathy-time.h @@ -18,8 +18,8 @@ * Boston, MA 02111-1307, USA. */ -#ifndef __GOSSIP_TIME_H__ -#define __GOSSIP_TIME_H__ +#ifndef __EMPATHY_TIME_H__ +#define __EMPATHY_TIME_H__ #define __USE_XOPEN #include <time.h> @@ -28,23 +28,23 @@ G_BEGIN_DECLS -#define GOSSIP_TIME_FORMAT_DISPLAY_SHORT "%H:%M" -#define GOSSIP_TIME_FORMAT_DISPLAY_LONG "%a %d %b %Y" +#define EMPATHY_TIME_FORMAT_DISPLAY_SHORT "%H:%M" +#define EMPATHY_TIME_FORMAT_DISPLAY_LONG "%a %d %b %Y" /* Note: Always in UTC. */ -typedef long GossipTime; +typedef long EmpathyTime; -GossipTime gossip_time_get_current (void); -time_t gossip_time_get_local_time (struct tm *tm); -GossipTime gossip_time_parse (const gchar *str); -GossipTime gossip_time_parse_format (const gchar *str, +EmpathyTime empathy_time_get_current (void); +time_t empathy_time_get_local_time (struct tm *tm); +EmpathyTime empathy_time_parse (const gchar *str); +EmpathyTime empathy_time_parse_format (const gchar *str, const gchar *format); -gchar *gossip_time_to_string_utc (GossipTime t, +gchar *empathy_time_to_string_utc (EmpathyTime t, const gchar *format); -gchar *gossip_time_to_string_local (GossipTime t, +gchar *empathy_time_to_string_local (EmpathyTime t, const gchar *format); G_END_DECLS -#endif /* __GOSSIP_TIME_H__ */ +#endif /* __EMPATHY_TIME_H__ */ diff --git a/libempathy/empathy-tp-chat.c b/libempathy/empathy-tp-chat.c index a2852e1d8..e97b5d641 100644 --- a/libempathy/empathy-tp-chat.c +++ b/libempathy/empathy-tp-chat.c @@ -34,9 +34,9 @@ #include "empathy-contact-manager.h" #include "empathy-tp-contact-list.h" #include "empathy-marshal.h" -#include "gossip-debug.h" -#include "gossip-time.h" -#include "gossip-utils.h" +#include "empathy-debug.h" +#include "empathy-time.h" +#include "empathy-utils.h" #define GET_PRIV(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), \ EMPATHY_TYPE_TP_CHAT, EmpathyTpChatPriv)) @@ -278,7 +278,7 @@ empathy_tp_chat_class_init (EmpathyTpChatClass *klass) NULL, NULL, g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, - 1, GOSSIP_TYPE_MESSAGE); + 1, EMPATHY_TYPE_MESSAGE); signals[CHAT_STATE_CHANGED] = g_signal_new ("chat-state-changed", @@ -288,7 +288,7 @@ empathy_tp_chat_class_init (EmpathyTpChatClass *klass) NULL, NULL, empathy_marshal_VOID__OBJECT_UINT, G_TYPE_NONE, - 2, GOSSIP_TYPE_CONTACT, G_TYPE_UINT); + 2, EMPATHY_TYPE_CONTACT, G_TYPE_UINT); signals[DESTROY] = g_signal_new ("destroy", @@ -320,14 +320,14 @@ tp_chat_finalize (GObject *object) priv = GET_PRIV (chat); if (priv->tp_chan) { - gossip_debug (DEBUG_DOMAIN, "Closing channel..."); + empathy_debug (DEBUG_DOMAIN, "Closing channel..."); g_signal_handlers_disconnect_by_func (priv->tp_chan, tp_chat_destroy_cb, object); if (!tp_chan_close (DBUS_G_PROXY (priv->tp_chan), &error)) { - gossip_debug (DEBUG_DOMAIN, + empathy_debug (DEBUG_DOMAIN, "Error closing text channel: %s", error ? error->message : "No error given"); g_clear_error (&error); @@ -366,7 +366,7 @@ tp_chat_constructor (GType type, priv->manager = empathy_contact_manager_new (); priv->list = empathy_contact_manager_get_list (priv->manager, priv->account); - priv->mc = gossip_mission_control_new (); + priv->mc = empathy_mission_control_new (); g_object_ref (priv->list); priv->text_iface = tp_chan_get_interface (priv->tp_chan, @@ -506,7 +506,7 @@ empathy_tp_chat_new (McAccount *account, } EmpathyTpChat * -empathy_tp_chat_new_with_contact (GossipContact *contact) +empathy_tp_chat_new_with_contact (EmpathyContact *contact) { EmpathyTpChat *chat; MissionControl *mc; @@ -516,10 +516,10 @@ empathy_tp_chat_new_with_contact (GossipContact *contact) const gchar *bus_name; guint handle; - g_return_val_if_fail (GOSSIP_IS_CONTACT (contact), NULL); + g_return_val_if_fail (EMPATHY_IS_CONTACT (contact), NULL); - mc = gossip_mission_control_new (); - account = gossip_contact_get_account (contact); + mc = empathy_mission_control_new (); + account = empathy_contact_get_account (contact); if (mission_control_get_connection_status (mc, account, NULL) != 0) { /* The account is not connected, nothing to do. */ @@ -529,7 +529,7 @@ empathy_tp_chat_new_with_contact (GossipContact *contact) tp_conn = mission_control_get_connection (mc, account, NULL); g_return_val_if_fail (tp_conn != NULL, NULL); bus_name = dbus_g_proxy_get_bus_name (DBUS_G_PROXY (tp_conn)); - handle = gossip_contact_get_handle (contact); + handle = empathy_contact_get_handle (contact); text_chan = tp_conn_new_channel (tp_get_bus (), tp_conn, @@ -566,7 +566,7 @@ empathy_tp_chat_request_pending (EmpathyTpChat *chat) TRUE, &messages_list, &error)) { - gossip_debug (DEBUG_DOMAIN, + empathy_debug (DEBUG_DOMAIN, "Error retrieving pending messages: %s", error ? error->message : "No error given"); g_clear_error (&error); @@ -591,7 +591,7 @@ empathy_tp_chat_request_pending (EmpathyTpChat *chat) message_flags = g_value_get_uint (g_value_array_get_nth (message_struct, 4)); message_body = g_value_get_string (g_value_array_get_nth (message_struct, 5)); - gossip_debug (DEBUG_DOMAIN, "Message pending: %s", message_body); + empathy_debug (DEBUG_DOMAIN, "Message pending: %s", message_body); tp_chat_emit_message (chat, message_type, @@ -607,27 +607,27 @@ empathy_tp_chat_request_pending (EmpathyTpChat *chat) void empathy_tp_chat_send (EmpathyTpChat *chat, - GossipMessage *message) + EmpathyMessage *message) { EmpathyTpChatPriv *priv; const gchar *message_body; - GossipMessageType message_type; + EmpathyMessageType message_type; GError *error = NULL; g_return_if_fail (EMPATHY_IS_TP_CHAT (chat)); - g_return_if_fail (GOSSIP_IS_MESSAGE (message)); + g_return_if_fail (EMPATHY_IS_MESSAGE (message)); priv = GET_PRIV (chat); - message_body = gossip_message_get_body (message); - message_type = gossip_message_get_type (message); + message_body = empathy_message_get_body (message); + message_type = empathy_message_get_type (message); - gossip_debug (DEBUG_DOMAIN, "Sending message: %s", message_body); + empathy_debug (DEBUG_DOMAIN, "Sending message: %s", message_body); if (!tp_chan_type_text_send (priv->text_iface, message_type, message_body, &error)) { - gossip_debug (DEBUG_DOMAIN, + empathy_debug (DEBUG_DOMAIN, "Send Error: %s", error ? error->message : "No error given"); g_clear_error (&error); @@ -646,11 +646,11 @@ empathy_tp_chat_set_state (EmpathyTpChat *chat, priv = GET_PRIV (chat); if (priv->chat_state_iface) { - gossip_debug (DEBUG_DOMAIN, "Set state: %d", state); + empathy_debug (DEBUG_DOMAIN, "Set state: %d", state); if (!tp_chan_iface_chat_state_set_chat_state (priv->chat_state_iface, state, &error)) { - gossip_debug (DEBUG_DOMAIN, + empathy_debug (DEBUG_DOMAIN, "Set Chat State Error: %s", error ? error->message : "No error given"); g_clear_error (&error); @@ -671,7 +671,7 @@ empathy_tp_chat_get_id (EmpathyTpChat *chat) return priv->id; } - priv->id = gossip_get_channel_id (priv->account, priv->tp_chan); + priv->id = empathy_get_channel_id (priv->account, priv->tp_chan); return priv->id; } @@ -684,7 +684,7 @@ tp_chat_destroy_cb (TpChan *text_chan, priv = GET_PRIV (chat); - gossip_debug (DEBUG_DOMAIN, "Channel Closed or CM crashed"); + empathy_debug (DEBUG_DOMAIN, "Channel Closed or CM crashed"); g_object_unref (priv->tp_chan); priv->tp_chan = NULL; @@ -726,7 +726,7 @@ tp_chat_received_cb (DBusGProxy *text_iface, priv = GET_PRIV (chat); - gossip_debug (DEBUG_DOMAIN, "Message received: %s", message_body); + empathy_debug (DEBUG_DOMAIN, "Message received: %s", message_body); tp_chat_emit_message (chat, message_type, @@ -748,7 +748,7 @@ tp_chat_sent_cb (DBusGProxy *text_iface, gchar *message_body, EmpathyTpChat *chat) { - gossip_debug (DEBUG_DOMAIN, "Message sent: %s", message_body); + empathy_debug (DEBUG_DOMAIN, "Message sent: %s", message_body); tp_chat_emit_message (chat, message_type, @@ -764,14 +764,14 @@ tp_chat_state_changed_cb (DBusGProxy *chat_state_iface, EmpathyTpChat *chat) { EmpathyTpChatPriv *priv; - GossipContact *contact; + EmpathyContact *contact; priv = GET_PRIV (chat); contact = empathy_tp_contact_list_get_from_handle (priv->list, handle); - gossip_debug (DEBUG_DOMAIN, "Chat state changed for %s (%d): %d", - gossip_contact_get_name (contact), + empathy_debug (DEBUG_DOMAIN, "Chat state changed for %s (%d): %d", + empathy_contact_get_name (contact), handle, state); @@ -788,9 +788,9 @@ tp_chat_emit_message (EmpathyTpChat *chat, const gchar *message_body) { EmpathyTpChatPriv *priv; - GossipMessage *message; - GossipContact *sender; - GossipContact *receiver; + EmpathyMessage *message; + EmpathyContact *sender; + EmpathyContact *receiver; priv = GET_PRIV (chat); @@ -802,11 +802,11 @@ tp_chat_emit_message (EmpathyTpChat *chat, from_handle); } - message = gossip_message_new (message_body); - gossip_message_set_type (message, type); - gossip_message_set_sender (message, sender); - gossip_message_set_receiver (message, receiver); - gossip_message_set_timestamp (message, (GossipTime) timestamp); + message = empathy_message_new (message_body); + empathy_message_set_type (message, type); + empathy_message_set_sender (message, sender); + empathy_message_set_receiver (message, receiver); + empathy_message_set_timestamp (message, (EmpathyTime) timestamp); g_signal_emit (chat, signals[MESSAGE_RECEIVED], 0, message); diff --git a/libempathy/empathy-tp-chat.h b/libempathy/empathy-tp-chat.h index 55bbfcd3d..ce4e2a836 100644 --- a/libempathy/empathy-tp-chat.h +++ b/libempathy/empathy-tp-chat.h @@ -30,8 +30,8 @@ #include <libmissioncontrol/mc-account.h> -#include "gossip-message.h" -#include "gossip-contact.h" +#include "empathy-message.h" +#include "empathy-contact.h" G_BEGIN_DECLS @@ -58,10 +58,10 @@ struct _EmpathyTpChatClass { GType empathy_tp_chat_get_type (void) G_GNUC_CONST; EmpathyTpChat *empathy_tp_chat_new (McAccount *account, TpChan *tp_chan); -EmpathyTpChat *empathy_tp_chat_new_with_contact (GossipContact *contact); +EmpathyTpChat *empathy_tp_chat_new_with_contact (EmpathyContact *contact); void empathy_tp_chat_request_pending (EmpathyTpChat *chat); void empathy_tp_chat_send (EmpathyTpChat *chat, - GossipMessage *message); + EmpathyMessage *message); void empathy_tp_chat_set_state (EmpathyTpChat *chat, TelepathyChannelChatState state); const gchar * empathy_tp_chat_get_id (EmpathyTpChat *chat); diff --git a/libempathy/empathy-tp-chatroom.c b/libempathy/empathy-tp-chatroom.c index 232db30fd..fe8e7f8e7 100644 --- a/libempathy/empathy-tp-chatroom.c +++ b/libempathy/empathy-tp-chatroom.c @@ -28,9 +28,9 @@ #include "empathy-tp-contact-list.h" #include "empathy-contact-list.h" #include "empathy-contact-manager.h" -#include "gossip-telepathy-group.h" -#include "gossip-utils.h" -#include "gossip-debug.h" +#include "empathy-tp-group.h" +#include "empathy-utils.h" +#include "empathy-debug.h" #define GET_PRIV(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), \ EMPATHY_TYPE_TP_CHATROOM, EmpathyTpChatroomPriv)) @@ -40,10 +40,10 @@ struct _EmpathyTpChatroomPriv { EmpathyContactManager *manager; EmpathyTpContactList *list; - GossipTelepathyGroup *group; + EmpathyTpGroup *group; gboolean is_invited; - GossipContact *invitor; + EmpathyContact *invitor; gchar *invit_message; }; @@ -51,26 +51,26 @@ static void empathy_tp_chatroom_class_init (EmpathyTpChatroomClass * static void tp_chatroom_iface_init (EmpathyContactListIface *iface); static void empathy_tp_chatroom_init (EmpathyTpChatroom *chatroom); static void tp_chatroom_finalize (GObject *object); -static void tp_chatroom_members_added_cb (GossipTelepathyGroup *group, +static void tp_chatroom_members_added_cb (EmpathyTpGroup *group, GArray *handles, guint actor_handle, guint reason, const gchar *message, EmpathyTpChatroom *list); -static void tp_chatroom_members_removed_cb (GossipTelepathyGroup *group, +static void tp_chatroom_members_removed_cb (EmpathyTpGroup *group, GArray *handles, guint actor_handle, guint reason, const gchar *message, EmpathyTpChatroom *list); static void tp_chatroom_setup (EmpathyContactList *list); -static GossipContact * tp_chatroom_find (EmpathyContactList *list, +static EmpathyContact * tp_chatroom_find (EmpathyContactList *list, const gchar *id); static void tp_chatroom_add (EmpathyContactList *list, - GossipContact *contact, + EmpathyContact *contact, const gchar *message); static void tp_chatroom_remove (EmpathyContactList *list, - GossipContact *contact, + EmpathyContact *contact, const gchar *message); static GList * tp_chatroom_get_members (EmpathyContactList *list); @@ -145,11 +145,11 @@ empathy_tp_chatroom_new (McAccount *account, priv = GET_PRIV (chatroom); - mc = gossip_mission_control_new (); + mc = empathy_mission_control_new (); tp_conn = mission_control_get_connection (mc, account, NULL); priv->manager = empathy_contact_manager_new (); priv->list = empathy_contact_manager_get_list (priv->manager, account); - priv->group = gossip_telepathy_group_new (tp_chan, tp_conn); + priv->group = empathy_tp_group_new (tp_chan, tp_conn); g_signal_connect (priv->group, "members-added", G_CALLBACK (tp_chatroom_members_added_cb), @@ -159,10 +159,10 @@ empathy_tp_chatroom_new (McAccount *account, chatroom); /* Check if we are invited to join the chat */ - self_handle = gossip_telepathy_group_get_self_handle (priv->group); - members = gossip_telepathy_group_get_local_pending_members_with_info (priv->group); + self_handle = empathy_tp_group_get_self_handle (priv->group); + members = empathy_tp_group_get_local_pending_members_with_info (priv->group); for (l = members; l; l = l->next) { - GossipTpGroupInfo *info; + EmpathyTpGroupInfo *info; info = l->data; @@ -175,12 +175,12 @@ empathy_tp_chatroom_new (McAccount *account, priv->invit_message = g_strdup (info->message); priv->is_invited = TRUE; - gossip_debug (DEBUG_DOMAIN, "We are invited to join by %s: %s", - gossip_contact_get_name (priv->invitor), + empathy_debug (DEBUG_DOMAIN, "We are invited to join by %s: %s", + empathy_contact_get_name (priv->invitor), priv->invit_message); } - gossip_telepathy_group_info_list_free (members); + empathy_tp_group_info_list_free (members); g_object_unref (mc); g_object_unref (tp_conn); @@ -189,7 +189,7 @@ empathy_tp_chatroom_new (McAccount *account, gboolean empathy_tp_chatroom_get_invitation (EmpathyTpChatroom *chatroom, - GossipContact **contact, + EmpathyContact **contact, const gchar **message) { EmpathyTpChatroomPriv *priv; @@ -228,8 +228,8 @@ empathy_tp_chatroom_accept_invitation (EmpathyTpChatroom *chatroom) priv->invit_message = NULL; /* Add ourself in the members of the room */ - self_handle = gossip_telepathy_group_get_self_handle (priv->group); - gossip_telepathy_group_add_member (priv->group, self_handle, + self_handle = empathy_tp_group_get_self_handle (priv->group); + empathy_tp_group_add_member (priv->group, self_handle, "Just for fun"); } @@ -240,12 +240,12 @@ empathy_tp_chatroom_set_topic (EmpathyTpChatroom *chatroom, } static void -tp_chatroom_members_added_cb (GossipTelepathyGroup *group, - GArray *handles, - guint actor_handle, - guint reason, - const gchar *message, - EmpathyTpChatroom *chatroom) +tp_chatroom_members_added_cb (EmpathyTpGroup *group, + GArray *handles, + guint actor_handle, + guint reason, + const gchar *message, + EmpathyTpChatroom *chatroom) { EmpathyTpChatroomPriv *priv; GList *contacts, *l; @@ -254,7 +254,7 @@ tp_chatroom_members_added_cb (GossipTelepathyGroup *group, contacts = empathy_tp_contact_list_get_from_handles (priv->list, handles); for (l = contacts; l; l = l->next) { - GossipContact *contact; + EmpathyContact *contact; contact = l->data; @@ -266,12 +266,12 @@ tp_chatroom_members_added_cb (GossipTelepathyGroup *group, } static void -tp_chatroom_members_removed_cb (GossipTelepathyGroup *group, - GArray *handles, - guint actor_handle, - guint reason, - const gchar *message, - EmpathyTpChatroom *chatroom) +tp_chatroom_members_removed_cb (EmpathyTpGroup *group, + GArray *handles, + guint actor_handle, + guint reason, + const gchar *message, + EmpathyTpChatroom *chatroom) { EmpathyTpChatroomPriv *priv; GList *contacts, *l; @@ -280,7 +280,7 @@ tp_chatroom_members_removed_cb (GossipTelepathyGroup *group, contacts = empathy_tp_contact_list_get_from_handles (priv->list, handles); for (l = contacts; l; l = l->next) { - GossipContact *contact; + EmpathyContact *contact; contact = l->data; @@ -297,7 +297,7 @@ tp_chatroom_setup (EmpathyContactList *list) /* Nothing to do */ } -static GossipContact * +static EmpathyContact * tp_chatroom_find (EmpathyContactList *list, const gchar *id) { @@ -306,36 +306,36 @@ tp_chatroom_find (EmpathyContactList *list, static void tp_chatroom_add (EmpathyContactList *list, - GossipContact *contact, + EmpathyContact *contact, const gchar *message) { EmpathyTpChatroomPriv *priv; g_return_if_fail (EMPATHY_IS_TP_CHATROOM (list)); - g_return_if_fail (GOSSIP_IS_CONTACT (contact)); + g_return_if_fail (EMPATHY_IS_CONTACT (contact)); priv = GET_PRIV (list); - gossip_telepathy_group_add_member (priv->group, - gossip_contact_get_handle (contact), - message); + empathy_tp_group_add_member (priv->group, + empathy_contact_get_handle (contact), + message); } static void tp_chatroom_remove (EmpathyContactList *list, - GossipContact *contact, + EmpathyContact *contact, const gchar *message) { EmpathyTpChatroomPriv *priv; g_return_if_fail (EMPATHY_IS_TP_CHATROOM (list)); - g_return_if_fail (GOSSIP_IS_CONTACT (contact)); + g_return_if_fail (EMPATHY_IS_CONTACT (contact)); priv = GET_PRIV (list); - gossip_telepathy_group_remove_member (priv->group, - gossip_contact_get_handle (contact), - message); + empathy_tp_group_remove_member (priv->group, + empathy_contact_get_handle (contact), + message); } static GList * @@ -349,7 +349,7 @@ tp_chatroom_get_members (EmpathyContactList *list) priv = GET_PRIV (list); - members = gossip_telepathy_group_get_members (priv->group); + members = empathy_tp_group_get_members (priv->group); contacts = empathy_tp_contact_list_get_from_handles (priv->list, members); g_array_free (members, TRUE); diff --git a/libempathy/empathy-tp-chatroom.h b/libempathy/empathy-tp-chatroom.h index 488ac74fb..cbdd246c6 100644 --- a/libempathy/empathy-tp-chatroom.h +++ b/libempathy/empathy-tp-chatroom.h @@ -56,7 +56,7 @@ GType empathy_tp_chatroom_get_type (void) G_GNUC_CONST; EmpathyTpChatroom *empathy_tp_chatroom_new (McAccount *account, TpChan *tp_chan); gboolean empathy_tp_chatroom_get_invitation (EmpathyTpChatroom *chatroom, - GossipContact **contact, + EmpathyContact **contact, const gchar **message); void empathy_tp_chatroom_accept_invitation (EmpathyTpChatroom *chatroom); void empathy_tp_chatroom_set_topic (EmpathyTpChatroom *chatroom, diff --git a/libempathy/empathy-tp-contact-list.c b/libempathy/empathy-tp-contact-list.c index c435218e8..dd04fac53 100644 --- a/libempathy/empathy-tp-contact-list.c +++ b/libempathy/empathy-tp-contact-list.c @@ -35,9 +35,9 @@ #include "empathy-tp-contact-list.h" #include "empathy-contact-list.h" -#include "gossip-telepathy-group.h" -#include "gossip-debug.h" -#include "gossip-utils.h" +#include "empathy-tp-group.h" +#include "empathy-debug.h" +#include "empathy-utils.h" #define GET_PRIV(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), \ EMPATHY_TYPE_TP_CONTACT_LIST, EmpathyTpContactListPriv)) @@ -46,25 +46,25 @@ #define MAX_AVATAR_REQUESTS 10 struct _EmpathyTpContactListPriv { - TpConn *tp_conn; - McAccount *account; - MissionControl *mc; - GossipContact *user_contact; - gboolean setup; + TpConn *tp_conn; + McAccount *account; + MissionControl *mc; + EmpathyContact *user_contact; + gboolean setup; - GossipTelepathyGroup *publish; - GossipTelepathyGroup *subscribe; + EmpathyTpGroup *publish; + EmpathyTpGroup *subscribe; - GHashTable *groups; - GHashTable *contacts; - GList *members; - GList *local_pending; + GHashTable *groups; + GHashTable *contacts; + GList *members; + GList *local_pending; - DBusGProxy *aliasing_iface; - DBusGProxy *avatars_iface; - DBusGProxy *presence_iface; + DBusGProxy *aliasing_iface; + DBusGProxy *avatars_iface; + DBusGProxy *presence_iface; - GList *avatar_requests_queue; + GList *avatar_requests_queue; }; typedef enum { @@ -89,129 +89,129 @@ typedef struct { guint *handles; } TpContactListAliasesRequestData; -static void empathy_tp_contact_list_class_init (EmpathyTpContactListClass *klass); -static void tp_contact_list_iface_init (EmpathyContactListIface *iface); -static void empathy_tp_contact_list_init (EmpathyTpContactList *list); -static void tp_contact_list_finalize (GObject *object); -static void tp_contact_list_finalize_proxies (EmpathyTpContactList *list); -static void tp_contact_list_setup (EmpathyContactList *list); -static GossipContact * tp_contact_list_find (EmpathyContactList *list, - const gchar *id); -static void tp_contact_list_add (EmpathyContactList *list, - GossipContact *contact, - const gchar *message); -static void tp_contact_list_remove (EmpathyContactList *list, - GossipContact *contact, - const gchar *message); -static GList * tp_contact_list_get_members (EmpathyContactList *list); -static GList * tp_contact_list_get_local_pending (EmpathyContactList *list); -static void tp_contact_list_process_pending (EmpathyContactList *list, - GossipContact *contact, - gboolean accept); -static void tp_contact_list_remove_local_pending (EmpathyTpContactList *list, - GossipContact *contact); -static void tp_contact_list_contact_removed_foreach (guint handle, - GossipContact *contact, - EmpathyTpContactList *list); -static void tp_contact_list_destroy_cb (DBusGProxy *proxy, - EmpathyTpContactList *list); -static gboolean tp_contact_list_find_foreach (guint handle, - GossipContact *contact, - gchar *id); -static void tp_contact_list_newchannel_cb (DBusGProxy *proxy, - const gchar *object_path, - const gchar *channel_type, - TelepathyHandleType handle_type, - guint channel_handle, - gboolean suppress_handle, - EmpathyTpContactList *list); -static TpContactListType tp_contact_list_get_type (EmpathyTpContactList *list, - GossipTelepathyGroup *group); -static void tp_contact_list_added_cb (GossipTelepathyGroup *group, - GArray *handles, - guint actor_handle, - guint reason, - const gchar *message, - EmpathyTpContactList *list); -static void tp_contact_list_removed_cb (GossipTelepathyGroup *group, - GArray *handles, - guint actor_handle, - guint reason, - const gchar *message, - EmpathyTpContactList *list); -static void tp_contact_list_pending_cb (GossipTelepathyGroup *group, - GArray *handles, - guint actor_handle, - guint reason, - const gchar *message, - EmpathyTpContactList *list); -static void tp_contact_list_groups_updated_cb (GossipContact *contact, - GParamSpec *param, - EmpathyTpContactList *list); -static void tp_contact_list_name_updated_cb (GossipContact *contact, - GParamSpec *param, - EmpathyTpContactList *list); -static void tp_contact_list_update_groups_foreach (gchar *object_path, - GossipTelepathyGroup *group, - TpContactListData *data); -static GossipTelepathyGroup * tp_contact_list_get_group (EmpathyTpContactList *list, - const gchar *name); -static gboolean tp_contact_list_find_group (gchar *key, - GossipTelepathyGroup *group, - gchar *group_name); -static void tp_contact_list_get_groups_foreach (gchar *key, - GossipTelepathyGroup *group, - GList **groups); -static void tp_contact_list_group_channel_closed_cb (TpChan *channel, - EmpathyTpContactList *list); -static void tp_contact_list_group_members_added_cb (GossipTelepathyGroup *group, - GArray *members, - guint actor_handle, - guint reason, - const gchar *message, - EmpathyTpContactList *list); -static void tp_contact_list_group_members_removed_cb (GossipTelepathyGroup *group, - GArray *members, - guint actor_handle, - guint reason, - const gchar *message, - EmpathyTpContactList *list); -static void tp_contact_list_get_info (EmpathyTpContactList *list, - GArray *handles); -static void tp_contact_list_request_avatar (EmpathyTpContactList *list, - guint handle); -static void tp_contact_list_start_avatar_requests (EmpathyTpContactList *list); -static void tp_contact_list_avatar_update_cb (DBusGProxy *proxy, - guint handle, - gchar *new_token, - EmpathyTpContactList *list); -static void tp_contact_list_request_avatar_cb (DBusGProxy *proxy, - GArray *avatar_data, - gchar *mime_type, - GError *error, - TpContactListAvatarRequestData *data); -static void tp_contact_list_aliases_update_cb (DBusGProxy *proxy, - GPtrArray *handlers, - EmpathyTpContactList *list); -static void tp_contact_list_request_aliases_cb (DBusGProxy *proxy, - gchar **contact_names, - GError *error, - TpContactListAliasesRequestData *data); -static void tp_contact_list_presence_update_cb (DBusGProxy *proxy, - GHashTable *handle_table, - EmpathyTpContactList *list); -static void tp_contact_list_parse_presence_foreach (guint handle, - GValueArray *presence_struct, - EmpathyTpContactList *list); -static void tp_contact_list_presences_table_foreach (const gchar *state_str, - GHashTable *presences_table, - GossipPresence **presence); -static void tp_contact_list_status_changed_cb (MissionControl *mc, - TelepathyConnectionStatus status, - McPresence presence, - TelepathyConnectionStatusReason reason, - const gchar *unique_name, - EmpathyTpContactList *list); +static void empathy_tp_contact_list_class_init (EmpathyTpContactListClass *klass); +static void tp_contact_list_iface_init (EmpathyContactListIface *iface); +static void empathy_tp_contact_list_init (EmpathyTpContactList *list); +static void tp_contact_list_finalize (GObject *object); +static void tp_contact_list_finalize_proxies (EmpathyTpContactList *list); +static void tp_contact_list_setup (EmpathyContactList *list); +static EmpathyContact * tp_contact_list_find (EmpathyContactList *list, + const gchar *id); +static void tp_contact_list_add (EmpathyContactList *list, + EmpathyContact *contact, + const gchar *message); +static void tp_contact_list_remove (EmpathyContactList *list, + EmpathyContact *contact, + const gchar *message); +static GList * tp_contact_list_get_members (EmpathyContactList *list); +static GList * tp_contact_list_get_local_pending (EmpathyContactList *list); +static void tp_contact_list_process_pending (EmpathyContactList *list, + EmpathyContact *contact, + gboolean accept); +static void tp_contact_list_remove_local_pending (EmpathyTpContactList *list, + EmpathyContact *contact); +static void tp_contact_list_contact_removed_foreach (guint handle, + EmpathyContact *contact, + EmpathyTpContactList *list); +static void tp_contact_list_destroy_cb (DBusGProxy *proxy, + EmpathyTpContactList *list); +static gboolean tp_contact_list_find_foreach (guint handle, + EmpathyContact *contact, + gchar *id); +static void tp_contact_list_newchannel_cb (DBusGProxy *proxy, + const gchar *object_path, + const gchar *channel_type, + TelepathyHandleType handle_type, + guint channel_handle, + gboolean suppress_handle, + EmpathyTpContactList *list); +static TpContactListType tp_contact_list_get_type (EmpathyTpContactList *list, + EmpathyTpGroup *group); +static void tp_contact_list_added_cb (EmpathyTpGroup *group, + GArray *handles, + guint actor_handle, + guint reason, + const gchar *message, + EmpathyTpContactList *list); +static void tp_contact_list_removed_cb (EmpathyTpGroup *group, + GArray *handles, + guint actor_handle, + guint reason, + const gchar *message, + EmpathyTpContactList *list); +static void tp_contact_list_pending_cb (EmpathyTpGroup *group, + GArray *handles, + guint actor_handle, + guint reason, + const gchar *message, + EmpathyTpContactList *list); +static void tp_contact_list_groups_updated_cb (EmpathyContact *contact, + GParamSpec *param, + EmpathyTpContactList *list); +static void tp_contact_list_name_updated_cb (EmpathyContact *contact, + GParamSpec *param, + EmpathyTpContactList *list); +static void tp_contact_list_update_groups_foreach (gchar *object_path, + EmpathyTpGroup *group, + TpContactListData *data); +static EmpathyTpGroup * tp_contact_list_get_group (EmpathyTpContactList *list, + const gchar *name); +static gboolean tp_contact_list_find_group (gchar *key, + EmpathyTpGroup *group, + gchar *group_name); +static void tp_contact_list_get_groups_foreach (gchar *key, + EmpathyTpGroup *group, + GList **groups); +static void tp_contact_list_group_channel_closed_cb (TpChan *channel, + EmpathyTpContactList *list); +static void tp_contact_list_group_members_added_cb (EmpathyTpGroup *group, + GArray *members, + guint actor_handle, + guint reason, + const gchar *message, + EmpathyTpContactList *list); +static void tp_contact_list_group_members_removed_cb (EmpathyTpGroup *group, + GArray *members, + guint actor_handle, + guint reason, + const gchar *message, + EmpathyTpContactList *list); +static void tp_contact_list_get_info (EmpathyTpContactList *list, + GArray *handles); +static void tp_contact_list_request_avatar (EmpathyTpContactList *list, + guint handle); +static void tp_contact_list_start_avatar_requests (EmpathyTpContactList *list); +static void tp_contact_list_avatar_update_cb (DBusGProxy *proxy, + guint handle, + gchar *new_token, + EmpathyTpContactList *list); +static void tp_contact_list_request_avatar_cb (DBusGProxy *proxy, + GArray *avatar_data, + gchar *mime_type, + GError *error, + TpContactListAvatarRequestData *data); +static void tp_contact_list_aliases_update_cb (DBusGProxy *proxy, + GPtrArray *handlers, + EmpathyTpContactList *list); +static void tp_contact_list_request_aliases_cb (DBusGProxy *proxy, + gchar **contact_names, + GError *error, + TpContactListAliasesRequestData *data); +static void tp_contact_list_presence_update_cb (DBusGProxy *proxy, + GHashTable *handle_table, + EmpathyTpContactList *list); +static void tp_contact_list_parse_presence_foreach (guint handle, + GValueArray *presence_struct, + EmpathyTpContactList *list); +static void tp_contact_list_presences_table_foreach (const gchar *state_str, + GHashTable *presences_table, + EmpathyPresence **presence); +static void tp_contact_list_status_changed_cb (MissionControl *mc, + TelepathyConnectionStatus status, + McPresence presence, + TelepathyConnectionStatusReason reason, + const gchar *unique_name, + EmpathyTpContactList *list); enum { DESTROY, @@ -283,7 +283,7 @@ tp_contact_list_finalize (GObject *object) list = EMPATHY_TP_CONTACT_LIST (object); priv = GET_PRIV (list); - gossip_debug (DEBUG_DOMAIN, "finalize: %p", object); + empathy_debug (DEBUG_DOMAIN, "finalize: %p", object); dbus_g_proxy_disconnect_signal (DBUS_G_PROXY (priv->mc), "AccountStatusChanged", @@ -328,7 +328,7 @@ empathy_tp_contact_list_new (McAccount *account) g_return_val_if_fail (MC_IS_ACCOUNT (account), NULL); - mc = gossip_mission_control_new (); + mc = empathy_mission_control_new (); if (mission_control_get_connection_status (mc, account, NULL) != 0) { /* The account is not connected, nothing to do. */ @@ -381,12 +381,12 @@ empathy_tp_contact_list_new (McAccount *account) /* Get our own handle and contact */ if (!tp_conn_get_self_handle (DBUS_G_PROXY (priv->tp_conn), &handle, &error)) { - gossip_debug (DEBUG_DOMAIN, "GetSelfHandle Error: %s", + empathy_debug (DEBUG_DOMAIN, "GetSelfHandle Error: %s", error ? error->message : "No error given"); g_clear_error (&error); } else { priv->user_contact = empathy_tp_contact_list_get_from_handle (list, handle); - gossip_contact_set_is_user (priv->user_contact, TRUE); + empathy_contact_set_is_user (priv->user_contact, TRUE); } return list; @@ -404,7 +404,7 @@ tp_contact_list_setup (EmpathyContactList *list) priv = GET_PRIV (list); - gossip_debug (DEBUG_DOMAIN, "setup contact list: %p", list); + empathy_debug (DEBUG_DOMAIN, "setup contact list: %p", list); priv->setup = TRUE; dbus_g_proxy_connect_signal (DBUS_G_PROXY (priv->tp_conn), "NewChannel", @@ -415,7 +415,7 @@ tp_contact_list_setup (EmpathyContactList *list) if (!tp_conn_list_channels (DBUS_G_PROXY (priv->tp_conn), &channels, &error)) { - gossip_debug (DEBUG_DOMAIN, + empathy_debug (DEBUG_DOMAIN, "Failed to get list of open channels: %s", error ? error->message : "No error given"); g_clear_error (&error); @@ -447,7 +447,7 @@ tp_contact_list_setup (EmpathyContactList *list) g_ptr_array_free (channels, TRUE); } -static GossipContact * +static EmpathyContact * tp_contact_list_find (EmpathyContactList *list, const gchar *id) { @@ -464,7 +464,7 @@ tp_contact_list_find (EmpathyContactList *list, static void tp_contact_list_add (EmpathyContactList *list, - GossipContact *contact, + EmpathyContact *contact, const gchar *message) { EmpathyTpContactListPriv *priv; @@ -474,13 +474,13 @@ tp_contact_list_add (EmpathyContactList *list, priv = GET_PRIV (list); - handle = gossip_contact_get_handle (contact); - gossip_telepathy_group_add_member (priv->subscribe, handle, message); + handle = empathy_contact_get_handle (contact); + empathy_tp_group_add_member (priv->subscribe, handle, message); } static void tp_contact_list_remove (EmpathyContactList *list, - GossipContact *contact, + EmpathyContact *contact, const gchar *message) { EmpathyTpContactListPriv *priv; @@ -490,8 +490,8 @@ tp_contact_list_remove (EmpathyContactList *list, priv = GET_PRIV (list); - handle = gossip_contact_get_handle (contact); - gossip_telepathy_group_remove_member (priv->subscribe, handle, message); + handle = empathy_contact_get_handle (contact); + empathy_tp_group_remove_member (priv->subscribe, handle, message); } static GList * @@ -521,22 +521,22 @@ tp_contact_list_get_local_pending (EmpathyContactList *list) static void tp_contact_list_process_pending (EmpathyContactList *list, - GossipContact *contact, + EmpathyContact *contact, gboolean accept) { EmpathyTpContactListPriv *priv; guint handle; g_return_if_fail (EMPATHY_IS_TP_CONTACT_LIST (list)); - g_return_if_fail (GOSSIP_IS_CONTACT (contact)); + g_return_if_fail (EMPATHY_IS_CONTACT (contact)); priv = GET_PRIV (list); - handle = gossip_contact_get_handle (contact); + handle = empathy_contact_get_handle (contact); if (accept) { - gossip_telepathy_group_add_member (priv->publish, handle, NULL); + empathy_tp_group_add_member (priv->publish, handle, NULL); } else { - gossip_telepathy_group_remove_member (priv->publish, handle, NULL); + empathy_tp_group_remove_member (priv->publish, handle, NULL); } } @@ -552,7 +552,7 @@ empathy_tp_contact_list_get_account (EmpathyTpContactList *list) return priv->account; } -GossipContact * +EmpathyContact * empathy_tp_contact_list_get_user (EmpathyTpContactList *list) { EmpathyTpContactListPriv *priv; @@ -564,12 +564,12 @@ empathy_tp_contact_list_get_user (EmpathyTpContactList *list) return priv->user_contact; } -GossipContact * +EmpathyContact * empathy_tp_contact_list_get_from_id (EmpathyTpContactList *list, const gchar *id) { EmpathyTpContactListPriv *priv; - GossipContact *contact; + EmpathyContact *contact; const gchar *contact_ids[] = {id, NULL}; GArray *handles; guint handle; @@ -590,7 +590,7 @@ empathy_tp_contact_list_get_from_id (EmpathyTpContactList *list, TP_HANDLE_TYPE_CONTACT, contact_ids, &handles, &error)) { - gossip_debug (DEBUG_DOMAIN, + empathy_debug (DEBUG_DOMAIN, "RequestHandle for %s failed: %s", id, error ? error->message : "No error given"); g_clear_error (&error); @@ -603,11 +603,11 @@ empathy_tp_contact_list_get_from_id (EmpathyTpContactList *list, return empathy_tp_contact_list_get_from_handle (list, handle); } -GossipContact * +EmpathyContact * empathy_tp_contact_list_get_from_handle (EmpathyTpContactList *list, guint handle) { - GossipContact *contact; + EmpathyContact *contact; GArray *handles; GList *contacts; @@ -649,7 +649,7 @@ empathy_tp_contact_list_get_from_handles (EmpathyTpContactList *list, /* Search all handles we already have */ new_handles = g_array_new (FALSE, FALSE, sizeof (guint)); for (i = 0; i < handles->len; i++) { - GossipContact *contact; + EmpathyContact *contact; guint handle; handle = g_array_index (handles, guint, i); @@ -679,7 +679,7 @@ empathy_tp_contact_list_get_from_handles (EmpathyTpContactList *list, if (!tp_conn_hold_handles (DBUS_G_PROXY (priv->tp_conn), TP_HANDLE_TYPE_CONTACT, new_handles, &error)) { - gossip_debug (DEBUG_DOMAIN, + empathy_debug (DEBUG_DOMAIN, "HoldHandles Error: %s", error ? error->message : "No error given"); g_clear_error (&error); @@ -693,7 +693,7 @@ empathy_tp_contact_list_get_from_handles (EmpathyTpContactList *list, new_handles, &handles_names, &error)) { - gossip_debug (DEBUG_DOMAIN, + empathy_debug (DEBUG_DOMAIN, "InspectHandle Error: %s", error ? error->message : "No error given"); g_clear_error (&error); @@ -703,25 +703,25 @@ empathy_tp_contact_list_get_from_handles (EmpathyTpContactList *list, /* Create contact objects */ for (i = 0, id = handles_names; *id && i < new_handles->len; id++, i++) { - GossipContact *contact; + EmpathyContact *contact; guint handle; handle = g_array_index (new_handles, guint, i); - contact = g_object_new (GOSSIP_TYPE_CONTACT, + contact = g_object_new (EMPATHY_TYPE_CONTACT, "account", priv->account, "id", *id, "handle", handle, NULL); if (!priv->presence_iface) { - GossipPresence *presence; + EmpathyPresence *presence; /* We have no presence iface, set default presence * to available */ - presence = gossip_presence_new_full (MC_PRESENCE_AVAILABLE, + presence = empathy_presence_new_full (MC_PRESENCE_AVAILABLE, NULL); - gossip_contact_set_presence (contact, presence); + empathy_contact_set_presence (contact, presence); g_object_unref (presence); } @@ -732,7 +732,7 @@ empathy_tp_contact_list_get_from_handles (EmpathyTpContactList *list, G_CALLBACK (tp_contact_list_name_updated_cb), list); - gossip_debug (DEBUG_DOMAIN, "new contact created: %s (%d)", + empathy_debug (DEBUG_DOMAIN, "new contact created: %s (%d)", *id, handle); g_hash_table_insert (priv->contacts, @@ -756,7 +756,7 @@ empathy_tp_contact_list_rename_group (EmpathyTpContactList *list, const gchar *new_group) { EmpathyTpContactListPriv *priv; - GossipTelepathyGroup *group; + EmpathyTpGroup *group; GArray *members; g_return_if_fail (EMPATHY_IS_TP_CONTACT_LIST (list)); @@ -773,22 +773,22 @@ empathy_tp_contact_list_rename_group (EmpathyTpContactList *list, return; } - gossip_debug (DEBUG_DOMAIN, "rename group %s to %s", group, new_group); + empathy_debug (DEBUG_DOMAIN, "rename group %s to %s", group, new_group); /* Remove all members from the old group */ - members = gossip_telepathy_group_get_members (group); - gossip_telepathy_group_remove_members (group, members, ""); + members = empathy_tp_group_get_members (group); + empathy_tp_group_remove_members (group, members, ""); tp_contact_list_group_members_removed_cb (group, members, - 0, - TP_CHANNEL_GROUP_CHANGE_REASON_NONE, - NULL, list); + 0, + TP_CHANNEL_GROUP_CHANGE_REASON_NONE, + NULL, list); g_hash_table_remove (priv->groups, - gossip_telepathy_group_get_object_path (group)); + empathy_tp_group_get_object_path (group)); /* Add all members to the new group */ group = tp_contact_list_get_group (list, new_group); if (group) { - gossip_telepathy_group_add_members (group, members, ""); + empathy_tp_group_add_members (group, members, ""); } } @@ -857,7 +857,7 @@ tp_contact_list_destroy_cb (DBusGProxy *proxy, priv = GET_PRIV (list); - gossip_debug (DEBUG_DOMAIN, "Connection destroyed... " + empathy_debug (DEBUG_DOMAIN, "Connection destroyed... " "Account disconnected or CM crashed"); /* DBus proxies should NOT be used anymore */ @@ -879,7 +879,7 @@ tp_contact_list_destroy_cb (DBusGProxy *proxy, static void tp_contact_list_contact_removed_foreach (guint handle, - GossipContact *contact, + EmpathyContact *contact, EmpathyTpContactList *list) { g_signal_handlers_disconnect_by_func (contact, @@ -894,7 +894,7 @@ tp_contact_list_contact_removed_foreach (guint handle, static void tp_contact_list_block_contact (EmpathyTpContactList *list, - GossipContact *contact) + EmpathyContact *contact) { g_signal_handlers_block_by_func (contact, tp_contact_list_groups_updated_cb, @@ -906,7 +906,7 @@ tp_contact_list_block_contact (EmpathyTpContactList *list, static void tp_contact_list_unblock_contact (EmpathyTpContactList *list, - GossipContact *contact) + EmpathyContact *contact) { g_signal_handlers_unblock_by_func (contact, tp_contact_list_groups_updated_cb, @@ -918,10 +918,10 @@ tp_contact_list_unblock_contact (EmpathyTpContactList *list, static gboolean tp_contact_list_find_foreach (guint handle, - GossipContact *contact, + EmpathyContact *contact, gchar *id) { - if (strcmp (gossip_contact_get_id (contact), id) == 0) { + if (strcmp (empathy_contact_get_id (contact), id) == 0) { return TRUE; } @@ -938,7 +938,7 @@ tp_contact_list_newchannel_cb (DBusGProxy *proxy, EmpathyTpContactList *list) { EmpathyTpContactListPriv *priv; - GossipTelepathyGroup *group; + EmpathyTpGroup *group; TpChan *new_chan; const gchar *bus_name; GArray *members; @@ -960,19 +960,19 @@ tp_contact_list_newchannel_cb (DBusGProxy *proxy, if (handle_type == TP_HANDLE_TYPE_LIST) { TpContactListType list_type; - group = gossip_telepathy_group_new (new_chan, priv->tp_conn); + group = empathy_tp_group_new (new_chan, priv->tp_conn); list_type = tp_contact_list_get_type (list, group); if (list_type == TP_CONTACT_LIST_TYPE_UNKNOWN) { - gossip_debug (DEBUG_DOMAIN, + empathy_debug (DEBUG_DOMAIN, "Type of contact list channel unknown: %s", - gossip_telepathy_group_get_name (group)); + empathy_tp_group_get_name (group)); g_object_unref (new_chan); g_object_unref (group); return; } else { - gossip_debug (DEBUG_DOMAIN, + empathy_debug (DEBUG_DOMAIN, "New contact list channel of type: %d", list_type); } @@ -997,13 +997,13 @@ tp_contact_list_newchannel_cb (DBusGProxy *proxy, G_CALLBACK (tp_contact_list_pending_cb), list); - pendings = gossip_telepathy_group_get_local_pending_members_with_info (group); + pendings = empathy_tp_group_get_local_pending_members_with_info (group); if (pendings) { GArray *pending; pending = g_array_sized_new (FALSE, FALSE, sizeof (guint), 1); for (l = pendings; l; l = l->next) { - GossipTpGroupInfo *info; + EmpathyTpGroupInfo *info; info = l->data; @@ -1015,7 +1015,7 @@ tp_contact_list_newchannel_cb (DBusGProxy *proxy, list); } g_array_free (pending, TRUE); - gossip_telepathy_group_info_list_free (pendings); + empathy_tp_group_info_list_free (pendings); } } if (list_type == TP_CONTACT_LIST_TYPE_SUBSCRIBE) { @@ -1030,10 +1030,10 @@ tp_contact_list_newchannel_cb (DBusGProxy *proxy, g_signal_connect (group, "remote-pending", G_CALLBACK (tp_contact_list_pending_cb), list); - gossip_telepathy_group_get_all_members (group, - &members, - NULL, - &remote_pendings); + empathy_tp_group_get_all_members (group, + &members, + NULL, + &remote_pendings); tp_contact_list_pending_cb (group, remote_pendings, 0, TP_CHANNEL_GROUP_CHANGE_REASON_NONE, @@ -1041,7 +1041,7 @@ tp_contact_list_newchannel_cb (DBusGProxy *proxy, list); g_array_free (remote_pendings, TRUE); } else { - members = gossip_telepathy_group_get_members (group); + members = empathy_tp_group_get_members (group); } tp_contact_list_added_cb (group, members, 0, @@ -1058,10 +1058,10 @@ tp_contact_list_newchannel_cb (DBusGProxy *proxy, return; } - group = gossip_telepathy_group_new (new_chan, priv->tp_conn); + group = empathy_tp_group_new (new_chan, priv->tp_conn); - gossip_debug (DEBUG_DOMAIN, "New server-side group channel: %s", - gossip_telepathy_group_get_name (group)); + empathy_debug (DEBUG_DOMAIN, "New server-side group channel: %s", + empathy_tp_group_get_name (group)); dbus_g_proxy_connect_signal (DBUS_G_PROXY (new_chan), "Closed", G_CALLBACK @@ -1076,10 +1076,10 @@ tp_contact_list_newchannel_cb (DBusGProxy *proxy, G_CALLBACK (tp_contact_list_group_members_removed_cb), list); - members = gossip_telepathy_group_get_members (group); + members = empathy_tp_group_get_members (group); tp_contact_list_group_members_added_cb (group, members, 0, - TP_CHANNEL_GROUP_CHANGE_REASON_NONE, - NULL, list); + TP_CHANNEL_GROUP_CHANGE_REASON_NONE, + NULL, list); g_array_free (members, TRUE); } @@ -1088,15 +1088,15 @@ tp_contact_list_newchannel_cb (DBusGProxy *proxy, static TpContactListType tp_contact_list_get_type (EmpathyTpContactList *list, - GossipTelepathyGroup *group) + EmpathyTpGroup *group) { - EmpathyTpContactListPriv *priv; - TpContactListType list_type; - const gchar *name; + EmpathyTpContactListPriv *priv; + TpContactListType list_type; + const gchar *name; priv = GET_PRIV (list); - name = gossip_telepathy_group_get_name (group); + name = empathy_tp_group_get_name (group); if (strcmp (name, "subscribe") == 0) { list_type = TP_CONTACT_LIST_TYPE_SUBSCRIBE; } else if (strcmp (name, "publish") == 0) { @@ -1109,7 +1109,7 @@ tp_contact_list_get_type (EmpathyTpContactList *list, } static void -tp_contact_list_added_cb (GossipTelepathyGroup *group, +tp_contact_list_added_cb (EmpathyTpGroup *group, GArray *handles, guint actor_handle, guint reason, @@ -1126,26 +1126,26 @@ tp_contact_list_added_cb (GossipTelepathyGroup *group, added_list = empathy_tp_contact_list_get_from_handles (list, handles); for (l = added_list; l; l = l->next) { - GossipContact *contact; - GossipSubscription subscription; + EmpathyContact *contact; + EmpathySubscription subscription; - contact = GOSSIP_CONTACT (l->data); + contact = EMPATHY_CONTACT (l->data); - gossip_debug (DEBUG_DOMAIN, "Contact '%s' added to list type %d", - gossip_contact_get_name (contact), + empathy_debug (DEBUG_DOMAIN, "Contact '%s' added to list type %d", + empathy_contact_get_name (contact), list_type); - subscription = gossip_contact_get_subscription (contact); + subscription = empathy_contact_get_subscription (contact); if (list_type == TP_CONTACT_LIST_TYPE_SUBSCRIBE) { - subscription |= GOSSIP_SUBSCRIPTION_FROM; + subscription |= EMPATHY_SUBSCRIPTION_FROM; } else if (list_type == TP_CONTACT_LIST_TYPE_PUBLISH) { - subscription |= GOSSIP_SUBSCRIPTION_TO; + subscription |= EMPATHY_SUBSCRIPTION_TO; tp_contact_list_remove_local_pending (list, contact); } tp_contact_list_block_contact (list, contact); - gossip_contact_set_subscription (contact, subscription); + empathy_contact_set_subscription (contact, subscription); tp_contact_list_unblock_contact (list, contact); if (list_type == TP_CONTACT_LIST_TYPE_SUBSCRIBE) { @@ -1163,7 +1163,7 @@ tp_contact_list_added_cb (GossipTelepathyGroup *group, } static void -tp_contact_list_removed_cb (GossipTelepathyGroup *group, +tp_contact_list_removed_cb (EmpathyTpGroup *group, GArray *handles, guint actor_handle, guint reason, @@ -1180,26 +1180,26 @@ tp_contact_list_removed_cb (GossipTelepathyGroup *group, removed_list = empathy_tp_contact_list_get_from_handles (list, handles); for (l = removed_list; l; l = l->next) { - GossipContact *contact; - GossipSubscription subscription; + EmpathyContact *contact; + EmpathySubscription subscription; - contact = GOSSIP_CONTACT (l->data); + contact = EMPATHY_CONTACT (l->data); - gossip_debug (DEBUG_DOMAIN, "Contact '%s' removed from list type %d", - gossip_contact_get_name (contact), + empathy_debug (DEBUG_DOMAIN, "Contact '%s' removed from list type %d", + empathy_contact_get_name (contact), list_type); - subscription = gossip_contact_get_subscription (contact); + subscription = empathy_contact_get_subscription (contact); if (list_type == TP_CONTACT_LIST_TYPE_SUBSCRIBE) { - subscription &= !GOSSIP_SUBSCRIPTION_FROM; + subscription &= !EMPATHY_SUBSCRIPTION_FROM; } else if (list_type == TP_CONTACT_LIST_TYPE_PUBLISH) { - subscription &= !GOSSIP_SUBSCRIPTION_TO; + subscription &= !EMPATHY_SUBSCRIPTION_TO; tp_contact_list_remove_local_pending (list, contact); } tp_contact_list_block_contact (list, contact); - gossip_contact_set_subscription (contact, subscription); + empathy_contact_set_subscription (contact, subscription); tp_contact_list_unblock_contact (list, contact); if (list_type == TP_CONTACT_LIST_TYPE_SUBSCRIBE) { @@ -1218,7 +1218,7 @@ tp_contact_list_removed_cb (GossipTelepathyGroup *group, } static void -tp_contact_list_pending_cb (GossipTelepathyGroup *group, +tp_contact_list_pending_cb (EmpathyTpGroup *group, GArray *handles, guint actor_handle, guint reason, @@ -1235,12 +1235,12 @@ tp_contact_list_pending_cb (GossipTelepathyGroup *group, pending_list = empathy_tp_contact_list_get_from_handles (list, handles); for (l = pending_list; l; l = l->next) { - GossipContact *contact; + EmpathyContact *contact; - contact = GOSSIP_CONTACT (l->data); + contact = EMPATHY_CONTACT (l->data); - gossip_debug (DEBUG_DOMAIN, "Contact '%s' pending in list type %d", - gossip_contact_get_name (contact), + empathy_debug (DEBUG_DOMAIN, "Contact '%s' pending in list type %d", + empathy_contact_get_name (contact), list_type); if (list_type == TP_CONTACT_LIST_TYPE_PUBLISH) { @@ -1269,7 +1269,7 @@ tp_contact_list_pending_cb (GossipTelepathyGroup *group, static void tp_contact_list_remove_local_pending (EmpathyTpContactList *list, - GossipContact *contact) + EmpathyContact *contact) { EmpathyTpContactListPriv *priv; GList *l; @@ -1280,9 +1280,9 @@ tp_contact_list_remove_local_pending (EmpathyTpContactList *list, EmpathyContactListInfo *info; info = l->data; - if (gossip_contact_equal (contact, info->contact)) { - gossip_debug (DEBUG_DOMAIN, "Contact no more local-pending: %s", - gossip_contact_get_name (contact)); + if (empathy_contact_equal (contact, info->contact)) { + empathy_debug (DEBUG_DOMAIN, "Contact no more local-pending: %s", + empathy_contact_get_name (contact)); priv->local_pending = g_list_delete_link (priv->local_pending, l); empathy_contact_list_info_free (info); @@ -1292,7 +1292,7 @@ tp_contact_list_remove_local_pending (EmpathyTpContactList *list, } static void -tp_contact_list_groups_updated_cb (GossipContact *contact, +tp_contact_list_groups_updated_cb (EmpathyContact *contact, GParamSpec *param, EmpathyTpContactList *list) { @@ -1303,12 +1303,12 @@ tp_contact_list_groups_updated_cb (GossipContact *contact, priv = GET_PRIV (list); /* Make sure all groups are created */ - groups = gossip_contact_get_groups (contact); + groups = empathy_contact_get_groups (contact); for (l = groups; l; l = l->next) { tp_contact_list_get_group (list, l->data); } - data.handle = gossip_contact_get_handle (contact); + data.handle = empathy_contact_get_handle (contact); data.new_groups = groups; g_hash_table_foreach (priv->groups, @@ -1317,7 +1317,7 @@ tp_contact_list_groups_updated_cb (GossipContact *contact, } static void -tp_contact_list_name_updated_cb (GossipContact *contact, +tp_contact_list_name_updated_cb (EmpathyContact *contact, GParamSpec *param, EmpathyTpContactList *list) { @@ -1333,10 +1333,10 @@ tp_contact_list_name_updated_cb (GossipContact *contact, return; } - handle = gossip_contact_get_handle (contact); - new_name = gossip_contact_get_name (contact); + handle = empathy_contact_get_handle (contact); + new_name = empathy_contact_get_name (contact); - gossip_debug (DEBUG_DOMAIN, "renaming handle %d to %s", + empathy_debug (DEBUG_DOMAIN, "renaming handle %d to %s", handle, new_name); new_alias = g_hash_table_new_full (g_direct_hash, @@ -1351,7 +1351,7 @@ tp_contact_list_name_updated_cb (GossipContact *contact, if (!tp_conn_iface_aliasing_set_aliases (priv->aliasing_iface, new_alias, &error)) { - gossip_debug (DEBUG_DOMAIN, + empathy_debug (DEBUG_DOMAIN, "Couldn't rename contact: %s", error ? error->message : "No error given"); g_clear_error (&error); @@ -1361,17 +1361,17 @@ tp_contact_list_name_updated_cb (GossipContact *contact, } static void -tp_contact_list_update_groups_foreach (gchar *object_path, - GossipTelepathyGroup *group, - TpContactListData *data) +tp_contact_list_update_groups_foreach (gchar *object_path, + EmpathyTpGroup *group, + TpContactListData *data) { gboolean is_member; gboolean found = FALSE; const gchar *group_name; GList *l; - is_member = gossip_telepathy_group_is_member (group, data->handle); - group_name = gossip_telepathy_group_get_name (group); + is_member = empathy_tp_group_is_member (group, data->handle); + group_name = empathy_tp_group_get_name (group); for (l = data->new_groups; l; l = l->next) { if (strcmp (group_name, l->data) == 0) { @@ -1382,25 +1382,25 @@ tp_contact_list_update_groups_foreach (gchar *object_path, if (is_member && !found) { /* We are no longer member of this group */ - gossip_debug (DEBUG_DOMAIN, "Contact %d removed from group '%s'", + empathy_debug (DEBUG_DOMAIN, "Contact %d removed from group '%s'", data->handle, group_name); - gossip_telepathy_group_remove_member (group, data->handle, ""); + empathy_tp_group_remove_member (group, data->handle, ""); } if (!is_member && found) { /* We are now member of this group */ - gossip_debug (DEBUG_DOMAIN, "Contact %d added to group '%s'", + empathy_debug (DEBUG_DOMAIN, "Contact %d added to group '%s'", data->handle, group_name); - gossip_telepathy_group_add_member (group, data->handle, ""); + empathy_tp_group_add_member (group, data->handle, ""); } } -static GossipTelepathyGroup * +static EmpathyTpGroup * tp_contact_list_get_group (EmpathyTpContactList *list, const gchar *name) { EmpathyTpContactListPriv *priv; - GossipTelepathyGroup *group; + EmpathyTpGroup *group; TpChan *group_channel; GArray *handles; guint group_handle; @@ -1417,14 +1417,14 @@ tp_contact_list_get_group (EmpathyTpContactList *list, return group; } - gossip_debug (DEBUG_DOMAIN, "creating new group: %s", name); + empathy_debug (DEBUG_DOMAIN, "creating new group: %s", name); if (!tp_conn_request_handles (DBUS_G_PROXY (priv->tp_conn), TP_HANDLE_TYPE_GROUP, names, &handles, &error)) { - gossip_debug (DEBUG_DOMAIN, + empathy_debug (DEBUG_DOMAIN, "Couldn't request the creation of a new handle for group: %s", error ? error->message : "No error given"); g_clear_error (&error); @@ -1440,7 +1440,7 @@ tp_contact_list_get_group (EmpathyTpContactList *list, FALSE, &group_object_path, &error)) { - gossip_debug (DEBUG_DOMAIN, + empathy_debug (DEBUG_DOMAIN, "Couldn't request the creation of a new group channel: %s", error ? error->message : "No error given"); g_clear_error (&error); @@ -1461,7 +1461,7 @@ tp_contact_list_get_group (EmpathyTpContactList *list, list, NULL); - group = gossip_telepathy_group_new (group_channel, priv->tp_conn); + group = empathy_tp_group_new (group_channel, priv->tp_conn); g_hash_table_insert (priv->groups, group_object_path, group); g_signal_connect (group, "members-added", G_CALLBACK (tp_contact_list_group_members_added_cb), @@ -1474,11 +1474,11 @@ tp_contact_list_get_group (EmpathyTpContactList *list, } static gboolean -tp_contact_list_find_group (gchar *key, - GossipTelepathyGroup *group, - gchar *group_name) +tp_contact_list_find_group (gchar *key, + EmpathyTpGroup *group, + gchar *group_name) { - if (strcmp (group_name, gossip_telepathy_group_get_name (group)) == 0) { + if (strcmp (group_name, empathy_tp_group_get_name (group)) == 0) { return TRUE; } @@ -1486,13 +1486,13 @@ tp_contact_list_find_group (gchar *key, } static void -tp_contact_list_get_groups_foreach (gchar *key, - GossipTelepathyGroup *group, - GList **groups) +tp_contact_list_get_groups_foreach (gchar *key, + EmpathyTpGroup *group, + GList **groups) { const gchar *name; - name = gossip_telepathy_group_get_name (group); + name = empathy_tp_group_get_name (group); *groups = g_list_append (*groups, g_strdup (name)); } @@ -1509,7 +1509,7 @@ tp_contact_list_group_channel_closed_cb (TpChan *channel, } static void -tp_contact_list_group_members_added_cb (GossipTelepathyGroup *group, +tp_contact_list_group_members_added_cb (EmpathyTpGroup *group, GArray *members, guint actor_handle, guint reason, @@ -1522,16 +1522,16 @@ tp_contact_list_group_members_added_cb (GossipTelepathyGroup *group, priv = GET_PRIV (list); - group_name = gossip_telepathy_group_get_name (group); + group_name = empathy_tp_group_get_name (group); added_list = empathy_tp_contact_list_get_from_handles (list, members); for (l = added_list; l; l = l->next) { - GossipContact *contact; + EmpathyContact *contact; - contact = GOSSIP_CONTACT (l->data); + contact = EMPATHY_CONTACT (l->data); tp_contact_list_block_contact (list, contact); - gossip_contact_add_group (contact, group_name); + empathy_contact_add_group (contact, group_name); tp_contact_list_unblock_contact (list, contact); g_object_unref (contact); @@ -1541,7 +1541,7 @@ tp_contact_list_group_members_added_cb (GossipTelepathyGroup *group, } static void -tp_contact_list_group_members_removed_cb (GossipTelepathyGroup *group, +tp_contact_list_group_members_removed_cb (EmpathyTpGroup *group, GArray *members, guint actor_handle, guint reason, @@ -1554,16 +1554,16 @@ tp_contact_list_group_members_removed_cb (GossipTelepathyGroup *group, priv = GET_PRIV (list); - group_name = gossip_telepathy_group_get_name (group); + group_name = empathy_tp_group_get_name (group); removed_list = empathy_tp_contact_list_get_from_handles (list, members); for (l = removed_list; l; l = l->next) { - GossipContact *contact; + EmpathyContact *contact; contact = l->data; tp_contact_list_block_contact (list, contact); - gossip_contact_remove_group (contact, group_name); + empathy_contact_remove_group (contact, group_name); tp_contact_list_unblock_contact (list, contact); g_object_unref (contact); @@ -1585,7 +1585,7 @@ tp_contact_list_get_info (EmpathyTpContactList *list, /* FIXME: We should use GetPresence instead */ if (!tp_conn_iface_presence_request_presence (priv->presence_iface, handles, &error)) { - gossip_debug (DEBUG_DOMAIN, + empathy_debug (DEBUG_DOMAIN, "Could not request presences: %s", error ? error->message : "No error given"); g_clear_error (&error); @@ -1675,7 +1675,7 @@ tp_contact_list_avatar_update_cb (DBusGProxy *proxy, return; } - gossip_debug (DEBUG_DOMAIN, "Changing avatar for %d to %s", + empathy_debug (DEBUG_DOMAIN, "Changing avatar for %d to %s", handle, new_token); tp_contact_list_request_avatar (list, handle); @@ -1688,24 +1688,24 @@ tp_contact_list_request_avatar_cb (DBusGProxy *proxy, GError *error, TpContactListAvatarRequestData *data) { - GossipContact *contact; + EmpathyContact *contact; contact = empathy_tp_contact_list_get_from_handle (data->list, data->handle); if (error) { - gossip_debug (DEBUG_DOMAIN, "Error requesting avatar for %s: %s", - gossip_contact_get_name (contact), + empathy_debug (DEBUG_DOMAIN, "Error requesting avatar for %s: %s", + empathy_contact_get_name (contact), error ? error->message : "No error given"); } else { - GossipAvatar *avatar; + EmpathyAvatar *avatar; - avatar = gossip_avatar_new (avatar_data->data, + avatar = empathy_avatar_new (avatar_data->data, avatar_data->len, mime_type); tp_contact_list_block_contact (data->list, contact); - gossip_contact_set_avatar (contact, avatar); + empathy_contact_set_avatar (contact, avatar); tp_contact_list_unblock_contact (data->list, contact); - gossip_avatar_unref (avatar); + empathy_avatar_unref (avatar); } n_avatar_requests--; @@ -1729,7 +1729,7 @@ tp_contact_list_aliases_update_cb (DBusGProxy *proxy, guint handle; const gchar *alias; GValueArray *renamed_struct; - GossipContact *contact; + EmpathyContact *contact; renamed_struct = g_ptr_array_index (renamed_handlers, i); handle = g_value_get_uint(g_value_array_get_nth (renamed_struct, 0)); @@ -1746,11 +1746,11 @@ tp_contact_list_aliases_update_cb (DBusGProxy *proxy, contact = empathy_tp_contact_list_get_from_handle (list, handle); tp_contact_list_block_contact (list, contact); - gossip_contact_set_name (contact, alias); + empathy_contact_set_name (contact, alias); tp_contact_list_unblock_contact (list, contact); g_object_unref (contact); - gossip_debug (DEBUG_DOMAIN, "contact %d renamed to %s (update cb)", + empathy_debug (DEBUG_DOMAIN, "contact %d renamed to %s (update cb)", handle, alias); } } @@ -1765,21 +1765,21 @@ tp_contact_list_request_aliases_cb (DBusGProxy *proxy, gchar **name; if (error) { - gossip_debug (DEBUG_DOMAIN, "Error requesting aliases: %s", + empathy_debug (DEBUG_DOMAIN, "Error requesting aliases: %s", error->message); } for (name = contact_names; *name && !error; name++) { - GossipContact *contact; + EmpathyContact *contact; contact = empathy_tp_contact_list_get_from_handle (data->list, data->handles[i]); tp_contact_list_block_contact (data->list, contact); - gossip_contact_set_name (contact, *name); + empathy_contact_set_name (contact, *name); tp_contact_list_unblock_contact (data->list, contact); g_object_unref (contact); - gossip_debug (DEBUG_DOMAIN, "contact %d renamed to %s (request cb)", + empathy_debug (DEBUG_DOMAIN, "contact %d renamed to %s (request cb)", data->handles[i], *name); i++; @@ -1806,8 +1806,8 @@ tp_contact_list_parse_presence_foreach (guint handle, { EmpathyTpContactListPriv *priv; GHashTable *presences_table; - GossipContact *contact; - GossipPresence *presence = NULL; + EmpathyContact *contact; + EmpathyPresence *presence = NULL; priv = GET_PRIV (list); @@ -1823,14 +1823,14 @@ tp_contact_list_parse_presence_foreach (guint handle, (GHFunc) tp_contact_list_presences_table_foreach, &presence); - gossip_debug (DEBUG_DOMAIN, "Presence changed for %s (%d) to %s (%d)", - gossip_contact_get_name (contact), + empathy_debug (DEBUG_DOMAIN, "Presence changed for %s (%d) to %s (%d)", + empathy_contact_get_name (contact), handle, - presence ? gossip_presence_get_status (presence) : "unset", - presence ? gossip_presence_get_state (presence) : MC_PRESENCE_UNSET); + presence ? empathy_presence_get_status (presence) : "unset", + presence ? empathy_presence_get_state (presence) : MC_PRESENCE_UNSET); tp_contact_list_block_contact (list, contact); - gossip_contact_set_presence (contact, presence); + empathy_contact_set_presence (contact, presence); tp_contact_list_unblock_contact (list, contact); g_object_unref (contact); @@ -1839,12 +1839,12 @@ tp_contact_list_parse_presence_foreach (guint handle, static void tp_contact_list_presences_table_foreach (const gchar *state_str, GHashTable *presences_table, - GossipPresence **presence) + EmpathyPresence **presence) { McPresence state; const GValue *message; - state = gossip_presence_state_from_str (state_str); + state = empathy_presence_state_from_str (state_str); if ((state == MC_PRESENCE_UNSET) || (state == MC_PRESENCE_OFFLINE)) { return; } @@ -1854,12 +1854,12 @@ tp_contact_list_presences_table_foreach (const gchar *state_str, *presence = NULL; } - *presence = gossip_presence_new (); - gossip_presence_set_state (*presence, state); + *presence = empathy_presence_new (); + empathy_presence_set_state (*presence, state); message = g_hash_table_lookup (presences_table, "message"); if (message != NULL) { - gossip_presence_set_status (*presence, + empathy_presence_set_status (*presence, g_value_get_string (message)); } } @@ -1879,7 +1879,7 @@ tp_contact_list_status_changed_cb (MissionControl *mc, account = mc_account_lookup (unique_name); if (status != TP_CONN_STATUS_DISCONNECTED || - !gossip_account_equal (account, priv->account) || + !empathy_account_equal (account, priv->account) || !priv->tp_conn) { g_object_unref (account); return; diff --git a/libempathy/empathy-tp-contact-list.h b/libempathy/empathy-tp-contact-list.h index 580741328..f0eccb375 100644 --- a/libempathy/empathy-tp-contact-list.h +++ b/libempathy/empathy-tp-contact-list.h @@ -27,7 +27,7 @@ #include <glib.h> #include <libmissioncontrol/mc-account.h> -#include "gossip-contact.h" +#include "empathy-contact.h" G_BEGIN_DECLS @@ -53,10 +53,10 @@ struct _EmpathyTpContactListClass { GType empathy_tp_contact_list_get_type (void) G_GNUC_CONST; EmpathyTpContactList * empathy_tp_contact_list_new (McAccount *account); McAccount * empathy_tp_contact_list_get_account (EmpathyTpContactList *list); -GossipContact * empathy_tp_contact_list_get_user (EmpathyTpContactList *list); -GossipContact * empathy_tp_contact_list_get_from_id (EmpathyTpContactList *list, +EmpathyContact * empathy_tp_contact_list_get_user (EmpathyTpContactList *list); +EmpathyContact * empathy_tp_contact_list_get_from_id (EmpathyTpContactList *list, const gchar *id); -GossipContact * empathy_tp_contact_list_get_from_handle (EmpathyTpContactList *list, +EmpathyContact * empathy_tp_contact_list_get_from_handle (EmpathyTpContactList *list, guint handle); GList * empathy_tp_contact_list_get_from_handles (EmpathyTpContactList *list, GArray *handles); diff --git a/libempathy/gossip-telepathy-group.c b/libempathy/empathy-tp-group.c index 5d6bff670..45a5e784d 100644 --- a/libempathy/gossip-telepathy-group.c +++ b/libempathy/empathy-tp-group.c @@ -26,36 +26,36 @@ #include <libtelepathy/tp-constants.h> #include <libtelepathy/tp-conn.h> -#include "gossip-debug.h" -#include "gossip-telepathy-group.h" +#include "empathy-debug.h" +#include "empathy-tp-group.h" #include "empathy-marshal.h" #define GET_PRIV(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), \ - GOSSIP_TYPE_TELEPATHY_GROUP, GossipTelepathyGroupPriv)) + EMPATHY_TYPE_TP_GROUP, EmpathyTpGroupPriv)) -#define DEBUG_DOMAIN "TelepathyGroup" +#define DEBUG_DOMAIN "TpGroup" -struct _GossipTelepathyGroupPriv { +struct _EmpathyTpGroupPriv { DBusGProxy *group_iface; TpConn *tp_conn; TpChan *tp_chan; gchar *group_name; }; -static void gossip_telepathy_group_class_init (GossipTelepathyGroupClass *klass); -static void gossip_telepathy_group_init (GossipTelepathyGroup *group); -static void telepathy_group_finalize (GObject *object); -static void telepathy_group_destroy_cb (DBusGProxy *proxy, - GossipTelepathyGroup *group); -static void telepathy_group_members_changed_cb (DBusGProxy *group_iface, - gchar *message, - GArray *added, - GArray *removed, - GArray *local_pending, - GArray *remote_pending, - guint actor, - guint reason, - GossipTelepathyGroup *group); +static void empathy_tp_group_class_init (EmpathyTpGroupClass *klass); +static void empathy_tp_group_init (EmpathyTpGroup *group); +static void tp_group_finalize (GObject *object); +static void tp_group_destroy_cb (DBusGProxy *proxy, + EmpathyTpGroup *group); +static void tp_group_members_changed_cb (DBusGProxy *group_iface, + gchar *message, + GArray *added, + GArray *removed, + GArray *local_pending, + GArray *remote_pending, + guint actor, + guint reason, + EmpathyTpGroup *group); enum { MEMBERS_ADDED, @@ -67,14 +67,14 @@ enum { static guint signals[LAST_SIGNAL]; -G_DEFINE_TYPE (GossipTelepathyGroup, gossip_telepathy_group, G_TYPE_OBJECT); +G_DEFINE_TYPE (EmpathyTpGroup, empathy_tp_group, G_TYPE_OBJECT); static void -gossip_telepathy_group_class_init (GossipTelepathyGroupClass *klass) +empathy_tp_group_class_init (EmpathyTpGroupClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); - object_class->finalize = telepathy_group_finalize; + object_class->finalize = tp_group_finalize; signals[MEMBERS_ADDED] = g_signal_new ("members-added", @@ -116,27 +116,27 @@ gossip_telepathy_group_class_init (GossipTelepathyGroupClass *klass) G_TYPE_NONE, 4, G_TYPE_POINTER, G_TYPE_UINT, G_TYPE_UINT, G_TYPE_STRING); - g_type_class_add_private (object_class, sizeof (GossipTelepathyGroupPriv)); + g_type_class_add_private (object_class, sizeof (EmpathyTpGroupPriv)); } static void -gossip_telepathy_group_init (GossipTelepathyGroup *group) +empathy_tp_group_init (EmpathyTpGroup *group) { } static void -telepathy_group_finalize (GObject *object) +tp_group_finalize (GObject *object) { - GossipTelepathyGroupPriv *priv; + EmpathyTpGroupPriv *priv; priv = GET_PRIV (object); if (priv->group_iface) { g_signal_handlers_disconnect_by_func (priv->group_iface, - telepathy_group_destroy_cb, + tp_group_destroy_cb, object); dbus_g_proxy_disconnect_signal (priv->group_iface, "MembersChanged", - G_CALLBACK (telepathy_group_members_changed_cb), + G_CALLBACK (tp_group_members_changed_cb), object); g_object_unref (priv->group_iface); } @@ -151,16 +151,16 @@ telepathy_group_finalize (GObject *object) g_free (priv->group_name); - G_OBJECT_CLASS (gossip_telepathy_group_parent_class)->finalize (object); + G_OBJECT_CLASS (empathy_tp_group_parent_class)->finalize (object); } -GossipTelepathyGroup * -gossip_telepathy_group_new (TpChan *tp_chan, - TpConn *tp_conn) +EmpathyTpGroup * +empathy_tp_group_new (TpChan *tp_chan, + TpConn *tp_conn) { - GossipTelepathyGroup *group; - GossipTelepathyGroupPriv *priv; - DBusGProxy *group_iface; + EmpathyTpGroup *group; + EmpathyTpGroupPriv *priv; + DBusGProxy *group_iface; g_return_val_if_fail (TELEPATHY_IS_CHAN (tp_chan), NULL); @@ -168,7 +168,7 @@ gossip_telepathy_group_new (TpChan *tp_chan, TELEPATHY_CHAN_IFACE_GROUP_QUARK); g_return_val_if_fail (group_iface != NULL, NULL); - group = g_object_new (GOSSIP_TYPE_TELEPATHY_GROUP, NULL); + group = g_object_new (EMPATHY_TYPE_TP_GROUP, NULL); priv = GET_PRIV (group); priv->tp_conn = g_object_ref (tp_conn); @@ -176,25 +176,24 @@ gossip_telepathy_group_new (TpChan *tp_chan, priv->group_iface = g_object_ref (group_iface); dbus_g_proxy_connect_signal (priv->group_iface, "MembersChanged", - G_CALLBACK (telepathy_group_members_changed_cb), + G_CALLBACK (tp_group_members_changed_cb), group, NULL); g_signal_connect (group_iface, "destroy", - G_CALLBACK (telepathy_group_destroy_cb), + G_CALLBACK (tp_group_destroy_cb), group); - return group; } void -gossip_telepathy_group_add_members (GossipTelepathyGroup *group, - GArray *handles, - const gchar *message) +empathy_tp_group_add_members (EmpathyTpGroup *group, + GArray *handles, + const gchar *message) { - GossipTelepathyGroupPriv *priv; - GError *error = NULL; + EmpathyTpGroupPriv *priv; + GError *error = NULL; - g_return_if_fail (GOSSIP_IS_TELEPATHY_GROUP (group)); + g_return_if_fail (EMPATHY_IS_TP_GROUP (group)); g_return_if_fail (handles != NULL); priv = GET_PRIV (group); @@ -203,7 +202,7 @@ gossip_telepathy_group_add_members (GossipTelepathyGroup *group, handles, message, &error)) { - gossip_debug (DEBUG_DOMAIN, + empathy_debug (DEBUG_DOMAIN, "Failed to add members: %s", error ? error->message : "No error given"); g_clear_error (&error); @@ -211,29 +210,29 @@ gossip_telepathy_group_add_members (GossipTelepathyGroup *group, } void -gossip_telepathy_group_add_member (GossipTelepathyGroup *group, - guint handle, - const gchar *message) +empathy_tp_group_add_member (EmpathyTpGroup *group, + guint handle, + const gchar *message) { GArray *handles; handles = g_array_new (FALSE, FALSE, sizeof (guint)); g_array_append_val (handles, handle); - gossip_telepathy_group_add_members (group, handles, message); + empathy_tp_group_add_members (group, handles, message); g_array_free (handles, TRUE); } void -gossip_telepathy_group_remove_members (GossipTelepathyGroup *group, - GArray *handles, - const gchar *message) +empathy_tp_group_remove_members (EmpathyTpGroup *group, + GArray *handles, + const gchar *message) { - GossipTelepathyGroupPriv *priv; - GError *error = NULL; + EmpathyTpGroupPriv *priv; + GError *error = NULL; - g_return_if_fail (GOSSIP_IS_TELEPATHY_GROUP (group)); + g_return_if_fail (EMPATHY_IS_TP_GROUP (group)); priv = GET_PRIV (group); @@ -241,7 +240,7 @@ gossip_telepathy_group_remove_members (GossipTelepathyGroup *group, handles, message, &error)) { - gossip_debug (DEBUG_DOMAIN, + empathy_debug (DEBUG_DOMAIN, "Failed to remove members: %s", error ? error->message : "No error given"); g_clear_error (&error); @@ -249,37 +248,37 @@ gossip_telepathy_group_remove_members (GossipTelepathyGroup *group, } void -gossip_telepathy_group_remove_member (GossipTelepathyGroup *group, - guint handle, - const gchar *message) +empathy_tp_group_remove_member (EmpathyTpGroup *group, + guint handle, + const gchar *message) { GArray *handles; - g_return_if_fail (GOSSIP_IS_TELEPATHY_GROUP (group)); + g_return_if_fail (EMPATHY_IS_TP_GROUP (group)); handles = g_array_new (FALSE, FALSE, sizeof (guint)); g_array_append_val (handles, handle); - gossip_telepathy_group_remove_members (group, handles, message); + empathy_tp_group_remove_members (group, handles, message); g_array_free (handles, TRUE); } GArray * -gossip_telepathy_group_get_members (GossipTelepathyGroup *group) +empathy_tp_group_get_members (EmpathyTpGroup *group) { - GossipTelepathyGroupPriv *priv; - GArray *members; - GError *error = NULL; + EmpathyTpGroupPriv *priv; + GArray *members; + GError *error = NULL; - g_return_val_if_fail (GOSSIP_IS_TELEPATHY_GROUP (group), NULL); + g_return_val_if_fail (EMPATHY_IS_TP_GROUP (group), NULL); priv = GET_PRIV (group); if (!tp_chan_iface_group_get_members (priv->group_iface, &members, &error)) { - gossip_debug (DEBUG_DOMAIN, + empathy_debug (DEBUG_DOMAIN, "Couldn't get members: %s", error ? error->message : "No error given"); g_clear_error (&error); @@ -290,15 +289,15 @@ gossip_telepathy_group_get_members (GossipTelepathyGroup *group) } void -gossip_telepathy_group_get_all_members (GossipTelepathyGroup *group, - GArray **members, - GArray **local_pending, - GArray **remote_pending) +empathy_tp_group_get_all_members (EmpathyTpGroup *group, + GArray **members, + GArray **local_pending, + GArray **remote_pending) { - GossipTelepathyGroupPriv *priv; - GError *error = NULL; + EmpathyTpGroupPriv *priv; + GError *error = NULL; - g_return_if_fail (GOSSIP_IS_TELEPATHY_GROUP (group)); + g_return_if_fail (EMPATHY_IS_TP_GROUP (group)); priv = GET_PRIV (group); @@ -307,7 +306,7 @@ gossip_telepathy_group_get_all_members (GossipTelepathyGroup *group, local_pending, remote_pending, &error)) { - gossip_debug (DEBUG_DOMAIN, + empathy_debug (DEBUG_DOMAIN, "Couldn't get all members: %s", error ? error->message : "No error given"); g_clear_error (&error); @@ -315,22 +314,22 @@ gossip_telepathy_group_get_all_members (GossipTelepathyGroup *group, } GList * -gossip_telepathy_group_get_local_pending_members_with_info (GossipTelepathyGroup *group) +empathy_tp_group_get_local_pending_members_with_info (EmpathyTpGroup *group) { - GossipTelepathyGroupPriv *priv; - GPtrArray *array; - guint i; - GList *infos = NULL; - GError *error = NULL; + EmpathyTpGroupPriv *priv; + GPtrArray *array; + guint i; + GList *infos = NULL; + GError *error = NULL; - g_return_val_if_fail (GOSSIP_IS_TELEPATHY_GROUP (group), NULL); + g_return_val_if_fail (EMPATHY_IS_TP_GROUP (group), NULL); priv = GET_PRIV (group); if (!tp_chan_iface_group_get_local_pending_members_with_info (priv->group_iface, &array, &error)) { - gossip_debug (DEBUG_DOMAIN, + empathy_debug (DEBUG_DOMAIN, "GetLocalPendingMembersWithInfo failed: %s", error ? error->message : "No error given"); g_clear_error (&error); @@ -346,11 +345,11 @@ gossip_telepathy_group_get_local_pending_members_with_info (GossipTelepathyGroup } for (i = 0; array->len > i; i++) { - GValueArray *pending_struct; - GossipTpGroupInfo *info; - const gchar *message; + GValueArray *pending_struct; + EmpathyTpGroupInfo *info; + const gchar *message; - info = g_slice_new (GossipTpGroupInfo); + info = g_slice_new (EmpathyTpGroupInfo); pending_struct = g_ptr_array_index (array, i); info->member = g_value_get_uint (g_value_array_get_nth (pending_struct, 0)); @@ -368,27 +367,27 @@ gossip_telepathy_group_get_local_pending_members_with_info (GossipTelepathyGroup } void -gossip_telepathy_group_info_list_free (GList *infos) +empathy_tp_group_info_list_free (GList *infos) { GList *l; for (l = infos; l; l = l->next) { - GossipTpGroupInfo *info; + EmpathyTpGroupInfo *info; info = l->data; g_free (info->message); - g_slice_free (GossipTpGroupInfo, info); + g_slice_free (EmpathyTpGroupInfo, info); } g_list_free (infos); } static void -telepathy_group_destroy_cb (DBusGProxy *proxy, - GossipTelepathyGroup *group) +tp_group_destroy_cb (DBusGProxy *proxy, + EmpathyTpGroup *group) { - GossipTelepathyGroupPriv *priv; + EmpathyTpGroupPriv *priv; priv = GET_PRIV (group); @@ -401,17 +400,17 @@ telepathy_group_destroy_cb (DBusGProxy *proxy, } static void -telepathy_group_members_changed_cb (DBusGProxy *group_iface, - gchar *message, - GArray *added, - GArray *removed, - GArray *local_pending, - GArray *remote_pending, - guint actor, - guint reason, - GossipTelepathyGroup *group) +tp_group_members_changed_cb (DBusGProxy *group_iface, + gchar *message, + GArray *added, + GArray *removed, + GArray *local_pending, + GArray *remote_pending, + guint actor, + guint reason, + EmpathyTpGroup *group) { - GossipTelepathyGroupPriv *priv; + EmpathyTpGroupPriv *priv; priv = GET_PRIV (group); @@ -435,7 +434,7 @@ telepathy_group_members_changed_cb (DBusGProxy *group_iface, } const gchar * -gossip_telepathy_group_get_name (GossipTelepathyGroup *group) +empathy_tp_group_get_name (EmpathyTpGroup *group) { TelepathyHandleType handle_type; guint channel_handle; @@ -443,9 +442,9 @@ gossip_telepathy_group_get_name (GossipTelepathyGroup *group) gchar **group_names; GError *error = NULL; - GossipTelepathyGroupPriv *priv; + EmpathyTpGroupPriv *priv; - g_return_val_if_fail (GOSSIP_IS_TELEPATHY_GROUP (group), NULL); + g_return_val_if_fail (EMPATHY_IS_TP_GROUP (group), NULL); priv = GET_PRIV (group); @@ -458,7 +457,7 @@ gossip_telepathy_group_get_name (GossipTelepathyGroup *group) &handle_type, &channel_handle, &error)) { - gossip_debug (DEBUG_DOMAIN, + empathy_debug (DEBUG_DOMAIN, "Couldn't retreive channel handle for group: %s", error ? error->message : "No error given"); g_clear_error (&error); @@ -472,7 +471,7 @@ gossip_telepathy_group_get_name (GossipTelepathyGroup *group) group_handles, &group_names, &error)) { - gossip_debug (DEBUG_DOMAIN, + empathy_debug (DEBUG_DOMAIN, "Couldn't get group name: %s", error ? error->message : "No error given"); g_clear_error (&error); @@ -488,18 +487,18 @@ gossip_telepathy_group_get_name (GossipTelepathyGroup *group) } guint -gossip_telepathy_group_get_self_handle (GossipTelepathyGroup *group) +empathy_tp_group_get_self_handle (EmpathyTpGroup *group) { - GossipTelepathyGroupPriv *priv; - guint handle; - GError *error = NULL; + EmpathyTpGroupPriv *priv; + guint handle; + GError *error = NULL; - g_return_val_if_fail (GOSSIP_IS_TELEPATHY_GROUP (group), 0 ); + g_return_val_if_fail (EMPATHY_IS_TP_GROUP (group), 0 ); priv = GET_PRIV (group); if (!tp_chan_iface_group_get_self_handle (priv->group_iface, &handle, &error)) { - gossip_debug (DEBUG_DOMAIN, + empathy_debug (DEBUG_DOMAIN, "Failed to get self handle: %s", error ? error->message : "No error given"); g_clear_error (&error); @@ -510,11 +509,11 @@ gossip_telepathy_group_get_self_handle (GossipTelepathyGroup *group) } const gchar * -gossip_telepathy_group_get_object_path (GossipTelepathyGroup *group) +empathy_tp_group_get_object_path (EmpathyTpGroup *group) { - GossipTelepathyGroupPriv *priv; + EmpathyTpGroupPriv *priv; - g_return_val_if_fail (GOSSIP_IS_TELEPATHY_GROUP (group), NULL); + g_return_val_if_fail (EMPATHY_IS_TP_GROUP (group), NULL); priv = GET_PRIV (group); @@ -522,14 +521,14 @@ gossip_telepathy_group_get_object_path (GossipTelepathyGroup *group) } gboolean -gossip_telepathy_group_is_member (GossipTelepathyGroup *group, - guint handle) +empathy_tp_group_is_member (EmpathyTpGroup *group, + guint handle) { GArray *members; guint i; gboolean found = FALSE; - members = gossip_telepathy_group_get_members (group); + members = empathy_tp_group_get_members (group); for (i = 0; i < members->len; i++) { if (g_array_index (members, guint, i) == handle) { found = TRUE; diff --git a/libempathy/empathy-tp-group.h b/libempathy/empathy-tp-group.h new file mode 100644 index 000000000..2381ea10e --- /dev/null +++ b/libempathy/empathy-tp-group.h @@ -0,0 +1,86 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ +/* + * Copyright (C) 2006 Xavier Claessens <xclaesse@gmail.com> + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This program 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 + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#ifndef __EMPATHY_TP_GROUP_H__ +#define __EMPATHY_TP_GROUP_H__ + +#include <glib.h> + +#include <libtelepathy/tp-chan.h> + +G_BEGIN_DECLS + +#define EMPATHY_TYPE_TP_GROUP (empathy_tp_group_get_type ()) +#define EMPATHY_TP_GROUP(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), EMPATHY_TYPE_TP_GROUP, EmpathyTpGroup)) +#define EMPATHY_TP_GROUP_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), EMPATHY_TYPE_TP_GROUP, EmpathyTpGroupClass)) +#define EMPATHY_IS_TP_GROUP(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), EMPATHY_TYPE_TP_GROUP)) +#define EMPATHY_IS_TP_GROUP_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), EMPATHY_TYPE_TP_GROUP)) +#define EMPATHY_TP_GROUP_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), EMPATHY_TYPE_TP_GROUP, EmpathyTpGroupClass)) + +typedef struct _EmpathyTpGroup EmpathyTpGroup; +typedef struct _EmpathyTpGroupClass EmpathyTpGroupClass; +typedef struct _EmpathyTpGroupPriv EmpathyTpGroupPriv; + +struct _EmpathyTpGroup { + GObject parent; +}; + +struct _EmpathyTpGroupClass { + GObjectClass parent_class; +}; + +typedef struct { + guint member; + guint actor; + guint reason; + gchar *message; +} EmpathyTpGroupInfo; + +GType empathy_tp_group_get_type (void) G_GNUC_CONST; +EmpathyTpGroup * empathy_tp_group_new (TpChan *tp_chan, + TpConn *tp_conn); +void empathy_tp_group_add_members (EmpathyTpGroup *group, + GArray *handles, + const gchar *message); +void empathy_tp_group_add_member (EmpathyTpGroup *group, + guint handle, + const gchar *message); +void empathy_tp_group_remove_members (EmpathyTpGroup *group, + GArray *handle, + const gchar *message); +void empathy_tp_group_remove_member (EmpathyTpGroup *group, + guint handle, + const gchar *message); +GArray * empathy_tp_group_get_members (EmpathyTpGroup *group); +void empathy_tp_group_get_all_members (EmpathyTpGroup *group, + GArray **members, + GArray **local_pending, + GArray **remote_pending); +GList * empathy_tp_group_get_local_pending_members_with_info (EmpathyTpGroup *group); +void empathy_tp_group_info_list_free (GList *infos); +const gchar * empathy_tp_group_get_name (EmpathyTpGroup *group); +guint empathy_tp_group_get_self_handle (EmpathyTpGroup *group); +const gchar * empathy_tp_group_get_object_path (EmpathyTpGroup *group); +gboolean empathy_tp_group_is_member (EmpathyTpGroup *group, + guint handle); + +G_END_DECLS + +#endif /* __EMPATHY_TP_GROUP_H__ */ diff --git a/libempathy/gossip-utils.c b/libempathy/empathy-utils.c index 27bcb85d1..74a6bc076 100644 --- a/libempathy/gossip-utils.c +++ b/libempathy/empathy-utils.c @@ -35,8 +35,8 @@ #include <libxml/uri.h> #include <libtelepathy/tp-helpers.h> -#include "gossip-debug.h" -#include "gossip-utils.h" +#include "empathy-debug.h" +#include "empathy-utils.h" #include "empathy-contact-manager.h" #define DEBUG_DOMAIN "Utils" @@ -44,7 +44,7 @@ static void regex_init (void); gchar * -gossip_substring (const gchar *str, +empathy_substring (const gchar *str, gint start, gint end) { @@ -62,7 +62,7 @@ gossip_substring (const gchar *str, #define USER "[" USERCHARS "]+(:["PASSCHARS "]+)?" #define URLPATH "/[" PATHCHARS "]*[^]'.}>) \t\r\n,\\\"]" -static regex_t dingus[GOSSIP_REGEX_ALL]; +static regex_t dingus[EMPATHY_REGEX_ALL]; static void regex_init (void) @@ -75,24 +75,24 @@ regex_init (void) return; } - for (i = 0; i < GOSSIP_REGEX_ALL; i++) { + for (i = 0; i < EMPATHY_REGEX_ALL; i++) { switch (i) { - case GOSSIP_REGEX_AS_IS: + case EMPATHY_REGEX_AS_IS: expression = SCHEME "//(" USER "@)?[" HOSTCHARS ".]+" "(:[0-9]+)?(" URLPATH ")?"; break; - case GOSSIP_REGEX_BROWSER: + case EMPATHY_REGEX_BROWSER: expression = "(www|ftp)[" HOSTCHARS "]*\\.[" HOSTCHARS ".]+" "(:[0-9]+)?(" URLPATH ")?"; break; - case GOSSIP_REGEX_EMAIL: + case EMPATHY_REGEX_EMAIL: expression = "(mailto:)?[a-z0-9][a-z0-9.-]*@[a-z0-9]" "[a-z0-9-]*(\\.[a-z0-9][a-z0-9-]*)+"; break; - case GOSSIP_REGEX_OTHER: + case EMPATHY_REGEX_OTHER: expression = "news:[-A-Z\\^_a-z{|}~!\"#$%&'()*+,./0-9;:=?`]+" "@[" HOSTCHARS ".]+(:[0-9]+)?"; @@ -111,7 +111,7 @@ regex_init (void) } gint -gossip_regex_match (GossipRegExType type, +empathy_regex_match (EmpathyRegExType type, const gchar *msg, GArray *start, GArray *end) @@ -122,11 +122,11 @@ gossip_regex_match (GossipRegExType type, gint offset = 0; gint i; - g_return_val_if_fail (type >= 0 || type <= GOSSIP_REGEX_ALL, 0); + g_return_val_if_fail (type >= 0 || type <= EMPATHY_REGEX_ALL, 0); regex_init (); - while (!ret && type != GOSSIP_REGEX_ALL) { + while (!ret && type != EMPATHY_REGEX_ALL) { ret = regexec (&dingus[type], msg + offset, 1, matches, 0); if (ret == 0) { gint s; @@ -141,15 +141,15 @@ gossip_regex_match (GossipRegExType type, } } - if (type != GOSSIP_REGEX_ALL) { - gossip_debug (DEBUG_DOMAIN, + if (type != EMPATHY_REGEX_ALL) { + empathy_debug (DEBUG_DOMAIN, "Found %d matches for regex type:%d", num_matches, type); return num_matches; } - /* If GOSSIP_REGEX_ALL then we run ALL regex's on the string. */ - for (i = 0; i < GOSSIP_REGEX_ALL; i++, ret = 0) { + /* If EMPATHY_REGEX_ALL then we run ALL regex's on the string. */ + for (i = 0; i < EMPATHY_REGEX_ALL; i++, ret = 0) { while (!ret) { ret = regexec (&dingus[i], msg + offset, 1, matches, 0); if (ret == 0) { @@ -166,7 +166,7 @@ gossip_regex_match (GossipRegExType type, } } - gossip_debug (DEBUG_DOMAIN, + empathy_debug (DEBUG_DOMAIN, "Found %d matches for ALL regex types", num_matches); @@ -174,14 +174,14 @@ gossip_regex_match (GossipRegExType type, } gint -gossip_strcasecmp (const gchar *s1, +empathy_strcasecmp (const gchar *s1, const gchar *s2) { - return gossip_strncasecmp (s1, s2, -1); + return empathy_strncasecmp (s1, s2, -1); } gint -gossip_strncasecmp (const gchar *s1, +empathy_strncasecmp (const gchar *s1, const gchar *s2, gsize n) { @@ -199,7 +199,7 @@ gossip_strncasecmp (const gchar *s1, } gboolean -gossip_xml_validate (xmlDoc *doc, +empathy_xml_validate (xmlDoc *doc, const gchar *dtd_filename) { gchar *path, *escaped; @@ -225,7 +225,7 @@ gossip_xml_validate (xmlDoc *doc, } xmlNodePtr -gossip_xml_node_get_child (xmlNodePtr node, +empathy_xml_node_get_child (xmlNodePtr node, const gchar *child_name) { xmlNodePtr l; @@ -243,7 +243,7 @@ gossip_xml_node_get_child (xmlNodePtr node, } xmlChar * -gossip_xml_node_get_child_content (xmlNodePtr node, +empathy_xml_node_get_child_content (xmlNodePtr node, const gchar *child_name) { xmlNodePtr l; @@ -251,7 +251,7 @@ gossip_xml_node_get_child_content (xmlNodePtr node, g_return_val_if_fail (node != NULL, NULL); g_return_val_if_fail (child_name != NULL, NULL); - l = gossip_xml_node_get_child (node, child_name); + l = empathy_xml_node_get_child (node, child_name); if (l) { return xmlNodeGetContent (l); } @@ -260,7 +260,7 @@ gossip_xml_node_get_child_content (xmlNodePtr node, } xmlNodePtr -gossip_xml_node_find_child_prop_value (xmlNodePtr node, +empathy_xml_node_find_child_prop_value (xmlNodePtr node, const gchar *prop_name, const gchar *prop_value) { @@ -290,7 +290,7 @@ gossip_xml_node_find_child_prop_value (xmlNodePtr node, } GType -gossip_dbus_type_to_g_type (const gchar *dbus_type_string) +empathy_dbus_type_to_g_type (const gchar *dbus_type_string) { if (dbus_type_string == NULL) return G_TYPE_NONE; @@ -313,7 +313,7 @@ gossip_dbus_type_to_g_type (const gchar *dbus_type_string) } const gchar * -gossip_g_type_to_dbus_type (GType g_type) +empathy_g_type_to_dbus_type (GType g_type) { switch (g_type) { case G_TYPE_STRING: @@ -332,7 +332,7 @@ gossip_g_type_to_dbus_type (GType g_type) } gchar * -gossip_g_value_to_string (const GValue *value) +empathy_g_value_to_string (const GValue *value) { gchar *return_string = NULL; GValue string_g_value = {0, }; @@ -346,7 +346,7 @@ gossip_g_value_to_string (const GValue *value) } GValue * -gossip_string_to_g_value (const gchar *str, GType type) +empathy_string_to_g_value (const gchar *str, GType type) { GValue *g_value; @@ -374,7 +374,7 @@ gossip_string_to_g_value (const gchar *str, GType type) } gboolean -gossip_g_value_equal (const GValue *value1, +empathy_g_value_equal (const GValue *value1, const GValue *value2) { GType type; @@ -412,13 +412,13 @@ gossip_g_value_equal (const GValue *value1, } guint -gossip_account_hash (gconstpointer key) +empathy_account_hash (gconstpointer key) { return g_str_hash (mc_account_get_unique_name (MC_ACCOUNT (key))); } gboolean -gossip_account_equal (gconstpointer a, +empathy_account_equal (gconstpointer a, gconstpointer b) { const gchar *name_a; @@ -431,7 +431,7 @@ gossip_account_equal (gconstpointer a, } MissionControl * -gossip_mission_control_new (void) +empathy_mission_control_new (void) { static MissionControl *mc = NULL; @@ -446,7 +446,7 @@ gossip_mission_control_new (void) } gchar * -gossip_get_channel_id (McAccount *account, +empathy_get_channel_id (McAccount *account, TpChan *tp_chan) { MissionControl *mc; @@ -459,7 +459,7 @@ gossip_get_channel_id (McAccount *account, g_return_val_if_fail (MC_IS_ACCOUNT (account), NULL); g_return_val_if_fail (TELEPATHY_IS_CHAN (tp_chan), NULL); - mc = gossip_mission_control_new (); + mc = empathy_mission_control_new (); tp_conn = mission_control_get_connection (mc, account, NULL); g_object_unref (mc); @@ -475,7 +475,7 @@ gossip_get_channel_id (McAccount *account, handles, &names, &error)) { - gossip_debug (DEBUG_DOMAIN, + empathy_debug (DEBUG_DOMAIN, "Couldn't get id: %s", error ? error->message : "No error given"); diff --git a/libempathy/gossip-utils.h b/libempathy/empathy-utils.h index 638c114bd..17be9ed3c 100644 --- a/libempathy/gossip-utils.h +++ b/libempathy/empathy-utils.h @@ -23,8 +23,8 @@ * Xavier Claessens <xclaesse@gmail.com> */ -#ifndef __GOSSIP_UTILS_H__ -#define __GOSSIP_UTILS_H__ +#ifndef __EMPATHY_UTILS_H__ +#define __EMPATHY_UTILS_H__ #include <glib.h> #include <glib-object.h> @@ -37,64 +37,64 @@ #include <libmissioncontrol/mc-account.h> #include <libmissioncontrol/mission-control.h> -#include "gossip-contact.h" +#include "empathy-contact.h" G_BEGIN_DECLS #define G_STR_EMPTY(x) ((x) == NULL || (x)[0] == '\0') typedef enum { - GOSSIP_REGEX_AS_IS, - GOSSIP_REGEX_BROWSER, - GOSSIP_REGEX_EMAIL, - GOSSIP_REGEX_OTHER, - GOSSIP_REGEX_ALL, -} GossipRegExType; + EMPATHY_REGEX_AS_IS, + EMPATHY_REGEX_BROWSER, + EMPATHY_REGEX_EMAIL, + EMPATHY_REGEX_OTHER, + EMPATHY_REGEX_ALL, +} EmpathyRegExType; /* Regular expressions */ -gchar * gossip_substring (const gchar *str, +gchar * empathy_substring (const gchar *str, gint start, gint end); -gint gossip_regex_match (GossipRegExType type, +gint empathy_regex_match (EmpathyRegExType type, const gchar *msg, GArray *start, GArray *end); /* Strings */ -gint gossip_strcasecmp (const gchar *s1, +gint empathy_strcasecmp (const gchar *s1, const gchar *s2); -gint gossip_strncasecmp (const gchar *s1, +gint empathy_strncasecmp (const gchar *s1, const gchar *s2, gsize n); /* XML */ -gboolean gossip_xml_validate (xmlDoc *doc, +gboolean empathy_xml_validate (xmlDoc *doc, const gchar *dtd_filename); -xmlNodePtr gossip_xml_node_get_child (xmlNodePtr node, +xmlNodePtr empathy_xml_node_get_child (xmlNodePtr node, const gchar *child_name); -xmlChar * gossip_xml_node_get_child_content (xmlNodePtr node, +xmlChar * empathy_xml_node_get_child_content (xmlNodePtr node, const gchar *child_name); -xmlNodePtr gossip_xml_node_find_child_prop_value (xmlNodePtr node, +xmlNodePtr empathy_xml_node_find_child_prop_value (xmlNodePtr node, const gchar *prop_name, const gchar *prop_value); /* GValue/GType */ -GType gossip_dbus_type_to_g_type (const gchar *dbus_type_string); -const gchar *gossip_g_type_to_dbus_type (GType g_type); -gchar * gossip_g_value_to_string (const GValue *value); -GValue * gossip_string_to_g_value (const gchar *str, +GType empathy_dbus_type_to_g_type (const gchar *dbus_type_string); +const gchar *empathy_g_type_to_dbus_type (GType g_type); +gchar * empathy_g_value_to_string (const GValue *value); +GValue * empathy_string_to_g_value (const gchar *str, GType type); -gboolean gossip_g_value_equal (const GValue *value1, +gboolean empathy_g_value_equal (const GValue *value1, const GValue *value2); -guint gossip_account_hash (gconstpointer key); -gboolean gossip_account_equal (gconstpointer a, +guint empathy_account_hash (gconstpointer key); +gboolean empathy_account_equal (gconstpointer a, gconstpointer b); -MissionControl *gossip_mission_control_new (void); -gchar * gossip_get_channel_id (McAccount *account, +MissionControl *empathy_mission_control_new (void); +gchar * empathy_get_channel_id (McAccount *account, TpChan *tp_chan); G_END_DECLS -#endif /* __GOSSIP_UTILS_H__ */ +#endif /* __EMPATHY_UTILS_H__ */ diff --git a/libempathy/gossip-chatroom-manager.h b/libempathy/gossip-chatroom-manager.h deleted file mode 100644 index 7d10a0fc1..000000000 --- a/libempathy/gossip-chatroom-manager.h +++ /dev/null @@ -1,72 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * Copyright (C) 2004-2007 Imendio AB - * Copyright (C) 2007 Collabora Ltd. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program 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 - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Authors: Xavier Claessens <xclaesse@gmail.com> - * Martyn Russell <martyn@imendio.com> - */ - -#ifndef __GOSSIP_CHATROOM_MANAGER_H__ -#define __GOSSIP_CHATROOM_MANAGER_H__ - -#include <glib-object.h> - -#include <libmissioncontrol/mc-account.h> - -#include "gossip-chatroom.h" - -G_BEGIN_DECLS - -#define GOSSIP_TYPE_CHATROOM_MANAGER (gossip_chatroom_manager_get_type ()) -#define GOSSIP_CHATROOM_MANAGER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GOSSIP_TYPE_CHATROOM_MANAGER, GossipChatroomManager)) -#define GOSSIP_CHATROOM_MANAGER_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), GOSSIP_TYPE_CHATROOM_MANAGER, GossipChatroomManagerClass)) -#define GOSSIP_IS_CHATROOM_MANAGER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GOSSIP_TYPE_CHATROOM_MANAGER)) -#define GOSSIP_IS_CHATROOM_MANAGER_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GOSSIP_TYPE_CHATROOM_MANAGER)) -#define GOSSIP_CHATROOM_MANAGER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GOSSIP_TYPE_CHATROOM_MANAGER, GossipChatroomManagerClass)) - -typedef struct _GossipChatroomManager GossipChatroomManager; -typedef struct _GossipChatroomManagerClass GossipChatroomManagerClass; -typedef struct _GossipChatroomManagerPriv GossipChatroomManagerPriv; - -struct _GossipChatroomManager { - GObject parent; -}; - -struct _GossipChatroomManagerClass { - GObjectClass parent_class; -}; - -GType gossip_chatroom_manager_get_type (void) G_GNUC_CONST; -GossipChatroomManager *gossip_chatroom_manager_new (void); -gboolean gossip_chatroom_manager_add (GossipChatroomManager *manager, - GossipChatroom *chatroom); -void gossip_chatroom_manager_remove (GossipChatroomManager *manager, - GossipChatroom *chatroom); -GossipChatroom * gossip_chatroom_manager_find (GossipChatroomManager *manager, - McAccount *account, - const gchar *room); -GList * gossip_chatroom_manager_get_chatrooms (GossipChatroomManager *manager, - McAccount *account); -guint gossip_chatroom_manager_get_count (GossipChatroomManager *manager, - McAccount *account); -void gossip_chatroom_manager_store (GossipChatroomManager *manager); - -G_END_DECLS - -#endif /* __GOSSIP_CHATROOM_MANAGER_H__ */ diff --git a/libempathy/gossip-chatroom.h b/libempathy/gossip-chatroom.h deleted file mode 100644 index 70614a368..000000000 --- a/libempathy/gossip-chatroom.h +++ /dev/null @@ -1,78 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * Copyright (C) 2007 Collabora Ltd. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program 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 - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Authors: Xavier Claessens <xclaesse@gmail.com> - */ - -#ifndef __GOSSIP_CHATROOM_H__ -#define __GOSSIP_CHATROOM_H__ - -#include <glib-object.h> - -#include <libmissioncontrol/mc-account.h> - -G_BEGIN_DECLS - -#define GOSSIP_TYPE_CHATROOM (gossip_chatroom_get_type ()) -#define GOSSIP_CHATROOM(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GOSSIP_TYPE_CHATROOM, GossipChatroom)) -#define GOSSIP_CHATROOM_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), GOSSIP_TYPE_CHATROOM, GossipChatroomClass)) -#define GOSSIP_IS_CHATROOM(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GOSSIP_TYPE_CHATROOM)) -#define GOSSIP_IS_CHATROOM_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GOSSIP_TYPE_CHATROOM)) -#define GOSSIP_CHATROOM_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GOSSIP_TYPE_CHATROOM, GossipChatroomClass)) - -#define GOSSIP_TYPE_CHATROOM_INVITE (gossip_chatroom_invite_get_gtype ()) - -typedef struct _GossipChatroom GossipChatroom; -typedef struct _GossipChatroomClass GossipChatroomClass; -typedef struct _GossipChatroomPriv GossipChatroomPriv; - -struct _GossipChatroom { - GObject parent; -}; - -struct _GossipChatroomClass { - GObjectClass parent_class; -}; - -GType gossip_chatroom_get_type (void) G_GNUC_CONST; -GossipChatroom *gossip_chatroom_new (McAccount *account, - const gchar *room); -GossipChatroom *gossip_chatroom_new_full (McAccount *account, - const gchar *room, - const gchar *name, - gboolean auto_connect); -McAccount * gossip_chatroom_get_account (GossipChatroom *chatroom); -void gossip_chatroom_set_account (GossipChatroom *chatroom, - McAccount *account); -const gchar * gossip_chatroom_get_room (GossipChatroom *chatroom); -void gossip_chatroom_set_room (GossipChatroom *chatroom, - const gchar *room); -const gchar * gossip_chatroom_get_name (GossipChatroom *chatroom); -void gossip_chatroom_set_name (GossipChatroom *chatroom, - const gchar *name); -gboolean gossip_chatroom_get_auto_connect (GossipChatroom *chatroom); -void gossip_chatroom_set_auto_connect (GossipChatroom *chatroom, - gboolean auto_connect); -gboolean gossip_chatroom_equal (gconstpointer v1, - gconstpointer v2); - - -G_BEGIN_DECLS - -#endif /* __GOSSIP_CHATROOM_H__ */ diff --git a/libempathy/gossip-conf.h b/libempathy/gossip-conf.h deleted file mode 100644 index 35fdfb902..000000000 --- a/libempathy/gossip-conf.h +++ /dev/null @@ -1,87 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * Copyright (C) 2006 Imendio AB - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program 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 - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#ifndef __GOSSIP_CONF_H__ -#define __GOSSIP_CONF_H__ - -#include <glib-object.h> - -G_BEGIN_DECLS - -#define GOSSIP_TYPE_CONF (gossip_conf_get_type ()) -#define GOSSIP_CONF(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GOSSIP_TYPE_CONF, GossipConf)) -#define GOSSIP_CONF_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), GOSSIP_TYPE_CONF, GossipConfClass)) -#define GOSSIP_IS_CONF(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GOSSIP_TYPE_CONF)) -#define GOSSIP_IS_CONF_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GOSSIP_TYPE_CONF)) -#define GOSSIP_CONF_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GOSSIP_TYPE_CONF, GossipConfClass)) - -typedef struct _GossipConf GossipConf; -typedef struct _GossipConfClass GossipConfClass; - -struct _GossipConf { - GObject parent; -}; - -struct _GossipConfClass { - GObjectClass parent_class; -}; - -typedef void (*GossipConfNotifyFunc) (GossipConf *conf, - const gchar *key, - gpointer user_data); - -GType gossip_conf_get_type (void) G_GNUC_CONST; -GossipConf *gossip_conf_get (void); -void gossip_conf_shutdown (void); -guint gossip_conf_notify_add (GossipConf *conf, - const gchar *key, - GossipConfNotifyFunc func, - gpointer data); -gboolean gossip_conf_notify_remove (GossipConf *conf, - guint id); -gboolean gossip_conf_set_int (GossipConf *conf, - const gchar *key, - gint value); -gboolean gossip_conf_get_int (GossipConf *conf, - const gchar *key, - gint *value); -gboolean gossip_conf_set_bool (GossipConf *conf, - const gchar *key, - gboolean value); -gboolean gossip_conf_get_bool (GossipConf *conf, - const gchar *key, - gboolean *value); -gboolean gossip_conf_set_string (GossipConf *conf, - const gchar *key, - const gchar *value); -gboolean gossip_conf_get_string (GossipConf *conf, - const gchar *key, - gchar **value); -gboolean gossip_conf_set_string_list (GossipConf *conf, - const gchar *key, - GSList *value); -gboolean gossip_conf_get_string_list (GossipConf *conf, - const gchar *key, - GSList **value); - -G_END_DECLS - -#endif /* __GOSSIP_CONF_H__ */ - diff --git a/libempathy/gossip-contact.h b/libempathy/gossip-contact.h deleted file mode 100644 index 14b32fdc2..000000000 --- a/libempathy/gossip-contact.h +++ /dev/null @@ -1,106 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * Copyright (C) 2004 Imendio AB - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program 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 - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#ifndef __GOSSIP_CONTACT_H__ -#define __GOSSIP_CONTACT_H__ - -#include <glib-object.h> - -#include <libmissioncontrol/mc-account.h> - -#include "gossip-avatar.h" -#include "gossip-presence.h" - -G_BEGIN_DECLS - -#define GOSSIP_TYPE_CONTACT (gossip_contact_get_gtype ()) -#define GOSSIP_CONTACT(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GOSSIP_TYPE_CONTACT, GossipContact)) -#define GOSSIP_CONTACT_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), GOSSIP_TYPE_CONTACT, GossipContactClass)) -#define GOSSIP_IS_CONTACT(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GOSSIP_TYPE_CONTACT)) -#define GOSSIP_IS_CONTACT_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GOSSIP_TYPE_CONTACT)) -#define GOSSIP_CONTACT_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GOSSIP_TYPE_CONTACT, GossipContactClass)) - -typedef struct _GossipContact GossipContact; -typedef struct _GossipContactClass GossipContactClass; - -struct _GossipContact { - GObject parent; -}; - -struct _GossipContactClass { - GObjectClass parent_class; -}; - -typedef enum { - GOSSIP_SUBSCRIPTION_NONE = 0, - GOSSIP_SUBSCRIPTION_TO = 1 << 0, /* We send our presence to that contact */ - GOSSIP_SUBSCRIPTION_FROM = 1 << 1, /* That contact sends his presence to us */ - GOSSIP_SUBSCRIPTION_BOTH = GOSSIP_SUBSCRIPTION_TO | GOSSIP_SUBSCRIPTION_FROM -} GossipSubscription; - -GType gossip_contact_get_gtype (void) G_GNUC_CONST; - -GossipContact * gossip_contact_new (McAccount *account); -GossipContact * gossip_contact_new_full (McAccount *account, - const gchar *id, - const gchar *name); -const gchar * gossip_contact_get_id (GossipContact *contact); -const gchar * gossip_contact_get_name (GossipContact *contact); -GossipAvatar * gossip_contact_get_avatar (GossipContact *contact); -McAccount * gossip_contact_get_account (GossipContact *contact); -GossipPresence * gossip_contact_get_presence (GossipContact *contact); -GList * gossip_contact_get_groups (GossipContact *contact); -GossipSubscription gossip_contact_get_subscription (GossipContact *contact); -guint gossip_contact_get_handle (GossipContact *contact); -gboolean gossip_contact_is_user (GossipContact *contact); -void gossip_contact_set_id (GossipContact *contact, - const gchar *id); -void gossip_contact_set_name (GossipContact *contact, - const gchar *name); -void gossip_contact_set_avatar (GossipContact *contact, - GossipAvatar *avatar); -void gossip_contact_set_account (GossipContact *contact, - McAccount *account); -void gossip_contact_set_presence (GossipContact *contact, - GossipPresence *presence); -void gossip_contact_set_groups (GossipContact *contact, - GList *categories); -void gossip_contact_set_subscription (GossipContact *contact, - GossipSubscription subscription); -void gossip_contact_set_handle (GossipContact *contact, - guint handle); -void gossip_contact_set_is_user (GossipContact *contact, - gboolean is_user); -void gossip_contact_add_group (GossipContact *contact, - const gchar *group); -void gossip_contact_remove_group (GossipContact *contact, - const gchar *group); -gboolean gossip_contact_is_online (GossipContact *contact); -gboolean gossip_contact_is_in_group (GossipContact *contact, - const gchar *group); -const gchar * gossip_contact_get_status (GossipContact *contact); -gboolean gossip_contact_equal (gconstpointer v1, - gconstpointer v2); -guint gossip_contact_hash (gconstpointer key); - -G_END_DECLS - -#endif /* __GOSSIP_CONTACT_H__ */ - diff --git a/libempathy/gossip-message.h b/libempathy/gossip-message.h deleted file mode 100644 index aa4948025..000000000 --- a/libempathy/gossip-message.h +++ /dev/null @@ -1,82 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * Copyright (C) 2004-2007 Imendio AB - * Copyright (C) 2007 Collabora Ltd. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program 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 - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Authors: Mikael Hallendal <micke@imendio.com> - * Xavier Claessens <xclaesse@gmail.com> - */ - -#ifndef __GOSSIP_MESSAGE_H__ -#define __GOSSIP_MESSAGE_H__ - -#include <glib-object.h> - -#include "gossip-contact.h" -#include "gossip-time.h" - -G_BEGIN_DECLS - -#define GOSSIP_TYPE_MESSAGE (gossip_message_get_gtype ()) -#define GOSSIP_MESSAGE(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GOSSIP_TYPE_MESSAGE, GossipMessage)) -#define GOSSIP_MESSAGE_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), GOSSIP_TYPE_MESSAGE, GossipMessageClass)) -#define GOSSIP_IS_MESSAGE(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GOSSIP_TYPE_MESSAGE)) -#define GOSSIP_IS_MESSAGE_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GOSSIP_TYPE_MESSAGE)) -#define GOSSIP_MESSAGE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GOSSIP_TYPE_MESSAGE, GossipMessageClass)) - -typedef struct _GossipMessage GossipMessage; -typedef struct _GossipMessageClass GossipMessageClass; - -struct _GossipMessage { - GObject parent; -}; - -struct _GossipMessageClass { - GObjectClass parent_class; -}; - -typedef enum { - GOSSIP_MESSAGE_TYPE_NORMAL, - GOSSIP_MESSAGE_TYPE_ACTION, - GOSSIP_MESSAGE_TYPE_NOTICE, - GOSSIP_MESSAGE_TYPE_AUTO_REPLY, - GOSSIP_MESSAGE_TYPE_LAST -} GossipMessageType; - -GType gossip_message_get_gtype (void) G_GNUC_CONST; -GossipMessage * gossip_message_new (const gchar *body); -GossipMessageType gossip_message_get_type (GossipMessage *message); -void gossip_message_set_type (GossipMessage *message, - GossipMessageType type); -GossipContact * gossip_message_get_sender (GossipMessage *message); -void gossip_message_set_sender (GossipMessage *message, - GossipContact *contact); -GossipContact * gossip_message_get_receiver (GossipMessage *message); -void gossip_message_set_receiver (GossipMessage *message, - GossipContact *contact); -const gchar * gossip_message_get_body (GossipMessage *message); -void gossip_message_set_body (GossipMessage *message, - const gchar *body); -/* What return value should we have here? */ -GossipTime gossip_message_get_timestamp (GossipMessage *message); -void gossip_message_set_timestamp (GossipMessage *message, - GossipTime timestamp); - -G_END_DECLS - -#endif /* __GOSSIP_MESSAGE_H__ */ diff --git a/libempathy/gossip-presence.h b/libempathy/gossip-presence.h deleted file mode 100644 index 0029906f3..000000000 --- a/libempathy/gossip-presence.h +++ /dev/null @@ -1,67 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * Copyright (C) 2004 Imendio AB - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program 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 - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#ifndef __GOSSIP_PRESENCE_H__ -#define __GOSSIP_PRESENCE_H__ - -#include <glib-object.h> -#include <libmissioncontrol/mission-control.h> - -G_BEGIN_DECLS - -#define GOSSIP_TYPE_PRESENCE (gossip_presence_get_type ()) -#define GOSSIP_PRESENCE(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GOSSIP_TYPE_PRESENCE, GossipPresence)) -#define GOSSIP_PRESENCE_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), GOSSIP_TYPE_PRESENCE, GossipPresenceClass)) -#define GOSSIP_IS_PRESENCE(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GOSSIP_TYPE_PRESENCE)) -#define GOSSIP_IS_PRESENCE_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GOSSIP_TYPE_PRESENCE)) -#define GOSSIP_PRESENCE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GOSSIP_TYPE_PRESENCE, GossipPresenceClass)) - -typedef struct _GossipPresence GossipPresence; -typedef struct _GossipPresenceClass GossipPresenceClass; - -struct _GossipPresence { - GObject parent; -}; - -struct _GossipPresenceClass { - GObjectClass parent_class; -}; - -GType gossip_presence_get_type (void) G_GNUC_CONST; - -GossipPresence * gossip_presence_new (void); -GossipPresence * gossip_presence_new_full (McPresence state, - const gchar *status); -McPresence gossip_presence_get_state (GossipPresence *presence); -const gchar * gossip_presence_get_status (GossipPresence *presence); -void gossip_presence_set_state (GossipPresence *presence, - McPresence state); -void gossip_presence_set_status (GossipPresence *presence, - const gchar *status); -gint gossip_presence_sort_func (gconstpointer a, - gconstpointer b); -const gchar * gossip_presence_state_get_default_status (McPresence state); -const gchar * gossip_presence_state_to_str (McPresence state); -McPresence gossip_presence_state_from_str (const gchar *str); - -G_END_DECLS - -#endif /* __GOSSIP_PRESENCE_H__ */ - diff --git a/libempathy/gossip-telepathy-group.h b/libempathy/gossip-telepathy-group.h deleted file mode 100644 index 17b96de2e..000000000 --- a/libempathy/gossip-telepathy-group.h +++ /dev/null @@ -1,87 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * Copyright (C) 2006 Xavier Claessens <xclaesse@gmail.com> - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program 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 - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#ifndef __GOSSIP_TELEPATHY_GROUP_H__ -#define __GOSSIP_TELEPATHY_GROUP_H__ - -#include <glib.h> - -#include <libtelepathy/tp-chan.h> - -G_BEGIN_DECLS - -#define GOSSIP_TYPE_TELEPATHY_GROUP (gossip_telepathy_group_get_type ()) -#define GOSSIP_TELEPATHY_GROUP(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GOSSIP_TYPE_TELEPATHY_GROUP, GossipTelepathyGroup)) -#define GOSSIP_TELEPATHY_GROUP_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GOSSIP_TYPE_TELEPATHY_GROUP, GossipTelepathyGroupClass)) -#define GOSSIP_IS_TELEPATHY_GROUP(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GOSSIP_TYPE_TELEPATHY_GROUP)) -#define GOSSIP_IS_TELEPATHY_GROUP_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GOSSIP_TYPE_TELEPATHY_GROUP)) -#define GOSSIP_TELEPATHY_GROUP_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GOSSIP_TYPE_TELEPATHY_GROUP, GossipTelepathyGroupClass)) - -typedef struct _GossipTelepathyGroup GossipTelepathyGroup; -typedef struct _GossipTelepathyGroupClass GossipTelepathyGroupClass; -typedef struct _GossipTelepathyGroupPriv GossipTelepathyGroupPriv; - -struct _GossipTelepathyGroup { - GObject parent; -}; - -struct _GossipTelepathyGroupClass { - GObjectClass parent_class; -}; - -typedef struct { - guint member; - guint actor; - guint reason; - gchar *message; -} GossipTpGroupInfo; - -GType gossip_telepathy_group_get_type (void) G_GNUC_CONST; -GossipTelepathyGroup *gossip_telepathy_group_new (TpChan *tp_chan, - TpConn *tp_conn); -void gossip_telepathy_group_add_members (GossipTelepathyGroup *group, - GArray *handles, - const gchar *message); -void gossip_telepathy_group_add_member (GossipTelepathyGroup *group, - guint handle, - const gchar *message); -void gossip_telepathy_group_remove_members (GossipTelepathyGroup *group, - GArray *handle, - const gchar *message); -void gossip_telepathy_group_remove_member (GossipTelepathyGroup *group, - guint handle, - const gchar *message); -GArray * gossip_telepathy_group_get_members (GossipTelepathyGroup *group); -void gossip_telepathy_group_get_all_members (GossipTelepathyGroup *group, - GArray **members, - GArray **local_pending, - GArray **remote_pending); -GList * gossip_telepathy_group_get_local_pending_members_with_info - (GossipTelepathyGroup *group); -void gossip_telepathy_group_info_list_free (GList *infos); -const gchar * gossip_telepathy_group_get_name (GossipTelepathyGroup *group); -guint gossip_telepathy_group_get_self_handle (GossipTelepathyGroup *group); -const gchar * gossip_telepathy_group_get_object_path (GossipTelepathyGroup *group); -gboolean gossip_telepathy_group_is_member (GossipTelepathyGroup *group, - guint handle); - -G_END_DECLS - -#endif /* __GOSSIP_TELEPATHY_GROUP_H__ */ |