[Commits] feed.c 1.1.2.128 1.1.2.129 feed.h 1.1.2.25 1.1.2.26 rssyl.c 1.1.2.34 1.1.2.35
colin at claws-mail.org
colin at claws-mail.org
Thu Nov 15 10:41:35 CET 2012
Update of /home/claws-mail/plugins/rssyl/src
In directory srv:/tmp/cvs-serv9917/src
Modified Files:
Tag: gtk2
feed.c feed.h rssyl.c
Log Message:
2012-11-15 [colin] 0.34.0cvs1
* src/feed.c
* src/feed.h
* src/rssyl.c
Better sanitizing of folder name. Windows needs a lot more
than replacing / with \ !
Index: feed.h
===================================================================
RCS file: /home/claws-mail/plugins/rssyl/src/Attic/feed.h,v
retrieving revision 1.1.2.25
retrieving revision 1.1.2.26
diff -u -d -r1.1.2.25 -r1.1.2.26
--- feed.h 21 Feb 2011 20:39:03 -0000 1.1.2.25
+++ feed.h 15 Nov 2012 09:41:33 -0000 1.1.2.26
@@ -89,5 +89,6 @@
void rssyl_refresh_all_func(FolderItem *item, gpointer data);
void rssyl_refresh_all_feeds(void);
+gchar *rssyl_feed_title_to_dir(const gchar *title);
#endif /* __FEED_H */
Index: rssyl.c
===================================================================
RCS file: /home/claws-mail/plugins/rssyl/src/Attic/rssyl.c,v
retrieving revision 1.1.2.34
retrieving revision 1.1.2.35
diff -u -d -r1.1.2.34 -r1.1.2.35
--- rssyl.c 19 Sep 2012 07:29:22 -0000 1.1.2.34
+++ rssyl.c 15 Nov 2012 09:41:33 -0000 1.1.2.35
@@ -326,7 +326,7 @@
g_return_val_if_fail(folder != NULL, NULL);
g_return_val_if_fail(parent != NULL, NULL);
g_return_val_if_fail(name != NULL, NULL);
- tmp = rssyl_strreplace((gchar *)name, "/", "\\");
+ tmp = rssyl_feed_title_to_dir((gchar *)name);
path = g_strconcat((parent->path != NULL) ? parent->path : "", ".",
tmp, NULL);
g_free(tmp);
@@ -340,7 +340,7 @@
static gchar *rssyl_item_get_path(Folder *folder, FolderItem *item)
{
gchar *result, *tmp;
- tmp = rssyl_strreplace(item->name, "/", "\\");
+ tmp = rssyl_feed_title_to_dir(item->name);
result = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S, RSSYL_DIR,
G_DIR_SEPARATOR_S, tmp, NULL);
g_free(tmp);
@@ -459,7 +459,7 @@
static gchar *rssyl_fetch_msg(Folder *folder, FolderItem *item, gint num)
{
gchar *snum = g_strdup_printf("%d", num);
- gchar *tmp = rssyl_strreplace(item->name, "/", "\\");
+ gchar *tmp = rssyl_feed_title_to_dir(item->name);
gchar *file = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S, RSSYL_DIR,
G_DIR_SEPARATOR_S, tmp,
G_DIR_SEPARATOR_S, snum, NULL);
Index: feed.c
===================================================================
RCS file: /home/claws-mail/plugins/rssyl/src/Attic/feed.c,v
retrieving revision 1.1.2.128
retrieving revision 1.1.2.129
diff -u -d -r1.1.2.128 -r1.1.2.129
--- feed.c 15 Oct 2012 17:40:16 -0000 1.1.2.128
+++ feed.c 15 Nov 2012 09:41:33 -0000 1.1.2.129
@@ -260,6 +260,25 @@
return template;
}
+gchar *rssyl_feed_title_to_dir(const gchar *title)
+{
+#ifndef G_OS_WIN32
+ return rssyl_strreplace(title, "/", "\\");
+#else
+ gchar *patterns[] = { "/", "\\", ":", "*", "?" , "\"", "<", ">", "|" };
+ gchar *sanitized = g_strdup(title);
+ int i;
+
+ for (i = 0; i < sizeof(patterns)/sizeof(patterns[0]); i++) {
+ gchar *tmp = rssyl_strreplace(sanitized, patterns[i], "-");
+ g_free(sanitized);
+ sanitized = tmp;
+ }
+
+ return sanitized;
+#endif
+}
+
/* rssyl_fetch_feed()
*
* This function utilizes libcurl's easy interface to fetch the feed, pre-parse
@@ -370,7 +389,7 @@
#ifdef RSSYL_DEBUG
/* debug mode - get timestamp, add it to returned xmlDoc, and make a copy
* of the fetched feed file */
- tmptitle = rssyl_strreplace(url, "/", "\\");
+ tmptitle = rssyl_feed_title_to_dir(url);
unixtime_str = g_strdup_printf("%ld", time(NULL) );
debugfname = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S, RSSYL_DIR,
G_DIR_SEPARATOR_S, ".", tmptitle, ".", unixtime_str, NULL);
@@ -524,7 +543,7 @@
subst_for_shellsafe_filename(*title);
}
- tmptitle = rssyl_strreplace(*title, "/", "\\");
+ tmptitle = rssyl_feed_title_to_dir(*title);
dir = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S, RSSYL_DIR,
G_DIR_SEPARATOR_S, tmptitle, NULL);
g_free(tmptitle);
@@ -1531,12 +1550,12 @@
g_free(error);
if (doc && title) {
- tmp = rssyl_strreplace(title, "/", "\\");
+ tmp = rssyl_feed_title_to_dir(title);
dir = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S, RSSYL_DIR,
G_DIR_SEPARATOR_S, tmp, NULL);
g_free(tmp);
if( strcmp(title, ritem->official_name) ) {
- tmp = rssyl_strreplace((&ritem->item)->name, "/", "\\");
+ tmp = rssyl_feed_title_to_dir((&ritem->item)->name);
dir2 = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S, RSSYL_DIR,
G_DIR_SEPARATOR_S, tmp,
NULL);
More information about the Commits
mailing list