aboutsummaryrefslogtreecommitdiffstats
path: root/matrix-roommembers.c
diff options
context:
space:
mode:
authorRichard van der Hoff <richard@matrix.org>2015-11-03 10:17:42 +0000
committerRichard van der Hoff <richard@matrix.org>2015-11-03 10:17:42 +0000
commit1543d529309d14233e0d7bb1829d0331b9e39384 (patch)
tree91cb5f147922c54c7e5624077528d4e5b8a5c32b /matrix-roommembers.c
parent8efee869304ed95823767363df39a5617e38ce7c (diff)
downloadpurple-matrix-1543d529309d14233e0d7bb1829d0331b9e39384.tar.gz
Include invited members in room name calculations
We want to include invited members when we are considering names for rooms.
Diffstat (limited to 'matrix-roommembers.c')
-rw-r--r--matrix-roommembers.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/matrix-roommembers.c b/matrix-roommembers.c
index cfe36a0..2f68ea0 100644
--- a/matrix-roommembers.c
+++ b/matrix-roommembers.c
@@ -178,6 +178,7 @@ const gchar *matrix_roommembers_get_displayname_for_member(
if (displayname != NULL)
return displayname;
+ displayname = _calculate_displayname_for_member(member);
member -> current_displayname = displayname;
return displayname;
}
@@ -193,7 +194,7 @@ void matrix_roommembers_get_new_members(MatrixRoomMemberTable *table,
g_assert(member->current_displayname == NULL);
displayname = _calculate_displayname_for_member(member);
- member->current_displayname = displayname;
+
*display_names = g_list_prepend(*display_names, displayname);
*flags = g_list_prepend(*flags, GINT_TO_POINTER(0));
@@ -279,14 +280,17 @@ void matrix_roommembers_update_member(MatrixRoomMemberTable *table,
if(new_membership_val == MATRIX_ROOM_MEMBERSHIP_JOIN) {
if(old_membership_val != MATRIX_ROOM_MEMBERSHIP_JOIN) {
+ /* new user in this room */
table->new_members = g_slist_append(
table->new_members, member);
} else if(g_strcmp0(old_displayname, new_displayname) != 0) {
+ /* user has changed name */
table->renamed_members = g_slist_append(
table->renamed_members, member);
}
} else {
if(old_membership_val == MATRIX_ROOM_MEMBERSHIP_JOIN) {
+ /* user has left this room */
table->left_members = g_slist_append(
table->left_members, member);
}
@@ -298,7 +302,7 @@ void matrix_roommembers_update_member(MatrixRoomMemberTable *table,
* Returns a list of user ids. Free the list, but not the string pointers.
*/
GList *matrix_roommembers_get_active_members(
- MatrixRoomMemberTable *member_table)
+ MatrixRoomMemberTable *member_table, gboolean include_invited)
{
GHashTableIter iter;
gpointer key, value;
@@ -309,8 +313,11 @@ GList *matrix_roommembers_get_active_members(
const gchar *user_id = key;
MatrixRoomMember *member = value;
- if(member->membership == MATRIX_ROOM_MEMBERSHIP_JOIN)
+ if(member->membership == MATRIX_ROOM_MEMBERSHIP_JOIN ||
+ (include_invited &&
+ member->membership == MATRIX_ROOM_MEMBERSHIP_INVITE)) {
members = g_list_prepend(members, (gpointer)user_id);
+ }
}
return members;
}