aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXavier Claessens <xclaesse@src.gnome.org>2007-04-27 22:02:59 +0800
committerXavier Claessens <xclaesse@src.gnome.org>2007-04-27 22:02:59 +0800
commit3e0960a8f543917145421d44a208177289028121 (patch)
tree0ffc15c04b43ffd52ac7a06b8e465437d520e59b
parenta6dd26148d5cd05475d27ab26c395e60beb797b2 (diff)
downloadgsoc2013-empathy-3e0960a8f543917145421d44a208177289028121.tar
gsoc2013-empathy-3e0960a8f543917145421d44a208177289028121.tar.gz
gsoc2013-empathy-3e0960a8f543917145421d44a208177289028121.tar.bz2
gsoc2013-empathy-3e0960a8f543917145421d44a208177289028121.tar.lz
gsoc2013-empathy-3e0960a8f543917145421d44a208177289028121.tar.xz
gsoc2013-empathy-3e0960a8f543917145421d44a208177289028121.tar.zst
gsoc2013-empathy-3e0960a8f543917145421d44a208177289028121.zip
[darcs-to-svn @ Only one presence per contact]
svn path=/trunk/; revision=9
-rw-r--r--libempathy-gtk/gossip-contact-list.c2
-rw-r--r--libempathy-gtk/gossip-private-chat.c2
-rw-r--r--libempathy-gtk/gossip-ui-utils.c2
-rw-r--r--libempathy/empathy-contact-list.c9
-rw-r--r--libempathy/gossip-contact.c324
-rw-r--r--libempathy/gossip-contact.h11
-rw-r--r--libempathy/gossip-presence.c153
-rw-r--r--libempathy/gossip-presence.h11
8 files changed, 101 insertions, 413 deletions
diff --git a/libempathy-gtk/gossip-contact-list.c b/libempathy-gtk/gossip-contact-list.c
index 6e1573d8f..3a49d12d0 100644
--- a/libempathy-gtk/gossip-contact-list.c
+++ b/libempathy-gtk/gossip-contact-list.c
@@ -793,7 +793,7 @@ contact_list_contact_added_cb (EmpathyContactManager *manager,
g_signal_connect (contact, "notify::groups",
G_CALLBACK (contact_list_contact_groups_updated_cb),
list);
- g_signal_connect (contact, "notify::presences",
+ g_signal_connect (contact, "notify::presence",
G_CALLBACK (contact_list_contact_updated_cb),
list);
g_signal_connect (contact, "notify::name",
diff --git a/libempathy-gtk/gossip-private-chat.c b/libempathy-gtk/gossip-private-chat.c
index 229895051..1ceb6d4a5 100644
--- a/libempathy-gtk/gossip-private-chat.c
+++ b/libempathy-gtk/gossip-private-chat.c
@@ -363,7 +363,7 @@ private_chat_setup (GossipPrivateChat *chat,
G_CALLBACK (private_chat_contact_updated_cb),
chat);
g_signal_connect (priv->contact,
- "notify::presences",
+ "notify::presence",
G_CALLBACK (private_chat_contact_presence_updated_cb),
chat);
diff --git a/libempathy-gtk/gossip-ui-utils.c b/libempathy-gtk/gossip-ui-utils.c
index 05d319c50..82879619e 100644
--- a/libempathy-gtk/gossip-ui-utils.c
+++ b/libempathy-gtk/gossip-ui-utils.c
@@ -401,7 +401,7 @@ gossip_pixbuf_for_contact (GossipContact *contact)
g_return_val_if_fail (GOSSIP_IS_CONTACT (contact),
gossip_pixbuf_offline ());
- presence = gossip_contact_get_active_presence (contact);
+ presence = gossip_contact_get_presence (contact);
if (presence) {
return gossip_pixbuf_for_presence (presence);
diff --git a/libempathy/empathy-contact-list.c b/libempathy/empathy-contact-list.c
index 5775ca750..02d0c174d 100644
--- a/libempathy/empathy-contact-list.c
+++ b/libempathy/empathy-contact-list.c
@@ -1732,12 +1732,7 @@ contact_list_parse_presence_foreach (guint handle,
handle);
contact_list_block_contact (list, contact);
- if (presence) {
- gossip_contact_add_presence (contact, presence);
- g_object_unref (presence);
- } else {
- g_object_set (contact, "presences", NULL, NULL);
- }
+ gossip_contact_set_presence (contact, presence);
contact_list_unblock_contact (list, contact);
}
@@ -1767,8 +1762,6 @@ contact_list_presences_table_foreach (const gchar *state_str,
gossip_presence_set_status (*presence,
g_value_get_string (message));
}
-
- gossip_presence_set_resource (*presence, "");
}
static GossipPresenceState
diff --git a/libempathy/gossip-contact.c b/libempathy/gossip-contact.c
index 6950c89b7..f19825437 100644
--- a/libempathy/gossip-contact.c
+++ b/libempathy/gossip-contact.c
@@ -40,12 +40,12 @@ typedef struct _GossipContactPriv GossipContactPriv;
struct _GossipContactPriv {
gchar *id;
gchar *name;
- guint handle;
- GList *presences;
- GList *groups;
- GossipSubscription subscription;
GossipAvatar *avatar;
McAccount *account;
+ GossipPresence *presence;
+ GList *groups;
+ GossipSubscription subscription;
+ guint handle;
};
static void contact_class_init (GossipContactClass *class);
@@ -59,19 +59,17 @@ static void contact_set_property (GObject *object,
guint param_id,
const GValue *value,
GParamSpec *pspec);
-static void contact_set_presences (GossipContact *contact,
- GList *presences);
enum {
PROP_0,
- PROP_NAME,
PROP_ID,
- PROP_PRESENCES,
+ PROP_NAME,
+ PROP_AVATAR,
+ PROP_ACCOUNT,
+ PROP_PRESENCE,
PROP_GROUPS,
PROP_SUBSCRIPTION,
- PROP_AVATAR,
- PROP_HANDLE,
- PROP_ACCOUNT
+ PROP_HANDLE
};
static gpointer parent_class = NULL;
@@ -115,6 +113,14 @@ contact_class_init (GossipContactClass *class)
object_class->set_property = contact_set_property;
g_object_class_install_property (object_class,
+ PROP_ID,
+ g_param_spec_string ("id",
+ "Contact id",
+ "String identifying contact",
+ NULL,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (object_class,
PROP_NAME,
g_param_spec_string ("name",
"Contact Name",
@@ -123,19 +129,28 @@ contact_class_init (GossipContactClass *class)
G_PARAM_READWRITE));
g_object_class_install_property (object_class,
- PROP_ID,
- g_param_spec_string ("id",
- "Contact id",
- "String identifying contact",
- NULL,
+ PROP_AVATAR,
+ g_param_spec_boxed ("avatar",
+ "Avatar image",
+ "The avatar image",
+ GOSSIP_TYPE_AVATAR,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (object_class,
+ PROP_ACCOUNT,
+ g_param_spec_object ("account",
+ "Contact Account",
+ "The account associated with the contact",
+ MC_TYPE_ACCOUNT,
G_PARAM_READWRITE));
g_object_class_install_property (object_class,
- PROP_PRESENCES,
- g_param_spec_pointer ("presences",
- "Contact presences",
- "Presences of contact",
- G_PARAM_READWRITE));
+ PROP_PRESENCE,
+ g_param_spec_object ("presence",
+ "Contact presence",
+ "Presence of contact",
+ GOSSIP_TYPE_PRESENCE,
+ G_PARAM_READWRITE));
g_object_class_install_property (object_class,
PROP_GROUPS,
@@ -154,21 +169,6 @@ contact_class_init (GossipContactClass *class)
GOSSIP_SUBSCRIPTION_NONE,
G_PARAM_READWRITE));
- g_object_class_install_property (object_class,
- PROP_AVATAR,
- g_param_spec_boxed ("avatar",
- "Avatar image",
- "The avatar image",
- GOSSIP_TYPE_AVATAR,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class,
- PROP_ACCOUNT,
- g_param_spec_object ("account",
- "Contact Account",
- "The account associated with the contact",
- MC_TYPE_ACCOUNT,
- G_PARAM_READWRITE));
g_object_class_install_property (object_class,
PROP_HANDLE,
@@ -190,13 +190,13 @@ contact_init (GossipContact *contact)
priv = GET_PRIV (contact);
- priv->name = NULL;
- priv->id = NULL;
- priv->presences = NULL;
- priv->account = NULL;
- priv->groups = NULL;
- priv->avatar = NULL;
- priv->handle = 0;
+ priv->id = NULL;
+ priv->name = NULL;
+ priv->avatar = NULL;
+ priv->account = NULL;
+ priv->presence = NULL;
+ priv->groups = NULL;
+ priv->handle = 0;
}
static void
@@ -215,9 +215,8 @@ contact_finalize (GObject *object)
gossip_avatar_unref (priv->avatar);
}
- if (priv->presences) {
- g_list_foreach (priv->presences, (GFunc) g_object_unref, NULL);
- g_list_free (priv->presences);
+ if (priv->presence) {
+ g_object_unref (priv->presence);
}
if (priv->groups) {
@@ -243,16 +242,22 @@ contact_get_property (GObject *object,
priv = GET_PRIV (object);
switch (param_id) {
+ case PROP_ID:
+ g_value_set_string (value,
+ gossip_contact_get_id (GOSSIP_CONTACT (object)));
+ break;
case PROP_NAME:
g_value_set_string (value,
gossip_contact_get_name (GOSSIP_CONTACT (object)));
break;
- case PROP_ID:
- g_value_set_string (value,
- gossip_contact_get_id (GOSSIP_CONTACT (object)));
+ case PROP_AVATAR:
+ g_value_set_boxed (value, priv->avatar);
break;
- case PROP_PRESENCES:
- g_value_set_pointer (value, priv->presences);
+ case PROP_ACCOUNT:
+ g_value_set_object (value, priv->account);
+ break;
+ case PROP_PRESENCE:
+ g_value_set_object (value, priv->presence);
break;
case PROP_GROUPS:
g_value_set_pointer (value, priv->groups);
@@ -260,12 +265,6 @@ contact_get_property (GObject *object,
case PROP_SUBSCRIPTION:
g_value_set_int (value, priv->subscription);
break;
- case PROP_AVATAR:
- g_value_set_boxed (value, priv->avatar);
- break;
- case PROP_ACCOUNT:
- g_value_set_object (value, priv->account);
- break;
case PROP_HANDLE:
g_value_set_uint (value, priv->handle);
break;
@@ -286,17 +285,25 @@ contact_set_property (GObject *object,
priv = GET_PRIV (object);
switch (param_id) {
+ case PROP_ID:
+ gossip_contact_set_id (GOSSIP_CONTACT (object),
+ g_value_get_string (value));
+ break;
case PROP_NAME:
gossip_contact_set_name (GOSSIP_CONTACT (object),
g_value_get_string (value));
break;
- case PROP_ID:
- gossip_contact_set_id (GOSSIP_CONTACT (object),
- g_value_get_string (value));
+ case PROP_AVATAR:
+ gossip_contact_set_avatar (GOSSIP_CONTACT (object),
+ g_value_get_boxed (value));
break;
- case PROP_PRESENCES:
- contact_set_presences (GOSSIP_CONTACT (object),
- g_value_get_pointer (value));
+ case PROP_ACCOUNT:
+ gossip_contact_set_account (GOSSIP_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)));
break;
case PROP_GROUPS:
gossip_contact_set_groups (GOSSIP_CONTACT (object),
@@ -306,14 +313,6 @@ contact_set_property (GObject *object,
gossip_contact_set_subscription (GOSSIP_CONTACT (object),
g_value_get_int (value));
break;
- case PROP_AVATAR:
- gossip_contact_set_avatar (GOSSIP_CONTACT (object),
- g_value_get_boxed (value));
- break;
- case PROP_ACCOUNT:
- gossip_contact_set_account (GOSSIP_CONTACT (object),
- MC_ACCOUNT (g_value_get_object (value)));
- break;
case PROP_HANDLE:
gossip_contact_set_handle (GOSSIP_CONTACT (object),
g_value_get_uint (value));
@@ -401,48 +400,7 @@ gossip_contact_get_account (GossipContact *contact)
}
GossipPresence *
-gossip_contact_get_active_presence (GossipContact *contact)
-{
- GossipContactPriv *priv;
-
- g_return_val_if_fail (GOSSIP_IS_CONTACT (contact), NULL);
-
- priv = GET_PRIV (contact);
-
- if (priv->presences) {
- /* Highest priority of the presences is first */
- return GOSSIP_PRESENCE (priv->presences->data);
- }
-
- return NULL;
-}
-
-GossipPresence *
-gossip_contact_get_presence_for_resource (GossipContact *contact,
- const gchar *resource)
-{
- GossipContactPriv *priv;
- GList *l;
-
- g_return_val_if_fail (GOSSIP_IS_CONTACT (contact), NULL);
- g_return_val_if_fail (resource != NULL, NULL);
-
- priv = GET_PRIV (contact);
-
- for (l = priv->presences; l; l = l->next) {
- const gchar *p_res;
-
- p_res = gossip_presence_get_resource (GOSSIP_PRESENCE (l->data));
- if (p_res && strcmp (resource, p_res) == 0) {
- return GOSSIP_PRESENCE (l->data);
- }
- }
-
- return NULL;
-}
-
-GList *
-gossip_contact_get_presence_list (GossipContact *contact)
+gossip_contact_get_presence (GossipContact *contact)
{
GossipContactPriv *priv;
@@ -450,7 +408,7 @@ gossip_contact_get_presence_list (GossipContact *contact)
priv = GET_PRIV (contact);
- return priv->presences;
+ return priv->presence;
}
GList *
@@ -524,25 +482,6 @@ gossip_contact_set_name (GossipContact *contact,
g_object_notify (G_OBJECT (contact), "name");
}
-static void
-contact_set_presences (GossipContact *contact,
- GList *presences)
-{
- GossipContactPriv *priv;
-
- priv = GET_PRIV (contact);
-
- if (priv->presences) {
- g_list_foreach (priv->presences, (GFunc) g_object_unref, NULL);
- g_list_free (priv->presences);
- }
-
- priv->presences = g_list_copy (presences);
- g_list_foreach (priv->presences, (GFunc) g_object_ref, NULL);
-
- g_object_notify (G_OBJECT (contact), "presences");
-}
-
void
gossip_contact_set_avatar (GossipContact *contact,
GossipAvatar *avatar)
@@ -567,7 +506,7 @@ gossip_contact_set_avatar (GossipContact *contact,
void
gossip_contact_set_account (GossipContact *contact,
- McAccount *account)
+ McAccount *account)
{
GossipContactPriv *priv;
@@ -579,108 +518,31 @@ gossip_contact_set_account (GossipContact *contact,
if (priv->account) {
g_object_unref (priv->account);
}
-
- if (account) {
- priv->account = g_object_ref (account);
- } else {
- priv->account = NULL;
- }
+ priv->account = g_object_ref (account);
g_object_notify (G_OBJECT (contact), "account");
}
void
-gossip_contact_add_presence (GossipContact *contact,
+gossip_contact_set_presence (GossipContact *contact,
GossipPresence *presence)
{
GossipContactPriv *priv;
- GossipPresence *this_presence;
- GList *l;
g_return_if_fail (GOSSIP_IS_CONTACT (contact));
- g_return_if_fail (GOSSIP_IS_PRESENCE (presence));
priv = GET_PRIV (contact);
- for (l = priv->presences; l && presence; l = l->next) {
- this_presence = l->data;
-
- if (gossip_presence_resource_equal (this_presence, presence)) {
- gint ref_count;
-
- ref_count = G_OBJECT (presence)->ref_count;
-
- /* Remove old presence for this resource, we
- * would use g_list_remove_all() here but we
- * want to make sure we unref for each
- * instance we find it in the list.
- */
- priv->presences = g_list_remove (priv->presences, this_presence);
- g_object_unref (this_presence);
-
- if (!priv->presences || ref_count <= 1) {
- break;
- }
-
- /* Reset list to beginnging to make sure we
- * didn't miss any duplicates.
- */
- l = priv->presences;
- }
+ if (priv->presence) {
+ g_object_unref (priv->presence);
+ priv->presence = NULL;
}
- /* Add new presence */
- priv->presences = g_list_insert_sorted (priv->presences,
- g_object_ref (presence),
- gossip_presence_sort_func);
-
- g_object_notify (G_OBJECT (contact), "presences");
-}
-
-void
-gossip_contact_remove_presence (GossipContact *contact,
- GossipPresence *presence)
-{
- GossipContactPriv *priv;
- GossipPresence *this_presence;
- GList *l;
-
- g_return_if_fail (GOSSIP_IS_CONTACT (contact));
- g_return_if_fail (GOSSIP_IS_PRESENCE (presence));
-
- priv = GET_PRIV (contact);
-
- for (l = priv->presences; l; l = l->next) {
- this_presence = l->data;
-
- if (gossip_presence_resource_equal (this_presence, presence)) {
- gint ref_count;
-
- ref_count = G_OBJECT (presence)->ref_count;
-
- /* Remove old presence for this resource, we
- * would use g_list_remove_all() here but we
- * want to make sure we unref for each
- * instance we find it in the list.
- */
- priv->presences = g_list_remove (priv->presences, this_presence);
- g_object_unref (this_presence);
-
- if (!priv->presences || ref_count <= 1) {
- break;
- }
-
- /* Reset list to beginnging to make sure we
- * didn't miss any duplicates.
- */
- l = priv->presences;
- }
+ if (presence) {
+ priv->presence = g_object_ref (presence);
}
- priv->presences = g_list_sort (priv->presences,
- gossip_presence_sort_func);
-
- g_object_notify (G_OBJECT (contact), "presences");
+ g_object_notify (G_OBJECT (contact), "presence");
}
void
@@ -745,11 +607,7 @@ gossip_contact_is_online (GossipContact *contact)
priv = GET_PRIV (contact);
- if (priv->presences == NULL) {
- return FALSE;
- }
-
- return TRUE;
+ return (priv->presence != NULL);
}
const gchar *
@@ -761,19 +619,21 @@ gossip_contact_get_status (GossipContact *contact)
priv = GET_PRIV (contact);
- if (priv->presences) {
- GossipPresence *p;
- const gchar *status;
+ if (priv->presence) {
+ const gchar *status;
- p = GOSSIP_PRESENCE (priv->presences->data);
- status = gossip_presence_get_status (p);
+ status = gossip_presence_get_status (priv->presence);
if (!status) {
- status = gossip_presence_state_get_default_status (gossip_presence_get_state (p));
+ GossipPresenceState state;
+
+ state = gossip_presence_get_state (priv->presence);
+ status = gossip_presence_state_get_default_status (state);
}
+
return status;
- } else {
- return _("Offline");
}
+
+ return _("Offline");
}
gboolean
diff --git a/libempathy/gossip-contact.h b/libempathy/gossip-contact.h
index 92caee9ea..99f1d2e1e 100644
--- a/libempathy/gossip-contact.h
+++ b/libempathy/gossip-contact.h
@@ -65,14 +65,7 @@ const gchar * gossip_contact_get_id (GossipContact
const gchar * gossip_contact_get_name (GossipContact *contact);
GossipAvatar * gossip_contact_get_avatar (GossipContact *contact);
McAccount * gossip_contact_get_account (GossipContact *contact);
-void gossip_contact_add_presence (GossipContact *contact,
- GossipPresence *presence);
-void gossip_contact_remove_presence (GossipContact *contact,
- GossipPresence *presence);
-GossipPresence * gossip_contact_get_presence_for_resource (GossipContact *contact,
- const gchar *resource);
-GossipPresence * gossip_contact_get_active_presence (GossipContact *contact);
-GList * gossip_contact_get_presence_list (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);
@@ -84,6 +77,8 @@ void gossip_contact_set_avatar (GossipContact
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,
diff --git a/libempathy/gossip-presence.c b/libempathy/gossip-presence.c
index e41ae5548..2857b7612 100644
--- a/libempathy/gossip-presence.c
+++ b/libempathy/gossip-presence.c
@@ -35,11 +35,7 @@ typedef struct _GossipPresencePriv GossipPresencePriv;
struct _GossipPresencePriv {
GossipPresenceState state;
-
gchar *status;
- gchar *resource;
-
- gint priority;
GossipTime timestamp;
};
@@ -56,9 +52,7 @@ static void presence_set_property (GObject *object,
enum {
PROP_0,
PROP_STATE,
- PROP_STATUS,
- PROP_RESOURCE,
- PROP_PRIORITY
+ PROP_STATUS
};
G_DEFINE_TYPE (GossipPresence, gossip_presence, G_TYPE_OBJECT);
@@ -90,22 +84,6 @@ gossip_presence_class_init (GossipPresenceClass *class)
"Status string set on presence",
NULL,
G_PARAM_READWRITE));
- g_object_class_install_property (object_class,
- PROP_RESOURCE,
- g_param_spec_string ("resource",
- "Presence Resource",
- "Resource that this presence is for",
- NULL,
- G_PARAM_READWRITE));
- g_object_class_install_property (object_class,
- PROP_PRIORITY,
- g_param_spec_int ("priority",
- "Presence Priority",
- "Priority value of presence",
- G_MININT,
- G_MAXINT,
- 0,
- G_PARAM_READWRITE));
g_type_class_add_private (object_class, sizeof (GossipPresencePriv));
}
@@ -118,12 +96,7 @@ gossip_presence_init (GossipPresence *presence)
priv = GET_PRIV (presence);
priv->state = GOSSIP_PRESENCE_STATE_AVAILABLE;
-
priv->status = NULL;
- priv->resource = NULL;
-
- priv->priority = 0;
-
priv->timestamp = gossip_time_get_current ();
}
@@ -135,7 +108,6 @@ presence_finalize (GObject *object)
priv = GET_PRIV (object);
g_free (priv->status);
- g_free (priv->resource);
(G_OBJECT_CLASS (gossip_presence_parent_class)->finalize) (object);
}
@@ -158,13 +130,6 @@ presence_get_property (GObject *object,
g_value_set_string (value,
gossip_presence_get_status (GOSSIP_PRESENCE (object)));
break;
- case PROP_RESOURCE:
- g_value_set_string (value,
- gossip_presence_get_resource (GOSSIP_PRESENCE (object)));
- break;
- case PROP_PRIORITY:
- g_value_set_int (value, priv->priority);
- break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
break;
@@ -188,13 +153,6 @@ presence_set_property (GObject *object,
gossip_presence_set_status (GOSSIP_PRESENCE (object),
g_value_get_string (value));
break;
- case PROP_RESOURCE:
- gossip_presence_set_resource (GOSSIP_PRESENCE (object),
- g_value_get_string (value));
- break;
- case PROP_PRIORITY:
- priv->priority = g_value_get_int (value);
- break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
break;
@@ -218,22 +176,6 @@ gossip_presence_new_full (GossipPresenceState state,
}
const gchar *
-gossip_presence_get_resource (GossipPresence *presence)
-{
- GossipPresencePriv *priv;
-
- g_return_val_if_fail (GOSSIP_IS_PRESENCE (presence), NULL);
-
- priv = GET_PRIV (presence);
-
- if (priv->resource) {
- return priv->resource;
- }
-
- return NULL;
-}
-
-const gchar *
gossip_presence_get_status (GossipPresence *presence)
{
GossipPresencePriv *priv;
@@ -246,34 +188,6 @@ gossip_presence_get_status (GossipPresence *presence)
return priv->status;
}
-gint
-gossip_presence_get_priority (GossipPresence *presence)
-{
- GossipPresencePriv *priv;
-
- priv = GET_PRIV (presence);
- g_return_val_if_fail (GOSSIP_IS_PRESENCE (presence), 0);
-
- return priv->priority;
-}
-
-void
-gossip_presence_set_resource (GossipPresence *presence,
- const gchar *resource)
-{
- GossipPresencePriv *priv;
-
- g_return_if_fail (GOSSIP_IS_PRESENCE (presence));
- g_return_if_fail (resource != NULL);
-
- priv = GET_PRIV (presence);
-
- g_free (priv->resource);
- priv->resource = g_strdup (resource);
-
- g_object_notify (G_OBJECT (presence), "resource");
-}
-
GossipPresenceState
gossip_presence_get_state (GossipPresence *presence)
{
@@ -322,53 +236,6 @@ gossip_presence_set_status (GossipPresence *presence,
g_object_notify (G_OBJECT (presence), "status");
}
-void
-gossip_presence_set_priority (GossipPresence *presence,
- gint priority)
-{
- GossipPresencePriv *priv;
-
- g_return_if_fail (GOSSIP_IS_PRESENCE (presence));
-
- priv = GET_PRIV (presence);
-
- priv->priority = priority;
-
- g_object_notify (G_OBJECT (presence), "priority");
-}
-
-gboolean
-gossip_presence_resource_equal (gconstpointer a,
- gconstpointer b)
-{
- GossipPresencePriv *priv1;
- GossipPresencePriv *priv2;
-
- g_return_val_if_fail (GOSSIP_IS_PRESENCE (a), FALSE);
- g_return_val_if_fail (GOSSIP_IS_PRESENCE (b), FALSE);
-
- priv1 = GET_PRIV (a);
- priv2 = GET_PRIV (b);
-
- if (!priv1->resource) {
- if (!priv2->resource) {
- return TRUE;
- }
-
- return FALSE;
- }
-
- if (!priv2->resource) {
- return FALSE;
- }
-
- if (strcmp (priv1->resource, priv2->resource) == 0) {
- return TRUE;
- }
-
- return FALSE;
-}
-
gint
gossip_presence_sort_func (gconstpointer a,
gconstpointer b)
@@ -379,16 +246,6 @@ gossip_presence_sort_func (gconstpointer a,
g_return_val_if_fail (GOSSIP_IS_PRESENCE (a), 0);
g_return_val_if_fail (GOSSIP_IS_PRESENCE (b), 0);
-
- /* We sort here by priority AND status, in theory, the
- * priority would be enough for JUST Jabber contacts which
- * actually abide to the protocol, but for other protocols and
- * dodgy clients, we will sort by:
- *
- * 1. State
- * 2. Priority
- * 3. Time it was set (most recent first).
- */
priv_a = GET_PRIV (a);
priv_b = GET_PRIV (b);
@@ -399,19 +256,13 @@ gossip_presence_sort_func (gconstpointer a,
return diff < 1 ? -1 : +1;
}
- /* 2. Priority */
- diff = priv_a->priority - priv_b->priority;
- if (diff != 0) {
- return diff < 1 ? -1 : +1;
- }
-
/* 3. Time (newest first) */
diff = priv_b->timestamp - priv_a->timestamp;
if (diff != 0) {
return diff < 1 ? -1 : +1;
}
- /* No real difference, except maybe resource */
+ /* No real difference */
return 0;
}
diff --git a/libempathy/gossip-presence.h b/libempathy/gossip-presence.h
index 64a0b8ec3..12648e6f7 100644
--- a/libempathy/gossip-presence.h
+++ b/libempathy/gossip-presence.h
@@ -57,25 +57,14 @@ GType gossip_presence_get_type (void) G_GNUC_CONST
GossipPresence * gossip_presence_new (void);
GossipPresence * gossip_presence_new_full (GossipPresenceState state,
const gchar *status);
-
-const gchar * gossip_presence_get_resource (GossipPresence *presence);
GossipPresenceState gossip_presence_get_state (GossipPresence *presence);
const gchar * gossip_presence_get_status (GossipPresence *presence);
-gint gossip_presence_get_priority (GossipPresence *presence);
-
-void gossip_presence_set_resource (GossipPresence *presence,
- const gchar *resource);
void gossip_presence_set_state (GossipPresence *presence,
GossipPresenceState state);
void gossip_presence_set_status (GossipPresence *presence,
const gchar *status);
-void gossip_presence_set_priority (GossipPresence *presence,
- gint priority);
-gboolean gossip_presence_resource_equal (gconstpointer a,
- gconstpointer b);
gint gossip_presence_sort_func (gconstpointer a,
gconstpointer b);
-
const gchar * gossip_presence_state_get_default_status (GossipPresenceState state);
G_END_DECLS