aboutsummaryrefslogtreecommitdiffstats
path: root/libmatrix.c
diff options
context:
space:
mode:
authorRichard van der Hoff <richard@matrix.org>2015-11-02 18:03:09 +0000
committerRichard van der Hoff <richard@matrix.org>2015-11-02 18:03:09 +0000
commit8efee869304ed95823767363df39a5617e38ce7c (patch)
tree03a802fd6a89e035632ec2e36817d33744c05bdf /libmatrix.c
parente78ea22ac644ecb3bb08ca2059068825fc77324c (diff)
downloadpurple-matrix-8efee869304ed95823767363df39a5617e38ce7c.tar.gz
Implement get_cb_real_name
Fixing this means purple is slightly less confused about who the users in our chats are.
Diffstat (limited to 'libmatrix.c')
-rw-r--r--libmatrix.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/libmatrix.c b/libmatrix.c
index 49cee43..e74c317 100644
--- a/libmatrix.c
+++ b/libmatrix.c
@@ -199,6 +199,24 @@ static int matrixprpl_chat_send(PurpleConnection *gc, int id,
}
+/**
+ * Get the user_id of a user, given their displayname in a room
+ *
+ * @returns a string, which will be freed by the caller
+ */
+static char *matrixprpl_get_cb_real_name(PurpleConnection *gc, int id,
+ const char *who)
+{
+ PurpleConversation *conv = purple_find_chat(gc, id);
+ gchar *res;
+ if(conv == NULL)
+ return NULL;
+ res = matrix_room_displayname_to_userid(conv, who);
+ purple_debug_info("matrixprpl", "%s's real id in %s is %s\n", who,
+ conv->name, res);
+ return res;
+}
+
/******************************************************************************
* The following comes from the 'nullprpl' dummy protocol. TODO: clear this out
@@ -993,7 +1011,7 @@ static PurplePluginProtocolInfo prpl_info =
matrixprpl_normalize, /* normalize */
matrixprpl_set_buddy_icon, /* set_buddy_icon */
matrixprpl_remove_group, /* remove_group */
- NULL, /* get_cb_real_name */
+ matrixprpl_get_cb_real_name, /* get_cb_real_name */
matrixprpl_set_chat_topic, /* set_chat_topic */
NULL, /* find_blist_chat */
matrixprpl_roomlist_get_list, /* roomlist_get_list */