aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libempathy-gtk/empathy-chat.c9
-rw-r--r--libempathy/empathy-tp-chat.c26
-rw-r--r--libempathy/empathy-tp-chat.h1
3 files changed, 34 insertions, 2 deletions
diff --git a/libempathy-gtk/empathy-chat.c b/libempathy-gtk/empathy-chat.c
index 8a17189ee..5dda2ce6b 100644
--- a/libempathy-gtk/empathy-chat.c
+++ b/libempathy-gtk/empathy-chat.c
@@ -1692,7 +1692,14 @@ chat_subject_changed_cb (EmpathyChat *chat)
gchar *str = NULL;
if (!EMP_STR_EMPTY (priv->subject)) {
- str = g_strdup_printf (_("Topic set to: %s"), priv->subject);
+ const gchar *actor = empathy_tp_chat_get_subject_actor (priv->tp_chat);
+
+ if (tp_str_empty (actor)) {
+ str = g_strdup_printf (_("Topic set to: %s"), priv->subject);
+ } else {
+ str = g_strdup_printf (_("Topic set by %s to: %s"),
+ actor, priv->subject);
+ }
} else if (empathy_tp_chat_supports_subject (priv->tp_chat)) {
/* No need to display this 'event' is no topic can be defined anyway */
str = g_strdup (_("No topic defined"));
diff --git a/libempathy/empathy-tp-chat.c b/libempathy/empathy-tp-chat.c
index fcef6e8a7..4e26a769b 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);
}
diff --git a/libempathy/empathy-tp-chat.h b/libempathy/empathy-tp-chat.h
index cc1c16aaf..885479cb3 100644
--- a/libempathy/empathy-tp-chat.h
+++ b/libempathy/empathy-tp-chat.h
@@ -81,6 +81,7 @@ const gchar * empathy_tp_chat_get_title (EmpathyTpChat *self);
gboolean empathy_tp_chat_supports_subject (EmpathyTpChat *self);
const gchar * empathy_tp_chat_get_subject (EmpathyTpChat *self);
+const gchar * empathy_tp_chat_get_subject_actor (EmpathyTpChat *self);
gboolean empathy_tp_chat_can_set_subject (EmpathyTpChat *self);
void empathy_tp_chat_set_subject (EmpathyTpChat *self,
const gchar *subject);