예제 #1
0
static gboolean
ttrss_subscription_prepare_update_request (subscriptionPtr subscription, struct updateRequest *request)
{
	ttrssSourcePtr	source = (ttrssSourcePtr) subscription->node->data;
	gchar *source_uri;

	debug0 (DEBUG_UPDATE, "ttrss_subscription_prepare_update_request");

	g_assert (source);
	if (source->loginState == TTRSS_SOURCE_STATE_NONE) {
		debug0 (DEBUG_UPDATE, "TinyTinyRSS login");
		ttrss_source_login (source, 0);
		return FALSE;
	}
	debug1 (DEBUG_UPDATE, "TinyTinyRSS updating subscription (node id %s)", subscription->node->id);

	/* Updating the TinyTinyRSS subscription means updating the list
	   of categories and the list of feeds in 2 requests and if the
	   installation is not self-updating to run a remote update for
	   each feed before fetching it's items */

	source_uri = g_strdup_printf (TTRSS_URL, source->url);	
	update_request_set_source (request, source_uri);
	g_free (source_uri);
	request->postdata = g_strdup_printf (TTRSS_JSON_CATEGORIES_LIST, source->session_id);

	return TRUE;
}
예제 #2
0
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;
}
예제 #3
0
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;
}
예제 #4
0
gboolean
aol_source_opml_quick_update(AolSourcePtr 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, AOL_READER_UNREAD_COUNTS_URL);
	update_request_set_auth_value(request, source->root->source->authToken);

	update_execute_request (source, request, aol_source_opml_quick_update_cb, source, 0);

	return TRUE;
}
gboolean
inoreader_source_opml_quick_update(InoreaderSourcePtr gsource) 
{
	updateRequestPtr request = update_request_new ();
	request->updateState = update_state_copy (gsource->root->subscription->updateState);
	request->options = update_options_copy (gsource->root->subscription->updateOptions);
	update_request_set_source (request, INOREADER_UNREAD_COUNTS_URL);
	update_request_set_auth_value(request, gsource->authHeaderValue);

	update_execute_request (gsource, request, inoreader_source_opml_quick_update_cb,
				gsource, 0);

	return TRUE;
}
예제 #6
0
static void
ttrss_source_update_subscription_list (ttrssSourcePtr source, subscriptionPtr subscription)
{
	updateRequestPtr	request;
	gchar			*source_uri;

	request = update_request_new ();
	request->updateState = update_state_copy (subscription->updateState);
	request->options = update_options_copy (subscription->updateOptions);

	source_uri = g_strdup_printf (TTRSS_URL, source->url);
	update_request_set_source (request, source_uri);
	g_free (source_uri);
	request->postdata = g_strdup_printf (TTRSS_JSON_SUBSCRIPTION_LIST, source->session_id);

	subscription->updateJob = update_execute_request (subscription, request, ttrss_source_subscription_list_cb, subscription, 0);
}
static gboolean
theoldreader_source_opml_subscription_prepare_update_request (subscriptionPtr subscription, struct updateRequest *request)
{
	nodePtr node = subscription->node;
	
	g_assert(node->source);
	if (node->source->loginState == NODE_SOURCE_STATE_NONE) {
		debug0 (DEBUG_UPDATE, "TheOldReaderSource: login");
		theoldreader_source_login (node->data, 0);
		return FALSE;
	}
	debug1 (DEBUG_UPDATE, "updating TheOldReader subscription (node id %s)", node->id);
	
	update_request_set_source (request, node->source->type->api.subscription_list);
	update_request_set_auth_value (request, node->source->authToken);
	
	return TRUE;
}
static gboolean
inoreader_source_opml_subscription_prepare_update_request (subscriptionPtr subscription, struct updateRequest *request)
{
	InoreaderSourcePtr	gsource = (InoreaderSourcePtr)subscription->node->data;
	
	g_assert(gsource);
	if (gsource->loginState == INOREADER_SOURCE_STATE_NONE) {
		debug0(DEBUG_UPDATE, "InoreaderSource: login");
		inoreader_source_login ((InoreaderSourcePtr) subscription->node->data, 0) ;
		return FALSE;
	}
	debug1 (DEBUG_UPDATE, "updating Inoreader subscription (node id %s)", subscription->node->id);
	
	update_request_set_source (request, INOREADER_SUBSCRIPTION_LIST_URL);
	
	update_request_set_auth_value (request, gsource->authHeaderValue);
	
	return TRUE;
}
예제 #9
0
static gboolean
inoreader_feed_subscription_prepare_update_request (subscriptionPtr subscription, 
                                                 struct updateRequest *request)
{
	debug0 (DEBUG_UPDATE, "preparing InoReader feed subscription for update\n");
	nodePtr node = subscription->node; 
	
	if (node->source->loginState == NODE_SOURCE_STATE_NONE) { 
		subscription_update (node_source_root_from_node (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, node->source->authToken);
	return TRUE;
}
예제 #10
0
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;
}