// FIXME: this ought to be a subscription property! static guint itemset_get_max_item_count (itemSetPtr itemSet) { nodePtr node = node_from_id (itemSet->nodeId); if (node && IS_FEED (node)) return feed_get_max_item_count (node); return G_MAXUINT; }
static gboolean ttrss_feed_subscription_prepare_update_request (subscriptionPtr subscription, struct updateRequest *request) { nodePtr root = node_source_root_from_node (subscription->node); ttrssSourcePtr source = (ttrssSourcePtr) root->data; const gchar *feed_id; gchar *source_name; gint fetchCount; debug0 (DEBUG_UPDATE, "TinyTinyRSS preparing feed subscription for update"); // FIXME: if (!source->selfUpdating) trigger remote update first! g_assert(source); if (source->loginState == TTRSS_SOURCE_STATE_NONE) { subscription_update (root->subscription, 0); return FALSE; } feed_id = metadata_list_get (subscription->metadata, "ttrss-feed-id"); if (!feed_id) { g_warning ("Fatal: TinyTinyRSS feed without id! (%s)", subscription->node->title); return FALSE; } /* We can always max out as TinyTinyRSS does limit results itself */ fetchCount = feed_get_max_item_count (subscription->node); request->postdata = g_strdup_printf (TTRSS_JSON_HEADLINES, source->session_id, feed_id, fetchCount); source_name = g_strdup_printf (TTRSS_URL, source->url); update_request_set_source (request, source_name); g_free (source_name); return TRUE; }