eion/purple-hangouts

97ddbfff660b
Parents 6f82b267a7e8
Children aa92b48daf81
Try support the way purple3 embeds images to send
--- a/hangouts_conversation.c Wed Sep 19 08:29:28 2018 +1200
+++ b/hangouts_conversation.c Wed Sep 19 12:19:04 2018 +1200
@@ -1463,7 +1463,7 @@
const gchar *img;
if ((img = strstr(message, "<img ")) || (img = strstr(message, "<IMG "))) {
- const gchar *id;
+ const gchar *id, *src;
const gchar *close = strchr(img, '>');
if (((id = strstr(img, "ID=\"")) || (id = strstr(img, "id=\""))) &&
@@ -1474,6 +1474,17 @@
if (image != NULL) {
hangouts_conversation_send_image(ha, conv_id, image);
}
+ } else if (((src = strstr(img, "SRC=\"")) || (src = strstr(img, "src=\""))) &&
+ src < close) {
+ // purple3 embeds images using src="purple-image:1"
+ if (strncmp(src + 5, "purple-image:", 13) == 0) {
+ int imgid = atoi(src + 5 + 13);
+ PurpleImage *image = purple_image_store_get(imgid);
+
+ if (image != NULL) {
+ hangouts_conversation_send_image(ha, conv_id, image);
+ }
+ }
}
}
}