struct _atom_backend
{
- AtomEntry * (*retrieve_entry) (AtomCtx *, IRI *);
+ AtomEntry * (*retrieve_entry) (AtomCtx *, AtomID *);
void (*enumerate_entries) (AtomCtx *, AtomEntry ***, size_t *);
+ int (*is_feed) (AtomCtx *, AtomID *);
};
AtomBackend *
void
atom_backend_retrieve_entry_set (AtomBackend *backend,
AtomEntry *retrieve_entry (AtomCtx *,
- IRI *))
+ AtomID *))
{
backend->retrieve_entry = retrieve_entry;
}
backend->enumerate_entries = enumerate_entries;
}
+void
+atom_backend_is_feed_set (AtomBackend *backend,
+ int is_feed (AtomCTx *, AtomID *))
+{
+ backend->is_feed = is_feed;
+}
+
AtomEntry *
-atom_retrieve_entry (AtomCtx *ctx, IRI *iri)
+atom_retrieve_entry (AtomCtx *ctx, AtomID *id)
{
AtomBackend *backend;
backend = atom_backend (ctx);
if (backend && backend->retrieve_entry)
- return backend->retrieve_entry (ctx, iri);
+ return backend->retrieve_entry (ctx, id);
return NULL;
}
*len = 0;
}
+int
+atom_is_feed (AtomCtx *ctx, AtomID *id)
+{
+ AtomBackend *backend;
+ backend = atom_backend (ctx);
+ if (backend && backend->is_feed)
+ {
+ return backend->is_feed (ctx, id);
+ }
+ return 0;
+}
+
AtomFeed *
atom_retrieve_feed (AtomCtx *ctx)
{
}
AtomResource *
-atom_retrieve_resource (AtomCtx *ctx, IRI *iri)
+atom_retrieve_resource (AtomCtx *ctx, AtomID *id)
{
AtomResource *res;
- char * path;
- path = iri_get_path (iri);
- if (!strcmp (path, "/"))
+ if (atom_is_feed (ctx, id))
{
AtomFeed *feed;
feed = atom_retrieve_feed (ctx);
else
{
AtomEntry *entry;
- entry = atom_retrieve_entry (ctx, iri);
+ entry = atom_retrieve_entry (ctx, id);
if (entry == NULL)
return NULL;
res = atom_resource_new_from_entry (entry);