aboutsummaryrefslogtreecommitdiffstats
path: root/matrix-room.c
diff options
context:
space:
mode:
authorEion Robb <eion@robbmob.com>2017-03-12 13:02:41 +1300
committerEion Robb <eion@robbmob.com>2017-03-12 13:02:41 +1300
commit2f9471dffd8ed4c82d1723f7909b6c7324bbd518 (patch)
treec90b7854d6788bec6ac6b83b0c196b5834b4677f /matrix-room.c
parentccf49582556edc17c75df1073d61d8bebfede744 (diff)
downloadpurple-matrix-2f9471dffd8ed4c82d1723f7909b6c7324bbd518.tar.gz
Support display of room topics
Diffstat (limited to 'matrix-room.c')
-rw-r--r--matrix-room.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/matrix-room.c b/matrix-room.c
index a0f91de..1940620 100644
--- a/matrix-room.c
+++ b/matrix-room.c
@@ -169,6 +169,19 @@ static void _on_member_change(PurpleConversation *conv,
new_state->content);
}
+/**
+ * Called when there is a change to the topic.
+ */
+static void _on_topic_change(PurpleConversation *conv,
+ MatrixRoomEvent *new_state)
+{
+ PurpleConvChat *chat = PURPLE_CONV_CHAT(conv);
+
+ purple_conv_chat_set_topic(chat, new_state->sender,
+ matrix_json_object_get_string_member(new_state->content,
+ "topic"));
+}
+
/**
* Called when there is a state update.
@@ -196,6 +209,9 @@ static void _on_state_update(const gchar *event_type,
strcmp(event_type, "m.room.name") == 0) {
_schedule_name_update(conv);
}
+ else if(strcmp(event_type, "m.room.topic") == 0) {
+ _on_topic_change(conv, new_state);
+ }
}
void matrix_room_handle_state_event(struct _PurpleConversation *conv,