aboutsummaryrefslogtreecommitdiffstats
path: root/matrix-room.c
diff options
context:
space:
mode:
authorDr. David Alan Gilbert <dave@treblig.org>2016-07-10 02:50:12 +0100
committerDr. David Alan Gilbert <dave@treblig.org>2016-07-10 02:53:48 +0100
commitd4530f8ea0c4e8bffa477b80571e6fef0c204a42 (patch)
treeab6ff847d4cf01ed923fd5ac30a13c174b6283d3 /matrix-room.c
parent8e8ce0171f1a47f958e576b4d0458341a11b51bc (diff)
downloadpurple-matrix-d4530f8ea0c4e8bffa477b80571e6fef0c204a42.tar.gz
Send outgoing emotes
Spot the /me in what we get from pidgin and use m.emote msgtype. Signed-off-by: Dr. David Alan Gilbert <dave@treblig.org>
Diffstat (limited to 'matrix-room.c')
-rw-r--r--matrix-room.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/matrix-room.c b/matrix-room.c
index 53ab097..ee5cdb5 100644
--- a/matrix-room.c
+++ b/matrix-room.c
@@ -791,10 +791,17 @@ void matrix_room_send_message(PurpleConversation *conv, const gchar *message)
{
JsonObject *content;
PurpleConvChat *chat = PURPLE_CONV_CHAT(conv);
+ const char *type_string = "m.text";
+ const gchar *message_to_send = message;
+
+ if (!strncmp(message, "/me ", 4)) {
+ type_string = "m.emote";
+ message_to_send = message + 4;
+ }
content = json_object_new();
- json_object_set_string_member(content, "msgtype", "m.text");
- json_object_set_string_member(content, "body", message);
+ json_object_set_string_member(content, "msgtype", type_string);
+ json_object_set_string_member(content, "body", message_to_send);
_enqueue_event(conv, "m.room.message", content);
json_object_unref(content);