summaryrefslogtreecommitdiff
path: root/src/app.c
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2020-11-27 18:12:35 +0200
committerJaakko Keränen <jaakko.keranen@iki.fi>2020-11-27 18:12:35 +0200
commitfb3d35b60463d3e96dca2712eb26e99d85ea1968 (patch)
tree4b1d31c345c49e9c3fac752b1c229958e8cae2a9 /src/app.c
parenta7a069ddaa827ad373b4b283e979a23e931f9433 (diff)
Autoupdate feeds after subscribing to the first one
Diffstat (limited to 'src/app.c')
-rw-r--r--src/app.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/app.c b/src/app.c
index 99e42fc2..57fa3318 100644
--- a/src/app.c
+++ b/src/app.c
@@ -1243,18 +1243,22 @@ iBool handleCommand_App(const char *cmd) {
1243 return iTrue; 1243 return iTrue;
1244 } 1244 }
1245 else if (equal_Command(cmd, "bookmark.addtag")) { 1245 else if (equal_Command(cmd, "bookmark.addtag")) {
1246 const iString *tag = string_Command(cmd, "tag"); 1246 const iString *tag = string_Command(cmd, "tag");
1247 const iString *feedUrl = url_DocumentWidget(document_App()); 1247 const iString *url = url_DocumentWidget(document_App());
1248 if (!isEmpty_String(feedUrl)) { 1248 const size_t numSubs = numSubscribed_Feeds();
1249 uint32_t id = findUrl_Bookmarks(d->bookmarks, feedUrl); 1249 if (!isEmpty_String(url)) {
1250 uint32_t id = findUrl_Bookmarks(d->bookmarks, url);
1250 if (id) { 1251 if (id) {
1251 addTag_Bookmark(get_Bookmarks(d->bookmarks, id), cstr_String(tag)); 1252 addTag_Bookmark(get_Bookmarks(d->bookmarks, id), cstr_String(tag));
1252 } 1253 }
1253 else { 1254 else {
1254 add_Bookmarks(d->bookmarks, feedUrl, bookmarkTitle_DocumentWidget(document_App()), 1255 add_Bookmarks(d->bookmarks, url, bookmarkTitle_DocumentWidget(document_App()),
1255 tag, siteIcon_GmDocument(document_DocumentWidget(document_App()))); 1256 tag, siteIcon_GmDocument(document_DocumentWidget(document_App())));
1256 } 1257 }
1257 postCommand_App("bookmarks.changed"); 1258 postCommand_App("bookmarks.changed");
1259 if (numSubs == 0 && !cmp_String(tag, "subscribed")) {
1260 postCommand_App("feeds.refresh");
1261 }
1258 } 1262 }
1259 return iTrue; 1263 return iTrue;
1260 } 1264 }