eion/purple-hangouts

21ae60fdf379
Merged in xvitaly/purple-hangouts (pull request #10)

Added CFLAGS and LDFLAGS into makefile.
--- a/hangouts_conversation.c Sun Jul 10 23:02:17 2016 +0000
+++ b/hangouts_conversation.c Wed Jul 13 09:42:29 2016 +1200
@@ -1105,22 +1105,6 @@
last_link = purple_unescape_text(attrib);
g_free(attrib);
- // Strip out the www.google.com/url?q= bit
- if (purple_account_get_bool(ha->account, "unravel_google_url", FALSE)) {
- PurpleHttpURL *url = purple_http_url_parse(last_link);
- if (purple_strequal(purple_http_url_get_host(url), "www.google.com")) {
- const gchar *path = purple_http_url_get_path(url);
- //apparently the path includes the query string
- if (g_str_has_prefix(path, "/url?q=")) {
- attrib = g_strndup(path + 7, path - strchr(path, '&') - 7);
- g_free(last_link);
- last_link = g_strdup(purple_url_decode(attrib));
- g_free(attrib);
- }
- }
- purple_http_url_free(url);
- }
-
c = href_end;
break;
}
--- a/hangouts_events.c Sun Jul 10 23:02:17 2016 +0000
+++ b/hangouts_events.c Wed Jul 13 09:42:29 2016 +1200
@@ -572,7 +572,23 @@
} else if (segment->type == SEGMENT_TYPE__SEGMENT_TYPE_LINK) {
node = purple_xmlnode_new_child(html, "a");
if (segment->link_data) {
- purple_xmlnode_set_attrib(node, "href", segment->link_data->link_target);
+ const gchar *href = segment->link_data->link_target;
+ purple_xmlnode_set_attrib(node, "href", href);
+
+ // Strip out the www.google.com/url?q= bit
+ if (purple_account_get_bool(ha->account, "unravel_google_url", FALSE)) {
+ PurpleHttpURL *url = purple_http_url_parse(href);
+ if (purple_strequal(purple_http_url_get_host(url), "www.google.com")) {
+ const gchar *path = purple_http_url_get_path(url);
+ //apparently the path includes the query string
+ if (g_str_has_prefix(path, "/url?q=")) {
+ gchar *new_href = g_strndup(path + 7, strchr(path, '&') - path - 7);
+ purple_xmlnode_set_attrib(node, "href", purple_url_decode(new_href));
+ g_free(new_href);
+ }
+ }
+ purple_http_url_free(url);
+ }
}
} else {
continue;