From 373560145387518942edaf729e8287ac19436b49 Mon Sep 17 00:00:00 2001 From: Thadeu Lima de Souza Cascardo Date: Sun, 26 Oct 2008 13:51:04 -0200 Subject: [PATCH] Added publish handler to frontend --- atom/frontend.c | 20 ++++++++++++++++++++ include/atompub/frontend.h | 3 +++ 2 files changed, 23 insertions(+) diff --git a/atom/frontend.c b/atom/frontend.c index b634c38..8365957 100644 --- a/atom/frontend.c +++ b/atom/frontend.c @@ -31,6 +31,7 @@ struct _atom_frontend void (*handle_error) (AtomCtx *); void (*handle_entry) (AtomCtx *, AtomEntry *); void (*handle_feed) (AtomCtx *, AtomFeed *); + void (*handle_publish) (AtomCtx *, AtomEntry *); }; AtomFrontend * @@ -44,6 +45,7 @@ atom_frontend_new () frontend->handle_error = NULL; frontend->handle_entry = NULL; frontend->handle_feed = NULL; + frontend->handle_publish = NULL; return frontend; } @@ -98,6 +100,13 @@ atom_frontend_handle_feed_set (AtomFrontend *frontend, frontend->handle_feed = handle_feed; } +void +atom_frontend_handle_publish_set (AtomFrontend *frontend, + void handle_publish (AtomCtx *, AtomEntry *)) +{ + frontend->handle_publish = handle_publish; +} + void atom_frontend_map_entries (AtomCtx *ctx, char ** reqs, AtomEntry ** entries, size_t len) @@ -171,3 +180,14 @@ atom_handle_feed (AtomCtx *ctx, AtomFeed *feed) frontend->handle_feed (ctx, feed); } } + +void +atom_handle_publish (AtomCtx *ctx, AtomEntry *entry) +{ + AtomFrontend *frontend; + frontend = atom_frontend (ctx); + if (frontend && frontend->handle_publish) + { + frontend->handle_publish (ctx, entry); + } +} diff --git a/include/atompub/frontend.h b/include/atompub/frontend.h index e2ee777..e2d4d6a 100644 --- a/include/atompub/frontend.h +++ b/include/atompub/frontend.h @@ -41,12 +41,15 @@ void atom_frontend_handle_entry_set (AtomFrontend *, void (AtomCtx *, AtomEntry *)); void atom_frontend_handle_feed_set (AtomFrontend *, void (AtomCtx *, AtomFeed *)); +void atom_frontend_handle_publish_set (AtomFrontend *, + void (AtomCtx *, AtomEntry *)); void atom_map_entries (AtomCtx *, char **, AtomEntry **, size_t); int atom_is_feed (AtomCtx *, char *); AtomRequest * atom_get_request (AtomCtx *); void atom_handle_error (AtomCtx *); void atom_handle_entry (AtomCtx *, AtomEntry *); void atom_handle_feed (AtomCtx *, AtomFeed *); +void atom_handle_publish (AtomCtx *, AtomEntry *); AtomFrontend * atom_frontend (AtomCtx *); void atom_frontend_set (AtomCtx *, AtomFrontend *); -- 2.20.1