static gboolean reedah_feed_subscription_prepare_update_request (subscriptionPtr subscription, struct updateRequest *request) { debug0 (DEBUG_UPDATE, "preparing Reedah feed subscription for update\n"); ReedahSourcePtr source = (ReedahSourcePtr) node_source_root_from_node (subscription->node)->data; g_assert(source); if (source->root->source->loginState == NODE_SOURCE_STATE_NONE) { subscription_update (node_source_root_from_node (subscription->node)->subscription, 0) ; return FALSE; } if (!metadata_list_get (subscription->metadata, "reedah-feed-id")) { g_warning ("Skipping Reedah feed '%s' (%s) without id!", subscription->source, subscription->node->id); return FALSE; } debug0 (DEBUG_UPDATE, "Setting cookies for a Reedah subscription"); gchar* source_escaped = g_uri_escape_string(metadata_list_get (subscription->metadata, "reedah-feed-id"), NULL, TRUE); // FIXME: move to .h // FIXME: do not use 30 gchar* newUrl = g_strdup_printf ("http://www.reedah.com/reader/api/0/stream/contents/%s?client=liferea&n=30", source_escaped); update_request_set_source (request, newUrl); g_free (newUrl); g_free (source_escaped); update_request_set_auth_value (request, source->root->source->authToken); return TRUE; }
static gboolean ttrss_feed_subscription_prepare_update_request (subscriptionPtr subscription, struct updateRequest *request) { debug0 (DEBUG_UPDATE, "ttrss_feed_subscription_prepare_update_request()"); nodePtr root = node_source_root_from_node (subscription->node); ttrssSourcePtr source = (ttrssSourcePtr) root->data; const gchar *feed_id; gchar *source_name; debug0 (DEBUG_UPDATE, "preparing tt-rss feed subscription for update"); 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 ("tt-rss feed without id! (%s)", subscription->node->title); return FALSE; } request->postdata = g_strdup_printf (TTRSS_JSON_HEADLINES, source->session_id, feed_id, 15 /* items to fetch */ ); source_name = g_strdup_printf (TTRSS_URL, metadata_list_get (root->subscription->metadata, "ttrss-url")); update_request_set_source (request, source_name); g_free (source_name); return TRUE; }
static gboolean aol_feed_subscription_prepare_update_request (subscriptionPtr subscription, struct updateRequest *request) { debug0 (DEBUG_UPDATE, "preparing AOL reader feed subscription for update\n"); AolSourcePtr source = (AolSourcePtr) node_source_root_from_node (subscription->node)->data; g_assert(source); if (source->root->source->loginState == NODE_SOURCE_STATE_NONE) { subscription_update (node_source_root_from_node (subscription->node)->subscription, 0) ; return FALSE; } debug0 (DEBUG_UPDATE, "Setting cookies for a AOL Reader subscription"); gchar* source_escaped = g_uri_escape_string(request->source, NULL, TRUE); gchar* newUrl = g_strdup_printf ("http://reader.aol.com/reader/atom/feed/%s", source_escaped); update_request_set_source (request, newUrl); g_free (newUrl); g_free (source_escaped); update_request_set_auth_value (request, subscription->node->source->authToken); return TRUE; }
static gboolean inoreader_feed_subscription_prepare_update_request (subscriptionPtr subscription, struct updateRequest *request) { debug0 (DEBUG_UPDATE, "preparing InoReader feed subscription for update\n"); InoreaderSourcePtr gsource = (InoreaderSourcePtr) node_source_root_from_node (subscription->node)->data; g_assert(gsource); if (gsource->loginState == INOREADER_SOURCE_STATE_NONE) { subscription_update (node_source_root_from_node (subscription->node)->subscription, 0) ; return FALSE; } debug0 (DEBUG_UPDATE, "Setting cookies for a InoReader subscription"); gchar* source_escaped = g_uri_escape_string(request->source, NULL, TRUE); gchar* newUrl = g_strdup_printf ("http://www.inoreader.com/reader/atom/feed/%s", source_escaped); update_request_set_source (request, newUrl); g_free (newUrl); g_free (source_escaped); update_request_set_auth_value (request, gsource->authHeaderValue); return TRUE; }
static void inoreader_source_item_retrieve_status (const xmlNodePtr entry, subscriptionPtr subscription, GHashTable *cache) { InoreaderSourcePtr gsource = (InoreaderSourcePtr) node_source_root_from_node (subscription->node)->data ; xmlNodePtr xml; nodePtr node = subscription->node; xmlChar *id = NULL; gboolean read = FALSE; gboolean starred = FALSE; xml = entry->children; g_assert (xml); for (xml = entry->children; xml; xml = xml->next) { if (!id && g_str_equal (xml->name, "id")) id = xmlNodeGetContent (xml); if (g_str_equal (xml->name, "category")) { xmlChar* label = xmlGetProp (xml, "label"); if (!label) continue; if (g_str_equal (label, "read")) read = TRUE; else if (g_str_equal(label, "starred")) starred = TRUE; xmlFree (label); } } if (!id) { g_warning ("Fatal: could not extract item id from InoReader Atom feed!"); return; } itemPtr item = inoreader_source_load_item_from_sourceid (node, id, cache); if (item && item->sourceId) { if (g_str_equal (item->sourceId, id) && !inoreader_source_edit_is_in_queue (gsource, id)) { if (item->readStatus != read) item_read_state_changed (item, read); if (item->flagStatus != starred) item_flag_state_changed (item, starred); } } if (item) item_unload (item) ; xmlFree (id); }
static void aol_source_item_retrieve_status (const xmlNodePtr entry, subscriptionPtr subscription, GHashTable *cache) { AolSourcePtr source = (AolSourcePtr) node_source_root_from_node (subscription->node)->data ; xmlNodePtr xml; nodePtr node = subscription->node; xmlChar *id; gboolean read = FALSE; gboolean starred = FALSE; xml = entry->children; g_assert (xml); g_assert (g_str_equal (xml->name, "id")); id = xmlNodeGetContent (xml); for (xml = entry->children; xml; xml = xml->next) { if (g_str_equal (xml->name, "category")) { xmlChar* label = xmlGetProp (xml, "label"); if (!label) continue; if (g_str_equal (label, "read")) read = TRUE; else if (g_str_equal(label, "starred")) starred = TRUE; xmlFree (label); } } itemPtr item = aol_source_load_item_from_sourceid (node, id, cache); if (item && item->sourceId) { if (g_str_equal (item->sourceId, id) && !aol_source_edit_is_in_queue(source, id)) { if (item->readStatus != read) item_read_state_changed (item, read); if (item->flagStatus != starred) item_flag_state_changed (item, starred); } } if (item) item_unload (item) ; xmlFree (id); }
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; }