Пример #1
0
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);
}
Пример #2
0
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);
}