Summary: SkypeWeb API Plugin for Pidgin/libpurple/Adium
Name: libpurple-protocol-skypeweb
Version: 1.7
-Release: 3
+Release: 4
License: GPL v3
Group: Applications/Communications
Source0: https://github.com/EionRobb/skype4pidgin/archive/%{version}.tar.gz
# Source0-md5: 6af9359c55f4644fc8848389df582848
Patch0: login.patch
Patch1: bitlbee_img_url.patch
+Patch2: xhtml.patch
URL: https://github.com/EionRobb/skype4pidgin/tree/master/skypeweb
BuildRequires: cmake >= 2.8
BuildRequires: glib2-devel
%setup -qn skype4pidgin-%{version}
%patch0 -p1
%patch1 -p1
+%patch2 -p1
%build
cd skypeweb
--- /dev/null
+From d0b6b1f1333af9427dd272447e48a0bcd8681619 Mon Sep 17 00:00:00 2001
+From: Jan Palus <jpalus@fastmail.com>
+Date: Mon, 25 Jan 2021 00:26:01 +0100
+Subject: [PATCH] Ensure sent message is in XHTML format
+
+It appears that Skype client is very sensitive to type of message that
+is being sent. Implicit linkifing through `purple_markup_linkify()` for
+some reason adds links with uppercase "<A HREF" which is ignored by
+skype client. While Pidgin itself seems to handle it correctly, it is
+not the case for all libpurple clients ie BitlBee. Follow other
+protocols (ie Jabber) and ensure message is XHTML before sending.
+---
+ skypeweb/skypeweb_messages.c | 5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+diff --git a/skypeweb/skypeweb_messages.c b/skypeweb/skypeweb_messages.c
+index ccd8f8d..8e6ba79 100644
+--- a/skypeweb/skypeweb_messages.c
++++ b/skypeweb/skypeweb_messages.c
+@@ -1487,14 +1487,17 @@ skypeweb_send_message(SkypeWebAccount *sa, const gchar *convname, const gchar *m
+ gchar *stripped;\r
+ static GRegex *font_strip_regex = NULL;\r
+ gchar *font_stripped;\r
++ char *xhtml;\r
+ \r
+ url = g_strdup_printf("/v1/users/ME/conversations/%s/messages", purple_url_encode(convname));\r
+ \r
+ clientmessageid = skypeweb_get_js_time();\r
+ clientmessageid_str = g_strdup_printf("%" G_GINT64_FORMAT "", clientmessageid);\r
+ \r
++ purple_markup_html_to_xhtml(message, &xhtml, NULL);\r
+ // Some clients don't receive messages with <br>'s in them\r
+- stripped = purple_strreplace(message, "<br>", "\r\n");\r
++ stripped = purple_strreplace(xhtml, "<br>", "\r\n");\r
++ g_free(xhtml);\r
+ \r
+ // Pidgin has a nasty habit of sending <font size="3"> when copy-pasting text\r
+ if (font_strip_regex == NULL) {\r