diff options
Diffstat (limited to 'libempathy')
-rw-r--r-- | libempathy/empathy-avatar.c | 4 | ||||
-rw-r--r-- | libempathy/empathy-contact-factory.c | 23 | ||||
-rw-r--r-- | libempathy/empathy-contact-manager.c | 14 | ||||
-rw-r--r-- | libempathy/empathy-tp-call.c | 2 | ||||
-rw-r--r-- | libempathy/empathy-tp-chat.c | 122 | ||||
-rw-r--r-- | libempathy/empathy-tp-chat.h | 26 | ||||
-rw-r--r-- | libempathy/empathy-tp-contact-list.c | 26 | ||||
-rw-r--r-- | libempathy/empathy-tp-group.c | 2 | ||||
-rw-r--r-- | libempathy/empathy-tp-roomlist.c | 2 | ||||
-rw-r--r-- | libempathy/empathy-utils.c | 76 | ||||
-rw-r--r-- | libempathy/empathy-utils.h | 3 |
11 files changed, 112 insertions, 188 deletions
diff --git a/libempathy/empathy-avatar.c b/libempathy/empathy-avatar.c index a38dcd6f7..efce645ba 100644 --- a/libempathy/empathy-avatar.c +++ b/libempathy/empathy-avatar.c @@ -22,6 +22,8 @@ #include "config.h" +#include <telepathy-glib/util.h> + #include "empathy-avatar.h" #include "empathy-utils.h" #include "empathy-debug.h" @@ -56,7 +58,7 @@ avatar_get_filename (const gchar *token) NULL); g_mkdir_with_parents (avatar_path, 0700); - token_escaped = empathy_escape_as_identifier (token); + token_escaped = tp_escape_as_identifier (token); avatar_file = g_build_filename (avatar_path, token_escaped, NULL); g_free (token_escaped); diff --git a/libempathy/empathy-contact-factory.c b/libempathy/empathy-contact-factory.c index 5bd51c9d8..3365f1710 100644 --- a/libempathy/empathy-contact-factory.c +++ b/libempathy/empathy-contact-factory.c @@ -23,6 +23,7 @@ #include <string.h> +#include <telepathy-glib/util.h> #include <libtelepathy/tp-conn.h> #include <libtelepathy/tp-conn-iface-aliasing-gen.h> #include <libtelepathy/tp-conn-iface-presence-gen.h> @@ -486,7 +487,7 @@ contact_factory_avatar_maybe_update (ContactFactoryAccountData *account_data, /* Check if the avatar changed */ avatar = empathy_contact_get_avatar (contact); - if (avatar && !empathy_strdiff (avatar->token, token)) { + if (avatar && !tp_strdiff (avatar->token, token)) { return TRUE; } @@ -880,13 +881,13 @@ contact_factory_account_data_update (ContactFactoryAccountData *account_data) /* We got a new connection */ account_data->tp_conn = tp_conn; account_data->aliasing_iface = tp_conn_get_interface (tp_conn, - TELEPATHY_CONN_IFACE_ALIASING_QUARK); + TP_IFACE_QUARK_CONNECTION_INTERFACE_ALIASING); account_data->avatars_iface = tp_conn_get_interface (tp_conn, - TELEPATHY_CONN_IFACE_AVATARS_QUARK); + TP_IFACE_QUARK_CONNECTION_INTERFACE_AVATARS); account_data->presence_iface = tp_conn_get_interface (tp_conn, - TELEPATHY_CONN_IFACE_PRESENCE_QUARK); + TP_IFACE_QUARK_CONNECTION_INTERFACE_PRESENCE); account_data->capabilities_iface = tp_conn_get_interface (tp_conn, - TELEPATHY_CONN_IFACE_CAPABILITIES_QUARK); + TP_IFACE_QUARK_CONNECTION_INTERFACE_CAPABILITIES); /* Connect signals */ if (account_data->aliasing_iface) { @@ -971,12 +972,12 @@ contact_factory_account_data_new (EmpathyContactFactory *factory, } static void -contact_factory_status_changed_cb (MissionControl *mc, - TelepathyConnectionStatus status, - McPresence presence, - TelepathyConnectionStatusReason reason, - const gchar *unique_name, - EmpathyContactFactory *factory) +contact_factory_status_changed_cb (MissionControl *mc, + TpConnectionStatus status, + McPresence presence, + TpConnectionStatusReason reason, + const gchar *unique_name, + EmpathyContactFactory *factory) { EmpathyContactFactoryPriv *priv = GET_PRIV (factory); ContactFactoryAccountData *account_data; diff --git a/libempathy/empathy-contact-manager.c b/libempathy/empathy-contact-manager.c index ad25cac0d..219cf8886 100644 --- a/libempathy/empathy-contact-manager.c +++ b/libempathy/empathy-contact-manager.c @@ -164,16 +164,16 @@ contact_manager_add_account (EmpathyContactManager *manager, } static void -contact_manager_status_changed_cb (MissionControl *mc, - TelepathyConnectionStatus status, - McPresence presence, - TelepathyConnectionStatusReason reason, - const gchar *unique_name, - EmpathyContactManager *manager) +contact_manager_status_changed_cb (MissionControl *mc, + TpConnectionStatus status, + McPresence presence, + TpConnectionStatusReason reason, + const gchar *unique_name, + EmpathyContactManager *manager) { McAccount *account; - if (status != TP_CONN_STATUS_CONNECTED) { + if (status != TP_CONNECTION_STATUS_CONNECTED) { /* We only care about newly connected accounts */ return; } diff --git a/libempathy/empathy-tp-call.c b/libempathy/empathy-tp-call.c index d4298a26c..3e8467994 100644 --- a/libempathy/empathy-tp-call.c +++ b/libempathy/empathy-tp-call.c @@ -318,7 +318,7 @@ tp_call_constructor (GType type, priv->group = empathy_tp_group_new (priv->account, priv->tp_chan); priv->streamed_iface = tp_chan_get_interface (priv->tp_chan, - TELEPATHY_CHAN_IFACE_STREAMED_QUARK); + TP_IFACE_QUARK_CHANNEL_TYPE_STREAMED_MEDIA); /* Connect signals */ dbus_g_proxy_connect_signal (priv->streamed_iface, "StreamAdded", diff --git a/libempathy/empathy-tp-chat.c b/libempathy/empathy-tp-chat.c index b11725f48..6a871822e 100644 --- a/libempathy/empathy-tp-chat.c +++ b/libempathy/empathy-tp-chat.c @@ -55,58 +55,58 @@ struct _EmpathyTpChatPriv { DBusGProxy *chat_state_iface; }; -static void empathy_tp_chat_class_init (EmpathyTpChatClass *klass); -static void empathy_tp_chat_init (EmpathyTpChat *chat); -static void tp_chat_finalize (GObject *object); -static GObject * tp_chat_constructor (GType type, - guint n_props, - GObjectConstructParam *props); -static void tp_chat_get_property (GObject *object, - guint param_id, - GValue *value, - GParamSpec *pspec); -static void tp_chat_set_property (GObject *object, - guint param_id, - const GValue *value, - GParamSpec *pspec); -static void tp_chat_destroy_cb (TpChan *text_chan, - EmpathyTpChat *chat); -static void tp_chat_closed_cb (TpChan *text_chan, - EmpathyTpChat *chat); -static void tp_chat_received_cb (DBusGProxy *text_iface, - guint message_id, - guint timestamp, - guint from_handle, - guint message_type, - guint message_flags, - gchar *message_body, - EmpathyTpChat *chat); -static void tp_chat_sent_cb (DBusGProxy *text_iface, - guint timestamp, - guint message_type, - gchar *message_body, - EmpathyTpChat *chat); -static void tp_chat_send_error_cb (DBusGProxy *text_iface, - guint error_code, - guint timestamp, - guint message_type, - gchar *message_body, - EmpathyTpChat *chat); -static void tp_chat_state_changed_cb (DBusGProxy *chat_state_iface, - guint handle, - TelepathyChannelChatState state, - EmpathyTpChat *chat); -static EmpathyMessage * tp_chat_build_message (EmpathyTpChat *chat, - guint type, - guint timestamp, - guint from_handle, - const gchar *message_body); -static void tp_chat_properties_ready_cb (TpPropsIface *props_iface, - EmpathyTpChat *chat); -static void tp_chat_properties_changed_cb (TpPropsIface *props_iface, - guint prop_id, - TpPropsChanged flag, - EmpathyTpChat *chat); +static void empathy_tp_chat_class_init (EmpathyTpChatClass *klass); +static void empathy_tp_chat_init (EmpathyTpChat *chat); +static void tp_chat_finalize (GObject *object); +static GObject * tp_chat_constructor (GType type, + guint n_props, + GObjectConstructParam *props); +static void tp_chat_get_property (GObject *object, + guint param_id, + GValue *value, + GParamSpec *pspec); +static void tp_chat_set_property (GObject *object, + guint param_id, + const GValue *value, + GParamSpec *pspec); +static void tp_chat_destroy_cb (TpChan *text_chan, + EmpathyTpChat *chat); +static void tp_chat_closed_cb (TpChan *text_chan, + EmpathyTpChat *chat); +static void tp_chat_received_cb (DBusGProxy *text_iface, + guint message_id, + guint timestamp, + guint from_handle, + guint message_type, + guint message_flags, + gchar *message_body, + EmpathyTpChat *chat); +static void tp_chat_sent_cb (DBusGProxy *text_iface, + guint timestamp, + guint message_type, + gchar *message_body, + EmpathyTpChat *chat); +static void tp_chat_send_error_cb (DBusGProxy *text_iface, + guint error_code, + guint timestamp, + guint message_type, + gchar *message_body, + EmpathyTpChat *chat); +static void tp_chat_state_changed_cb (DBusGProxy *chat_state_iface, + guint handle, + TpChannelChatState state, + EmpathyTpChat *chat); +static EmpathyMessage * tp_chat_build_message (EmpathyTpChat *chat, + guint type, + guint timestamp, + guint from_handle, + const gchar *message_body); +static void tp_chat_properties_ready_cb (TpPropsIface *props_iface, + EmpathyTpChat *chat); +static void tp_chat_properties_changed_cb (TpPropsIface *props_iface, + guint prop_id, + TpPropsChanged flag, + EmpathyTpChat *chat); enum { PROP_0, PROP_ACCOUNT, @@ -416,11 +416,11 @@ tp_chat_constructor (GType type, priv->mc = empathy_mission_control_new (); priv->text_iface = tp_chan_get_interface (priv->tp_chan, - TELEPATHY_CHAN_IFACE_TEXT_QUARK); + TP_IFACE_QUARK_CHANNEL_TYPE_TEXT); priv->chat_state_iface = tp_chan_get_interface (priv->tp_chan, - TELEPATHY_CHAN_IFACE_CHAT_STATE_QUARK); + TP_IFACE_QUARK_CHANNEL_INTERFACE_CHAT_STATE); priv->props_iface = tp_chan_get_interface (priv->tp_chan, - TELEPATHY_PROPS_IFACE_QUARK); + TP_IFACE_QUARK_PROPERTIES_INTERFACE); g_signal_connect (priv->tp_chan, "destroy", G_CALLBACK (tp_chat_destroy_cb), @@ -736,8 +736,8 @@ empathy_tp_chat_send (EmpathyTpChat *chat, } void -empathy_tp_chat_set_state (EmpathyTpChat *chat, - TelepathyChannelChatState state) +empathy_tp_chat_set_state (EmpathyTpChat *chat, + TpChannelChatState state) { EmpathyTpChatPriv *priv; GError *error = NULL; @@ -891,10 +891,10 @@ tp_chat_send_error_cb (DBusGProxy *text_iface, } static void -tp_chat_state_changed_cb (DBusGProxy *chat_state_iface, - guint handle, - TelepathyChannelChatState state, - EmpathyTpChat *chat) +tp_chat_state_changed_cb (DBusGProxy *chat_state_iface, + guint handle, + TpChannelChatState state, + EmpathyTpChat *chat) { EmpathyTpChatPriv *priv; EmpathyContact *contact; diff --git a/libempathy/empathy-tp-chat.h b/libempathy/empathy-tp-chat.h index 1c9d450c4..cd807c983 100644 --- a/libempathy/empathy-tp-chat.h +++ b/libempathy/empathy-tp-chat.h @@ -55,19 +55,19 @@ 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 (EmpathyContact *contact); -gboolean empathy_tp_chat_get_acknowledge (EmpathyTpChat *chat); -void empathy_tp_chat_set_acknowledge (EmpathyTpChat *chat, - gboolean acknowledge); -TpChan * empathy_tp_chat_get_channel (EmpathyTpChat *chat); -GList * empathy_tp_chat_get_pendings (EmpathyTpChat *chat); -void empathy_tp_chat_send (EmpathyTpChat *chat, - EmpathyMessage *message); -void empathy_tp_chat_set_state (EmpathyTpChat *chat, - TelepathyChannelChatState state); -const gchar * empathy_tp_chat_get_id (EmpathyTpChat *chat); +EmpathyTpChat *empathy_tp_chat_new (McAccount *account, + TpChan *tp_chan); +EmpathyTpChat *empathy_tp_chat_new_with_contact (EmpathyContact *contact); +gboolean empathy_tp_chat_get_acknowledge (EmpathyTpChat *chat); +void empathy_tp_chat_set_acknowledge (EmpathyTpChat *chat, + gboolean acknowledge); +TpChan * empathy_tp_chat_get_channel (EmpathyTpChat *chat); +GList * empathy_tp_chat_get_pendings (EmpathyTpChat *chat); +void empathy_tp_chat_send (EmpathyTpChat *chat, + EmpathyMessage *message); +void empathy_tp_chat_set_state (EmpathyTpChat *chat, + TpChannelChatState state); +const gchar * empathy_tp_chat_get_id (EmpathyTpChat *chat); G_END_DECLS diff --git a/libempathy/empathy-tp-contact-list.c b/libempathy/empathy-tp-contact-list.c index 76def9d31..805150177 100644 --- a/libempathy/empathy-tp-contact-list.c +++ b/libempathy/empathy-tp-contact-list.c @@ -345,7 +345,7 @@ static void tp_contact_list_newchannel_cb (DBusGProxy *proxy, const gchar *object_path, const gchar *channel_type, - TelepathyHandleType handle_type, + TpHandleType handle_type, guint channel_handle, gboolean suppress_handler, EmpathyTpContactList *list) @@ -541,18 +541,18 @@ tp_contact_list_disconnect (EmpathyTpContactList *list) } static void -tp_contact_list_status_changed_cb (MissionControl *mc, - TelepathyConnectionStatus status, - McPresence presence, - TelepathyConnectionStatusReason reason, - const gchar *unique_name, - EmpathyTpContactList *list) +tp_contact_list_status_changed_cb (MissionControl *mc, + TpConnectionStatus status, + McPresence presence, + TpConnectionStatusReason reason, + const gchar *unique_name, + EmpathyTpContactList *list) { EmpathyTpContactListPriv *priv = GET_PRIV (list); McAccount *account; account = mc_account_lookup (unique_name); - if (status != TP_CONN_STATUS_CONNECTED && + if (status != TP_CONNECTION_STATUS_CONNECTED && empathy_account_equal (account, priv->account)) { /* We are disconnected */ tp_contact_list_disconnect (list); @@ -662,11 +662,11 @@ tp_contact_list_setup (EmpathyTpContactList *list) } for (i = 0; i < channels->len; i++) { - GValueArray *chan_struct; - const gchar *object_path; - const gchar *chan_iface; - TelepathyHandleType handle_type; - guint handle; + GValueArray *chan_struct; + const gchar *object_path; + const gchar *chan_iface; + TpHandleType handle_type; + guint handle; chan_struct = g_ptr_array_index (channels, i); object_path = g_value_get_boxed (g_value_array_get_nth (chan_struct, 0)); diff --git a/libempathy/empathy-tp-group.c b/libempathy/empathy-tp-group.c index ff04648a3..e648d40ab 100644 --- a/libempathy/empathy-tp-group.c +++ b/libempathy/empathy-tp-group.c @@ -565,7 +565,7 @@ empathy_tp_group_new (McAccount *account, g_return_val_if_fail (MC_IS_ACCOUNT (account), NULL); group_iface = tp_chan_get_interface (tp_chan, - TELEPATHY_CHAN_IFACE_GROUP_QUARK); + TP_IFACE_QUARK_CHANNEL_INTERFACE_GROUP); g_return_val_if_fail (group_iface != NULL, NULL); group = g_object_new (EMPATHY_TYPE_TP_GROUP, NULL); diff --git a/libempathy/empathy-tp-roomlist.c b/libempathy/empathy-tp-roomlist.c index a091bf9ff..0b161346a 100644 --- a/libempathy/empathy-tp-roomlist.c +++ b/libempathy/empathy-tp-roomlist.c @@ -182,7 +182,7 @@ empathy_tp_roomlist_new (McAccount *account) priv->account = g_object_ref (account); priv->roomlist_iface = tp_chan_get_interface (priv->tp_chan, - TELEPATHY_CHAN_IFACE_ROOMLIST_QUARK); + TP_IFACE_QUARK_CHANNEL_TYPE_ROOM_LIST); g_signal_connect (priv->tp_chan, "destroy", G_CALLBACK (tp_roomlist_destroy_cb), diff --git a/libempathy/empathy-utils.c b/libempathy/empathy-utils.c index 032b121ea..f322f0288 100644 --- a/libempathy/empathy-utils.c +++ b/libempathy/empathy-utils.c @@ -199,82 +199,6 @@ empathy_strncasecmp (const gchar *s1, return ret_val; } -/* Stolen from telepathy-glib */ -gboolean -empathy_strdiff (const gchar *left, const gchar *right) -{ - if ((NULL == left) != (NULL == right)) - return TRUE; - - else if (left == right) - return FALSE; - - else - return (0 != strcmp (left, right)); -} - -/* Stolen from telepathy-glib */ -static inline gboolean -_esc_ident_bad (gchar c, gboolean is_first) -{ - return ((c < 'a' || c > 'z') && - (c < 'A' || c > 'Z') && - (c < '0' || c > '9' || is_first)); -} - -/* Stolen from telepathy-glib */ -gchar * -empathy_escape_as_identifier (const gchar *name) -{ - gboolean bad = FALSE; - size_t len = 0; - GString *op; - const gchar *ptr, *first_ok; - - g_return_val_if_fail (name != NULL, NULL); - - for (ptr = name; *ptr; ptr++) - { - if (_esc_ident_bad (*ptr, ptr == name)) - { - bad = TRUE; - len += 3; - } - else - len++; - } - - /* fast path if it's clean */ - if (!bad) - return g_strdup (name); - - /* If strictly less than ptr, first_ok is the first uncopied safe character. - */ - first_ok = name; - op = g_string_sized_new (len); - for (ptr = name; *ptr; ptr++) - { - if (_esc_ident_bad (*ptr, ptr == name)) - { - /* copy preceding safe characters if any */ - if (first_ok < ptr) - { - g_string_append_len (op, first_ok, ptr - first_ok); - } - /* escape the unsafe character */ - g_string_append_printf (op, "_%02x", (unsigned char)(*ptr)); - /* restart after it */ - first_ok = ptr + 1; - } - } - /* copy trailing safe characters if any */ - if (first_ok < ptr) - { - g_string_append_len (op, first_ok, ptr - first_ok); - } - return g_string_free (op, FALSE); -} - gboolean empathy_xml_validate (xmlDoc *doc, const gchar *dtd_filename) diff --git a/libempathy/empathy-utils.h b/libempathy/empathy-utils.h index 587adaedc..746e8de5b 100644 --- a/libempathy/empathy-utils.h +++ b/libempathy/empathy-utils.h @@ -66,9 +66,6 @@ gint empathy_strcasecmp (const gchar *s1, gint empathy_strncasecmp (const gchar *s1, const gchar *s2, gsize n); -gboolean empathy_strdiff (const gchar *left, - const gchar *right); -gchar * empathy_escape_as_identifier (const gchar *name); /* XML */ gboolean empathy_xml_validate (xmlDoc *doc, |