|| (uri.has_prefix ("geo:") && uri.chr (-1, ',') != null)
|| uri.has_prefix ("javascript:"));
}
- public static bool is_email (string? uri) {
- return uri != null
- && (uri.chr (-1, '@') != null || uri.has_prefix ("mailto:"))
- /* :// and @ together would mean login credentials */
- && uri.str ("://") == null;
- }
+
public static bool is_ip_address (string? uri) {
/* Quick check for IPv4 or IPv6, no validation.
FIXME: Schemes are not handled
g_free (new_uri);
return TRUE;
}
- else if (g_str_has_prefix (uri, "mailto:") || sokoke_external_uri (uri))
+ else if (sokoke_external_uri (uri))
{
if (sokoke_show_uri (gtk_widget_get_screen (GTK_WIDGET (web_view)),
uri, GDK_CURRENT_TIME, NULL))
midori_view_always_same_tab (const gchar* uri)
{
/* No opening in tab, window or app for Javascript or mailto links */
- return g_str_has_prefix (uri, "javascript:") || midori_uri_is_email (uri);
+ return g_str_has_prefix (uri, "javascript:") || g_str_has_prefix (uri, "mailto:");
}
static void
g_strstrip (view->selected_text);
if (midori_uri_is_valid (view->selected_text))
{
- if (midori_uri_is_email (view->selected_text))
+ /* :// and @ together would mean login credentials */
+ if (g_str_has_prefix (view->selected_text, "mailto:")
+ || (strchr (view->selected_text, '@') != NULL
+ && strstr (view->selected_text, "://") == NULL))
{
gchar* text = g_strdup_printf (_("Send a message to %s"), view->selected_text);
menuitem = midori_view_insert_menu_item (menu_shell, -1,
g_free (exception);
}
}
- else if (g_str_has_prefix (uri, "mailto:") || sokoke_external_uri (uri))
+ else if (sokoke_external_uri (uri))
{
sokoke_show_uri (NULL, uri, GDK_CURRENT_TIME, NULL);
}
magic_uri_pseudo (void)
{
test_input ("javascript:alert(1)", "javascript:alert(1)");
- test_input ("mailto:christian@twotoasts.de", "mailto:christian@twotoasts.de");
test_input ("data:text/html;charset=utf-8,<title>Test</title>Test",
"data:text/html;charset=utf-8,<title>Test</title>Test");
}