Skip to content

Commit

Permalink
Fixes SF #1141: Liferea does not update feeds with TinyTinyRSS (repor…
Browse files Browse the repository at this point in the history
…ted by Dominik Grafenhofer, denk_mal, Fabian Henze)
  • Loading branch information
lwindolf committed Apr 13, 2014
1 parent 679adba commit 5dc8981
Show file tree
Hide file tree
Showing 11 changed files with 25 additions and 95 deletions.
2 changes: 2 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ To be released
(reported by Yanko Kaneti)
* Fixes Github #13: Parsing errors not visible with dark themes
(reported by Steve Kelly)
* Fixes SF #1141: Liferea does not update feeds with TinyTinyRSS
(reported by Dominik Grafenhofer, denk_mal, Fabian Henze)
* Patch SF #224: Update to new libxml2 buffer API
(Simon Kagedal Reimer)
* Patch SF #209: Avoid copying list in itemset_merge_items
Expand Down
3 changes: 2 additions & 1 deletion src/fl_sources/aol_source.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* @file aol_source.c AOL reader feed list source support
*
* Copyright (C) 2007-2013 Lars Windolf <lars.lindner@gmail.com>
* Copyright (C) 2007-2014 Lars Windolf <lars.lindner@gmail.com>
* Copyright (C) 2008 Arnold Noronha <arnstein87@gmail.com>
* Copyright (C) 2011 Peter Oliver
* Copyright (C) 2011 Sergey Snitsaruk <narren96c@gmail.com>
Expand Down Expand Up @@ -212,6 +212,7 @@ aol_source_import (nodePtr node)
{
opml_source_import (node);

node->subscription->updateInterval = -1;
node->subscription->type = &aolSourceOpmlSubscriptionType;
if (!node->data)
node->data = (gpointer) aol_source_new (node);
Expand Down
2 changes: 2 additions & 0 deletions src/fl_sources/aol_source_opml.c
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,8 @@ static void
google_subscription_opml_cb (subscriptionPtr subscription, const struct updateResult * const result, updateFlags flags)
{
AolSourcePtr gsource = (AolSourcePtr) subscription->node->data;

subscription->updateJob = NULL;

if (result->data) {
xmlDocPtr doc = xml_parse (result->data, result->size, NULL);
Expand Down
5 changes: 3 additions & 2 deletions src/fl_sources/inoreader_source.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* @file inoreader_source.c InoReader feed list source support
* @file inoreader_source.c InoReader source support
*
* Copyright (C) 2007-2013 Lars Windolf <lars.lindner@gmail.com>
* Copyright (C) 2007-2014 Lars Windolf <lars.lindner@gmail.com>
* Copyright (C) 2008 Arnold Noronha <arnstein87@gmail.com>
* Copyright (C) 2011 Peter Oliver
* Copyright (C) 2011 Sergey Snitsaruk <narren96c@gmail.com>
Expand Down Expand Up @@ -222,6 +222,7 @@ inoreader_source_import (nodePtr node)
{
opml_source_import (node);

node->subscription->updateInterval = -1;
node->subscription->type = &inoreaderSourceOpmlSubscriptionType;
if (!node->data)
node->data = (gpointer) inoreader_source_new (node);
Expand Down
4 changes: 3 additions & 1 deletion src/fl_sources/inoreader_source_feed_list.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* @file inoreader_source_feed_list.c Inoreader handling routines.
*
* Copyright (C) 2013 Lars Windolf <lars.lindner@gmail.com>
* Copyright (C) 2013-2014 Lars Windolf <lars.lindner@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -120,6 +120,8 @@ static void
google_subscription_opml_cb (subscriptionPtr subscription, const struct updateResult * const result, updateFlags flags)
{
InoreaderSourcePtr source = (InoreaderSourcePtr) subscription->node->data;

subscription->updateJob = NULL;

// FIXME: the following code is very similar to ttrss!
if (result->data && result->httpstatus == 200) {
Expand Down
3 changes: 2 additions & 1 deletion src/fl_sources/reedah_source.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* @file reedah_source.c Reedah source support
*
* Copyright (C) 2007-2013 Lars Windolf <lars.lindner@gmail.com>
* Copyright (C) 2007-2014 Lars Windolf <lars.lindner@gmail.com>
* Copyright (C) 2008 Arnold Noronha <arnstein87@gmail.com>
* Copyright (C) 2011 Peter Oliver
* Copyright (C) 2011 Sergey Snitsaruk <narren96c@gmail.com>
Expand Down Expand Up @@ -222,6 +222,7 @@ reedah_source_import (nodePtr node)
{
opml_source_import (node);

node->subscription->updateInterval = -1;
node->subscription->type = &reedahSourceOpmlSubscriptionType;
if (!node->data)
node->data = (gpointer) reedah_source_new (node);
Expand Down
4 changes: 3 additions & 1 deletion src/fl_sources/reedah_source_feed_list.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* @file reedah_source_feed_list.c Reedah feed list handling routines
*
* Copyright (C) 2013 Lars Windolf <lars.lindner@gmail.com>
* Copyright (C) 2013-2014 Lars Windolf <lars.lindner@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -119,6 +119,8 @@ static void
reedah_subscription_opml_cb (subscriptionPtr subscription, const struct updateResult * const result, updateFlags flags)
{
ReedahSourcePtr source = (ReedahSourcePtr) subscription->node->data;

subscription->updateJob = NULL;

// FIXME: the following code is very similar to ttrss!
if (result->data && result->httpstatus == 200) {
Expand Down
3 changes: 2 additions & 1 deletion src/fl_sources/theoldreader_source.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* @file theoldreader_source.c TheOldReader feed list source support
*
* Copyright (C) 2007-2013 Lars Windolf <lars.lindner@gmail.com>
* Copyright (C) 2007-2014 Lars Windolf <lars.lindner@gmail.com>
* Copyright (C) 2008 Arnold Noronha <arnstein87@gmail.com>
* Copyright (C) 2011 Peter Oliver
* Copyright (C) 2011 Sergey Snitsaruk <narren96c@gmail.com>
Expand Down Expand Up @@ -224,6 +224,7 @@ theoldreader_source_import (nodePtr node)
{
opml_source_import (node);

node->subscription->updateInterval = -1;
node->subscription->type = &theOldReaderSourceOpmlSubscriptionType;
if (!node->data)
node->data = (gpointer) theoldreader_source_new (node);
Expand Down
91 changes: 3 additions & 88 deletions src/fl_sources/theoldreader_source_feed_list.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* @file theoldreader_source_feed_list.c TheOldReader feed list handling
*
* Copyright (C) 2013 Lars Windolf <lars.lindner@gmail.com>
* Copyright (C) 2013-2014 Lars Windolf <lars.lindner@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -119,6 +119,8 @@ theoldreader_subscription_cb (subscriptionPtr subscription, const struct updateR
TheOldReaderSourcePtr source = (TheOldReaderSourcePtr) subscription->node->data;

debug1 (DEBUG_UPDATE,"theoldreader_subscription_cb(): %s", result->data);

subscription->updateJob = NULL;

// FIXME: the following code is very similar to ttrss!
if (result->data && result->httpstatus == 200) {
Expand Down Expand Up @@ -198,93 +200,6 @@ theoldreader_subscription_cb (subscriptionPtr subscription, const struct updateR
node_foreach_child_data (subscription->node, node_update_subscription, GUINT_TO_POINTER (0));
}

/** functions for an efficient updating mechanism */
/*
static void
theoldreader_source_opml_quick_update_helper (xmlNodePtr match, gpointer userdata)
{
TheOldReaderSourcePtr gsource = (TheOldReaderSourcePtr) userdata;
xmlNodePtr xmlNode;
xmlChar *id, *newestItemTimestamp;
nodePtr node = NULL;
const gchar *oldNewestItemTimestamp;
xmlNode = xpath_find (match, "./string[@name='id']");
id = xmlNodeGetContent (xmlNode);
if (g_str_has_prefix (id, "feed/"))
node = theoldreader_source_opml_get_node_by_source (gsource, id + strlen ("feed/"));
else {
xmlFree (id);
return;
}
if (node == NULL) {
xmlFree (id);
return;
}
xmlNode = xpath_find (match, "./number[@name='newestItemTimestampUsec']");
newestItemTimestamp = xmlNodeGetContent (xmlNode);
oldNewestItemTimestamp = g_hash_table_lookup (gsource->lastTimestampMap, node->subscription->source);
if (!oldNewestItemTimestamp ||
(newestItemTimestamp &&
!g_str_equal (newestItemTimestamp, oldNewestItemTimestamp))) {
debug3(DEBUG_UPDATE, "TheOldReaderSource: auto-updating %s "
"[oldtimestamp%s, timestamp %s]",
id, oldNewestItemTimestamp, newestItemTimestamp);
g_hash_table_insert (gsource->lastTimestampMap,
g_strdup (node->subscription->source),
g_strdup (newestItemTimestamp));
subscription_update (node->subscription, 0);
}
xmlFree (newestItemTimestamp);
xmlFree (id);
}
static void
theoldreader_source_opml_quick_update_cb (const struct updateResult* const result, gpointer userdata, updateFlags flags)
{
TheOldReaderSourcePtr gsource = (TheOldReaderSourcePtr) userdata;
xmlDocPtr doc;
if (!result->data) {
debug0 (DEBUG_UPDATE, "TheOldReaderSource: Unable to get unread counts, this update is aborted.");
return;
}
doc = xml_parse (result->data, result->size, NULL);
if (!doc) {
debug0 (DEBUG_UPDATE, "TheOldReaderSource: The XML failed to parse, maybe the session has expired. (FIXME)");
return;
}
xpath_foreach_match (xmlDocGetRootElement (doc),
"/object/list[@name='unreadcounts']/object",
theoldreader_source_opml_quick_update_helper, gsource);
xmlFreeDoc (doc);
}
gboolean
theoldreader_source_opml_quick_update (TheOldReaderSourcePtr source)
{
updateRequestPtr request = update_request_new ();
request->updateState = update_state_copy (source->root->subscription->updateState);
request->options = update_options_copy (source->root->subscription->updateOptions);
update_request_set_source (request, THEOLDREADER_READER_UNREAD_COUNTS_URL);
update_request_set_auth_value (request, source->authHeaderValue);
update_execute_request (source, request, theoldreader_source_opml_quick_update_cb,
source, 0);
return TRUE;
}
*/

static void
theoldreader_source_opml_subscription_process_update_result (subscriptionPtr subscription, const struct updateResult * const result, updateFlags flags)
{
Expand Down
1 change: 1 addition & 0 deletions src/fl_sources/ttrss_source.c
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,7 @@ ttrss_source_import (nodePtr node)
{
opml_source_import (node);

node->subscription->updateInterval = -1;
node->subscription->type = &ttrssSourceSubscriptionType;
if (!node->data)
node->data = (gpointer) ttrss_source_new (node);
Expand Down
2 changes: 2 additions & 0 deletions src/fl_sources/ttrss_source_feed_list.c
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,8 @@ ttrss_source_subscription_list_cb (const struct updateResult * const result, gpo
ttrssSourcePtr source = (ttrssSourcePtr) subscription->node->data;

debug1 (DEBUG_UPDATE,"ttrss_subscription_cb(): %s", result->data);

subscription->updateJob = NULL;

if (result->data && result->httpstatus == 200) {
JsonParser *parser = json_parser_new ();
Expand Down

0 comments on commit 5dc8981

Please sign in to comment.