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>
27 void atom_get (AtomCtx *ctx, AtomRequest *request)
29 if (atom_is_feed (ctx, atom_request_request (request)))
32 feed = atom_retrieve_feed (ctx);
35 atom_handle_feed (ctx, feed);
36 atom_feed_delete (feed);
42 entry = atom_retrieve_entry (ctx, atom_request_request (request));
45 atom_handle_entry (ctx, entry);
46 atom_entry_delete (entry);
52 atom_serve_request (AtomCtx *ctx)
56 request = atom_get_request (ctx);
59 if (atom_request_type (request) == ATOM_REQUEST_GET)
61 atom_get (ctx, request);
65 error = atom_error_new ();
66 atom_error_code_set (error, 501);
67 atom_error_message_set (error, "Not Implemented");
68 atom_error_set (ctx, error);
71 if (atom_error_get (ctx))
73 atom_handle_error (ctx);
74 atom_error_set (ctx, NULL);