aboutsummaryrefslogtreecommitdiff
path: root/src/gnunet_chat_lib.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/gnunet_chat_lib.c')
-rw-r--r--src/gnunet_chat_lib.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/src/gnunet_chat_lib.c b/src/gnunet_chat_lib.c
index 0b36765..b273441 100644
--- a/src/gnunet_chat_lib.c
+++ b/src/gnunet_chat_lib.c
@@ -63,6 +63,43 @@ GNUNET_CHAT_stop (struct GNUNET_CHAT_Handle *handle)
63 63
64 64
65int 65int
66GNUNET_CHAT_account_create (struct GNUNET_CHAT_Handle *handle,
67 const char* name)
68{
69 if ((!handle) || (!name))
70 return GNUNET_SYSERR;
71
72 struct GNUNET_CHAT_InternalAccounts *accounts = handle->accounts_head;
73 while (accounts)
74 {
75 if (!(accounts->account))
76 goto skip_account;
77
78 if ((accounts->account->name) &&
79 (0 == strcmp(accounts->account->name, name)))
80 return GNUNET_NO;
81
82skip_account:
83 accounts = accounts->next;
84 }
85
86 if (handle->creation_op)
87 GNUNET_IDENTITY_cancel(handle->creation_op);
88
89 handle->creation_op = GNUNET_IDENTITY_create(
90 handle->identity,
91 name,
92 NULL,
93 GNUNET_IDENTITY_TYPE_ECDSA,
94 cb_account_creation,
95 handle
96 );
97
98 return (handle->creation_op? GNUNET_OK : GNUNET_SYSERR);
99}
100
101
102int
66GNUNET_CHAT_iterate_accounts (const struct GNUNET_CHAT_Handle *handle, 103GNUNET_CHAT_iterate_accounts (const struct GNUNET_CHAT_Handle *handle,
67 GNUNET_CHAT_AccountCallback callback, 104 GNUNET_CHAT_AccountCallback callback,
68 void *cls) 105 void *cls)