Skip to content
This repository has been archived by the owner on Oct 10, 2019. It is now read-only.

Commit

Permalink
Merge branch 'import-filters-and-scripts' of https://github.com/ittne…
Browse files Browse the repository at this point in the history
…r/newsbeuter into ittner-import-filters-and-scripts
  • Loading branch information
akrennmair committed Jan 3, 2011
2 parents 7a89a37 + b9390d8 commit 334bb2b
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
2 changes: 1 addition & 1 deletion TODO
Expand Up @@ -8,7 +8,6 @@ TODO:
- implement RFC 5005 (http://www.ietf.org/rfc/rfc5005.txt)
- implement a single key with which it is possible to go through all unread articles (like space in slrn)
- make it configurable whether "n" jumps to the next feed or stays in the same.
- implement filter extension support also for OPML


DONE:
Expand Down Expand Up @@ -166,3 +165,4 @@ DONE:
- reduce memory usage by loading feeds on demand when being opened
- when in offline mode of Google Reader support, record which articles have been marked as read, and sync that back to Google Reader.
- document XDG base directory support.
- implement filter extension support also for OPML
22 changes: 22 additions & 0 deletions src/controller.cpp
Expand Up @@ -1029,6 +1029,28 @@ void controller::rec_find_rss_outlines(xmlNode * node, std::string tag) {
if (url) {
LOG(LOG_DEBUG,"OPML import: found RSS outline with url = %s",url);

std::string nurl = std::string(url);

// Liferea uses a pipe to signal feeds read from the output of
// a program in its OPMLs. Convert them to our syntax.
if (*url == '|') {
nurl = utils::strprintf("exec:%s", url+1);
LOG(LOG_DEBUG,"OPML import: liferea-style url %s converted to %s", url, nurl.c_str());
}

// Handle OPML filters.
char * filtercmd = (char *)xmlGetProp(node, (const xmlChar *)"filtercmd");
if (filtercmd) {
LOG(LOG_DEBUG,"OPML import: adding filter command %s to url %s", filtercmd, nurl.c_str());
nurl.insert(0, utils::strprintf("filter:%s:", filtercmd));
xmlFree(filtercmd);
}

xmlFree(url);
// Filters and scripts may have arguments, so, quote them when needed.
url = (char*) xmlStrdup((const xmlChar*)utils::quote_if_necessary(nurl).c_str());
assert(url);

bool found = false;

LOG(LOG_DEBUG, "OPML import: size = %u", urlcfg->get_urls().size());
Expand Down

0 comments on commit 334bb2b

Please sign in to comment.