diff options
author | Milan Crha <mcrha@redhat.com> | 2014-04-30 22:05:31 +0800 |
---|---|---|
committer | Milan Crha <mcrha@redhat.com> | 2014-04-30 22:05:31 +0800 |
commit | e0e498c644a485aee0029805532622f0a711ecfc (patch) | |
tree | 7d6f236770db467798e94549192b852c712eec65 /e-util/e-html-utils.c | |
parent | 2ee38c849d96546a1795babf041bd45af37fd3ea (diff) | |
download | gsoc2013-evolution-e0e498c644a485aee0029805532622f0a711ecfc.tar gsoc2013-evolution-e0e498c644a485aee0029805532622f0a711ecfc.tar.gz gsoc2013-evolution-e0e498c644a485aee0029805532622f0a711ecfc.tar.bz2 gsoc2013-evolution-e0e498c644a485aee0029805532622f0a711ecfc.tar.lz gsoc2013-evolution-e0e498c644a485aee0029805532622f0a711ecfc.tar.xz gsoc2013-evolution-e0e498c644a485aee0029805532622f0a711ecfc.tar.zst gsoc2013-evolution-e0e498c644a485aee0029805532622f0a711ecfc.zip |
Bug #729084 - Use tel: URI instead of callto: for phone numbers
This change does a bit more, actually:
- learn the code of "tel" URI, being handler similar to "sip", "callto", "h323"
- generate tel: URIs for phone numbers, but only if the leading character of the
phone number is a plus ("+") sign
- always remove spaces in href part in the e_text_to_html() when
E_TEXT_TO_HTML_URL_IS_WHOLE_TEXT flag is set
Diffstat (limited to 'e-util/e-html-utils.c')
-rw-r--r-- | e-util/e-html-utils.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/e-util/e-html-utils.c b/e-util/e-html-utils.c index 260e26bdc0..9187b75057 100644 --- a/e-util/e-html-utils.c +++ b/e-util/e-html-utils.c @@ -231,7 +231,7 @@ is_citation (const guchar *c, * user will only see "www.example.com") * * - E_TEXT_TO_HTML_URL_IS_WHOLE_TEXT: set when the whole @input text - * represents a URL + * represents a URL; any spaces are removed in the href part. * * Returns: a newly-allocated string containing HTML **/ @@ -302,6 +302,7 @@ e_text_to_html_full (const gchar *input, !g_ascii_strncasecmp ((gchar *) cur, "callto:", 7) || !g_ascii_strncasecmp ((gchar *) cur, "h323:", 5) || !g_ascii_strncasecmp ((gchar *) cur, "sip:", 4) || + !g_ascii_strncasecmp ((gchar *) cur, "tel:", 4) || !g_ascii_strncasecmp ((gchar *) cur, "webcal:", 7)) { tmpurl = url_extract (&cur, TRUE, (flags & E_TEXT_TO_HTML_URL_IS_WHOLE_TEXT) != 0); if (tmpurl) { @@ -335,6 +336,18 @@ e_text_to_html_full (const gchar *input, } if (tmpurl) { + if ((flags & E_TEXT_TO_HTML_URL_IS_WHOLE_TEXT) != 0) { + /* also remove any spaces in refurl */ + gchar *replaced, **split_url; + + split_url = g_strsplit (refurl, " ", 0); + replaced = g_strjoinv ("", split_url); + g_strfreev (split_url); + + g_free (refurl); + refurl = replaced; + } + out = check_size ( &buffer, &buffer_size, out, strlen (refurl) + |