diff options
author | TheJackiMonster <thejackimonster@gmail.com> | 2021-11-20 04:20:03 +0100 |
---|---|---|
committer | TheJackiMonster <thejackimonster@gmail.com> | 2021-11-20 04:20:03 +0100 |
commit | 788a15d1c82a562e7080d3c523b30340938d8f1d (patch) | |
tree | 3f040e52d14a79b54397526857781531d490b1b3 /src/gnunet_chat_contact.c | |
parent | 41b1445ce9191b4f4a3a6355dad24d39945f3b69 (diff) | |
download | libgnunetchat-788a15d1c82a562e7080d3c523b30340938d8f1d.tar.gz libgnunetchat-788a15d1c82a562e7080d3c523b30340938d8f1d.zip |
Simplified identity keys into basic strings to integrate into ui
Signed-off-by: TheJackiMonster <thejackimonster@gmail.com>
Diffstat (limited to 'src/gnunet_chat_contact.c')
-rw-r--r-- | src/gnunet_chat_contact.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/gnunet_chat_contact.c b/src/gnunet_chat_contact.c index 6ef6506..a955088 100644 --- a/src/gnunet_chat_contact.c +++ b/src/gnunet_chat_contact.c | |||
@@ -37,15 +37,40 @@ contact_create_from_member (struct GNUNET_CHAT_Handle *handle, | |||
37 | 37 | ||
38 | contact->member = member; | 38 | contact->member = member; |
39 | 39 | ||
40 | contact->public_key = NULL; | ||
40 | contact->user_pointer = NULL; | 41 | contact->user_pointer = NULL; |
41 | 42 | ||
43 | contact_update_key (contact); | ||
42 | return contact; | 44 | return contact; |
43 | } | 45 | } |
44 | 46 | ||
45 | void | 47 | void |
48 | contact_update_key (struct GNUNET_CHAT_Contact *contact) | ||
49 | { | ||
50 | GNUNET_assert(contact); | ||
51 | |||
52 | if (contact->public_key) | ||
53 | GNUNET_free(contact->public_key); | ||
54 | |||
55 | contact->public_key = NULL; | ||
56 | |||
57 | if (!contact->member) | ||
58 | return; | ||
59 | |||
60 | const struct GNUNET_IDENTITY_PublicKey *pubkey; | ||
61 | pubkey = GNUNET_MESSENGER_contact_get_key(contact->member); | ||
62 | |||
63 | if (pubkey) | ||
64 | contact->public_key = GNUNET_IDENTITY_public_key_to_string(pubkey); | ||
65 | } | ||
66 | |||
67 | void | ||
46 | contact_destroy (struct GNUNET_CHAT_Contact* contact) | 68 | contact_destroy (struct GNUNET_CHAT_Contact* contact) |
47 | { | 69 | { |
48 | GNUNET_assert(contact); | 70 | GNUNET_assert(contact); |
49 | 71 | ||
72 | if (contact->public_key) | ||
73 | GNUNET_free(contact->public_key); | ||
74 | |||
50 | GNUNET_free(contact); | 75 | GNUNET_free(contact); |
51 | } | 76 | } |