eion/purple-hangouts

Add an option to strip `www.google.com/url?q=` urls so that they don't need to go through google
--- a/hangouts_conversation.c Mon Jun 27 00:58:18 2016 -0400
+++ b/hangouts_conversation.c Sun Jul 10 22:36:38 2016 +1200
@@ -1105,6 +1105,22 @@
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/libhangouts.c Mon Jun 27 00:58:18 2016 -0400
+++ b/libhangouts.c Sun Jul 10 22:36:38 2016 +1200
@@ -83,6 +83,9 @@
option = purple_account_option_bool_new(N_("Show call links in chat"), "show-call-links", !purple_media_manager_get());
account_options = g_list_append(account_options, option);
+ option = purple_account_option_bool_new(N_("Un-Googlify URLs"), "unravel_google_url", FALSE);
+ account_options = g_list_append(account_options, option);
+
return account_options;
}