talons

Fork of Claws Mail https://www.claws-mail
Log | Files | Refs | README | LICENSE

commit 3bf1a29835ea753597ccab93919a41a2f195422a
parent c9be0c35f12d8aa9f335f15b8848b1fd835ffb5a
Author: wwp <subscript@free.fr>
Date:   Fri, 17 Sep 2021 16:55:12 +0200

Fix few wrong string lengths when matching URI schemes, add more known
schemes.

Diffstat:
Msrc/common/utils.c | 13+++++++++++++
Msrc/compose.c | 3+++
Msrc/messageview.c | 4++++
Msrc/plugins/vcalendar/vcal_meeting_gtk.c | 6++++--
Msrc/plugins/vcalendar/vcal_prefs.c | 6++++--
Msrc/textview.c | 6++++++
6 files changed, 34 insertions(+), 4 deletions(-)

diff --git a/src/common/utils.c b/src/common/utils.c @@ -1334,6 +1334,11 @@ gboolean is_uri_string(const gchar *str) return (g_ascii_strncasecmp(str, "http://", 7) == 0 || g_ascii_strncasecmp(str, "https://", 8) == 0 || g_ascii_strncasecmp(str, "ftp://", 6) == 0 || + g_ascii_strncasecmp(str, "ftps://", 7) == 0 || + g_ascii_strncasecmp(str, "sftp://", 7) == 0 || + g_ascii_strncasecmp(str, "ftp.", 4) == 0 || + g_ascii_strncasecmp(str, "webcal://", 9) == 0 || + g_ascii_strncasecmp(str, "webcals://", 10) == 0 || g_ascii_strncasecmp(str, "www.", 4) == 0); } @@ -1347,6 +1352,14 @@ gchar *get_uri_path(const gchar *uri) return (gchar *)(uri + 8); else if (g_ascii_strncasecmp(uri, "ftp://", 6) == 0) return (gchar *)(uri + 6); + else if (g_ascii_strncasecmp(uri, "ftps://", 7) == 0) + return (gchar *)(uri + 7); + else if (g_ascii_strncasecmp(uri, "sftp://", 7) == 0) + return (gchar *)(uri + 7); + else if (g_ascii_strncasecmp(uri, "webcal://", 9) == 0) + return (gchar *)(uri + 7); + else if (g_ascii_strncasecmp(uri, "webcals://", 10) == 0) + return (gchar *)(uri + 7); else return (gchar *)uri; } diff --git a/src/compose.c b/src/compose.c @@ -4547,9 +4547,12 @@ static gboolean compose_beautify_paragraph(Compose *compose, GtkTextIter *par_it {"http://", strcasestr, get_uri_part, make_uri_string}, {"https://", strcasestr, get_uri_part, make_uri_string}, {"ftp://", strcasestr, get_uri_part, make_uri_string}, + {"ftps://", strcasestr, get_uri_part, make_uri_string}, {"sftp://", strcasestr, get_uri_part, make_uri_string}, {"gopher://",strcasestr, get_uri_part, make_uri_string}, {"www.", strcasestr, get_uri_part, make_http_string}, + {"webcal://",strcasestr, get_uri_part, make_uri_string}, + {"webcals://",strcasestr, get_uri_part, make_uri_string}, {"mailto:", strcasestr, get_uri_part, make_uri_string}, {"@", strcasestr, get_email_part, make_email_string} }; diff --git a/src/messageview.c b/src/messageview.c @@ -3024,7 +3024,11 @@ void messageview_list_urls (MessageView *msgview) if (uri->uri && (!g_ascii_strncasecmp(uri->uri, "ftp.", 4) || !g_ascii_strncasecmp(uri->uri, "ftp:", 4) || + !g_ascii_strncasecmp(uri->uri, "ftps:", 5) || + !g_ascii_strncasecmp(uri->uri, "sftp:", 5) || !g_ascii_strncasecmp(uri->uri, "www.", 4) || + !g_ascii_strncasecmp(uri->uri, "webcal:", 7) || + !g_ascii_strncasecmp(uri->uri, "webcals:", 8) || !g_ascii_strncasecmp(uri->uri, "http:", 5) || !g_ascii_strncasecmp(uri->uri, "https:", 6))) { diff --git a/src/plugins/vcalendar/vcal_meeting_gtk.c b/src/plugins/vcalendar/vcal_meeting_gtk.c @@ -1,6 +1,6 @@ /* * Claws Mail -- a GTK+ based, lightweight, and fast e-mail client - * Copyright (C) 1999-2013 Colin Leroy <colin@colino.net> and + * Copyright (C) 1999-2021 Colin Leroy <colin@colino.net> and * the Claws Mail team * * This program is free software; you can redistribute it and/or modify @@ -1063,7 +1063,9 @@ static gboolean check_attendees_availability(VCalMeeting *meet, gboolean tell_if && strncmp(tmp, "https://", 8) && strncmp(tmp, "webcal://", 9) && strncmp(tmp, "webcals://", 10) - && strncmp(tmp, "ftp://", 6)) + && strncmp(tmp, "ftp://", 6) + && strncmp(tmp, "ftps://", 7) + && strncmp(tmp, "sftp://", 7)) contents = file_read_to_str(tmp); else { gchar *label = g_strdup_printf(_("Fetching planning for %s..."), email); diff --git a/src/plugins/vcalendar/vcal_prefs.c b/src/plugins/vcalendar/vcal_prefs.c @@ -140,7 +140,8 @@ static void set_auth_sensitivity(struct VcalendarPage *page) (!strncmp(export_path, "http://", 7) || !strncmp(export_path, "ftp://", 6) || !strncmp(export_path, "https://", 8) || - !strncmp(export_path, "sftp://", 5) || + !strncmp(export_path, "ftps://", 7) || + !strncmp(export_path, "sftp://", 7) || !strncmp(export_path, "webcal://", 9) || !strncmp(export_path, "webcals://", 10))) { gtk_widget_set_sensitive(page->export_user_label, TRUE); @@ -157,7 +158,8 @@ static void set_auth_sensitivity(struct VcalendarPage *page) (!strncmp(export_freebusy_path, "http://", 7) || !strncmp(export_freebusy_path, "ftp://", 6) || !strncmp(export_freebusy_path, "https://", 8) || - !strncmp(export_freebusy_path, "sftp://", 5) || + !strncmp(export_freebusy_path, "ftps://", 7) || + !strncmp(export_freebusy_path, "sftp://", 7) || !strncmp(export_freebusy_path, "webcal://", 9) || !strncmp(export_freebusy_path, "webcals://", 10))) { gtk_widget_set_sensitive(page->export_freebusy_user_label, TRUE); diff --git a/src/textview.c b/src/textview.c @@ -1368,9 +1368,12 @@ static void textview_make_clickable_parts(TextView *textview, {"http://", strcasestr, get_uri_part, make_uri_string}, {"https://", strcasestr, get_uri_part, make_uri_string}, {"ftp://", strcasestr, get_uri_part, make_uri_string}, + {"ftps://", strcasestr, get_uri_part, make_uri_string}, {"sftp://", strcasestr, get_uri_part, make_uri_string}, {"gopher://",strcasestr, get_uri_part, make_uri_string}, {"www.", strcasestr, get_uri_part, make_http_string}, + {"webcal://",strcasestr, get_uri_part, make_uri_string}, + {"webcals://",strcasestr, get_uri_part, make_uri_string}, {"mailto:", strcasestr, get_uri_part, make_uri_string}, {"@", strcasestr, get_email_part, make_email_string} }; @@ -1492,9 +1495,12 @@ static void textview_make_clickable_parts_later(TextView *textview, {"http://", strcasestr, get_uri_part, make_uri_string}, {"https://", strcasestr, get_uri_part, make_uri_string}, {"ftp://", strcasestr, get_uri_part, make_uri_string}, + {"ftps://", strcasestr, get_uri_part, make_uri_string}, {"sftp://", strcasestr, get_uri_part, make_uri_string}, {"www.", strcasestr, get_uri_part, make_http_string}, {"mailto:", strcasestr, get_uri_part, make_uri_string}, + {"webcal://",strcasestr, get_uri_part, make_uri_string}, + {"webcals://",strcasestr, get_uri_part, make_uri_string}, {"@", strcasestr, get_email_part, make_email_string} }; const gint PARSE_ELEMS = sizeof parser / sizeof parser[0];