aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/html.c1
-rw-r--r--src/main.c10
-rw-r--r--src/rss_html_common.c1
3 files changed, 7 insertions, 5 deletions
diff --git a/src/html.c b/src/html.c
index 6e27d13..c163ec8 100644
--- a/src/html.c
+++ b/src/html.c
@@ -80,6 +80,7 @@ static int url_extract_domain(const char *url, char *domain, int domain_len) {
}
]
+ Note: there might be other fields in the input but those should be ignored by the plugin.
TODO: Rename input "title" to "url", to make input and output match (easier to test with).
*/
typedef int (*PluginListCallback)(const char *name, const char *url, void *userdata);
diff --git a/src/main.c b/src/main.c
index b47e24a..28130f6 100644
--- a/src/main.c
+++ b/src/main.c
@@ -108,13 +108,15 @@ static void data_file_get_downloaded(const char *dir_name, const char *data_file
goto cleanup;
}
- size_t dir_name_len = strlen(dir_name);
-
const cJSON *downloaded_item_json = NULL;
cJSON_ArrayForEach(downloaded_item_json, downloaded_json) {
if(!cJSON_IsObject(downloaded_item_json))
continue;
+ const cJSON *filler_json = cJSON_GetObjectItemCaseSensitive(downloaded_item_json, "filler");
+ if(cJSON_IsTrue(filler_json))
+ continue;
+
const cJSON *time_json = cJSON_GetObjectItemCaseSensitive(downloaded_item_json, "time");
if(!time_json || !cJSON_IsString(time_json))
continue;
@@ -128,9 +130,7 @@ static void data_file_get_downloaded(const char *dir_name, const char *data_file
strcpy(title, filename_json->valuestring);
} else if(title_json && cJSON_IsString(title_json)) {
if(is_html) {
- strcpy(title, dir_name);
- title[dir_name_len] = '/';
- strcpy(title + dir_name_len + 1, title_json->valuestring);
+ snprintf(title, sizeof(title), "%s/%s", dir_name, title_json->valuestring);
} else {
strcpy(title, title_json->valuestring);
}
diff --git a/src/rss_html_common.c b/src/rss_html_common.c
index 567671e..e5e44ab 100644
--- a/src/rss_html_common.c
+++ b/src/rss_html_common.c
@@ -41,6 +41,7 @@ int write_plugin_json_to_file(const char *dir, const char *filename, const char
cJSON_AddStringToObject(downloaded_item_json, "title", prev_download_items[i].title);
cJSON_AddStringToObject(downloaded_item_json, "time", item_created_timestamp_fake);
cJSON_AddStringToObject(downloaded_item_json, "url", prev_download_items[i].link);
+ cJSON_AddBoolToObject(downloaded_item_json, "filler", 1);
cJSON_AddItemToArray(downloaded_json, downloaded_item_json);
}