aboutsummaryrefslogtreecommitdiffstats
path: root/matrix-statetable.c
diff options
context:
space:
mode:
authorRichard van der Hoff <richard@matrix.org>2015-11-02 14:25:14 +0000
committerRichard van der Hoff <richard@matrix.org>2015-11-02 14:25:14 +0000
commitf9b67d862caed52dd6494e0aa526ed65dd85c08d (patch)
treee7b5f4735f1e7d6dc95cf1072942b8a14ab25d98 /matrix-statetable.c
parent2ed95f49507a2fa528df6eeacdf8954df473a75e (diff)
downloadpurple-matrix-f9b67d862caed52dd6494e0aa526ed65dd85c08d.tar.gz
Use m.room.canonical_alias when it exists
Some rooms have a canonical alias which should be used for their names.
Diffstat (limited to 'matrix-statetable.c')
-rw-r--r--matrix-statetable.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/matrix-statetable.c b/matrix-statetable.c
index f90fb97..9d91398 100644
--- a/matrix-statetable.c
+++ b/matrix-statetable.c
@@ -123,6 +123,17 @@ gchar *matrix_statetable_get_room_alias(MatrixRoomStateEventTable *state_table)
}
}
+ /* look for a canonical alias */
+ event = matrix_statetable_get_event(state_table, "m.room.canonical_alias",
+ "");
+ if(event != NULL) {
+ tmpname = matrix_json_object_get_string_member(
+ event->content, "alias");
+ if(tmpname != NULL) {
+ return g_strdup(tmpname);
+ }
+ }
+
/* look for an alias */
tmp = (GHashTable *) g_hash_table_lookup(state_table, "m.room.aliases");
if(tmp != NULL) {