summaryrefslogtreecommitdiff
path: root/src/atom-writer.h
diff options
context:
space:
mode:
authorTomas Bzatek <tbzatek@users.sourceforge.net>2010-10-08 17:02:47 +0200
committerTomas Bzatek <tbzatek@users.sourceforge.net>2010-10-08 17:02:47 +0200
commit10c6b1f0978710cf5a9f309b6fdcaef922f9b07f (patch)
tree00679d479d9554f91f5d3beb4f4e709705ba55df /src/atom-writer.h
parent5fc53d25a171fbd85ee09c9fc771580350d689c8 (diff)
downloadcataract-10c6b1f0978710cf5a9f309b6fdcaef922f9b07f.tar.xz
Add basic Atom feed writer
Diffstat (limited to 'src/atom-writer.h')
-rw-r--r--src/atom-writer.h70
1 files changed, 70 insertions, 0 deletions
diff --git a/src/atom-writer.h b/src/atom-writer.h
new file mode 100644
index 0000000..cf90001
--- /dev/null
+++ b/src/atom-writer.h
@@ -0,0 +1,70 @@
+/* Cataract - Static web photo gallery generator
+ * Copyright (C) 2010 Tomas Bzatek <tbzatek@users.sourceforge.net>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+#ifndef __ATOM_WRITER_H__
+#define __ATOM_WRITER_H__
+
+#include <glib.h>
+#include "setup.h"
+
+/*
+ * Resources:
+ * http://tools.ietf.org/html/rfc4287
+ * http://www.atomenabled.org/developers/syndication/
+ * http://feedvalidator.org/
+ * http://diveintomark.org/archives/2004/05/28/howto-atom-id
+ *
+ */
+
+
+typedef struct {
+ gchar *title;
+ gchar *base_url;
+ gchar *feed_url;
+
+ GSList *items;
+} TAtomFeed;
+
+typedef struct {
+ gchar *title;
+ gchar *path; /* relative path in the gallery structure */
+ gchar *date; /* format ISO.8601.1988 yyyy-mm-ddThh:mm:ssZ or yyyy-mm-ddThh:mm:ss+hh:mm (timezone) */
+ gchar *summary; /* escaped automatically */
+ gchar *summary_type; /* valid values are "text", "html", "xhtml" */
+} TAtomFeedItem;
+
+
+/* Global instances */
+TAtomFeed *news_feed;
+
+
+TAtomFeed * atom_writer_new ();
+void atom_writer_write_to_file (TAtomFeed *feed, const gchar *filename, TGallerySetup *setup);
+void atom_writer_set_title (TAtomFeed *feed, const gchar *title);
+void atom_writer_set_base_url (TAtomFeed *feed, const gchar *base_url);
+void atom_writer_set_feed_url (TAtomFeed *feed, const gchar *feed_url);
+void atom_writer_free (TAtomFeed *feed); /* will free data of all items */
+
+TAtomFeedItem * atom_writer_add_item (TAtomFeed *feed);
+void atom_feed_item_set_title (TAtomFeedItem *item, const gchar *title);
+void atom_feed_item_set_path (TAtomFeedItem *item, const gchar *path);
+void atom_feed_item_set_date (TAtomFeedItem *item, const gchar *date);
+void atom_feed_item_set_summary (TAtomFeedItem *item, const gchar *summary);
+void atom_feed_item_set_summary_type (TAtomFeedItem *item, const gchar *summary_type);
+
+
+#endif /* __ATOM_WRITER_H__ */