aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/gnunet/gnunet_chat_lib.h2
-rw-r--r--src/gnunet_chat_handle.c19
-rw-r--r--src/gnunet_chat_handle.h11
-rw-r--r--src/gnunet_chat_lib.c2
4 files changed, 30 insertions, 4 deletions
diff --git a/include/gnunet/gnunet_chat_lib.h b/include/gnunet/gnunet_chat_lib.h
index fbb7719..b8c44bf 100644
--- a/include/gnunet/gnunet_chat_lib.h
+++ b/include/gnunet/gnunet_chat_lib.h
@@ -41,7 +41,7 @@
41 * the #GNUNET_MESSENGER_VERSION of the GNUnet Messenger 41 * the #GNUNET_MESSENGER_VERSION of the GNUnet Messenger
42 * service while the patch version is independent. 42 * service while the patch version is independent.
43 */ 43 */
44#define GNUNET_CHAT_VERSION 0x000000020000L 44#define GNUNET_CHAT_VERSION 0x000000030000L
45 45
46#define GNUNET_CHAT_VERSION_MAJOR ((GNUNET_CHAT_VERSION >> 32L) & 0xFFFFL) 46#define GNUNET_CHAT_VERSION_MAJOR ((GNUNET_CHAT_VERSION >> 32L) & 0xFFFFL)
47#define GNUNET_CHAT_VERSION_MINOR ((GNUNET_CHAT_VERSION >> 16L) & 0xFFFFL) 47#define GNUNET_CHAT_VERSION_MINOR ((GNUNET_CHAT_VERSION >> 16L) & 0xFFFFL)
diff --git a/src/gnunet_chat_handle.c b/src/gnunet_chat_handle.c
index 7edc209..c94b01b 100644
--- a/src/gnunet_chat_handle.c
+++ b/src/gnunet_chat_handle.c
@@ -241,6 +241,10 @@ handle_connect (struct GNUNET_CHAT_Handle *handle,
241 241
242 const char *name = account->name; 242 const char *name = account->name;
243 243
244 const struct GNUNET_IDENTITY_PrivateKey *key = NULL;
245 if (account->ego)
246 key = GNUNET_IDENTITY_ego_get_private_key(account->ego);
247
244 char* fs_client_name = NULL; 248 char* fs_client_name = NULL;
245 GNUNET_asprintf ( 249 GNUNET_asprintf (
246 &fs_client_name, 250 &fs_client_name,
@@ -261,13 +265,14 @@ handle_connect (struct GNUNET_CHAT_Handle *handle,
261 handle->gns = GNUNET_GNS_connect(handle->cfg); 265 handle->gns = GNUNET_GNS_connect(handle->cfg);
262 266
263 handle->messenger = GNUNET_MESSENGER_connect( 267 handle->messenger = GNUNET_MESSENGER_connect(
264 handle->cfg, name, 268 handle->cfg, name, key,
265 on_handle_identity, handle,
266 on_handle_message, handle 269 on_handle_message, handle
267 ); 270 );
268 271
269 handle->current = account; 272 handle->current = account;
270 handle_update_key(handle); 273 handle_update_key(handle);
274
275 on_handle_identity(handle, handle->messenger);
271} 276}
272 277
273void 278void
@@ -509,6 +514,16 @@ handle_get_directory (const struct GNUNET_CHAT_Handle *handle)
509 return handle->current->directory; 514 return handle->current->directory;
510} 515}
511 516
517int
518handle_update (struct GNUNET_CHAT_Handle *handle)
519{
520 GNUNET_assert((handle) && (handle->current));
521
522 // TODO: Implement update function
523
524 return GNUNET_SYSERR;
525}
526
512const struct GNUNET_IDENTITY_PrivateKey* 527const struct GNUNET_IDENTITY_PrivateKey*
513handle_get_key (const struct GNUNET_CHAT_Handle *handle) 528handle_get_key (const struct GNUNET_CHAT_Handle *handle)
514{ 529{
diff --git a/src/gnunet_chat_handle.h b/src/gnunet_chat_handle.h
index 0ceb40f..bc4d7c3 100644
--- a/src/gnunet_chat_handle.h
+++ b/src/gnunet_chat_handle.h
@@ -208,6 +208,17 @@ const char*
208handle_get_directory (const struct GNUNET_CHAT_Handle *handle); 208handle_get_directory (const struct GNUNET_CHAT_Handle *handle);
209 209
210/** 210/**
211 * Updates the used private key by creating a new identity
212 * using the same identifier as currently in use, replacing
213 * the old identity.
214 *
215 * @param[in] handle Chat handle
216 * @return #GNUNET_OK on success, #GNUNET_SYSERR on failure
217 */
218int
219handle_update (struct GNUNET_CHAT_Handle *handle);
220
221/**
211 * Returns the private key from the current connected chat 222 * Returns the private key from the current connected chat
212 * account of a given chat <i>handle</i>. 223 * account of a given chat <i>handle</i>.
213 * 224 *
diff --git a/src/gnunet_chat_lib.c b/src/gnunet_chat_lib.c
index 111bfd8..dfe6846 100644
--- a/src/gnunet_chat_lib.c
+++ b/src/gnunet_chat_lib.c
@@ -199,7 +199,7 @@ GNUNET_CHAT_update (struct GNUNET_CHAT_Handle *handle)
199 if ((!handle) || (handle->destruction)) 199 if ((!handle) || (handle->destruction))
200 return GNUNET_SYSERR; 200 return GNUNET_SYSERR;
201 201
202 return GNUNET_MESSENGER_update(handle->messenger); 202 return handle_update(handle);
203} 203}
204 204
205 205