X-Git-Url: http://git.cascardo.eti.br/?p=cascardo%2Fatompub.git;a=blobdiff_plain;f=atom%2Ffrontend.c;h=ed0faad8570ab806694e048cdf9b5bae6cd0efa2;hp=778ffa1e448443ec07d02d03fb25d7202bf97247;hb=5e0b46512db1307562af23db7ea1a1c5f6655472;hpb=41a3c4da11e6a4e2a40ad01f251706d3bd948e33 diff --git a/atom/frontend.c b/atom/frontend.c index 778ffa1..ed0faad 100644 --- a/atom/frontend.c +++ b/atom/frontend.c @@ -26,6 +26,7 @@ struct _atom_frontend { void (*map_entries) (AtomCtx *, char **, AtomEntry **, size_t); + int (*is_feed) (AtomCtx *, char *); }; AtomFrontend * @@ -34,6 +35,7 @@ atom_frontend_new () AtomFrontend *frontend; frontend = g_slice_new (AtomFrontend); frontend->map_entries = NULL; + frontend->is_feed = NULL; return frontend; } @@ -53,6 +55,13 @@ atom_frontend_map_entries_set (AtomFrontend *frontend, frontend->map_entries = map_entries; } +void +atom_frontend_is_feed_set (AtomFrontend *frontend, + int is_feed (AtomCtx *, char *)) +{ + frontend->is_feed = is_feed; +} + void atom_frontend_map_entries (AtomCtx *ctx, char ** reqs, AtomEntry ** entries, size_t len) @@ -64,3 +73,20 @@ atom_frontend_map_entries (AtomCtx *ctx, char ** reqs, frontend->map_entries (ctx, reqs, entries, len); } } + +int +atom_is_feed (AtomCtx *ctx, char *req) +{ + AtomFrontend *frontend; + AtomError *aerr; + frontend = atom_frontend (ctx); + if (frontend && frontend->is_feed) + { + return frontend->is_feed (ctx, req); + } + /* If frontend cannot decide if a request is a feed, let's tell it's + * not. If the request mapping cannot be done, it will return a "Not + * Found" error anyway. + */ + return 0; +}