guint feed_update(Feed *feed, time_t last_update);
-#define FILL(n) { g_free(n); n = g_strdup(text); } while(0);
+#define FILL(n) do { g_free(n); n = g_strdup(text); } while(0);
#include "feeditem.h"
{
guint i;
- if( attr == NULL && name == NULL )
+ if( attr == NULL || name == NULL )
return NULL;
for( i = 0; attr[i] != NULL && attr[i+1] != NULL; i += 2 ) {
opmlfile = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S, RSSYL_DIR,
G_DIR_SEPARATOR_S, RSSYL_OPML_FILE, NULL);
- if( g_file_test(opmlfile, G_FILE_TEST_EXISTS | G_FILE_TEST_IS_REGULAR ) )
- g_remove(opmlfile);
+ if( g_file_test(opmlfile, G_FILE_TEST_EXISTS | G_FILE_TEST_IS_REGULAR ) ) {
+ if (g_remove(opmlfile) != 0) {
+ log_warning(LOG_PROTOCOL,
+ _("RSSyl: Couldn't delete old OPML file '%s': %s\n"),
+ opmlfile, g_strerror(errno));
+ debug_print("RSSyl: couldn't delete old file '%s'\n", opmlfile);
+ g_free(opmlfile);
+ return;
+ }
+ }
if( (f = g_fopen(opmlfile, "w")) == NULL ) {
log_warning(LOG_PROTOCOL,
new_item = rssyl_feed_subscribe_new((FolderItem *)ctx->current->data,
url, TRUE);
/* ...and rename it if needed */
- if (new_item != NULL && strcmp(title, new_item->name))
- folder_item_rename(new_item, title);
+ if (new_item != NULL && strcmp(title, new_item->name)) {
+ if (folder_item_rename(new_item, title) < 0) {
+ alertpanel_error(_("Error while subscribing feed\n"
+ "%s\n\nFolder name '%s' is not allowed."),
+ url, title);
+ }
+ }
}
}
closedir(dp);
- debug_print("Rssyl: get_num_list: returning %d\n", nummsgs);
+ debug_print("RSSyl: get_num_list: returning %d\n", nummsgs);
return nummsgs;
}
return 0;
else
return 1;
+ }
- /* ... and as a last resort, if there is no title, item texts. */
- if( no_title && a->text && b->text ) {
- if( !strcmp(a->text, b->text) )
- return 0;
- else
- return 1;
- }
+ /* ... and as a last resort, if there is no title, item texts. */
+ if( no_title && a->text && b->text ) {
+ if( !strcmp(a->text, b->text) )
+ return 0;
+ else
+ return 1;
}
/* We don't know this item. */
MsgPermFlags oldperm_flags = 0;
MsgInfo *msginfo;
FILE *f;
- gint fd, d, dif;
+ gint fd, d, dif, errno = 0;
time_t tmpd;
gchar *meta_charset = NULL;
gchar *baseurl = NULL;
oldperm_flags = msginfo->flags.perm_flags;
ritem->items = g_slist_remove(ritem->items, old_item);
- g_remove(ctx->path);
+ if (g_unlink(ctx->path) != 0) {
+ debug_print("RSSyl: Error, could not delete file '%s': %s\n",
+ ctx->path, g_strerror(errno));
+ }
g_free(ctx->path);
feed_item_free(old_item);
{
FILE *f;
- if (g_file_test(deleted_file, G_FILE_TEST_EXISTS | G_FILE_TEST_IS_REGULAR))
- g_remove(deleted_file);
+ if (g_file_test(deleted_file, G_FILE_TEST_EXISTS | G_FILE_TEST_IS_REGULAR)) {
+ if (g_remove(deleted_file) != 0) {
+ debug_print("RSSyl: Oops, couldn't delete '%s', bailing out\n",
+ deleted_file);
+ return;
+ }
+ }
if (g_slist_length(deleted_items) == 0)
return;
if ((f = g_fopen(deleted_file, "w")) == NULL) {
- debug_print("RSSyl: Couldn't open '%s', ignoring.\n", deleted_file);
+ debug_print("RSSyl: Couldn't open '%s', bailing out.\n", deleted_file);
return;
}
g_slist_foreach(deleted_items, (GFunc)_store_one_deleted_item,
(gpointer)f);
-
+
fclose(f);
debug_print("RSSyl: written and closed deletion file\n");
}