diff options
-rw-r--r-- | addressbook/gui/widgets/eab-contact-formatter.c | 23 | ||||
-rw-r--r-- | e-util/e-buffer-tagger.c | 2 | ||||
-rw-r--r-- | e-util/e-html-utils.c | 15 | ||||
-rw-r--r-- | e-util/e-web-view-gtkhtml.c | 9 | ||||
-rw-r--r-- | e-util/e-web-view.c | 9 |
5 files changed, 37 insertions, 21 deletions
diff --git a/addressbook/gui/widgets/eab-contact-formatter.c b/addressbook/gui/widgets/eab-contact-formatter.c index 5935145cdc..7bfa46893b 100644 --- a/addressbook/gui/widgets/eab-contact-formatter.c +++ b/addressbook/gui/widgets/eab-contact-formatter.c @@ -64,7 +64,7 @@ struct _EABContactFormatterPrivate { EABContactDisplayMode mode; gboolean render_maps; - gboolean supports_callto; + gboolean supports_tel; gboolean supports_sip; }; @@ -88,7 +88,7 @@ G_DEFINE_TYPE ( eab_contact_formatter, G_TYPE_OBJECT); -#define E_CREATE_CALLTO_URL (E_TEXT_TO_HTML_LAST_FLAG << 0) +#define E_CREATE_TEL_URL (E_TEXT_TO_HTML_LAST_FLAG << 0) #define E_CREATE_SIP_URL (E_TEXT_TO_HTML_LAST_FLAG << 1) static gboolean @@ -303,8 +303,13 @@ maybe_create_url (const gchar *str, g_return_val_if_fail (str != NULL, NULL); - if ((html_flags & E_CREATE_CALLTO_URL) != 0) { - url = "callto:"; + if ((html_flags & E_CREATE_TEL_URL) != 0) { + /* RFC 3966 requires either the phone number begins with '+', + or the URL contains a 'phone-context' parameter, but that + also requires changing phone number for some countries, thus + rather mandate the '+' at the beginning. */ + if (*str == '+') + url = "tel:"; } else if ((html_flags & E_CREATE_SIP_URL) != 0) { url = "sip:"; } @@ -798,11 +803,11 @@ render_work_column (EABContactFormatter *formatter, GString *accum = g_string_new (""); guint32 phone_flags = 0, sip_flags = 0; - if (formatter->priv->supports_callto) + if (formatter->priv->supports_tel) phone_flags = E_TEXT_TO_HTML_CONVERT_URLS | E_TEXT_TO_HTML_HIDE_URL_SCHEME | E_TEXT_TO_HTML_URL_IS_WHOLE_TEXT | - E_CREATE_CALLTO_URL; + E_CREATE_TEL_URL; if (formatter->priv->supports_sip) sip_flags = E_TEXT_TO_HTML_CONVERT_URLS | @@ -847,11 +852,11 @@ render_personal_column (EABContactFormatter *formatter, GString *accum = g_string_new (""); guint32 phone_flags = 0, sip_flags = 0; - if (formatter->priv->supports_callto) + if (formatter->priv->supports_tel) phone_flags = E_TEXT_TO_HTML_CONVERT_URLS | E_TEXT_TO_HTML_HIDE_URL_SCHEME | E_TEXT_TO_HTML_URL_IS_WHOLE_TEXT | - E_CREATE_CALLTO_URL; + E_CREATE_TEL_URL; if (formatter->priv->supports_sip) sip_flags = E_TEXT_TO_HTML_CONVERT_URLS | @@ -1307,7 +1312,7 @@ eab_contact_formatter_init (EABContactFormatter *formatter) formatter->priv->mode = EAB_CONTACT_DISPLAY_RENDER_NORMAL; formatter->priv->render_maps = FALSE; - formatter->priv->supports_callto = eab_contact_formatter_scheme_supported ("callto"); + formatter->priv->supports_tel = eab_contact_formatter_scheme_supported ("tel"); formatter->priv->supports_sip = eab_contact_formatter_scheme_supported ("sip"); } diff --git a/e-util/e-buffer-tagger.c b/e-util/e-buffer-tagger.c index 7866c88296..c3c923aa7b 100644 --- a/e-util/e-buffer-tagger.c +++ b/e-util/e-buffer-tagger.c @@ -56,7 +56,7 @@ typedef struct _MagicInsertMatch MagicInsertMatch; static MagicInsertMatch mim[] = { /* prefixed expressions */ { "(news|telnet|nntp|file|http|ftp|sftp|https|webcal)://([-a-z0-9]+(:[-a-z0-9]+)?@)?[-a-z0-9.]+[-a-z0-9](:[0-9]*)?(([.])?/[-a-z0-9_$.+!*(),;:@%&=?/~#']*[^]'.}>\\) \n\r\t,?!;:\"]?)?", NULL, NULL }, - { "(sip|h323|callto):([-_a-z0-9.'\\+]+(:[0-9]{1,5})?(/[-_a-z0-9.']+)?)(@([-_a-z0-9.%=?]+|([0-9]{1,3}.){3}[0-9]{1,3})?)?(:[0-9]{1,5})?", NULL, NULL }, + { "(sip|h323|callto|tel):([-_a-z0-9.'\\+]+(:[0-9]{1,5})?(/[-_a-z0-9.']+)?)(@([-_a-z0-9.%=?]+|([0-9]{1,3}.){3}[0-9]{1,3})?)?(:[0-9]{1,5})?", NULL, NULL }, { "mailto:[-_a-z0-9.'\\+]+@[-_a-z0-9.%=?]+", NULL, NULL }, /* not prefixed expression */ { "www\\.[-a-z0-9.]+[-a-z0-9](:[0-9]*)?(([.])?/[-A-Za-z0-9_$.+!*(),;:@%&=?/~#]*[^]'.}>\\) \n\r\t,?!;:\"]?)?", NULL, "http://" }, 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) + diff --git a/e-util/e-web-view-gtkhtml.c b/e-util/e-web-view-gtkhtml.c index 5b6db0d504..799240d45d 100644 --- a/e-util/e-web-view-gtkhtml.c +++ b/e-util/e-web-view-gtkhtml.c @@ -967,11 +967,10 @@ web_view_gtkhtml_hovering_over_link (EWebViewGtkHTML *web_view, if (g_str_has_prefix (uri, "mailto:")) format = _("Click to mail %s"); - else if (g_str_has_prefix (uri, "callto:")) - format = _("Click to call %s"); - else if (g_str_has_prefix (uri, "h323:")) - format = _("Click to call %s"); - else if (g_str_has_prefix (uri, "sip:")) + else if (g_str_has_prefix (uri, "callto:") || + g_str_has_prefix (uri, "h323:") || + g_str_has_prefix (uri, "sip:") || + g_str_has_prefix (uri, "tel:")) format = _("Click to call %s"); else if (g_str_has_prefix (uri, "##")) message = g_strdup (_("Click to hide/unhide addresses")); diff --git a/e-util/e-web-view.c b/e-util/e-web-view.c index ac238bc2c0..47e31dcfb3 100644 --- a/e-util/e-web-view.c +++ b/e-util/e-web-view.c @@ -994,11 +994,10 @@ web_view_hovering_over_link (EWebView *web_view, if (g_str_has_prefix (uri, "mailto:")) format = _("Click to mail %s"); - else if (g_str_has_prefix (uri, "callto:")) - format = _("Click to call %s"); - else if (g_str_has_prefix (uri, "h323:")) - format = _("Click to call %s"); - else if (g_str_has_prefix (uri, "sip:")) + else if (g_str_has_prefix (uri, "callto:") || + g_str_has_prefix (uri, "h323:") || + g_str_has_prefix (uri, "sip:") || + g_str_has_prefix (uri, "tel:")) format = _("Click to call %s"); else if (g_str_has_prefix (uri, "##")) message = g_strdup (_("Click to hide/unhide addresses")); |