Added functions to convert AtomID from and to frontend and backend requests
[cascardo/atompub.git] / atom / ctx.c
index 678509b..37a5a0d 100644 (file)
@@ -138,3 +138,22 @@ atom_map_frontend_requests (AtomCtx *ctx, char **reqs,
       g_hash_table_replace (ctx->femap, key, val);
     }
 }
+
+AtomID *
+atom_id_new_from_frontend (AtomCtx *ctx, char * req)
+{
+  char *id;
+  if (g_hash_table_lookup_extended (ctx->femap, req, NULL, &id))
+    return atom_id_new (id);
+  return NULL;
+}
+
+char *
+atom_id_to_backend (AtomCtx *ctx, AtomID *id)
+{
+  char *key = atom_id_string (id);
+  char *val;
+  if (g_hash_table_lookup_extended (ctx->bemap, key, NULL, &val))
+    return val;
+  return NULL;
+}