lib_LTLIBRARIES = libatom.la
-libatom_la_SOURCES = id.c entry.c person.c feed.c resource.c
+libatom_la_SOURCES = id.c entry.c person.c feed.c resource.c \
+ config.c ctx.c backend.c error.c
libatom_la_CFLAGS = -I$(top_srcdir)/include $(GLIB_CFLAGS)
libatom_la_CFLAGS += $(XML_CFLAGS) $(GIO_CFLAGS)
libatom_la_LIBADD = $(GIO_LIBS) $(GLIB_LIBS) $(XML_LIBS)
--- /dev/null
+/*
+ * Copyright (C) 2007 Thadeu Lima de Souza Cascardo <cascardo@holoscopio.com>
+ *
+ * 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
+ * (at your option) 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.
+ */
+
+
+#include <atompub/atom.h>
+
+#include <glib.h>
+
+#include <string.h>
+
+struct _atom_backend
+{
+ AtomEntry * (*retrieve_entry) (AtomCtx *, AtomID *);
+ void (*enumerate_entries) (AtomCtx *, char ***, AtomEntry ***, size_t *);
+ int (*is_feed) (AtomCtx *, AtomID *);
+};
+
+AtomBackend *
+atom_backend_new ()
+{
+ AtomBackend *backend;
+ backend = g_slice_new (AtomBackend);
+ backend->retrieve_entry = NULL;
+ backend->enumerate_entries = NULL;
+ return backend;
+}
+
+void
+atom_backend_delete (AtomBackend *backend)
+{
+ g_slice_free (AtomBackend, backend);
+}
+
+void
+atom_backend_retrieve_entry_set (AtomBackend *backend,
+ AtomEntry *retrieve_entry (AtomCtx *,
+ AtomID *))
+{
+ backend->retrieve_entry = retrieve_entry;
+}
+
+void
+atom_backend_enumerate_entries_set (AtomBackend *backend,
+ void enumerate_entries (AtomCtx *,
+ char ***,
+ AtomEntry ***,
+ size_t *))
+{
+ backend->enumerate_entries = enumerate_entries;
+}
+
+void
+atom_backend_is_feed_set (AtomBackend *backend,
+ int is_feed (AtomCtx *, AtomID *))
+{
+ backend->is_feed = is_feed;
+}
+
+AtomEntry *
+atom_retrieve_entry (AtomCtx *ctx, AtomID *id)
+{
+ AtomBackend *backend;
+ backend = atom_backend (ctx);
+ if (backend && backend->retrieve_entry)
+ return backend->retrieve_entry (ctx, id);
+ return NULL;
+}
+
+void
+atom_backend_enumerate_entries (AtomCtx *ctx, char *** reqs,
+ AtomEntry *** entries, size_t *len)
+{
+ AtomBackend *backend;
+ char **rreqs = NULL;
+ AtomEntry **rentries = NULL;
+ size_t rlen = 0;
+ int i;
+ backend = atom_backend (ctx);
+ if (backend && backend->enumerate_entries)
+ {
+ backend->enumerate_entries (ctx, &rreqs, &rentries, &rlen);
+ }
+ if (reqs)
+ {
+ *reqs = rreqs;
+ }
+ else
+ {
+ for (i = 0; i < rlen; i++)
+ g_free (rreqs[i]);
+ g_free (rreqs);
+ }
+ if (entries)
+ {
+ *entries = rentries;
+ }
+ else
+ {
+ for (i = 0; i < rlen; i++)
+ atom_entry_delete (rentries[i]);
+ g_free (rentries);
+ }
+ if (len)
+ *len = rlen;
+}
+
+int
+atom_is_feed (AtomCtx *ctx, AtomID *id)
+{
+ AtomBackend *backend;
+ AtomError *aerr;
+ backend = atom_backend (ctx);
+ if (backend && backend->is_feed)
+ {
+ return backend->is_feed (ctx, id);
+ }
+ /* Frontend may make the decision of whether the requested resource is
+ * a feed or not. If it is not able to do so and backend isn't either,
+ * it is an error.
+ */
+ aerr = atom_error_new ();
+ atom_error_code_set (aerr, 404);
+ atom_error_message_set (aerr, "Not Found");
+ atom_error_set (ctx, aerr);
+ return 0;
+}
+
+AtomFeed *
+atom_retrieve_feed (AtomCtx *ctx)
+{
+ AtomFeed *feed;
+ AtomEntry **entries;
+ size_t len;
+ atom_backend_enumerate_entries (ctx, NULL, &entries, &len);
+ if (atom_error_get (ctx) != NULL)
+ return NULL;
+ feed = atom_feed_new ();
+ atom_feed_entry_append_array (feed, entries, len);
+ g_free (entries);
+ return feed;
+}
+
+AtomResource *
+atom_retrieve_resource (AtomCtx *ctx, AtomID *id)
+{
+ AtomResource *res;
+ res = NULL;
+ if (atom_is_feed (ctx, id))
+ {
+ AtomFeed *feed;
+ feed = atom_retrieve_feed (ctx);
+ if (feed == NULL)
+ return NULL;
+ res = atom_resource_new_from_feed (feed);
+ atom_feed_delete (feed);
+ }
+ else if (atom_error_get (ctx) == NULL)
+ {
+ AtomEntry *entry;
+ entry = atom_retrieve_entry (ctx, id);
+ if (entry == NULL)
+ return NULL;
+ res = atom_resource_new_from_entry (entry);
+ atom_entry_delete (entry);
+ }
+ return res;
+}
--- /dev/null
+/*
+ * Copyright (C) 2007 Thadeu Lima de Souza Cascardo <cascardo@holoscopio.com>
+ *
+ * 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
+ * (at your option) 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.
+ */
+
+
+#include <atompub/atom.h>
+
+extern void gkeyfile_atom_config_init (AtomCtx *);
+extern char *gkeyfile_atom_config_get_str (AtomCtx *, char *, char *);
+
+void
+atom_config_init (AtomCtx *ctx)
+{
+ gkeyfile_atom_config_init (ctx);
+}
+
+char *
+atom_config_get_str (AtomCtx *ctx, char *namespace, char *key)
+{
+ return gkeyfile_atom_config_get_str (ctx, namespace, key);
+}
--- /dev/null
+/*
+ * Copyright (C) 2007 Thadeu Lima de Souza Cascardo <cascardo@holoscopio.com>
+ *
+ * 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
+ * (at your option) 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.
+ */
+
+
+#include <atompub/atom.h>
+
+#include <glib.h>
+
+struct _atom_ctx
+{
+ AtomError *error;
+ gpointer config_data;
+ AtomBackend *backend;
+ GHashTable *bemap;
+};
+
+AtomCtx *
+atom_ctx_new ()
+{
+ AtomCtx *ctx;
+ ctx = g_slice_new (AtomCtx);
+ ctx->error = NULL;
+ ctx->config_data = NULL;
+ ctx->backend = NULL;
+ ctx->bemap = g_hash_table_new_full (g_str_hash, g_str_equal,
+ g_free, g_free);
+ return ctx;
+}
+
+void
+atom_ctx_delete (AtomCtx *ctx)
+{
+ if (ctx->error)
+ atom_error_delete (ctx->error);
+ if (ctx->backend)
+ atom_backend_delete (ctx->backend);
+ if (ctx->bemap)
+ g_hash_table_destroy (ctx->bemap);
+ g_slice_free (AtomCtx, ctx);
+}
+
+void
+atom_error_set (AtomCtx *ctx, AtomError *error)
+{
+ if (ctx->error)
+ atom_error_delete (ctx->error);
+ ctx->error = error;
+}
+
+AtomError *
+atom_error_get (AtomCtx *ctx)
+{
+ return ctx->error;
+}
+
+void *
+atom_config_data (AtomCtx *ctx)
+{
+ return ctx->config_data;
+}
+
+void
+atom_config_data_set (AtomCtx *ctx, void *data)
+{
+ ctx->config_data = data;
+}
+
+AtomBackend *
+atom_backend (AtomCtx *ctx)
+{
+ return ctx->backend;
+}
+
+void
+atom_backend_set (AtomCtx *ctx, AtomBackend *backend)
+{
+ ctx->backend = backend;
+}
+
+void
+atom_map_backend_requests (AtomCtx *ctx, char **reqs,
+ AtomEntry **entries, size_t len)
+{
+ int i;
+ for (i = 0; i < len; i++)
+ {
+ char *key = g_strdup (atom_entry_id (entries[i]));
+ char *val = g_strdup (reqs[i]);
+ g_hash_table_replace (ctx->bemap, key, val);
+ }
+}
--- /dev/null
+/*
+ * Copyright (C) 2008 Thadeu Lima de Souza Cascardo <cascardo@holoscopio.com>
+ *
+ * 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
+ * (at your option) 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.
+ */
+
+
+#include <atompub/atom.h>
+
+#include <glib.h>
+#include <gio/gio.h>
+
+struct _atom_error
+{
+ int code;
+ char * message;
+};
+
+AtomError *
+atom_error_new ()
+{
+ AtomError *error;
+ error = g_slice_new (AtomError);
+ error->code = 0;
+ error->message = NULL;
+ return error;
+}
+
+void
+atom_error_delete (AtomError *error)
+{
+ if (error->message)
+ g_free (error->message);
+ g_slice_free (AtomError, error);
+}
+
+int
+atom_error_code (AtomError *error)
+{
+ return error->code;
+}
+
+void
+atom_error_code_set (AtomError *error, int code)
+{
+ error->code = code;
+}
+
+char *
+atom_error_message (AtomError *error)
+{
+ return error->message;
+}
+
+void
+atom_error_message_set (AtomError *error, char *message)
+{
+ error->message = g_strdup (message);
+}
+
+AtomError *
+atom_error_new_from_gerror (GError *error)
+{
+ AtomError *aerr;
+ aerr = atom_error_new ();
+ if (error->domain == G_FILE_ERROR)
+ {
+ switch (error->code)
+ {
+ case G_FILE_ERROR_EXIST:
+ case G_FILE_ERROR_ACCES:
+ case G_FILE_ERROR_PERM:
+ aerr->code = 403;
+ break;
+ case G_FILE_ERROR_NOENT:
+ aerr->code = 404;
+ break;
+ default:
+ aerr->code = 500;
+ break;
+ }
+ }
+ else if (error->domain = G_IO_ERROR)
+ {
+ switch (error->code)
+ {
+ case G_IO_ERROR_NOT_FOUND:
+ aerr->code = 404;
+ break;
+ default:
+ aerr->code = 500;
+ break;
+ }
+ }
+ else
+ {
+ aerr->code = 500;
+ }
+ aerr->message = g_strdup (error->message);
+ return aerr;
+}
bin_PROGRAMS = atompub
-atompub_SOURCES = main.c config.c ctx.c backend.c error.c
+atompub_SOURCES = main.c
atompub_CFLAGS = -I$(top_srcdir)/include
atompub_CFLAGS += $(GLIB_CFLAGS) $(GIO_CFLAGS)
atompub_LDADD = -L$(top_builddir)/atom -latom
+++ /dev/null
-/*
- * Copyright (C) 2007 Thadeu Lima de Souza Cascardo <cascardo@holoscopio.com>
- *
- * 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
- * (at your option) 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.
- */
-
-
-#include <atompub/atom.h>
-
-#include <glib.h>
-
-#include <string.h>
-
-struct _atom_backend
-{
- AtomEntry * (*retrieve_entry) (AtomCtx *, AtomID *);
- void (*enumerate_entries) (AtomCtx *, char ***, AtomEntry ***, size_t *);
- int (*is_feed) (AtomCtx *, AtomID *);
-};
-
-AtomBackend *
-atom_backend_new ()
-{
- AtomBackend *backend;
- backend = g_slice_new (AtomBackend);
- backend->retrieve_entry = NULL;
- backend->enumerate_entries = NULL;
- return backend;
-}
-
-void
-atom_backend_delete (AtomBackend *backend)
-{
- g_slice_free (AtomBackend, backend);
-}
-
-void
-atom_backend_retrieve_entry_set (AtomBackend *backend,
- AtomEntry *retrieve_entry (AtomCtx *,
- AtomID *))
-{
- backend->retrieve_entry = retrieve_entry;
-}
-
-void
-atom_backend_enumerate_entries_set (AtomBackend *backend,
- void enumerate_entries (AtomCtx *,
- char ***,
- AtomEntry ***,
- size_t *))
-{
- backend->enumerate_entries = enumerate_entries;
-}
-
-void
-atom_backend_is_feed_set (AtomBackend *backend,
- int is_feed (AtomCtx *, AtomID *))
-{
- backend->is_feed = is_feed;
-}
-
-AtomEntry *
-atom_retrieve_entry (AtomCtx *ctx, AtomID *id)
-{
- AtomBackend *backend;
- backend = atom_backend (ctx);
- if (backend && backend->retrieve_entry)
- return backend->retrieve_entry (ctx, id);
- return NULL;
-}
-
-void
-atom_backend_enumerate_entries (AtomCtx *ctx, char *** reqs,
- AtomEntry *** entries, size_t *len)
-{
- AtomBackend *backend;
- char **rreqs = NULL;
- AtomEntry **rentries = NULL;
- size_t rlen = 0;
- int i;
- backend = atom_backend (ctx);
- if (backend && backend->enumerate_entries)
- {
- backend->enumerate_entries (ctx, &rreqs, &rentries, &rlen);
- }
- if (reqs)
- {
- *reqs = rreqs;
- }
- else
- {
- for (i = 0; i < rlen; i++)
- g_free (rreqs[i]);
- g_free (rreqs);
- }
- if (entries)
- {
- *entries = rentries;
- }
- else
- {
- for (i = 0; i < rlen; i++)
- atom_entry_delete (rentries[i]);
- g_free (rentries);
- }
- if (len)
- *len = rlen;
-}
-
-int
-atom_is_feed (AtomCtx *ctx, AtomID *id)
-{
- AtomBackend *backend;
- AtomError *aerr;
- backend = atom_backend (ctx);
- if (backend && backend->is_feed)
- {
- return backend->is_feed (ctx, id);
- }
- /* Frontend may make the decision of whether the requested resource is
- * a feed or not. If it is not able to do so and backend isn't either,
- * it is an error.
- */
- aerr = atom_error_new ();
- atom_error_code_set (aerr, 404);
- atom_error_message_set (aerr, "Not Found");
- atom_error_set (ctx, aerr);
- return 0;
-}
-
-AtomFeed *
-atom_retrieve_feed (AtomCtx *ctx)
-{
- AtomFeed *feed;
- AtomEntry **entries;
- size_t len;
- atom_backend_enumerate_entries (ctx, NULL, &entries, &len);
- if (atom_error_get (ctx) != NULL)
- return NULL;
- feed = atom_feed_new ();
- atom_feed_entry_append_array (feed, entries, len);
- g_free (entries);
- return feed;
-}
-
-AtomResource *
-atom_retrieve_resource (AtomCtx *ctx, AtomID *id)
-{
- AtomResource *res;
- res = NULL;
- if (atom_is_feed (ctx, id))
- {
- AtomFeed *feed;
- feed = atom_retrieve_feed (ctx);
- if (feed == NULL)
- return NULL;
- res = atom_resource_new_from_feed (feed);
- atom_feed_delete (feed);
- }
- else if (atom_error_get (ctx) == NULL)
- {
- AtomEntry *entry;
- entry = atom_retrieve_entry (ctx, id);
- if (entry == NULL)
- return NULL;
- res = atom_resource_new_from_entry (entry);
- atom_entry_delete (entry);
- }
- return res;
-}
+++ /dev/null
-/*
- * Copyright (C) 2007 Thadeu Lima de Souza Cascardo <cascardo@holoscopio.com>
- *
- * 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
- * (at your option) 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.
- */
-
-
-#include <atompub/atom.h>
-
-extern void gkeyfile_atom_config_init (AtomCtx *);
-extern char *gkeyfile_atom_config_get_str (AtomCtx *, char *, char *);
-
-void
-atom_config_init (AtomCtx *ctx)
-{
- gkeyfile_atom_config_init (ctx);
-}
-
-char *
-atom_config_get_str (AtomCtx *ctx, char *namespace, char *key)
-{
- return gkeyfile_atom_config_get_str (ctx, namespace, key);
-}
+++ /dev/null
-/*
- * Copyright (C) 2007 Thadeu Lima de Souza Cascardo <cascardo@holoscopio.com>
- *
- * 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
- * (at your option) 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.
- */
-
-
-#include <atompub/atom.h>
-
-#include <glib.h>
-
-struct _atom_ctx
-{
- AtomError *error;
- gpointer config_data;
- AtomBackend *backend;
- GHashTable *bemap;
-};
-
-AtomCtx *
-atom_ctx_new ()
-{
- AtomCtx *ctx;
- ctx = g_slice_new (AtomCtx);
- ctx->error = NULL;
- ctx->config_data = NULL;
- ctx->backend = NULL;
- ctx->bemap = g_hash_table_new_full (g_str_hash, g_str_equal,
- g_free, g_free);
- return ctx;
-}
-
-void
-atom_ctx_delete (AtomCtx *ctx)
-{
- if (ctx->error)
- atom_error_delete (ctx->error);
- if (ctx->backend)
- atom_backend_delete (ctx->backend);
- if (ctx->bemap)
- g_hash_table_destroy (ctx->bemap);
- g_slice_free (AtomCtx, ctx);
-}
-
-void
-atom_error_set (AtomCtx *ctx, AtomError *error)
-{
- if (ctx->error)
- atom_error_delete (ctx->error);
- ctx->error = error;
-}
-
-AtomError *
-atom_error_get (AtomCtx *ctx)
-{
- return ctx->error;
-}
-
-void *
-atom_config_data (AtomCtx *ctx)
-{
- return ctx->config_data;
-}
-
-void
-atom_config_data_set (AtomCtx *ctx, void *data)
-{
- ctx->config_data = data;
-}
-
-AtomBackend *
-atom_backend (AtomCtx *ctx)
-{
- return ctx->backend;
-}
-
-void
-atom_backend_set (AtomCtx *ctx, AtomBackend *backend)
-{
- ctx->backend = backend;
-}
-
-void
-atom_map_backend_requests (AtomCtx *ctx, char **reqs,
- AtomEntry **entries, size_t len)
-{
- int i;
- for (i = 0; i < len; i++)
- {
- char *key = g_strdup (atom_entry_id (entries[i]));
- char *val = g_strdup (reqs[i]);
- g_hash_table_replace (ctx->bemap, key, val);
- }
-}
+++ /dev/null
-/*
- * Copyright (C) 2008 Thadeu Lima de Souza Cascardo <cascardo@holoscopio.com>
- *
- * 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
- * (at your option) 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.
- */
-
-
-#include <atompub/atom.h>
-
-#include <glib.h>
-#include <gio/gio.h>
-
-struct _atom_error
-{
- int code;
- char * message;
-};
-
-AtomError *
-atom_error_new ()
-{
- AtomError *error;
- error = g_slice_new (AtomError);
- error->code = 0;
- error->message = NULL;
- return error;
-}
-
-void
-atom_error_delete (AtomError *error)
-{
- if (error->message)
- g_free (error->message);
- g_slice_free (AtomError, error);
-}
-
-int
-atom_error_code (AtomError *error)
-{
- return error->code;
-}
-
-void
-atom_error_code_set (AtomError *error, int code)
-{
- error->code = code;
-}
-
-char *
-atom_error_message (AtomError *error)
-{
- return error->message;
-}
-
-void
-atom_error_message_set (AtomError *error, char *message)
-{
- error->message = g_strdup (message);
-}
-
-AtomError *
-atom_error_new_from_gerror (GError *error)
-{
- AtomError *aerr;
- aerr = atom_error_new ();
- if (error->domain == G_FILE_ERROR)
- {
- switch (error->code)
- {
- case G_FILE_ERROR_EXIST:
- case G_FILE_ERROR_ACCES:
- case G_FILE_ERROR_PERM:
- aerr->code = 403;
- break;
- case G_FILE_ERROR_NOENT:
- aerr->code = 404;
- break;
- default:
- aerr->code = 500;
- break;
- }
- }
- else if (error->domain = G_IO_ERROR)
- {
- switch (error->code)
- {
- case G_IO_ERROR_NOT_FOUND:
- aerr->code = 404;
- break;
- default:
- aerr->code = 500;
- break;
- }
- }
- else
- {
- aerr->code = 500;
- }
- aerr->message = g_strdup (error->message);
- return aerr;
-}