Added publish handler to frontend
authorThadeu Lima de Souza Cascardo <cascardo@holoscopio.com>
Sun, 26 Oct 2008 15:51:04 +0000 (13:51 -0200)
committerThadeu Lima de Souza Cascardo <cascardo@holoscopio.com>
Sun, 26 Oct 2008 15:51:04 +0000 (13:51 -0200)
atom/frontend.c
include/atompub/frontend.h

index b634c38..8365957 100644 (file)
@@ -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);
+    }
+}
index e2ee777..e2d4d6a 100644 (file)
@@ -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 *);