summaryrefslogtreecommitdiff
path: root/src/fs
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2012-03-01 08:24:17 +0000
committerChristian Grothoff <christian@grothoff.org>2012-03-01 08:24:17 +0000
commit2768306ebbaee4936fdd57398f2f54e7e4018b1f (patch)
tree03261d585de6289b50a3f850cd6f33b302ab4407 /src/fs
parentff56613c903265d0c96b782b064bffa10d1c1fdc (diff)
LRN: updates to pseudonym API from #1952, change pseudonym management
Diffstat (limited to 'src/fs')
-rw-r--r--src/fs/fs_uri.c12
-rw-r--r--src/fs/gnunet-pseudonym.c23
2 files changed, 23 insertions, 12 deletions
diff --git a/src/fs/fs_uri.c b/src/fs/fs_uri.c
index 5dfdcb54d..43cf2c5bd 100644
--- a/src/fs/fs_uri.c
+++ b/src/fs/fs_uri.c
@@ -1377,15 +1377,17 @@ GNUNET_FS_uri_sks_to_string_fancy (struct GNUNET_CONFIGURATION_Handle *cfg,
const struct GNUNET_FS_Uri *uri)
{
char *ret;
- char *name;
+ char *name, *unique_name;
+ int getinfo_result;
if (uri->type != sks)
return NULL;
- name = GNUNET_PSEUDONYM_id_to_name (cfg, &uri->data.sks.namespace);
- if (name == NULL)
- return GNUNET_FS_uri_to_string (uri);
- GNUNET_asprintf (&ret, "%s: %s", name, uri->data.sks.identifier);
+ getinfo_result = GNUNET_PSEUDONYM_get_info (cfg, &uri->data.sks.namespace,
+ NULL, NULL, &name, NULL);
+ unique_name = GNUNET_PSEUDONYM_name_uniquify (cfg, &uri->data.sks.namespace, name, NULL);
GNUNET_free (name);
+ GNUNET_asprintf (&ret, "%s: %s", unique_name, uri->data.sks.identifier);
+ GNUNET_free (unique_name);
return ret;
}
diff --git a/src/fs/gnunet-pseudonym.c b/src/fs/gnunet-pseudonym.c
index 412ddd2b0..247a5a0d8 100644
--- a/src/fs/gnunet-pseudonym.c
+++ b/src/fs/gnunet-pseudonym.c
@@ -106,20 +106,28 @@ ns_printer (void *cls, const char *name, const GNUNET_HashCode * id)
static int
pseudo_printer (void *cls, const GNUNET_HashCode * pseudonym,
+ const char *name, const char *unique_name,
const struct GNUNET_CONTAINER_MetaData *md, int rating)
{
- char *id;
-
- id = GNUNET_PSEUDONYM_id_to_name (cfg, pseudonym);
- if (id == NULL)
+ char *id, *unique_id;
+ int getinfo_result;
+
+ /* While we get a name from the caller, it might be NULL.
+ * GNUNET_PSEUDONYM_get_info () never returns NULL.
+ */
+ getinfo_result = GNUNET_PSEUDONYM_get_info (cfg, pseudonym,
+ NULL, NULL, &id, NULL);
+ if (getinfo_result != GNUNET_OK)
{
GNUNET_break (0);
return GNUNET_OK;
}
- FPRINTF (stdout, "%s (%d):\n", id, rating);
+ unique_id = GNUNET_PSEUDONYM_name_uniquify (cfg, pseudonym, id, NULL);
+ GNUNET_free (id);
+ FPRINTF (stdout, "%s (%d):\n", unique_id, rating);
GNUNET_CONTAINER_meta_data_iterate (md, &EXTRACTOR_meta_data_print, stdout);
FPRINTF (stdout, "%s", "\n");
- GNUNET_free (id);
+ GNUNET_free (unique_id);
return GNUNET_OK;
}
@@ -162,7 +170,8 @@ post_advertising (void *cls, const struct GNUNET_FS_Uri *uri, const char *emsg)
}
else
{
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _("Namespace `%s' unknown.\n"),
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ ("Namespace `%s' unknown. Make sure you specify its numeric suffix, if any.\n"),
rating_change);
}
}