--- a/hangouts_conversation.c Fri Sep 30 11:09:33 2016 +1300
+++ b/hangouts_conversation.c Sun Oct 16 21:11:33 2016 +1300
@@ -1373,16 +1373,30 @@
SendChatMessageRequest request;
MessageContent message_content;
+ EventAnnotation event_annotation; + gchar *message_dup = g_strdup(message); //Check for any images to send first
- hangouts_conversation_check_message_for_images(ha, conv_id, message);
+ hangouts_conversation_check_message_for_images(ha, conv_id, message_dup); send_chat_message_request__init(&request);
message_content__init(&message_content);
- segments = hangouts_convert_html_to_segments(ha, message, &n_segments);
+ if (purple_message_meify(message_dup, -1)) { + //TODO put purple_account_get_private_alias(sa->account) on the front + event_annotation__init(&event_annotation); + event_annotation.has_type = TRUE; + event_annotation.type = HANGOUTS_MAGIC_HALF_EIGHT_SLASH_ME_TYPE; + request.n_annotation = 1; + request.annotation = g_new0(EventAnnotation *, 1); + request.annotation[0] = &event_annotation; + segments = hangouts_convert_html_to_segments(ha, message_dup, &n_segments); message_content.segment = segments;
message_content.n_segment = n_segments;
--- a/hangouts_events.c Fri Sep 30 11:09:33 2016 +1300
+++ b/hangouts_events.c Sun Oct 16 21:11:33 2016 +1300
@@ -560,6 +560,16 @@
PurpleXmlNode *html = purple_xmlnode_new("html");
time_t message_timestamp;
+ for (i = 0; i < chat_message->n_annotation; i++) { + EventAnnotation *annotation = chat_message->annotation[i]; + if (annotation->type == HANGOUTS_MAGIC_HALF_EIGHT_SLASH_ME_TYPE) { + //TODO strip name off the front of the first segment + purple_xmlnode_insert_data(html, "/me ", -1); for (i = 0; i < n_segments; i++) {
Segment *segment = segments[i];
--- a/libhangouts.h Fri Sep 30 11:09:33 2016 +1300
+++ b/libhangouts.h Sun Oct 16 21:11:33 2016 +1300
@@ -68,6 +68,8 @@
#define HANGOUTS_ACTIVE_CLIENT_TIMEOUT 120
+#define HANGOUTS_MAGIC_HALF_EIGHT_SLASH_ME_TYPE 4