diff options
author | Richard Laager <rlaager@pidgin.im> | 2007-05-20 15:02:03 +0000 |
---|---|---|
committer | Richard Laager <rlaager@pidgin.im> | 2007-05-20 15:02:03 +0000 |
commit | bf35ef260b92d7269b6f8ac8799a2217df972ee3 (patch) | |
tree | d74e050c37a046c18e6ff0a0360def6d6954594d | |
parent | 2b6afa63f6729c283d92b6838873b52fafbe4327 (diff) | |
parent | 185727a9482887e3e3c00fed40b3d11258136654 (diff) | |
download | pidgin-bf35ef260b92d7269b6f8ac8799a2217df972ee3.tar.gz |
merge of '1642240525c6b9d8e34dec8078d7f65129bdc004'
and '3ab33b0a5f5b9e8e9a33c7b3a2a08caa1e23991f'
-rwxr-xr-x | libpurple/purple-remote | 2 | ||||
-rw-r--r-- | libpurple/util.c | 57 |
2 files changed, 59 insertions, 0 deletions
diff --git a/libpurple/purple-remote b/libpurple/purple-remote index ce5929fff5..2ddbce2b3d 100755 --- a/libpurple/purple-remote +++ b/libpurple/purple-remote @@ -94,6 +94,8 @@ def findaccount(accountname, protocolname): def execute(uri): match = re.match(urlregexp, uri) protocol = match.group(2) + if protocol == "xmpp" + protocol = "jabber" if protocol == "aim" or protocol == "icq": protocol = "oscar" if protocol is not None: diff --git a/libpurple/util.c b/libpurple/util.c index 031c93c3a2..c149a2e8ff 100644 --- a/libpurple/util.c +++ b/libpurple/util.c @@ -1874,6 +1874,11 @@ purple_markup_linkify(const char *text) while (1) { if (badchar(*t) || badentity(t)) { + if ((!g_ascii_strncasecmp(c, "http://", 7) && (t - c == 7)) || + (!g_ascii_strncasecmp(c, "https://", 8) && (t - c == 8))) { + break; + } + if (*(t) == ',' && (*(t + 1) != ' ')) { t++; continue; @@ -1933,6 +1938,12 @@ purple_markup_linkify(const char *text) t = c; while (1) { if (badchar(*t) || badentity(t)) { + + if ((!g_ascii_strncasecmp(c, "ftp://", 6) && (t - c == 6)) || + (!g_ascii_strncasecmp(c, "sftp://", 7) && (t - c == 7))) { + break; + } + if (*(t - 1) == '.') t--; if ((*(t - 1) == ')' && (inside_paren > 0))) { @@ -1984,8 +1995,21 @@ purple_markup_linkify(const char *text) t = c; while (1) { if (badchar(*t) || badentity(t)) { + char *d; + if (t - c == 7) { + break; + } if (*(t - 1) == '.') t--; + if ((d = strstr(c + 7, "?")) != NULL && d < t) + url_buf = g_strndup(c + 7, d - c - 7); + else + url_buf = g_strndup(c + 7, t - c - 7); + if (!purple_email_is_valid(url_buf)) { + g_free(url_buf); + break; + } + g_free(url_buf); url_buf = g_strndup(c, t - c); tmpurlbuf = purple_unescape_html(url_buf); g_string_append_printf(ret, "<A HREF=\"%s\">%s</A>", @@ -2000,6 +2024,39 @@ purple_markup_linkify(const char *text) t++; } + } else if ((*c=='x') && (!g_ascii_strncasecmp(c, "xmpp:", 5)) && + (c == text || badchar(c[-1]) || badentity(c-1))) { + t = c; + while (1) { + if (badchar(*t) || badentity(t)) { + + if (t - c == 5) { + break; + } + + if (*(t) == ',' && (*(t + 1) != ' ')) { + t++; + continue; + } + + if (*(t - 1) == '.') + t--; + if ((*(t - 1) == ')' && (inside_paren > 0))) { + t--; + } + + url_buf = g_strndup(c, t - c); + tmpurlbuf = purple_unescape_html(url_buf); + g_string_append_printf(ret, "<A HREF=\"%s\">%s</A>", + tmpurlbuf, url_buf); + g_free(url_buf); + g_free(tmpurlbuf); + c = t; + break; + } + t++; + + } } else if (c != text && (*c == '@')) { int flag; GString *gurl_buf = NULL; |