diff options
author | Will Thompson <will.thompson@collabora.co.uk> | 2012-02-01 14:26:58 +0000 |
---|---|---|
committer | Will Thompson <will.thompson@collabora.co.uk> | 2012-02-01 17:28:47 +0000 |
commit | cdfd5215dfa3e7dfe1254f76a5eccf4b4356816d (patch) | |
tree | ac44db6f3d61d3e9a08fc0b6a7c52e7755604597 /libempathy/empathy-tp-chat.c | |
parent | 0dc2ba9ea63c7d7d7f46b4d4e8b9311dfad823bb (diff) |
Chat: show who changed the subject
https://bugzilla.gnome.org/show_bug.cgi?id=669177
Diffstat (limited to 'libempathy/empathy-tp-chat.c')
-rw-r--r-- | libempathy/empathy-tp-chat.c | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/libempathy/empathy-tp-chat.c b/libempathy/empathy-tp-chat.c index fcef6e8a..4e26a769 100644 --- a/libempathy/empathy-tp-chat.c +++ b/libempathy/empathy-tp-chat.c @@ -51,6 +51,7 @@ struct _EmpathyTpChatPrivate { gboolean supports_subject; gboolean can_set_subject; gchar *subject; + gchar *subject_actor; /* Room config (for now, we only track the title and don't support * setting it) */ @@ -609,12 +610,26 @@ update_subject (EmpathyTpChat *self, subject = tp_asv_get_string (properties, "Subject"); if (subject != NULL) { + const gchar *actor; + g_free (priv->subject); priv->subject = g_strdup (subject); + + /* If the actor is included with this update, use it; + * otherwise, clear it to avoid showing stale information. + * Why might it not be included? When you join an IRC channel, + * you get a pair of messages: first, the current topic; next, + * who set it, and when. Idle reports these in two separate + * signals. + */ + actor = tp_asv_get_string (properties, "Actor"); + g_free (priv->subject_actor); + priv->subject_actor = g_strdup (actor); + g_object_notify (G_OBJECT (self), "subject"); } - /* TODO: track Actor and Timestamp. */ + /* TODO: track Timestamp. */ } static void @@ -733,6 +748,14 @@ empathy_tp_chat_get_subject (EmpathyTpChat *self) return priv->subject; } +const gchar * +empathy_tp_chat_get_subject_actor (EmpathyTpChat *self) +{ + EmpathyTpChatPrivate *priv = self->priv; + + return priv->subject_actor; +} + static void tp_chat_dispose (GObject *object) { @@ -768,6 +791,7 @@ tp_chat_finalize (GObject *object) g_free (self->priv->title); g_free (self->priv->subject); + g_free (self->priv->subject_actor); G_OBJECT_CLASS (empathy_tp_chat_parent_class)->finalize (object); } |