2 * Copyright (C) 2008 Thadeu Lima de Souza Cascardo <cascardo@holoscopio.com>
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20 #include <atompub/atom.h>
28 void (*map_entries) (AtomCtx *, char **, AtomEntry **, size_t);
29 int (*is_feed) (AtomCtx *, char *);
35 AtomFrontend *frontend;
36 frontend = g_slice_new (AtomFrontend);
37 frontend->map_entries = NULL;
38 frontend->is_feed = NULL;
43 atom_frontend_delete (AtomFrontend *frontend)
45 g_slice_free (AtomFrontend, frontend);
49 atom_frontend_map_entries_set (AtomFrontend *frontend,
50 void map_entries (AtomCtx *,
55 frontend->map_entries = map_entries;
59 atom_frontend_is_feed_set (AtomFrontend *frontend,
60 int is_feed (AtomCtx *, char *))
62 frontend->is_feed = is_feed;
66 atom_frontend_map_entries (AtomCtx *ctx, char ** reqs,
67 AtomEntry ** entries, size_t len)
69 AtomFrontend *frontend;
70 frontend = atom_frontend (ctx);
71 if (frontend && frontend->map_entries)
73 frontend->map_entries (ctx, reqs, entries, len);
78 atom_is_feed (AtomCtx *ctx, char *req)
80 AtomFrontend *frontend;
82 frontend = atom_frontend (ctx);
83 if (frontend && frontend->is_feed)
85 return frontend->is_feed (ctx, req);
87 /* If frontend cannot decide if a request is a feed, let's tell it's
88 * not. If the request mapping cannot be done, it will return a "Not
89 * Found" error anyway.