From: Thadeu Lima de Souza Cascardo Date: Sun, 12 Oct 2008 20:11:39 +0000 (-0300) Subject: Added frontend requests mapping X-Git-Url: http://git.cascardo.info/?p=cascardo%2Fatompub.git;a=commitdiff_plain;h=ec6e6939dd16e36da38a75731b51ab4a96c3b30f Added frontend requests mapping --- diff --git a/atom/ctx.c b/atom/ctx.c index 8519b31..678509b 100644 --- a/atom/ctx.c +++ b/atom/ctx.c @@ -28,6 +28,7 @@ struct _atom_ctx AtomBackend *backend; AtomFrontend *frontend; GHashTable *bemap; + GHashTable *femap; }; AtomCtx * @@ -41,6 +42,8 @@ atom_ctx_new () ctx->frontend = NULL; ctx->bemap = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free); + ctx->femap = g_hash_table_new_full (g_str_hash, g_str_equal, + g_free, g_free); return ctx; } @@ -55,6 +58,8 @@ atom_ctx_delete (AtomCtx *ctx) atom_frontend_delete (ctx->frontend); if (ctx->bemap) g_hash_table_destroy (ctx->bemap); + if (ctx->femap) + g_hash_table_destroy (ctx->femap); g_slice_free (AtomCtx, ctx); } @@ -120,3 +125,16 @@ atom_map_backend_requests (AtomCtx *ctx, char **reqs, g_hash_table_replace (ctx->bemap, key, val); } } + +void +atom_map_frontend_requests (AtomCtx *ctx, char **reqs, + AtomEntry **entries, size_t len) +{ + int i; + for (i = 0; i < len; i++) + { + char *key = g_strdup (reqs[i]); + char *val = g_strdup (atom_entry_id (entries[i])); + g_hash_table_replace (ctx->femap, key, val); + } +} diff --git a/include/atompub/map.h b/include/atompub/map.h index 06e180f..1be9525 100644 --- a/include/atompub/map.h +++ b/include/atompub/map.h @@ -24,5 +24,6 @@ #include void atom_map_backend_requests (AtomCtx *, char **, AtomEntry **, size_t); +void atom_map_frontend_requests (AtomCtx *, char **, AtomEntry **, size_t); #endif