fix bugs 4373, 'attach mailto URI double free' and 4374, ' insert mailto URI misses...
[claws.git] / src / common / utils.h
index 40c3576c03f088fe3016d6bea712a010b15315f8..9816c4efcac9c400985cef6ebba9f48e75b0e74b 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Claws Mail -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2016 Hiroyuki Yamamoto and the Claws Mail team
+ * Copyright (C) 1999-2020 The Claws Mail Team and Hiroyuki Yamamoto
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -25,6 +25,7 @@
 
 #ifdef HAVE_CONFIG_H
 #include "claws-features.h"
+#include "config.h"
 #endif
 
 #ifdef HAVE_BACKTRACE
@@ -280,8 +281,10 @@ gchar *strretchomp (gchar          *str);
 gchar *strtailchomp    (gchar          *str,
                         gchar           tail_char);
 gchar *strcrchomp      (gchar          *str);
+#ifndef HAVE_STRCASESTR
 gchar *strcasestr      (const gchar    *haystack,
                         const gchar    *needle);
+#endif /* HAVE_STRCASESTR */
 gchar *strncasestr     (const gchar    *haystack,
                         gint            haystack_len,
                         const gchar    *needle);
@@ -340,8 +343,8 @@ void unfold_line                    (gchar          *str);
 void subst_char                                (gchar          *str,
                                         gchar           orig,
                                         gchar           subst);
-void subst_chars                       (gchar          *str,   
-                                        gchar          *orig, 
+void subst_chars                       (gchar          *str,
+                                        gchar          *orig,
                                         gchar          subst);
 void subst_for_filename                        (gchar          *str);
 void subst_for_shellsafe_filename      (gchar          *str);
@@ -367,8 +370,8 @@ gchar *get_uri_path                 (const gchar    *uri);
 gint get_uri_len                       (const gchar    *str);
 void decode_uri                                (gchar          *decoded_uri,
                                         const gchar    *encoded_uri);
-void decode_uri_with_plus              (gchar          *decoded_uri, 
-                                        const gchar    *encoded_uri, 
+void decode_uri_with_plus              (gchar          *decoded_uri,
+                                        const gchar    *encoded_uri,
                                         gboolean        with_plus);
 gint scan_mailto_url                   (const gchar    *mailto,
                                         gchar         **from,
@@ -395,6 +398,7 @@ const gchar *get_tmp_dir            (void);
 const gchar *get_locale_dir            (void);
 gchar *get_tmp_file                    (void);
 const gchar *get_domain_name           (void);
+gboolean is_numeric_host_address       (const gchar *hostaddress);
 const gchar *get_desktop_file(void);
 #ifdef G_OS_WIN32
 const gchar *w32_get_themes_dir    (void);
@@ -409,6 +413,7 @@ gboolean file_exist         (const gchar    *file,
 gboolean is_relative_filename   (const gchar *file);
 gboolean is_dir_exist          (const gchar    *dir);
 gboolean is_file_entry_exist   (const gchar    *file);
+gboolean is_file_entry_regular(const gchar *file);
 gboolean dirent_is_regular_file        (struct dirent  *d);
 
 #define is_file_exist(file)            file_exist(file, FALSE)
@@ -452,9 +457,9 @@ void get_rfc822_date                (gchar          *buf,
 void get_rfc822_date_hide_tz   (gchar          *buf,
                                 gint            len);
 
-size_t fast_strftime           (gchar                  *buf, 
-                                gint                    buflen, 
-                                const gchar            *format, 
+size_t fast_strftime           (gchar                  *buf,
+                                gint                    buflen,
+                                const gchar            *format,
                                 struct tm              *lt);
 
 /* debugging */
@@ -490,7 +495,7 @@ void get_hex_str(gchar *out, guchar ch);
 typedef struct AutoPointer     GAuto;
 GType g_auto_pointer_register          (void);
 GAuto *g_auto_pointer_new              (gpointer pointer);
-GAuto *g_auto_pointer_new_with_free    (gpointer p, 
+GAuto *g_auto_pointer_new_with_free    (gpointer p,
                                         GFreeFunc free);
 gpointer g_auto_pointer_get_ptr                (GAuto *auto_ptr);
 GAuto *g_auto_pointer_copy             (GAuto *auto_ptr);
@@ -503,9 +508,9 @@ gboolean get_uri_part       (const gchar *start,
                         gboolean hdr);
 gchar *make_uri_string (const gchar *bp,
                         const gchar *ep);
-gboolean get_email_part        (const gchar *start, 
+gboolean get_email_part        (const gchar *start,
                         const gchar *scanpos,
-                        const gchar **bp, 
+                        const gchar **bp,
                         const gchar **ep,
                         gboolean hdr);
 gchar *make_email_string(const gchar *bp,
@@ -513,7 +518,7 @@ gchar *make_email_string(const gchar *bp,
 gchar *make_http_string (const gchar *bp,
                         const gchar *ep);
 
-gchar *mailcap_get_command_for_type(const gchar *type, 
+gchar *mailcap_get_command_for_type(const gchar *type,
                                    const gchar *file_to_open);
 void mailcap_update_default       (const gchar *type,
                                    const gchar *command);
@@ -541,4 +546,10 @@ gboolean get_random_bytes(void *buf, size_t count);
 }
 #endif
 
+gboolean get_serverportfp_from_filename(const gchar *str, gchar **server, gchar **port, gchar **fp);
+
+#ifdef G_OS_WIN32
+gchar *win32_debug_log_path(void);
+#endif
+
 #endif /* __UTILS_H__ */