commit 2ee30f372acad534246beaf579b7bbfefab0b246
parent fa50b6878fa0c8aef70bc2d879e2e0dffdc65f88
Author: Jacki <jacki@thejackimonster.de>
Date: Thu, 4 Jan 2024 18:14:46 +0100
Format more code
Signed-off-by: Jacki <jacki@thejackimonster.de>
Diffstat:
28 files changed, 654 insertions(+), 622 deletions(-)
diff --git a/src/gnunet_chat_account.c b/src/gnunet_chat_account.c
@@ -1,6 +1,6 @@
/*
This file is part of GNUnet.
- Copyright (C) 2022--2023 GNUnet e.V.
+ Copyright (C) 2022--2024 GNUnet e.V.
GNUnet is free software: you can redistribute it and/or modify it
under the terms of the GNU Affero General Public License as published
@@ -27,7 +27,7 @@
struct GNUNET_CHAT_Account*
account_create_from_ego(struct GNUNET_IDENTITY_Ego *ego,
- const char *name)
+ const char *name)
{
GNUNET_assert((ego) && (name));
@@ -46,7 +46,7 @@ account_create_from_ego(struct GNUNET_IDENTITY_Ego *ego,
void
account_update_directory (struct GNUNET_CHAT_Account *account,
- const char *base_directory)
+ const char *base_directory)
{
GNUNET_assert((account) && (base_directory));
diff --git a/src/gnunet_chat_account.h b/src/gnunet_chat_account.h
@@ -1,6 +1,6 @@
/*
This file is part of GNUnet.
- Copyright (C) 2022 GNUnet e.V.
+ Copyright (C) 2022--2024 GNUnet e.V.
GNUnet is free software: you can redistribute it and/or modify it
under the terms of the GNU Affero General Public License as published
@@ -47,7 +47,7 @@ struct GNUNET_CHAT_Account
*/
struct GNUNET_CHAT_Account*
account_create_from_ego(struct GNUNET_IDENTITY_Ego *ego,
- const char *name);
+ const char *name);
/**
* Updates the stored directory path by a chat <i>account</i>
@@ -58,7 +58,7 @@ account_create_from_ego(struct GNUNET_IDENTITY_Ego *ego,
*/
void
account_update_directory (struct GNUNET_CHAT_Account *account,
- const char *base_directory);
+ const char *base_directory);
/**
* Destroys a chat <i>account</i> and frees its memory.
diff --git a/src/gnunet_chat_contact.c b/src/gnunet_chat_contact.c
@@ -30,7 +30,7 @@
struct GNUNET_CHAT_Contact*
contact_create_from_member (struct GNUNET_CHAT_Handle *handle,
- const struct GNUNET_MESSENGER_Contact *member)
+ const struct GNUNET_MESSENGER_Contact *member)
{
GNUNET_assert((handle) && (member));
@@ -84,18 +84,18 @@ contact_find_context (const struct GNUNET_CHAT_Contact *contact)
find.room = NULL;
GNUNET_MESSENGER_find_rooms(
- contact->handle->messenger,
- contact->member,
- it_contact_find_room,
- &find
+ contact->handle->messenger,
+ contact->member,
+ it_contact_find_room,
+ &find
);
if (!(find.room))
return NULL;
return GNUNET_CONTAINER_multihashmap_get(
- contact->handle->contexts,
- GNUNET_MESSENGER_room_get_key(find.room)
+ contact->handle->contexts,
+ GNUNET_MESSENGER_room_get_key(find.room)
);
}
diff --git a/src/gnunet_chat_contact.h b/src/gnunet_chat_contact.h
@@ -56,7 +56,7 @@ struct GNUNET_CHAT_Contact
*/
struct GNUNET_CHAT_Contact*
contact_create_from_member (struct GNUNET_CHAT_Handle *handle,
- const struct GNUNET_MESSENGER_Contact *member);
+ const struct GNUNET_MESSENGER_Contact *member);
/**
* Updates the string representation of the public key from
diff --git a/src/gnunet_chat_contact_intern.c b/src/gnunet_chat_contact_intern.c
@@ -1,6 +1,6 @@
/*
This file is part of GNUnet.
- Copyright (C) 2021 GNUnet e.V.
+ Copyright (C) 2021--2024 GNUnet e.V.
GNUnet is free software: you can redistribute it and/or modify it
under the terms of the GNU Affero General Public License as published
@@ -34,8 +34,8 @@ struct GNUNET_CHAT_ContactFindRoom
int
it_contact_find_room (void *cls,
- struct GNUNET_MESSENGER_Room *room,
- GNUNET_UNUSED const struct GNUNET_MESSENGER_Contact *member)
+ struct GNUNET_MESSENGER_Room *room,
+ GNUNET_UNUSED const struct GNUNET_MESSENGER_Contact *member)
{
GNUNET_assert((cls) && (room));
diff --git a/src/gnunet_chat_context.c b/src/gnunet_chat_context.c
@@ -1,6 +1,6 @@
/*
This file is part of GNUnet.
- Copyright (C) 2021--2023 GNUnet e.V.
+ Copyright (C) 2021--2024 GNUnet e.V.
GNUnet is free software: you can redistribute it and/or modify it
under the terms of the GNU Affero General Public License as published
@@ -23,7 +23,6 @@
*/
#include "gnunet_chat_context.h"
-#include "gnunet_chat_group.h"
#include "gnunet_chat_handle.h"
#include "gnunet_chat_util.h"
@@ -35,7 +34,7 @@ static const unsigned int initial_map_size_of_contact = 4;
struct GNUNET_CHAT_Context*
context_create_from_room (struct GNUNET_CHAT_Handle *handle,
- struct GNUNET_MESSENGER_Room *room)
+ struct GNUNET_MESSENGER_Room *room)
{
GNUNET_assert((handle) && (room));
@@ -49,13 +48,13 @@ context_create_from_room (struct GNUNET_CHAT_Handle *handle,
context->deleted = GNUNET_NO;
context->timestamps = GNUNET_CONTAINER_multishortmap_create(
- initial_map_size_of_room, GNUNET_NO);
+ initial_map_size_of_room, GNUNET_NO);
context->messages = GNUNET_CONTAINER_multihashmap_create(
- initial_map_size_of_room, GNUNET_NO);
+ initial_map_size_of_room, GNUNET_NO);
context->invites = GNUNET_CONTAINER_multihashmap_create(
- initial_map_size_of_room, GNUNET_NO);
+ initial_map_size_of_room, GNUNET_NO);
context->files = GNUNET_CONTAINER_multihashmap_create(
- initial_map_size_of_room, GNUNET_NO);
+ initial_map_size_of_room, GNUNET_NO);
context->room = room;
context->contact = NULL;
@@ -63,7 +62,7 @@ context_create_from_room (struct GNUNET_CHAT_Handle *handle,
context->user_pointer = NULL;
context->member_pointers = GNUNET_CONTAINER_multishortmap_create(
- initial_map_size_of_room, GNUNET_NO);
+ initial_map_size_of_room, GNUNET_NO);
context->query = NULL;
@@ -72,7 +71,7 @@ context_create_from_room (struct GNUNET_CHAT_Handle *handle,
struct GNUNET_CHAT_Context*
context_create_from_contact (struct GNUNET_CHAT_Handle *handle,
- const struct GNUNET_MESSENGER_Contact *contact)
+ const struct GNUNET_MESSENGER_Contact *contact)
{
GNUNET_assert((handle) && (contact));
@@ -86,13 +85,13 @@ context_create_from_contact (struct GNUNET_CHAT_Handle *handle,
context->deleted = GNUNET_NO;
context->timestamps = GNUNET_CONTAINER_multishortmap_create(
- initial_map_size_of_contact, GNUNET_NO);
+ initial_map_size_of_contact, GNUNET_NO);
context->messages = GNUNET_CONTAINER_multihashmap_create(
- initial_map_size_of_contact, GNUNET_NO);
+ initial_map_size_of_contact, GNUNET_NO);
context->invites = GNUNET_CONTAINER_multihashmap_create(
- initial_map_size_of_contact, GNUNET_NO);
+ initial_map_size_of_contact, GNUNET_NO);
context->files = GNUNET_CONTAINER_multihashmap_create(
- initial_map_size_of_contact, GNUNET_NO);
+ initial_map_size_of_contact, GNUNET_NO);
context->room = NULL;
context->contact = contact;
@@ -100,7 +99,7 @@ context_create_from_contact (struct GNUNET_CHAT_Handle *handle,
context->user_pointer = NULL;
context->member_pointers = GNUNET_CONTAINER_multishortmap_create(
- initial_map_size_of_contact, GNUNET_NO);
+ initial_map_size_of_contact, GNUNET_NO);
context->query = NULL;
@@ -110,25 +109,27 @@ context_create_from_contact (struct GNUNET_CHAT_Handle *handle,
void
context_destroy (struct GNUNET_CHAT_Context *context)
{
- GNUNET_assert((context) &&
+ GNUNET_assert(
+ (context) &&
(context->timestamps) &&
(context->messages) &&
(context->invites) &&
- (context->files));
+ (context->files)
+ );
if (context->query)
GNUNET_NAMESTORE_cancel(context->query);
GNUNET_CONTAINER_multishortmap_iterate(
- context->timestamps, it_destroy_context_timestamps, NULL
+ context->timestamps, it_destroy_context_timestamps, NULL
);
GNUNET_CONTAINER_multihashmap_iterate(
- context->messages, it_destroy_context_messages, NULL
+ context->messages, it_destroy_context_messages, NULL
);
GNUNET_CONTAINER_multihashmap_iterate(
- context->invites, it_destroy_context_invites, NULL
+ context->invites, it_destroy_context_invites, NULL
);
GNUNET_CONTAINER_multishortmap_destroy(context->member_pointers);
@@ -146,7 +147,7 @@ context_destroy (struct GNUNET_CHAT_Context *context)
void
context_update_room (struct GNUNET_CHAT_Context *context,
- struct GNUNET_MESSENGER_Room *room)
+ struct GNUNET_MESSENGER_Room *room)
{
GNUNET_assert(context);
@@ -154,20 +155,20 @@ context_update_room (struct GNUNET_CHAT_Context *context,
return;
GNUNET_CONTAINER_multishortmap_iterate(
- context->timestamps, it_destroy_context_timestamps, NULL
+ context->timestamps, it_destroy_context_timestamps, NULL
);
GNUNET_CONTAINER_multihashmap_iterate(
- context->messages, it_destroy_context_messages, NULL
+ context->messages, it_destroy_context_messages, NULL
);
GNUNET_CONTAINER_multihashmap_iterate(
- context->invites, it_destroy_context_invites, NULL
+ context->invites, it_destroy_context_invites, NULL
);
GNUNET_CONTAINER_multishortmap_destroy(context->timestamps);
context->timestamps = GNUNET_CONTAINER_multishortmap_create(
- initial_map_size_of_room, GNUNET_NO);
+ initial_map_size_of_room, GNUNET_NO);
GNUNET_CONTAINER_multihashmap_clear(context->messages);
GNUNET_CONTAINER_multihashmap_clear(context->invites);
@@ -183,7 +184,7 @@ context_update_room (struct GNUNET_CHAT_Context *context,
void
context_update_nick (struct GNUNET_CHAT_Context *context,
- const char *nick)
+ const char *nick)
{
GNUNET_assert(context);
@@ -198,21 +199,20 @@ context_update_nick (struct GNUNET_CHAT_Context *context,
return;
handle_send_internal_message(
- context->handle,
- context,
- GNUNET_CHAT_FLAG_UPDATE,
- NULL
+ context->handle,
+ context,
+ GNUNET_CHAT_FLAG_UPDATE,
+ NULL
);
}
void
context_read_records (struct GNUNET_CHAT_Context *context,
- const char *label,
- unsigned int count,
- const struct GNUNET_GNSRECORD_Data *data)
+ const char *label,
+ unsigned int count,
+ const struct GNUNET_GNSRECORD_Data *data)
{
- GNUNET_assert((context) &&
- (context->room));
+ GNUNET_assert((context) && (context->room));
char *nick = NULL;
char *topic = NULL;
@@ -226,7 +226,7 @@ context_read_records (struct GNUNET_CHAT_Context *context,
if (GNUNET_GNSRECORD_TYPE_MESSENGER_ROOM_DETAILS == data[i].record_type)
{
if (nick)
- continue;
+ continue;
const struct GNUNET_MESSENGER_RoomDetailsRecord *record = data[i].data;
@@ -237,7 +237,7 @@ context_read_records (struct GNUNET_CHAT_Context *context,
if (GNUNET_DNSPARSER_TYPE_TXT == data[i].record_type)
{
if (topic)
- continue;
+ continue;
topic = GNUNET_strndup(data[i].data, data[i].data_size);
}
@@ -249,7 +249,7 @@ context_read_records (struct GNUNET_CHAT_Context *context,
GNUNET_free(nick);
const struct GNUNET_HashCode *hash = GNUNET_MESSENGER_room_get_key(
- context->room
+ context->room
);
if (topic)
@@ -275,19 +275,17 @@ context_read_records (struct GNUNET_CHAT_Context *context,
void
context_write_records (struct GNUNET_CHAT_Context *context)
{
- GNUNET_assert((context) &&
- (context->handle) &&
- (context->room));
+ GNUNET_assert((context) && (context->handle) && (context->room));
const struct GNUNET_CRYPTO_PrivateKey *zone = handle_get_key(
- context->handle
+ context->handle
);
if (!zone)
return;
const struct GNUNET_HashCode *hash = GNUNET_MESSENGER_room_get_key(
- context->room
+ context->room
);
struct GNUNET_TIME_Absolute expiration = GNUNET_TIME_absolute_get_forever_();
@@ -296,9 +294,9 @@ context_write_records (struct GNUNET_CHAT_Context *context)
GNUNET_CRYPTO_get_peer_identity(context->handle->cfg, &(room_entry.door));
GNUNET_memcpy(
- &(room_entry.key),
- hash,
- sizeof(room_entry.key)
+ &(room_entry.key),
+ hash,
+ sizeof(room_entry.key)
);
struct GNUNET_MESSENGER_RoomDetailsRecord room_details;
@@ -339,8 +337,8 @@ context_write_records (struct GNUNET_CHAT_Context *context)
data[count].data_size = sizeof(room_details);
data[count].expiration_time = expiration.abs_value_us;
data[count].flags = (
- GNUNET_GNSRECORD_RF_PRIVATE |
- GNUNET_GNSRECORD_RF_SUPPLEMENTAL
+ GNUNET_GNSRECORD_RF_PRIVATE |
+ GNUNET_GNSRECORD_RF_SUPPLEMENTAL
);
count++;
@@ -353,8 +351,8 @@ context_write_records (struct GNUNET_CHAT_Context *context)
data[count].data_size = strlen(topic);
data[count].expiration_time = expiration.abs_value_us;
data[count].flags = (
- GNUNET_GNSRECORD_RF_PRIVATE |
- GNUNET_GNSRECORD_RF_SUPPLEMENTAL
+ GNUNET_GNSRECORD_RF_PRIVATE |
+ GNUNET_GNSRECORD_RF_SUPPLEMENTAL
);
count++;
@@ -365,13 +363,13 @@ skip_record_data:
GNUNET_NAMESTORE_cancel(context->query);
context->query = GNUNET_NAMESTORE_record_set_store(
- context->handle->namestore,
- zone,
- label,
- count,
- data,
- cont_context_write_records,
- context
+ context->handle->namestore,
+ zone,
+ label,
+ count,
+ data,
+ cont_context_write_records,
+ context
);
GNUNET_free(label);
diff --git a/src/gnunet_chat_context.h b/src/gnunet_chat_context.h
@@ -1,6 +1,6 @@
/*
This file is part of GNUnet.
- Copyright (C) 2021--2022 GNUnet e.V.
+ Copyright (C) 2021--2024 GNUnet e.V.
GNUnet is free software: you can redistribute it and/or modify it
under the terms of the GNU Affero General Public License as published
@@ -67,7 +67,7 @@ struct GNUNET_CHAT_Context
*/
struct GNUNET_CHAT_Context*
context_create_from_room (struct GNUNET_CHAT_Handle *handle,
- struct GNUNET_MESSENGER_Room *room);
+ struct GNUNET_MESSENGER_Room *room);
/**
* Creates a chat context from a messenger <i>contact</i>
@@ -79,7 +79,7 @@ context_create_from_room (struct GNUNET_CHAT_Handle *handle,
*/
struct GNUNET_CHAT_Context*
context_create_from_contact (struct GNUNET_CHAT_Handle *handle,
- const struct GNUNET_MESSENGER_Contact *contact);
+ const struct GNUNET_MESSENGER_Contact *contact);
/**
* Destroys a chat <i>context</i> and frees its memory.
@@ -98,7 +98,7 @@ context_destroy (struct GNUNET_CHAT_Context* context);
*/
void
context_update_room (struct GNUNET_CHAT_Context *context,
- struct GNUNET_MESSENGER_Room *room);
+ struct GNUNET_MESSENGER_Room *room);
/**
* Updates the <i>nick</i> of a selected chat <i>context</i>.
@@ -108,7 +108,7 @@ context_update_room (struct GNUNET_CHAT_Context *context,
*/
void
context_update_nick (struct GNUNET_CHAT_Context *context,
- const char *nick);
+ const char *nick);
/**
* Reads the <i>data</i> of records under a given <i>label</i>
@@ -121,9 +121,9 @@ context_update_nick (struct GNUNET_CHAT_Context *context,
*/
void
context_read_records (struct GNUNET_CHAT_Context *context,
- const char *label,
- unsigned int count,
- const struct GNUNET_GNSRECORD_Data *data);
+ const char *label,
+ unsigned int count,
+ const struct GNUNET_GNSRECORD_Data *data);
/**
* Writes the data from a selected chat <i>context</i> into
diff --git a/src/gnunet_chat_context_intern.c b/src/gnunet_chat_context_intern.c
@@ -1,6 +1,6 @@
/*
This file is part of GNUnet.
- Copyright (C) 2021 GNUnet e.V.
+ Copyright (C) 2021--2024 GNUnet e.V.
GNUnet is free software: you can redistribute it and/or modify it
under the terms of the GNU Affero General Public License as published
@@ -31,8 +31,8 @@
int
it_destroy_context_timestamps (GNUNET_UNUSED void *cls,
- GNUNET_UNUSED const struct GNUNET_ShortHashCode *key,
- void *value)
+ GNUNET_UNUSED const struct GNUNET_ShortHashCode *key,
+ void *value)
{
GNUNET_assert(value);
@@ -43,8 +43,8 @@ it_destroy_context_timestamps (GNUNET_UNUSED void *cls,
int
it_destroy_context_messages (GNUNET_UNUSED void *cls,
- GNUNET_UNUSED const struct GNUNET_HashCode *key,
- void *value)
+ GNUNET_UNUSED const struct GNUNET_HashCode *key,
+ void *value)
{
GNUNET_assert(value);
@@ -55,8 +55,8 @@ it_destroy_context_messages (GNUNET_UNUSED void *cls,
int
it_destroy_context_invites (GNUNET_UNUSED void *cls,
- GNUNET_UNUSED const struct GNUNET_HashCode *key,
- void *value)
+ GNUNET_UNUSED const struct GNUNET_HashCode *key,
+ void *value)
{
GNUNET_assert(value);
@@ -67,7 +67,7 @@ it_destroy_context_invites (GNUNET_UNUSED void *cls,
void
cont_context_write_records (void *cls,
- enum GNUNET_ErrorCode ec)
+ enum GNUNET_ErrorCode ec)
{
struct GNUNET_CHAT_Context *context = cls;
@@ -77,9 +77,9 @@ cont_context_write_records (void *cls,
if (GNUNET_EC_NONE != ec)
handle_send_internal_message(
- context->handle,
- context,
- GNUNET_CHAT_FLAG_WARNING,
- GNUNET_ErrorCode_get_hint(ec)
+ context->handle,
+ context,
+ GNUNET_CHAT_FLAG_WARNING,
+ GNUNET_ErrorCode_get_hint(ec)
);
}
diff --git a/src/gnunet_chat_file.c b/src/gnunet_chat_file.c
@@ -1,6 +1,6 @@
/*
This file is part of GNUnet.
- Copyright (C) 2021--2022 GNUnet e.V.
+ Copyright (C) 2021--2024 GNUnet e.V.
GNUnet is free software: you can redistribute it and/or modify it
under the terms of the GNU Affero General Public License as published
@@ -30,11 +30,9 @@
struct GNUNET_CHAT_File*
file_create_from_message (struct GNUNET_CHAT_Handle *handle,
- const struct GNUNET_MESSENGER_MessageFile *message)
+ const struct GNUNET_MESSENGER_MessageFile *message)
{
- GNUNET_assert((handle) &&
- (message) &&
- (message->name));
+ GNUNET_assert((handle) && (message) && (message->name));
struct GNUNET_CHAT_File* file = GNUNET_new(struct GNUNET_CHAT_File);
@@ -71,14 +69,11 @@ file_create_from_message (struct GNUNET_CHAT_Handle *handle,
struct GNUNET_CHAT_File*
file_create_from_disk (struct GNUNET_CHAT_Handle *handle,
- const char *name,
- const struct GNUNET_HashCode *hash,
- const struct GNUNET_CRYPTO_SymmetricSessionKey *key)
+ const char *name,
+ const struct GNUNET_HashCode *hash,
+ const struct GNUNET_CRYPTO_SymmetricSessionKey *key)
{
- GNUNET_assert((handle) &&
- (name) &&
- (hash) &&
- (key));
+ GNUNET_assert((handle) && (name) && (hash) && (key));
struct GNUNET_CHAT_File* file = GNUNET_new(struct GNUNET_CHAT_File);
@@ -124,9 +119,9 @@ file_destroy (struct GNUNET_CHAT_File *file)
upload = file->upload_head;
GNUNET_CONTAINER_DLL_remove(
- file->upload_head,
- file->upload_tail,
- upload
+ file->upload_head,
+ file->upload_tail,
+ upload
);
GNUNET_free(upload);
@@ -138,9 +133,9 @@ file_destroy (struct GNUNET_CHAT_File *file)
download = file->download_head;
GNUNET_CONTAINER_DLL_remove(
- file->download_head,
- file->download_tail,
- download
+ file->download_head,
+ file->download_tail,
+ download
);
GNUNET_free(download);
@@ -152,9 +147,9 @@ file_destroy (struct GNUNET_CHAT_File *file)
unindex = file->unindex_head;
GNUNET_CONTAINER_DLL_remove(
- file->unindex_head,
- file->unindex_tail,
- unindex
+ file->unindex_head,
+ file->unindex_tail,
+ unindex
);
GNUNET_free(unindex);
@@ -174,14 +169,14 @@ file_destroy (struct GNUNET_CHAT_File *file)
void
file_bind_upload (struct GNUNET_CHAT_File *file,
- struct GNUNET_CHAT_Context *context,
- GNUNET_CHAT_FileUploadCallback cb,
- void *cls)
+ struct GNUNET_CHAT_Context *context,
+ GNUNET_CHAT_FileUploadCallback cb,
+ void *cls)
{
GNUNET_assert(file);
struct GNUNET_CHAT_FileUpload *upload = GNUNET_new(
- struct GNUNET_CHAT_FileUpload
+ struct GNUNET_CHAT_FileUpload
);
upload->context = context;
@@ -189,58 +184,58 @@ file_bind_upload (struct GNUNET_CHAT_File *file,
upload->cls = cls;
GNUNET_CONTAINER_DLL_insert(
- file->upload_head,
- file->upload_tail,
- upload
+ file->upload_head,
+ file->upload_tail,
+ upload
);
}
void
file_bind_downlaod (struct GNUNET_CHAT_File *file,
- GNUNET_CHAT_FileDownloadCallback cb,
- void *cls)
+ GNUNET_CHAT_FileDownloadCallback cb,
+ void *cls)
{
GNUNET_assert(file);
struct GNUNET_CHAT_FileDownload *download = GNUNET_new(
- struct GNUNET_CHAT_FileDownload
+ struct GNUNET_CHAT_FileDownload
);
download->callback = cb;
download->cls = cls;
GNUNET_CONTAINER_DLL_insert(
- file->download_head,
- file->download_tail,
- download
+ file->download_head,
+ file->download_tail,
+ download
);
}
void
file_bind_unindex (struct GNUNET_CHAT_File *file,
- GNUNET_CHAT_FileUnindexCallback cb,
- void *cls)
+ GNUNET_CHAT_FileUnindexCallback cb,
+ void *cls)
{
GNUNET_assert(file);
struct GNUNET_CHAT_FileUnindex *unindex = GNUNET_new(
- struct GNUNET_CHAT_FileUnindex
+ struct GNUNET_CHAT_FileUnindex
);
unindex->callback = cb;
unindex->cls = cls;
GNUNET_CONTAINER_DLL_insert(
- file->unindex_head,
- file->unindex_tail,
- unindex
+ file->unindex_head,
+ file->unindex_tail,
+ unindex
);
}
void
file_update_upload (struct GNUNET_CHAT_File *file,
- uint64_t completed,
- uint64_t size)
+ uint64_t completed,
+ uint64_t size)
{
GNUNET_assert(file);
@@ -284,14 +279,14 @@ file_update_upload (struct GNUNET_CHAT_File *file,
GNUNET_free(msg.body.file.uri);
file->status &= (
- GNUNET_CHAT_FILE_STATUS_MASK ^ GNUNET_CHAT_FILE_STATUS_PUBLISH
+ GNUNET_CHAT_FILE_STATUS_MASK ^ GNUNET_CHAT_FILE_STATUS_PUBLISH
);
}
void
file_update_download (struct GNUNET_CHAT_File *file,
- uint64_t completed,
- uint64_t size)
+ uint64_t completed,
+ uint64_t size)
{
GNUNET_assert(file);
@@ -324,14 +319,14 @@ file_update_download (struct GNUNET_CHAT_File *file,
}
file->status &= (
- GNUNET_CHAT_FILE_STATUS_MASK ^ GNUNET_CHAT_FILE_STATUS_DOWNLOAD
+ GNUNET_CHAT_FILE_STATUS_MASK ^ GNUNET_CHAT_FILE_STATUS_DOWNLOAD
);
}
void
file_update_unindex (struct GNUNET_CHAT_File *file,
- uint64_t completed,
- uint64_t size)
+ uint64_t completed,
+ uint64_t size)
{
GNUNET_assert(file);
@@ -364,6 +359,6 @@ file_update_unindex (struct GNUNET_CHAT_File *file,
}
file->status &= (
- GNUNET_CHAT_FILE_STATUS_MASK ^ GNUNET_CHAT_FILE_STATUS_UNINDEX
+ GNUNET_CHAT_FILE_STATUS_MASK ^ GNUNET_CHAT_FILE_STATUS_UNINDEX
);
}
diff --git a/src/gnunet_chat_file.h b/src/gnunet_chat_file.h
@@ -1,6 +1,6 @@
/*
This file is part of GNUnet.
- Copyright (C) 2021--2022 GNUnet e.V.
+ Copyright (C) 2021--2024 GNUnet e.V.
GNUnet is free software: you can redistribute it and/or modify it
under the terms of the GNU Affero General Public License as published
@@ -110,7 +110,7 @@ struct GNUNET_CHAT_File
*/
struct GNUNET_CHAT_File*
file_create_from_message (struct GNUNET_CHAT_Handle *handle,
- const struct GNUNET_MESSENGER_MessageFile *message);
+ const struct GNUNET_MESSENGER_MessageFile *message);
/**
* Creates a chat file handle from a local file on disk
@@ -126,9 +126,9 @@ file_create_from_message (struct GNUNET_CHAT_Handle *handle,
*/
struct GNUNET_CHAT_File*
file_create_from_disk (struct GNUNET_CHAT_Handle *handle,
- const char *name,
- const struct GNUNET_HashCode *hash,
- const struct GNUNET_CRYPTO_SymmetricSessionKey *key);
+ const char *name,
+ const struct GNUNET_HashCode *hash,
+ const struct GNUNET_CRYPTO_SymmetricSessionKey *key);
/**
* Destroys a chat <i>file</i> handle and frees its memory.
@@ -150,9 +150,9 @@ file_destroy (struct GNUNET_CHAT_File *file);
*/
void
file_bind_upload (struct GNUNET_CHAT_File *file,
- struct GNUNET_CHAT_Context *context,
- GNUNET_CHAT_FileUploadCallback cb,
- void *cls);
+ struct GNUNET_CHAT_Context *context,
+ GNUNET_CHAT_FileUploadCallback cb,
+ void *cls);
/**
* Binds a callback and a closure to a given chat <i>file</i>
@@ -165,8 +165,8 @@ file_bind_upload (struct GNUNET_CHAT_File *file,
*/
void
file_bind_downlaod (struct GNUNET_CHAT_File *file,
- GNUNET_CHAT_FileDownloadCallback cb,
- void *cls);
+ GNUNET_CHAT_FileDownloadCallback cb,
+ void *cls);
/**
* Binds a callback and a closure to a given chat <i>file</i>
@@ -179,8 +179,8 @@ file_bind_downlaod (struct GNUNET_CHAT_File *file,
*/
void
file_bind_unindex (struct GNUNET_CHAT_File *file,
- GNUNET_CHAT_FileUnindexCallback cb,
- void *cls);
+ GNUNET_CHAT_FileUnindexCallback cb,
+ void *cls);
/**
* Calls the regarding events and bound callback of a given
@@ -194,8 +194,8 @@ file_bind_unindex (struct GNUNET_CHAT_File *file,
*/
void
file_update_upload (struct GNUNET_CHAT_File *file,
- uint64_t completed,
- uint64_t size);
+ uint64_t completed,
+ uint64_t size);
/**
* Calls the regarding events and bound callback of a given
@@ -209,8 +209,8 @@ file_update_upload (struct GNUNET_CHAT_File *file,
*/
void
file_update_download (struct GNUNET_CHAT_File *file,
- uint64_t completed,
- uint64_t size);
+ uint64_t completed,
+ uint64_t size);
/**
* Calls the regarding events and bound callback of a given
@@ -224,7 +224,7 @@ file_update_download (struct GNUNET_CHAT_File *file,
*/
void
file_update_unindex (struct GNUNET_CHAT_File *file,
- uint64_t completed,
- uint64_t size);
+ uint64_t completed,
+ uint64_t size);
#endif /* GNUNET_CHAT_FILE_H_ */
diff --git a/src/gnunet_chat_group.c b/src/gnunet_chat_group.c
@@ -1,6 +1,6 @@
/*
This file is part of GNUnet.
- Copyright (C) 2021--2023 GNUnet e.V.
+ Copyright (C) 2021--2024 GNUnet e.V.
GNUnet is free software: you can redistribute it and/or modify it
under the terms of the GNU Affero General Public License as published
@@ -32,7 +32,7 @@ static const uint16_t group_regex_compression = 6;
struct GNUNET_CHAT_Group*
group_create_from_context (struct GNUNET_CHAT_Handle *handle,
- struct GNUNET_CHAT_Context *context)
+ struct GNUNET_CHAT_Context *context)
{
GNUNET_assert((handle) && (context));
@@ -45,7 +45,7 @@ group_create_from_context (struct GNUNET_CHAT_Handle *handle,
group->search = NULL;
group->registry = GNUNET_CONTAINER_multipeermap_create(
- initial_map_size_of_context, GNUNET_NO);
+ initial_map_size_of_context, GNUNET_NO);
group->user_pointer = NULL;
@@ -72,28 +72,30 @@ group_destroy (struct GNUNET_CHAT_Group* group)
void
group_publish (struct GNUNET_CHAT_Group* group)
{
- GNUNET_assert((group) &&
+ GNUNET_assert(
+ (group) &&
(group->context) &&
(group->context->topic) &&
(group->handle) &&
- (group->handle->cfg));
+ (group->handle->cfg)
+ );
char* topic = NULL;
GNUNET_asprintf (
- &topic,
- "GNUNET_CHAT_%s",
- group->context->topic
+ &topic,
+ "GNUNET_CHAT_%s",
+ group->context->topic
);
group->announcement = GNUNET_REGEX_announce(
- group->handle->cfg, topic,
- GNUNET_TIME_relative_get_minute_(),
- group_regex_compression
+ group->handle->cfg, topic,
+ GNUNET_TIME_relative_get_minute_(),
+ group_regex_compression
);
group->search = GNUNET_REGEX_search(
- group->handle->cfg, topic,
- search_group_by_topic, group
+ group->handle->cfg, topic,
+ search_group_by_topic, group
);
GNUNET_free(topic);
diff --git a/src/gnunet_chat_group.h b/src/gnunet_chat_group.h
@@ -1,6 +1,6 @@
/*
This file is part of GNUnet.
- Copyright (C) 2021--2022 GNUnet e.V.
+ Copyright (C) 2021--2024 GNUnet e.V.
GNUnet is free software: you can redistribute it and/or modify it
under the terms of the GNU Affero General Public License as published
@@ -54,7 +54,7 @@ struct GNUNET_CHAT_Group
*/
struct GNUNET_CHAT_Group*
group_create_from_context (struct GNUNET_CHAT_Handle *handle,
- struct GNUNET_CHAT_Context *context);
+ struct GNUNET_CHAT_Context *context);
/**
* Destroys a chat <i>group</i> and frees its memory.
diff --git a/src/gnunet_chat_group_intern.c b/src/gnunet_chat_group_intern.c
@@ -1,6 +1,6 @@
/*
This file is part of GNUnet.
- Copyright (C) 2021--2023 GNUnet e.V.
+ Copyright (C) 2021--2024 GNUnet e.V.
GNUnet is free software: you can redistribute it and/or modify it
under the terms of the GNU Affero General Public License as published
@@ -30,19 +30,21 @@
void
search_group_by_topic(void *cls,
const struct GNUNET_PeerIdentity *door,
- GNUNET_UNUSED const struct GNUNET_PeerIdentity *get_path,
- GNUNET_UNUSED unsigned int get_path_length,
- GNUNET_UNUSED const struct GNUNET_PeerIdentity *put_path,
- GNUNET_UNUSED unsigned int put_path_length)
+ GNUNET_UNUSED const struct GNUNET_PeerIdentity *get_path,
+ GNUNET_UNUSED unsigned int get_path_length,
+ GNUNET_UNUSED const struct GNUNET_PeerIdentity *put_path,
+ GNUNET_UNUSED unsigned int put_path_length)
{
struct GNUNET_CHAT_Group *group = cls;
- GNUNET_assert((group) &&
+ GNUNET_assert(
+ (group) &&
(group->handle) &&
(group->handle->cfg) &&
(group->handle->messenger) &&
(group->context) &&
- (group->context->room));
+ (group->context->room)
+ );
struct GNUNET_PeerIdentity peer;
GNUNET_CRYPTO_get_peer_identity(group->handle->cfg, &peer);
@@ -51,7 +53,7 @@ search_group_by_topic(void *cls,
return;
const struct GNUNET_HashCode *key = GNUNET_MESSENGER_room_get_key(
- group->context->room
+ group->context->room
);
if ((GNUNET_YES == GNUNET_CONTAINER_multipeermap_contains(
@@ -62,9 +64,9 @@ search_group_by_topic(void *cls,
return;
struct GNUNET_MESSENGER_Room *room = GNUNET_MESSENGER_enter_room(
- group->handle->messenger,
- door,
- key
+ group->handle->messenger,
+ door,
+ key
);
handle_send_room_name(group->handle, room);
diff --git a/src/gnunet_chat_handle.c b/src/gnunet_chat_handle.c
@@ -1,6 +1,6 @@
/*
This file is part of GNUnet.
- Copyright (C) 2021--2023 GNUnet e.V.
+ Copyright (C) 2021--2024 GNUnet e.V.
GNUnet is free software: you can redistribute it and/or modify it
under the terms of the GNU Affero General Public License as published
@@ -31,8 +31,8 @@ static const unsigned int minimum_amount_of_other_members_in_group = 2;
struct GNUNET_CHAT_Handle*
handle_create_from_config (const struct GNUNET_CONFIGURATION_Handle* cfg,
- GNUNET_CHAT_ContextMessageCallback msg_cb,
- void *msg_cls)
+ GNUNET_CHAT_ContextMessageCallback msg_cb,
+ void *msg_cls)
{
GNUNET_assert(cfg);
@@ -40,7 +40,7 @@ handle_create_from_config (const struct GNUNET_CONFIGURATION_Handle* cfg,
handle->cfg = cfg;
handle->shutdown_hook = GNUNET_SCHEDULER_add_shutdown(
- on_handle_shutdown, handle
+ on_handle_shutdown, handle
);
handle->destruction = NULL;
@@ -61,7 +61,7 @@ handle_create_from_config (const struct GNUNET_CONFIGURATION_Handle* cfg,
handle->directory = NULL;
}
else if ((GNUNET_YES != GNUNET_DISK_directory_test(handle->directory, GNUNET_YES)) &&
- (GNUNET_OK != GNUNET_DISK_directory_create(handle->directory)))
+ (GNUNET_OK != GNUNET_DISK_directory_create(handle->directory)))
{
GNUNET_free(handle->directory);
@@ -74,7 +74,7 @@ handle_create_from_config (const struct GNUNET_CONFIGURATION_Handle* cfg,
util_get_dirname(handle->directory, "chat", &chat_directory);
if ((GNUNET_YES != GNUNET_DISK_directory_test(chat_directory, GNUNET_YES)) &&
- (GNUNET_OK != GNUNET_DISK_directory_create(chat_directory)))
+ (GNUNET_OK != GNUNET_DISK_directory_create(chat_directory)))
GNUNET_free(chat_directory);
else
{
@@ -104,21 +104,22 @@ handle_create_from_config (const struct GNUNET_CONFIGURATION_Handle* cfg,
handle->groups = NULL;
handle->arm = GNUNET_ARM_connect(
- handle->cfg,
- on_handle_arm_connection, handle
+ handle->cfg,
+ on_handle_arm_connection,
+ handle
);
if (handle->arm)
on_handle_arm_connection(handle, GNUNET_NO);
handle->identity = GNUNET_IDENTITY_connect(
- handle->cfg,
- on_handle_gnunet_identity,
- handle
+ handle->cfg,
+ on_handle_gnunet_identity,
+ handle
);
handle->namestore = GNUNET_NAMESTORE_connect(
- handle->cfg
+ handle->cfg
);
handle->fs = NULL;
@@ -212,9 +213,9 @@ handle_destroy (struct GNUNET_CHAT_Handle *handle)
message_destroy(internal->msg);
GNUNET_CONTAINER_DLL_remove(
- handle->internal_head,
- handle->internal_tail,
- internal
+ handle->internal_head,
+ handle->internal_tail,
+ internal
);
GNUNET_free(internal);
@@ -226,10 +227,12 @@ handle_destroy (struct GNUNET_CHAT_Handle *handle)
static void
handle_update_identity(struct GNUNET_CHAT_Handle *handle)
{
- GNUNET_assert((handle) &&
+ GNUNET_assert(
+ (handle) &&
(handle->contexts) &&
(handle->groups) &&
- (handle->contacts));
+ (handle->contacts)
+ );
handle_update_key(handle);
@@ -241,10 +244,10 @@ handle_update_identity(struct GNUNET_CHAT_Handle *handle)
GNUNET_assert(handle->messenger);
handle_send_internal_message(
- handle,
- NULL,
- GNUNET_CHAT_FLAG_LOGIN,
- NULL
+ handle,
+ NULL,
+ GNUNET_CHAT_FLAG_LOGIN,
+ NULL
);
const struct GNUNET_CRYPTO_PrivateKey *zone = handle_get_key(handle);
@@ -253,28 +256,30 @@ handle_update_identity(struct GNUNET_CHAT_Handle *handle)
return;
handle->monitor = GNUNET_NAMESTORE_zone_monitor_start(
- handle->cfg,
- zone,
- GNUNET_YES,
- NULL,
- NULL,
- on_monitor_namestore_record,
- handle,
- NULL,
- NULL
+ handle->cfg,
+ zone,
+ GNUNET_YES,
+ NULL,
+ NULL,
+ on_monitor_namestore_record,
+ handle,
+ NULL,
+ NULL
);
}
void
handle_connect (struct GNUNET_CHAT_Handle *handle,
- const struct GNUNET_CHAT_Account *account)
+ const struct GNUNET_CHAT_Account *account)
{
- GNUNET_assert((handle) && (account) &&
+ GNUNET_assert(
+ (handle) && (account) &&
(!(handle->current)) &&
(!(handle->groups)) &&
(!(handle->contacts)) &&
(!(handle->contexts)) &&
- (!(handle->files)));
+ (!(handle->files))
+ );
if (handle->monitor)
{
@@ -283,13 +288,13 @@ handle_connect (struct GNUNET_CHAT_Handle *handle,
}
handle->files = GNUNET_CONTAINER_multihashmap_create(
- initial_map_size_of_handle, GNUNET_NO);
+ initial_map_size_of_handle, GNUNET_NO);
handle->contexts = GNUNET_CONTAINER_multihashmap_create(
- initial_map_size_of_handle, GNUNET_NO);
+ initial_map_size_of_handle, GNUNET_NO);
handle->contacts = GNUNET_CONTAINER_multishortmap_create(
- initial_map_size_of_handle, GNUNET_NO);
+ initial_map_size_of_handle, GNUNET_NO);
handle->groups = GNUNET_CONTAINER_multihashmap_create(
- initial_map_size_of_handle, GNUNET_NO);
+ initial_map_size_of_handle, GNUNET_NO);
const char *name = account->name;
@@ -299,17 +304,17 @@ handle_connect (struct GNUNET_CHAT_Handle *handle,
char* fs_client_name = NULL;
GNUNET_asprintf (
- &fs_client_name,
- "GNUNET_CHAT_%s%s",
- name? "_" : "anonymous",
- name? name : ""
+ &fs_client_name,
+ "GNUNET_CHAT_%s%s",
+ name? "_" : "anonymous",
+ name? name : ""
);
handle->fs = GNUNET_FS_start(
- handle->cfg, fs_client_name,
- notify_handle_fs_progress, handle,
- GNUNET_FS_FLAGS_NONE,
- GNUNET_FS_OPTIONS_END
+ handle->cfg, fs_client_name,
+ notify_handle_fs_progress, handle,
+ GNUNET_FS_FLAGS_NONE,
+ GNUNET_FS_OPTIONS_END
);
GNUNET_free(fs_client_name);
@@ -317,9 +322,9 @@ handle_connect (struct GNUNET_CHAT_Handle *handle,
handle->gns = GNUNET_GNS_connect(handle->cfg);
handle->messenger = GNUNET_MESSENGER_connect(
- handle->cfg, name, key,
- on_handle_message,
- handle
+ handle->cfg, name, key,
+ on_handle_message,
+ handle
);
handle->current = account;
@@ -329,23 +334,25 @@ handle_connect (struct GNUNET_CHAT_Handle *handle,
void
handle_disconnect (struct GNUNET_CHAT_Handle *handle)
{
- GNUNET_assert((handle) &&
+ GNUNET_assert(
+ (handle) &&
(handle->current) &&
(handle->groups) &&
(handle->contacts) &&
(handle->contexts) &&
- (handle->files));
+ (handle->files)
+ );
GNUNET_CONTAINER_multihashmap_iterate(
- handle->groups, it_destroy_handle_groups, NULL
+ handle->groups, it_destroy_handle_groups, NULL
);
GNUNET_CONTAINER_multishortmap_iterate(
- handle->contacts, it_destroy_handle_contacts, NULL
+ handle->contacts, it_destroy_handle_contacts, NULL
);
GNUNET_CONTAINER_multihashmap_iterate(
- handle->contexts, it_destroy_handle_contexts, NULL
+ handle->contexts, it_destroy_handle_contexts, NULL
);
struct GNUNET_CHAT_InternalMessages *internal;
@@ -395,7 +402,7 @@ handle_disconnect (struct GNUNET_CHAT_Handle *handle)
GNUNET_GNS_disconnect(handle->gns);
GNUNET_CONTAINER_multihashmap_iterate(
- handle->files, it_destroy_handle_files, NULL
+ handle->files, it_destroy_handle_files, NULL
);
if (handle->fs)
@@ -438,7 +445,7 @@ handle_disconnect (struct GNUNET_CHAT_Handle *handle)
static struct GNUNET_CHAT_InternalAccounts*
find_accounts_by_name (struct GNUNET_CHAT_Handle *handle,
- const char *name)
+ const char *name)
{
GNUNET_assert((handle) && (name));
@@ -449,7 +456,7 @@ find_accounts_by_name (struct GNUNET_CHAT_Handle *handle,
goto skip_account;
if ((accounts->account->name) &&
- (0 == strcmp(accounts->account->name, name)))
+ (0 == strcmp(accounts->account->name, name)))
break;
skip_account:
@@ -461,9 +468,9 @@ find_accounts_by_name (struct GNUNET_CHAT_Handle *handle,
static int
update_accounts_operation (struct GNUNET_CHAT_InternalAccounts **out_accounts,
- struct GNUNET_CHAT_Handle *handle,
- const char *name,
- int wait_for_completion)
+ struct GNUNET_CHAT_Handle *handle,
+ const char *name,
+ int wait_for_completion)
{
GNUNET_assert(handle);
@@ -504,7 +511,7 @@ update_accounts_operation (struct GNUNET_CHAT_InternalAccounts **out_accounts,
int
handle_create_account (struct GNUNET_CHAT_Handle *handle,
- const char *name)
+ const char *name)
{
GNUNET_assert((handle) && (name));
@@ -514,18 +521,23 @@ handle_create_account (struct GNUNET_CHAT_Handle *handle,
if (accounts)
return GNUNET_NO;
- int result = update_accounts_operation(&accounts, handle, NULL, GNUNET_NO);
+ int result = update_accounts_operation(
+ &accounts,
+ handle,
+ NULL,
+ GNUNET_NO
+ );
if (GNUNET_OK != result)
return result;
accounts->op = GNUNET_IDENTITY_create(
- handle->identity,
- name,
- NULL,
- GNUNET_PUBLIC_KEY_TYPE_ECDSA,
- cb_account_creation,
- accounts
+ handle->identity,
+ name,
+ NULL,
+ GNUNET_PUBLIC_KEY_TYPE_ECDSA,
+ cb_account_creation,
+ accounts
);
if (!accounts->op)
@@ -536,23 +548,28 @@ handle_create_account (struct GNUNET_CHAT_Handle *handle,
int
handle_delete_account (struct GNUNET_CHAT_Handle *handle,
- const char *name)
+ const char *name)
{
GNUNET_assert((handle) && (name));
struct GNUNET_CHAT_InternalAccounts *accounts;
accounts = find_accounts_by_name(handle, name);
- int result = update_accounts_operation(&accounts, handle, NULL, GNUNET_YES);
+ int result = update_accounts_operation(
+ &accounts,
+ handle,
+ NULL,
+ GNUNET_YES
+ );
if (GNUNET_OK != result)
return result;
accounts->op = GNUNET_IDENTITY_delete(
- handle->identity,
- name,
- cb_account_deletion,
- accounts
+ handle->identity,
+ name,
+ cb_account_deletion,
+ accounts
);
if (!accounts->op)
@@ -563,25 +580,30 @@ handle_delete_account (struct GNUNET_CHAT_Handle *handle,
int
handle_rename_account (struct GNUNET_CHAT_Handle *handle,
- const char *old_name,
- const char *new_name)
+ const char *old_name,
+ const char *new_name)
{
GNUNET_assert((handle) && (old_name) && (new_name));
struct GNUNET_CHAT_InternalAccounts *accounts;
accounts = find_accounts_by_name(handle, old_name);
- int result = update_accounts_operation(&accounts, handle, NULL, GNUNET_YES);
+ int result = update_accounts_operation(
+ &accounts,
+ handle,
+ NULL,
+ GNUNET_YES
+ );
if (GNUNET_OK != result)
return result;
accounts->op = GNUNET_IDENTITY_rename(
- handle->identity,
- old_name,
- new_name,
- cb_account_rename,
- accounts
+ handle->identity,
+ old_name,
+ new_name,
+ cb_account_rename,
+ accounts
);
if (!accounts->op)
@@ -617,16 +639,21 @@ handle_update (struct GNUNET_CHAT_Handle *handle)
struct GNUNET_CHAT_InternalAccounts *accounts;
accounts = find_accounts_by_name(handle, name);
- int result = update_accounts_operation(&accounts, handle, name, GNUNET_YES);
+ int result = update_accounts_operation(
+ &accounts,
+ handle,
+ name,
+ GNUNET_YES
+ );
if (GNUNET_OK != result)
return result;
accounts->op = GNUNET_IDENTITY_delete(
- handle->identity,
- name,
- cb_account_update,
- accounts
+ handle->identity,
+ name,
+ cb_account_update,
+ accounts
);
if (!accounts->op)
@@ -644,15 +671,15 @@ handle_get_key (const struct GNUNET_CHAT_Handle *handle)
return NULL;
return GNUNET_IDENTITY_ego_get_private_key(
- handle->current->ego
+ handle->current->ego
);
}
void
handle_send_internal_message (struct GNUNET_CHAT_Handle *handle,
- struct GNUNET_CHAT_Context *context,
- enum GNUNET_CHAT_MessageFlag flag,
- const char *warning)
+ struct GNUNET_CHAT_Context *context,
+ enum GNUNET_CHAT_MessageFlag flag,
+ const char *warning)
{
GNUNET_assert((handle) && (GNUNET_CHAT_FLAG_NONE != flag));
@@ -660,11 +687,11 @@ handle_send_internal_message (struct GNUNET_CHAT_Handle *handle,
return;
struct GNUNET_CHAT_InternalMessages *internal = GNUNET_new(
- struct GNUNET_CHAT_InternalMessages
+ struct GNUNET_CHAT_InternalMessages
);
internal->msg = message_create_internally(
- context, flag, warning
+ context, flag, warning
);
if (!(internal->msg))
@@ -677,9 +704,9 @@ handle_send_internal_message (struct GNUNET_CHAT_Handle *handle,
if (context)
GNUNET_CONTAINER_DLL_insert(
- handle->internal_head,
- handle->internal_tail,
- internal
+ handle->internal_head,
+ handle->internal_tail,
+ internal
);
else
GNUNET_CONTAINER_DLL_insert_tail(
@@ -715,16 +742,18 @@ handle_send_room_name (struct GNUNET_CHAT_Handle *handle,
int
handle_request_context_by_room (struct GNUNET_CHAT_Handle *handle,
- struct GNUNET_MESSENGER_Room *room)
+ struct GNUNET_MESSENGER_Room *room)
{
- GNUNET_assert((handle) &&
+ GNUNET_assert(
+ (handle) &&
(handle->contexts) &&
- (room));
+ (room)
+ );
const struct GNUNET_HashCode *key = GNUNET_MESSENGER_room_get_key(room);
struct GNUNET_CHAT_Context *context = GNUNET_CONTAINER_multihashmap_get(
- handle->contexts, key
+ handle->contexts, key
);
struct GNUNET_CHAT_CheckHandleRoomMembers check;
@@ -752,7 +781,7 @@ check_type:
check.contact = NULL;
const int checks = GNUNET_MESSENGER_iterate_members(
- room, check_handle_room_members, &check
+ room, check_handle_room_members, &check
);
if ((check.contact) &&
@@ -779,11 +808,11 @@ check_type:
if (context->contact)
{
struct GNUNET_CHAT_Contact *contact = handle_get_contact_from_messenger(
- handle, check.contact
+ handle, check.contact
);
if ((contact) && (contact->context == context))
- contact->context = NULL;
+ contact->context = NULL;
context->contact = NULL;
}
@@ -804,14 +833,14 @@ setup_group:
group_publish(group);
if (GNUNET_OK == GNUNET_CONTAINER_multihashmap_put(
- handle->groups, key, group,
- GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST))
+ handle->groups, key, group,
+ GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST))
{
handle_send_internal_message(
- handle,
- context,
- GNUNET_CHAT_FLAG_UPDATE,
- NULL
+ handle,
+ context,
+ GNUNET_CHAT_FLAG_UPDATE,
+ NULL
);
context_write_records(context);
@@ -827,7 +856,7 @@ setup_group:
struct GNUNET_CHAT_Contact*
handle_get_contact_from_messenger (const struct GNUNET_CHAT_Handle *handle,
- const struct GNUNET_MESSENGER_Contact *contact)
+ const struct GNUNET_MESSENGER_Contact *contact)
{
GNUNET_assert((handle) && (handle->contacts) && (contact));
@@ -835,13 +864,13 @@ handle_get_contact_from_messenger (const struct GNUNET_CHAT_Handle *handle,
util_shorthash_from_member(contact, &shorthash);
return GNUNET_CONTAINER_multishortmap_get(
- handle->contacts, &shorthash
+ handle->contacts, &shorthash
);
}
struct GNUNET_CHAT_Group*
handle_get_group_from_messenger (const struct GNUNET_CHAT_Handle *handle,
- const struct GNUNET_MESSENGER_Room *room)
+ const struct GNUNET_MESSENGER_Room *room)
{
GNUNET_assert((handle) && (handle->groups) && (room));
@@ -851,15 +880,15 @@ handle_get_group_from_messenger (const struct GNUNET_CHAT_Handle *handle,
return NULL;
return GNUNET_CONTAINER_multihashmap_get(
- handle->groups, key
+ handle->groups, key
);
}
struct GNUNET_CHAT_Context*
handle_process_records (struct GNUNET_CHAT_Handle *handle,
- const char *label,
- unsigned int count,
- const struct GNUNET_GNSRECORD_Data *data)
+ const char *label,
+ unsigned int count,
+ const struct GNUNET_GNSRECORD_Data *data)
{
GNUNET_assert((handle) && (data));
@@ -885,8 +914,8 @@ handle_process_records (struct GNUNET_CHAT_Handle *handle,
return NULL;
struct GNUNET_CHAT_Context *context = GNUNET_CONTAINER_multihashmap_get(
- handle->contexts,
- &(record->key)
+ handle->contexts,
+ &(record->key)
);
if (context)
@@ -896,9 +925,9 @@ handle_process_records (struct GNUNET_CHAT_Handle *handle,
}
struct GNUNET_MESSENGER_Room *room = GNUNET_MESSENGER_enter_room(
- handle->messenger,
- &(record->door),
- &(record->key)
+ handle->messenger,
+ &(record->door),
+ &(record->key)
);
if (!room)
diff --git a/src/gnunet_chat_handle.h b/src/gnunet_chat_handle.h
@@ -1,6 +1,6 @@
/*
This file is part of GNUnet.
- Copyright (C) 2021--2023 GNUnet e.V.
+ Copyright (C) 2021--2024 GNUnet e.V.
GNUnet is free software: you can redistribute it and/or modify it
under the terms of the GNU Affero General Public License as published
@@ -134,8 +134,8 @@ struct GNUNET_CHAT_Handle
*/
struct GNUNET_CHAT_Handle*
handle_create_from_config (const struct GNUNET_CONFIGURATION_Handle* cfg,
- GNUNET_CHAT_ContextMessageCallback msg_cb,
- void *msg_cls);
+ GNUNET_CHAT_ContextMessageCallback msg_cb,
+ void *msg_cls);
/**
* Updates the string representation of the public key from
@@ -163,7 +163,7 @@ handle_destroy (struct GNUNET_CHAT_Handle *handle);
*/
void
handle_connect (struct GNUNET_CHAT_Handle *handle,
- const struct GNUNET_CHAT_Account *account);
+ const struct GNUNET_CHAT_Account *account);
/**
* Disconnects a given chat <i>handle</i> from its current
@@ -184,7 +184,7 @@ handle_disconnect (struct GNUNET_CHAT_Handle *handle);
*/
int
handle_create_account (struct GNUNET_CHAT_Handle *handle,
- const char *name);
+ const char *name);
/**
* Enqueues a deletion for a chat account with a specific
@@ -196,7 +196,7 @@ handle_create_account (struct GNUNET_CHAT_Handle *handle,
*/
int
handle_delete_account (struct GNUNET_CHAT_Handle *handle,
- const char *name);
+ const char *name);
/**
* Renames a chat account with a specific <i>old_name</i>
@@ -210,8 +210,8 @@ handle_delete_account (struct GNUNET_CHAT_Handle *handle,
*/
int
handle_rename_account (struct GNUNET_CHAT_Handle *handle,
- const char *old_name,
- const char *new_name);
+ const char *old_name,
+ const char *new_name);
/**
* Returns the main directory path to store information
@@ -256,9 +256,9 @@ handle_get_key (const struct GNUNET_CHAT_Handle *handle);
*/
void
handle_send_internal_message (struct GNUNET_CHAT_Handle *handle,
- struct GNUNET_CHAT_Context *context,
- enum GNUNET_CHAT_MessageFlag flag,
- const char *warning);
+ struct GNUNET_CHAT_Context *context,
+ enum GNUNET_CHAT_MessageFlag flag,
+ const char *warning);
/**
* Sends a name message to a messenger <i>room</i> with
@@ -269,7 +269,7 @@ handle_send_internal_message (struct GNUNET_CHAT_Handle *handle,
*/
void
handle_send_room_name (struct GNUNET_CHAT_Handle *handle,
- struct GNUNET_MESSENGER_Room *room);
+ struct GNUNET_MESSENGER_Room *room);
/**
* Checks a given chat <i>handle</i> for any chat context
@@ -282,7 +282,7 @@ handle_send_room_name (struct GNUNET_CHAT_Handle *handle,
*/
int
handle_request_context_by_room (struct GNUNET_CHAT_Handle *handle,
- struct GNUNET_MESSENGER_Room *room);
+ struct GNUNET_MESSENGER_Room *room);
/**
* Returns the chat contact registered for a given messenger
@@ -294,7 +294,7 @@ handle_request_context_by_room (struct GNUNET_CHAT_Handle *handle,
*/
struct GNUNET_CHAT_Contact*
handle_get_contact_from_messenger (const struct GNUNET_CHAT_Handle *handle,
- const struct GNUNET_MESSENGER_Contact *contact);
+ const struct GNUNET_MESSENGER_Contact *contact);
/**
* Returns the chat group registered for a given messenger
@@ -306,7 +306,7 @@ handle_get_contact_from_messenger (const struct GNUNET_CHAT_Handle *handle,
*/
struct GNUNET_CHAT_Group*
handle_get_group_from_messenger (const struct GNUNET_CHAT_Handle *handle,
- const struct GNUNET_MESSENGER_Room *room);
+ const struct GNUNET_MESSENGER_Room *room);
/**
* Processes the <i>data</i> of records under a given
@@ -322,8 +322,8 @@ handle_get_group_from_messenger (const struct GNUNET_CHAT_Handle *handle,
*/
struct GNUNET_CHAT_Context*
handle_process_records (struct GNUNET_CHAT_Handle *handle,
- const char *label,
- unsigned int count,
- const struct GNUNET_GNSRECORD_Data *data);
+ const char *label,
+ unsigned int count,
+ const struct GNUNET_GNSRECORD_Data *data);
#endif /* GNUNET_CHAT_HANDLE_H_ */
diff --git a/src/gnunet_chat_handle_intern.c b/src/gnunet_chat_handle_intern.c
@@ -57,7 +57,7 @@ on_handle_shutdown(void *cls)
void
on_handle_arm_connection(void *cls,
- int connected)
+ int connected)
{
struct GNUNET_CHAT_Handle *chat = cls;
@@ -71,15 +71,15 @@ on_handle_arm_connection(void *cls,
);
GNUNET_ARM_request_service_start(
- chat->arm, gnunet_service_name_messenger,
- GNUNET_OS_INHERIT_STD_NONE,
- NULL, NULL
+ chat->arm, gnunet_service_name_messenger,
+ GNUNET_OS_INHERIT_STD_NONE,
+ NULL, NULL
);
GNUNET_ARM_request_service_start(
- chat->arm, gnunet_service_name_fs,
- GNUNET_OS_INHERIT_STD_NONE,
- NULL, NULL
+ chat->arm, gnunet_service_name_fs,
+ GNUNET_OS_INHERIT_STD_NONE,
+ NULL, NULL
);
GNUNET_ARM_request_service_start(
@@ -95,16 +95,16 @@ on_handle_arm_connection(void *cls,
);
} else {
GNUNET_ARM_request_service_start(
- chat->arm, gnunet_service_name_arm,
- GNUNET_OS_INHERIT_STD_NONE,
- NULL, NULL
+ chat->arm, gnunet_service_name_arm,
+ GNUNET_OS_INHERIT_STD_NONE,
+ NULL, NULL
);
}
}
void*
notify_handle_fs_progress(void* cls,
- const struct GNUNET_FS_ProgressInfo* info)
+ const struct GNUNET_FS_ProgressInfo* info)
{
struct GNUNET_CHAT_Handle *chat = cls;
@@ -118,9 +118,9 @@ notify_handle_fs_progress(void* cls,
struct GNUNET_CHAT_File *file = info->value.publish.cctx;
file_update_upload(
- file,
- 0,
- info->value.publish.size
+ file,
+ 0,
+ info->value.publish.size
);
return file;
@@ -128,9 +128,9 @@ notify_handle_fs_progress(void* cls,
struct GNUNET_CHAT_File *file = info->value.publish.cctx;
file_update_upload(
- file,
- info->value.publish.completed,
- info->value.publish.size
+ file,
+ info->value.publish.completed,
+ info->value.publish.size
);
return file;
@@ -138,13 +138,13 @@ notify_handle_fs_progress(void* cls,
struct GNUNET_CHAT_File *file = info->value.publish.cctx;
file->uri = GNUNET_FS_uri_dup(
- info->value.publish.specifics.completed.chk_uri
+ info->value.publish.specifics.completed.chk_uri
);
file_update_upload(
- file,
- info->value.publish.size,
- info->value.publish.size
+ file,
+ info->value.publish.size,
+ info->value.publish.size
);
file->publish = NULL;
@@ -155,9 +155,9 @@ notify_handle_fs_progress(void* cls,
struct GNUNET_CHAT_File *file = info->value.download.cctx;
file_update_download(
- file,
- 0,
- info->value.download.size
+ file,
+ 0,
+ info->value.download.size
);
return file;
@@ -169,9 +169,9 @@ notify_handle_fs_progress(void* cls,
struct GNUNET_CHAT_File *file = info->value.download.cctx;
file_update_download(
- file,
- info->value.download.completed,
- info->value.download.size
+ file,
+ info->value.download.completed,
+ info->value.download.size
);
return file;
@@ -179,9 +179,9 @@ notify_handle_fs_progress(void* cls,
struct GNUNET_CHAT_File *file = info->value.download.cctx;
file_update_download(
- file,
- info->value.download.size,
- info->value.download.size
+ file,
+ info->value.download.size,
+ info->value.download.size
);
file->download = NULL;
@@ -192,9 +192,9 @@ notify_handle_fs_progress(void* cls,
struct GNUNET_CHAT_File *file = info->value.unindex.cctx;
file_update_unindex(
- file,
- 0,
- info->value.unindex.size
+ file,
+ 0,
+ info->value.unindex.size
);
return file;
@@ -202,9 +202,9 @@ notify_handle_fs_progress(void* cls,
struct GNUNET_CHAT_File *file = info->value.unindex.cctx;
file_update_unindex(
- file,
- info->value.unindex.completed,
- info->value.unindex.size
+ file,
+ info->value.unindex.completed,
+ info->value.unindex.size
);
return file;
@@ -212,9 +212,9 @@ notify_handle_fs_progress(void* cls,
struct GNUNET_CHAT_File *file = info->value.unindex.cctx;
file_update_unindex(
- file,
- info->value.unindex.size,
- info->value.unindex.size
+ file,
+ info->value.unindex.size,
+ info->value.unindex.size
);
file->unindex = NULL;
@@ -225,7 +225,7 @@ notify_handle_fs_progress(void* cls,
char *filename;
util_get_filename (
- directory, "files", &(file->hash), &filename
+ directory, "files", &(file->hash), &filename
);
if (GNUNET_YES == GNUNET_DISK_file_test_read(filename))
@@ -243,8 +243,8 @@ notify_handle_fs_progress(void* cls,
void
on_handle_gnunet_identity(void *cls,
- struct GNUNET_IDENTITY_Ego *ego,
- void **ctx,
+ struct GNUNET_IDENTITY_Ego *ego,
+ void **ctx,
const char *name)
{
struct GNUNET_CHAT_Handle* handle = cls;
@@ -270,34 +270,34 @@ on_handle_gnunet_identity(void *cls,
util_set_name_field(name, &(accounts->account->name));
if (handle->current == accounts->account)
- handle_send_internal_message(
- handle,
- NULL,
- GNUNET_CHAT_FLAG_LOGIN,
- NULL
- );
+ handle_send_internal_message(
+ handle,
+ NULL,
+ GNUNET_CHAT_FLAG_LOGIN,
+ NULL
+ );
}
else
{
if (handle->current == accounts->account)
- handle_disconnect(handle);
+ handle_disconnect(handle);
account_destroy(accounts->account);
if (accounts->op)
{
- accounts->account = NULL;
- goto send_refresh;
+ accounts->account = NULL;
+ goto send_refresh;
}
GNUNET_CONTAINER_DLL_remove(
- handle->accounts_head,
- handle->accounts_tail,
- accounts
+ handle->accounts_head,
+ handle->accounts_tail,
+ accounts
);
if (accounts->identifier)
- GNUNET_free(accounts->identifier);
+ GNUNET_free(accounts->identifier);
GNUNET_free(accounts);
}
@@ -306,7 +306,7 @@ on_handle_gnunet_identity(void *cls,
check_matching_name:
if ((name) && (accounts->account->name) &&
- (0 == strcmp(accounts->account->name, name)))
+ (0 == strcmp(accounts->account->name, name)))
{
accounts->account->ego = ego;
goto send_refresh;
@@ -331,9 +331,9 @@ skip_account:
account_update_directory(accounts->account, handle->directory);
GNUNET_CONTAINER_DLL_insert_tail(
- handle->accounts_head,
- handle->accounts_tail,
- accounts
+ handle->accounts_head,
+ handle->accounts_tail,
+ accounts
);
send_refresh:
@@ -342,21 +342,21 @@ send_refresh:
void
cb_account_creation (void *cls,
- const struct GNUNET_CRYPTO_PrivateKey *key,
- enum GNUNET_ErrorCode ec)
+ const struct GNUNET_CRYPTO_PrivateKey *key,
+ enum GNUNET_ErrorCode ec)
{
GNUNET_assert(cls);
struct GNUNET_CHAT_InternalAccounts *accounts = (
- (struct GNUNET_CHAT_InternalAccounts*) cls
+ (struct GNUNET_CHAT_InternalAccounts*) cls
);
struct GNUNET_CHAT_Handle *handle = accounts->handle;
GNUNET_CONTAINER_DLL_remove(
- handle->accounts_head,
- handle->accounts_tail,
- accounts
+ handle->accounts_head,
+ handle->accounts_tail,
+ accounts
);
if (accounts->identifier)
@@ -381,20 +381,20 @@ cb_account_creation (void *cls,
void
cb_account_deletion (void *cls,
- enum GNUNET_ErrorCode ec)
+ enum GNUNET_ErrorCode ec)
{
GNUNET_assert(cls);
struct GNUNET_CHAT_InternalAccounts *accounts = (
- (struct GNUNET_CHAT_InternalAccounts*) cls
+ (struct GNUNET_CHAT_InternalAccounts*) cls
);
struct GNUNET_CHAT_Handle *handle = accounts->handle;
GNUNET_CONTAINER_DLL_remove(
- handle->accounts_head,
- handle->accounts_tail,
- accounts
+ handle->accounts_head,
+ handle->accounts_tail,
+ accounts
);
if (accounts->identifier)
@@ -405,10 +405,10 @@ cb_account_deletion (void *cls,
if (GNUNET_EC_NONE != ec)
{
handle_send_internal_message(
- handle,
- NULL,
- GNUNET_CHAT_FLAG_WARNING,
- GNUNET_ErrorCode_get_hint(ec)
+ handle,
+ NULL,
+ GNUNET_CHAT_FLAG_WARNING,
+ GNUNET_ErrorCode_get_hint(ec)
);
return;
@@ -417,20 +417,20 @@ cb_account_deletion (void *cls,
void
cb_account_rename (void *cls,
- enum GNUNET_ErrorCode ec)
+ enum GNUNET_ErrorCode ec)
{
GNUNET_assert(cls);
struct GNUNET_CHAT_InternalAccounts *accounts = (
- (struct GNUNET_CHAT_InternalAccounts*) cls
+ (struct GNUNET_CHAT_InternalAccounts*) cls
);
struct GNUNET_CHAT_Handle *handle = accounts->handle;
GNUNET_CONTAINER_DLL_remove(
- handle->accounts_head,
- handle->accounts_tail,
- accounts
+ handle->accounts_head,
+ handle->accounts_tail,
+ accounts
);
if (accounts->identifier)
@@ -453,13 +453,13 @@ cb_account_rename (void *cls,
static void
cb_account_update_completion (void *cls,
- const struct GNUNET_CRYPTO_PrivateKey *key,
- enum GNUNET_ErrorCode ec)
+ const struct GNUNET_CRYPTO_PrivateKey *key,
+ enum GNUNET_ErrorCode ec)
{
GNUNET_assert(cls);
struct GNUNET_CHAT_InternalAccounts *accounts = (
- (struct GNUNET_CHAT_InternalAccounts*) cls
+ (struct GNUNET_CHAT_InternalAccounts*) cls
);
struct GNUNET_CHAT_Handle *handle = accounts->handle;
@@ -472,12 +472,12 @@ cb_account_update_completion (void *cls,
void
cb_account_update (void *cls,
- enum GNUNET_ErrorCode ec)
+ enum GNUNET_ErrorCode ec)
{
GNUNET_assert(cls);
struct GNUNET_CHAT_InternalAccounts *accounts = (
- (struct GNUNET_CHAT_InternalAccounts*) cls
+ (struct GNUNET_CHAT_InternalAccounts*) cls
);
struct GNUNET_CHAT_Handle *handle = accounts->handle;
@@ -489,19 +489,19 @@ cb_account_update (void *cls,
}
accounts->op = GNUNET_IDENTITY_create(
- handle->identity,
- accounts->identifier,
- NULL,
- GNUNET_PUBLIC_KEY_TYPE_ECDSA,
- cb_account_update_completion,
- accounts
+ handle->identity,
+ accounts->identifier,
+ NULL,
+ GNUNET_PUBLIC_KEY_TYPE_ECDSA,
+ cb_account_update_completion,
+ accounts
);
}
int
intern_provide_contact_for_member(struct GNUNET_CHAT_Handle *handle,
- const struct GNUNET_MESSENGER_Contact *member,
- struct GNUNET_CHAT_Context *context)
+ const struct GNUNET_MESSENGER_Contact *member,
+ struct GNUNET_CHAT_Context *context)
{
GNUNET_assert((handle) && (handle->contacts));
@@ -512,7 +512,7 @@ intern_provide_contact_for_member(struct GNUNET_CHAT_Handle *handle,
util_shorthash_from_member(member, &shorthash);
struct GNUNET_CHAT_Contact *contact = GNUNET_CONTAINER_multishortmap_get(
- handle->contacts, &shorthash
+ handle->contacts, &shorthash
);
if (contact)
@@ -556,7 +556,7 @@ struct GNUNET_CHAT_CheckHandleRoomMembers
int
check_handle_room_members (void* cls,
- GNUNET_UNUSED struct GNUNET_MESSENGER_Room *room,
+ GNUNET_UNUSED struct GNUNET_MESSENGER_Room *room,
const struct GNUNET_MESSENGER_Contact *member)
{
struct GNUNET_CHAT_CheckHandleRoomMembers *check = cls;
@@ -564,7 +564,7 @@ check_handle_room_members (void* cls,
GNUNET_assert((check) && (member));
const struct GNUNET_CRYPTO_PublicKey *member_key = (
- GNUNET_MESSENGER_contact_get_key(member)
+ GNUNET_MESSENGER_contact_get_key(member)
);
if ((member_key) && (check->ignore_key) &&
@@ -583,7 +583,7 @@ check_handle_room_members (void* cls,
int
scan_handle_room_members (void* cls,
- GNUNET_UNUSED struct GNUNET_MESSENGER_Room *room,
+ GNUNET_UNUSED struct GNUNET_MESSENGER_Room *room,
const struct GNUNET_MESSENGER_Contact *member)
{
struct GNUNET_CHAT_Handle *handle = cls;
@@ -596,11 +596,11 @@ scan_handle_room_members (void* cls,
void
on_monitor_namestore_record(void *cls,
- GNUNET_UNUSED const
- struct GNUNET_CRYPTO_PrivateKey *zone,
- const char *label,
- unsigned int count,
- const struct GNUNET_GNSRECORD_Data *data)
+ GNUNET_UNUSED const
+ struct GNUNET_CRYPTO_PrivateKey *zone,
+ const char *label,
+ unsigned int count,
+ const struct GNUNET_GNSRECORD_Data *data)
{
struct GNUNET_CHAT_Handle *chat = cls;
@@ -622,10 +622,12 @@ on_handle_message_callback(void *cls)
{
struct GNUNET_CHAT_Message *message = (struct GNUNET_CHAT_Message*) cls;
- GNUNET_assert((message) &&
+ GNUNET_assert(
+ (message) &&
(message->msg) &&
(message->context) &&
- (message->context->handle));
+ (message->context->handle)
+ );
message->task = NULL;
@@ -662,7 +664,7 @@ on_handle_message_callback(void *cls)
util_shorthash_from_member(sender, &shorthash);
struct GNUNET_CHAT_Contact *contact = GNUNET_CONTAINER_multishortmap_get(
- handle->contacts, &shorthash
+ handle->contacts, &shorthash
);
if ((!contact) || (GNUNET_YES == contact->blocked))
@@ -673,18 +675,20 @@ on_handle_message_callback(void *cls)
void
on_handle_message (void *cls,
- struct GNUNET_MESSENGER_Room *room,
- const struct GNUNET_MESSENGER_Contact *sender,
- const struct GNUNET_MESSENGER_Message *msg,
- const struct GNUNET_HashCode *hash,
- enum GNUNET_MESSENGER_MessageFlags flags)
+ struct GNUNET_MESSENGER_Room *room,
+ const struct GNUNET_MESSENGER_Contact *sender,
+ const struct GNUNET_MESSENGER_Message *msg,
+ const struct GNUNET_HashCode *hash,
+ enum GNUNET_MESSENGER_MessageFlags flags)
{
struct GNUNET_CHAT_Handle *handle = cls;
- GNUNET_assert((handle) &&
+ GNUNET_assert(
+ (handle) &&
(room) &&
(msg) &&
- (hash));
+ (hash)
+ );
if ((handle->destruction) ||
(GNUNET_OK != handle_request_context_by_room(handle, room)))
@@ -700,25 +704,25 @@ on_handle_message (void *cls,
return;
struct GNUNET_CHAT_Context *context = GNUNET_CONTAINER_multihashmap_get(
- handle->contexts, GNUNET_MESSENGER_room_get_key(room)
+ handle->contexts, GNUNET_MESSENGER_room_get_key(room)
);
const struct GNUNET_TIME_Absolute timestamp = GNUNET_TIME_absolute_ntoh(
- msg->header.timestamp
+ msg->header.timestamp
);
struct GNUNET_ShortHashCode shorthash;
util_shorthash_from_member(sender, &shorthash);
struct GNUNET_CHAT_Contact *contact = GNUNET_CONTAINER_multishortmap_get(
- handle->contacts, &shorthash
+ handle->contacts, &shorthash
);
if (flags & GNUNET_MESSENGER_FLAG_SENT)
contact->owned = GNUNET_YES;
struct GNUNET_TIME_Absolute *time = GNUNET_CONTAINER_multishortmap_get(
- context->timestamps, &shorthash
+ context->timestamps, &shorthash
);
if (!time)
@@ -727,14 +731,14 @@ on_handle_message (void *cls,
*time = timestamp;
if (GNUNET_OK != GNUNET_CONTAINER_multishortmap_put(
- context->timestamps, &shorthash, time,
- GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST))
+ context->timestamps, &shorthash, time,
+ GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST))
GNUNET_free(time);
}
else
{
struct GNUNET_TIME_Relative delta = GNUNET_TIME_absolute_get_difference(
- timestamp, *time
+ timestamp, *time
);
if (GNUNET_TIME_relative_get_zero_().rel_value_us == delta.rel_value_us)
@@ -742,7 +746,7 @@ on_handle_message (void *cls,
}
struct GNUNET_CHAT_Message *message = GNUNET_CONTAINER_multihashmap_get(
- context->messages, hash
+ context->messages, hash
);
if (message)
@@ -762,20 +766,20 @@ on_handle_message (void *cls,
case GNUNET_MESSENGER_KIND_INVITE:
{
struct GNUNET_CHAT_Invitation *invitation = invitation_create_from_message(
- context, &(msg->body.invite)
+ context, &(msg->body.invite)
);
if (GNUNET_OK != GNUNET_CONTAINER_multihashmap_put(
- context->invites, hash, invitation,
- GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST))
+ context->invites, hash, invitation,
+ GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST))
invitation_destroy(invitation);
break;
}
case GNUNET_MESSENGER_KIND_FILE:
{
GNUNET_CONTAINER_multihashmap_put(
- context->files, hash, NULL,
- GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST
+ context->files, hash, NULL,
+ GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST
);
struct GNUNET_CHAT_File *file = GNUNET_CONTAINER_multihashmap_get(
@@ -786,28 +790,28 @@ on_handle_message (void *cls,
break;
file = file_create_from_message(
- context->handle, &(msg->body.file)
+ context->handle, &(msg->body.file)
);
if (GNUNET_OK != GNUNET_CONTAINER_multihashmap_put(
- context->handle->files, &(file->hash), file,
- GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST))
+ context->handle->files, &(file->hash), file,
+ GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST))
file_destroy(file);
break;
}
case GNUNET_MESSENGER_KIND_DELETE:
{
struct GNUNET_TIME_Relative delay = GNUNET_TIME_relative_ntoh(
- msg->body.deletion.delay
+ msg->body.deletion.delay
);
task = GNUNET_SCHEDULER_add_delayed(
- GNUNET_TIME_absolute_get_difference(
- GNUNET_TIME_absolute_get(),
- GNUNET_TIME_absolute_add(timestamp, delay)
- ),
- on_handle_message_callback,
- message
+ GNUNET_TIME_absolute_get_difference(
+ GNUNET_TIME_absolute_get(),
+ GNUNET_TIME_absolute_add(timestamp, delay)
+ ),
+ on_handle_message_callback,
+ message
);
break;
}
@@ -834,8 +838,8 @@ on_handle_message (void *cls,
int
it_destroy_handle_groups (GNUNET_UNUSED void *cls,
- GNUNET_UNUSED const struct GNUNET_HashCode *key,
- void *value)
+ GNUNET_UNUSED const struct GNUNET_HashCode *key,
+ void *value)
{
GNUNET_assert(value);
@@ -846,8 +850,8 @@ it_destroy_handle_groups (GNUNET_UNUSED void *cls,
int
it_destroy_handle_contacts (GNUNET_UNUSED void *cls,
- GNUNET_UNUSED const struct GNUNET_ShortHashCode *key,
- void *value)
+ GNUNET_UNUSED const struct GNUNET_ShortHashCode *key,
+ void *value)
{
GNUNET_assert(value);
@@ -858,8 +862,8 @@ it_destroy_handle_contacts (GNUNET_UNUSED void *cls,
int
it_destroy_handle_contexts (GNUNET_UNUSED void *cls,
- GNUNET_UNUSED const struct GNUNET_HashCode *key,
- void *value)
+ GNUNET_UNUSED const struct GNUNET_HashCode *key,
+ void *value)
{
GNUNET_assert(value);
@@ -870,8 +874,8 @@ it_destroy_handle_contexts (GNUNET_UNUSED void *cls,
int
it_destroy_handle_files (GNUNET_UNUSED void *cls,
- GNUNET_UNUSED const struct GNUNET_HashCode *key,
- void *value)
+ GNUNET_UNUSED const struct GNUNET_HashCode *key,
+ void *value)
{
GNUNET_assert(value);
diff --git a/src/gnunet_chat_invitation.c b/src/gnunet_chat_invitation.c
@@ -1,6 +1,6 @@
/*
This file is part of GNUnet.
- Copyright (C) 2021 GNUnet e.V.
+ Copyright (C) 2021--2024 GNUnet e.V.
GNUnet is free software: you can redistribute it and/or modify it
under the terms of the GNU Affero General Public License as published
@@ -26,7 +26,7 @@
struct GNUNET_CHAT_Invitation*
invitation_create_from_message (struct GNUNET_CHAT_Context *context,
- const struct GNUNET_MESSENGER_MessageInvite *message)
+ const struct GNUNET_MESSENGER_MessageInvite *message)
{
GNUNET_assert((context) && (message));
diff --git a/src/gnunet_chat_lib.c b/src/gnunet_chat_lib.c
@@ -1742,7 +1742,7 @@ GNUNET_CHAT_file_start_download (struct GNUNET_CHAT_File *file,
if ((!file) || (!(file->uri)))
return GNUNET_SYSERR;
- if (file->download)a
+ if (file->download)
{
file_bind_downlaod(file, callback, cls);
diff --git a/src/gnunet_chat_lib_intern.c b/src/gnunet_chat_lib_intern.c
@@ -1,6 +1,6 @@
/*
This file is part of GNUnet.
- Copyright (C) 2021--2023 GNUnet e.V.
+ Copyright (C) 2021--2024 GNUnet e.V.
GNUnet is free software: you can redistribute it and/or modify it
under the terms of the GNU Affero General Public License as published
@@ -45,13 +45,13 @@ task_handle_destruction (void *cls)
if (accounts)
{
handle->destruction = GNUNET_SCHEDULER_add_at_with_priority(
- GNUNET_TIME_absolute_add(
- GNUNET_TIME_absolute_get(),
- GNUNET_TIME_relative_get_millisecond_()
- ),
- GNUNET_SCHEDULER_PRIORITY_IDLE,
- task_handle_destruction,
- handle
+ GNUNET_TIME_absolute_add(
+ GNUNET_TIME_absolute_get(),
+ GNUNET_TIME_relative_get_millisecond_()
+ ),
+ GNUNET_SCHEDULER_PRIORITY_IDLE,
+ task_handle_destruction,
+ handle
);
return;
@@ -63,8 +63,8 @@ task_handle_destruction (void *cls)
void
cb_lobby_lookup (void *cls,
- uint32_t count,
- const struct GNUNET_GNSRECORD_Data *data)
+ uint32_t count,
+ const struct GNUNET_GNSRECORD_Data *data)
{
GNUNET_assert(cls);
@@ -74,10 +74,10 @@ cb_lobby_lookup (void *cls,
goto drop_lookup;
struct GNUNET_CHAT_Context *context = handle_process_records(
- lookups->handle,
- lookups->uri->label,
- count,
- data
+ lookups->handle,
+ lookups->uri->label,
+ count,
+ data
);
if (context)
@@ -106,8 +106,8 @@ struct GNUNET_CHAT_HandleIterateContacts
int
it_handle_iterate_contacts (void *cls,
- GNUNET_UNUSED const struct GNUNET_ShortHashCode *key,
- void *value)
+ GNUNET_UNUSED const struct GNUNET_ShortHashCode *key,
+ void *value)
{
GNUNET_assert((cls) && (value));
@@ -130,8 +130,8 @@ struct GNUNET_CHAT_HandleIterateGroups
int
it_handle_iterate_groups (void *cls,
- GNUNET_UNUSED const struct GNUNET_HashCode *key,
- void *value)
+ GNUNET_UNUSED const struct GNUNET_HashCode *key,
+ void *value)
{
GNUNET_assert((cls) && (value));
@@ -153,8 +153,8 @@ struct GNUNET_CHAT_RoomFindContact
int
it_room_find_contact (void *cls,
- GNUNET_UNUSED struct GNUNET_MESSENGER_Room *room,
- const struct GNUNET_MESSENGER_Contact *member)
+ GNUNET_UNUSED struct GNUNET_MESSENGER_Room *room,
+ const struct GNUNET_MESSENGER_Contact *member)
{
GNUNET_assert((cls) && (member));
@@ -181,7 +181,7 @@ struct GNUNET_CHAT_GroupIterateContacts
int
it_group_iterate_contacts (void* cls,
- GNUNET_UNUSED struct GNUNET_MESSENGER_Room *room,
+ GNUNET_UNUSED struct GNUNET_MESSENGER_Room *room,
const struct GNUNET_MESSENGER_Contact *member)
{
GNUNET_assert((cls) && (member));
@@ -192,7 +192,7 @@ it_group_iterate_contacts (void* cls,
return GNUNET_YES;
return it->cb(it->cls, it->group, handle_get_contact_from_messenger(
- it->group->handle, member
+ it->group->handle, member
));
}
@@ -205,8 +205,8 @@ struct GNUNET_CHAT_ContextIterateMessages
int
it_context_iterate_messages (void *cls,
- GNUNET_UNUSED const struct GNUNET_HashCode *key,
- void *value)
+ GNUNET_UNUSED const struct GNUNET_HashCode *key,
+ void *value)
{
GNUNET_assert((cls) && (value));
@@ -229,8 +229,8 @@ struct GNUNET_CHAT_ContextIterateFiles
int
it_context_iterate_files (void *cls,
- const struct GNUNET_HashCode *key,
- GNUNET_UNUSED void *value)
+ const struct GNUNET_HashCode *key,
+ GNUNET_UNUSED void *value)
{
GNUNET_assert((cls) && (key));
@@ -240,14 +240,14 @@ it_context_iterate_files (void *cls,
return GNUNET_YES;
struct GNUNET_CHAT_Message *message = GNUNET_CONTAINER_multihashmap_get(
- it->context->messages, key
+ it->context->messages, key
);
if (!message)
return GNUNET_YES;
struct GNUNET_CHAT_File *file = GNUNET_CONTAINER_multihashmap_get(
- it->context->handle->files, &(message->hash)
+ it->context->handle->files, &(message->hash)
);
if (!file)
@@ -265,8 +265,8 @@ struct GNUNET_CHAT_MessageIterateReadReceipts
int
it_message_iterate_read_receipts (void *cls,
- GNUNET_UNUSED struct GNUNET_MESSENGER_Room *room,
- const struct GNUNET_MESSENGER_Contact *member)
+ GNUNET_UNUSED struct GNUNET_MESSENGER_Room *room,
+ const struct GNUNET_MESSENGER_Contact *member)
{
GNUNET_assert((cls) && (member));
@@ -287,14 +287,14 @@ it_message_iterate_read_receipts (void *cls,
return GNUNET_YES;
struct GNUNET_TIME_Absolute *timestamp = GNUNET_CONTAINER_multishortmap_get(
- it->message->context->timestamps, &shorthash
+ it->message->context->timestamps, &shorthash
);
if (!timestamp)
return GNUNET_YES;
struct GNUNET_TIME_Relative delta = GNUNET_TIME_absolute_get_difference(
- *timestamp, GNUNET_CHAT_message_get_timestamp(it->message)
+ *timestamp, GNUNET_CHAT_message_get_timestamp(it->message)
);
int read_receipt;
diff --git a/src/gnunet_chat_lobby.c b/src/gnunet_chat_lobby.c
@@ -1,6 +1,6 @@
/*
This file is part of GNUnet.
- Copyright (C) 2022--2023 GNUnet e.V.
+ Copyright (C) 2022--2024 GNUnet e.V.
GNUnet is free software: you can redistribute it and/or modify it
under the terms of the GNU Affero General Public License as published
@@ -59,7 +59,7 @@ lobby_destroy (struct GNUNET_CHAT_Lobby *lobby)
if (lobby->context)
{
const struct GNUNET_HashCode *key = GNUNET_MESSENGER_room_get_key(
- lobby->context->room
+ lobby->context->room
);
if (!key)
@@ -87,9 +87,9 @@ skip_deletion:
void
lobby_open (struct GNUNET_CHAT_Lobby *lobby,
- struct GNUNET_TIME_Relative delay,
- GNUNET_CHAT_LobbyCallback callback,
- void *cls)
+ struct GNUNET_TIME_Relative delay,
+ GNUNET_CHAT_LobbyCallback callback,
+ void *cls)
{
GNUNET_assert(lobby);
@@ -109,8 +109,8 @@ lobby_open (struct GNUNET_CHAT_Lobby *lobby,
GNUNET_CRYPTO_random_block(GNUNET_CRYPTO_QUALITY_WEAK, &key, sizeof(key));
struct GNUNET_MESSENGER_Room *room = GNUNET_MESSENGER_open_room(
- lobby->handle->messenger,
- &key
+ lobby->handle->messenger,
+ &key
);
if (!room)
@@ -135,12 +135,12 @@ open_zone:
util_lobby_name(&key, &name);
lobby->op = GNUNET_IDENTITY_create(
- lobby->handle->identity,
- name,
- NULL,
- GNUNET_PUBLIC_KEY_TYPE_EDDSA,
- cont_lobby_identity_create,
- lobby
+ lobby->handle->identity,
+ name,
+ NULL,
+ GNUNET_PUBLIC_KEY_TYPE_EDDSA,
+ cont_lobby_identity_create,
+ lobby
);
GNUNET_free(name);
diff --git a/src/gnunet_chat_lobby.h b/src/gnunet_chat_lobby.h
@@ -1,6 +1,6 @@
/*
This file is part of GNUnet.
- Copyright (C) 2022 GNUnet e.V.
+ Copyright (C) 2022--2024 GNUnet e.V.
GNUnet is free software: you can redistribute it and/or modify it
under the terms of the GNU Affero General Public License as published
@@ -79,8 +79,8 @@ lobby_destroy (struct GNUNET_CHAT_Lobby *lobby);
*/
void
lobby_open (struct GNUNET_CHAT_Lobby *lobby,
- struct GNUNET_TIME_Relative delay,
- GNUNET_CHAT_LobbyCallback callback,
- void *cls);
+ struct GNUNET_TIME_Relative delay,
+ GNUNET_CHAT_LobbyCallback callback,
+ void *cls);
#endif /* GNUNET_CHAT_LOBBY_H_ */
diff --git a/src/gnunet_chat_lobby_intern.c b/src/gnunet_chat_lobby_intern.c
@@ -1,6 +1,6 @@
/*
This file is part of GNUnet.
- Copyright (C) 2022--2023 GNUnet e.V.
+ Copyright (C) 2022--2024 GNUnet e.V.
GNUnet is free software: you can redistribute it and/or modify it
under the terms of the GNU Affero General Public License as published
@@ -26,7 +26,7 @@
void
cont_lobby_write_records (void *cls,
- enum GNUNET_ErrorCode ec)
+ enum GNUNET_ErrorCode ec)
{
struct GNUNET_CHAT_Lobby *lobby = cls;
@@ -35,7 +35,7 @@ cont_lobby_write_records (void *cls,
lobby->query = NULL;
const struct GNUNET_HashCode *key = GNUNET_MESSENGER_room_get_key(
- lobby->context->room
+ lobby->context->room
);
char *name;
@@ -52,10 +52,10 @@ cont_lobby_write_records (void *cls,
}
handle_send_internal_message(
- lobby->handle,
- lobby->context,
- GNUNET_CHAT_FLAG_WARNING,
- GNUNET_ErrorCode_get_hint(ec)
+ lobby->handle,
+ lobby->context,
+ GNUNET_CHAT_FLAG_WARNING,
+ GNUNET_ErrorCode_get_hint(ec)
);
if (lobby->uri)
@@ -70,8 +70,8 @@ call_cb:
void
cont_lobby_identity_create (void *cls,
- const struct GNUNET_CRYPTO_PrivateKey *zone,
- enum GNUNET_ErrorCode ec)
+ const struct GNUNET_CRYPTO_PrivateKey *zone,
+ enum GNUNET_ErrorCode ec)
{
struct GNUNET_CHAT_Lobby *lobby = cls;
@@ -82,17 +82,17 @@ cont_lobby_identity_create (void *cls,
if (GNUNET_EC_NONE != ec)
{
handle_send_internal_message(
- lobby->handle,
+ lobby->handle,
lobby->context,
GNUNET_CHAT_FLAG_WARNING,
- GNUNET_ErrorCode_get_hint(ec)
+ GNUNET_ErrorCode_get_hint(ec)
);
return;
}
const struct GNUNET_HashCode *key = GNUNET_MESSENGER_room_get_key(
- lobby->context->room
+ lobby->context->room
);
struct GNUNET_MESSENGER_RoomEntryRecord room;
@@ -119,12 +119,12 @@ cont_lobby_identity_create (void *cls,
GNUNET_free(label);
lobby->query = GNUNET_NAMESTORE_record_set_store(
- lobby->handle->namestore,
- zone,
- lobby->uri->label,
- 1,
- data,
- cont_lobby_write_records,
- lobby
+ lobby->handle->namestore,
+ zone,
+ lobby->uri->label,
+ 1,
+ data,
+ cont_lobby_write_records,
+ lobby
);
}
diff --git a/src/gnunet_chat_message.c b/src/gnunet_chat_message.c
@@ -1,6 +1,6 @@
/*
This file is part of GNUnet.
- Copyright (C) 2021 GNUnet e.V.
+ Copyright (C) 2021--2024 GNUnet e.V.
GNUnet is free software: you can redistribute it and/or modify it
under the terms of the GNU Affero General Public License as published
@@ -26,13 +26,11 @@
struct GNUNET_CHAT_Message*
message_create_from_msg (struct GNUNET_CHAT_Context *context,
- const struct GNUNET_HashCode *hash,
- enum GNUNET_MESSENGER_MessageFlags flags,
- const struct GNUNET_MESSENGER_Message *msg)
+ const struct GNUNET_HashCode *hash,
+ enum GNUNET_MESSENGER_MessageFlags flags,
+ const struct GNUNET_MESSENGER_Message *msg)
{
- GNUNET_assert((context) &&
- (hash) &&
- (msg));
+ GNUNET_assert((context) && (hash) && (msg));
struct GNUNET_CHAT_Message *message = GNUNET_new(struct GNUNET_CHAT_Message);
@@ -50,8 +48,8 @@ message_create_from_msg (struct GNUNET_CHAT_Context *context,
struct GNUNET_CHAT_Message*
message_create_internally (struct GNUNET_CHAT_Context *context,
- enum GNUNET_CHAT_MessageFlag flag,
- const char *warning)
+ enum GNUNET_CHAT_MessageFlag flag,
+ const char *warning)
{
struct GNUNET_CHAT_Message *message = GNUNET_new(struct GNUNET_CHAT_Message);
diff --git a/src/gnunet_chat_message.h b/src/gnunet_chat_message.h
@@ -1,6 +1,6 @@
/*
This file is part of GNUnet.
- Copyright (C) 2021--2022 GNUnet e.V.
+ Copyright (C) 2021--2024 GNUnet e.V.
GNUnet is free software: you can redistribute it and/or modify it
under the terms of the GNU Affero General Public License as published
@@ -76,9 +76,9 @@ struct GNUNET_CHAT_Message
*/
struct GNUNET_CHAT_Message*
message_create_from_msg (struct GNUNET_CHAT_Context *context,
- const struct GNUNET_HashCode *hash,
- enum GNUNET_MESSENGER_MessageFlags flags,
- const struct GNUNET_MESSENGER_Message *msg);
+ const struct GNUNET_HashCode *hash,
+ enum GNUNET_MESSENGER_MessageFlags flags,
+ const struct GNUNET_MESSENGER_Message *msg);
/**
* Creates an internal chat message with an optional chat
@@ -92,8 +92,8 @@ message_create_from_msg (struct GNUNET_CHAT_Context *context,
*/
struct GNUNET_CHAT_Message*
message_create_internally (struct GNUNET_CHAT_Context *context,
- enum GNUNET_CHAT_MessageFlag flag,
- const char *warning);
+ enum GNUNET_CHAT_MessageFlag flag,
+ const char *warning);
/**
* Destroys a chat <i>message</i> and frees its memory.
diff --git a/src/gnunet_chat_uri.c b/src/gnunet_chat_uri.c
@@ -1,6 +1,6 @@
/*
This file is part of GNUnet.
- Copyright (C) 2022--2023 GNUnet e.V.
+ Copyright (C) 2022--2024 GNUnet e.V.
GNUnet is free software: you can redistribute it and/or modify it
under the terms of the GNU Affero General Public License as published
@@ -26,7 +26,7 @@
struct GNUNET_CHAT_Uri*
uri_create (const struct GNUNET_CRYPTO_PublicKey *zone,
- const char *label)
+ const char *label)
{
GNUNET_assert((zone) && (label));
diff --git a/src/gnunet_chat_uri.h b/src/gnunet_chat_uri.h
@@ -1,6 +1,6 @@
/*
This file is part of GNUnet.
- Copyright (C) 2022--2023 GNUnet e.V.
+ Copyright (C) 2022--2024 GNUnet e.V.
GNUnet is free software: you can redistribute it and/or modify it
under the terms of the GNU Affero General Public License as published
@@ -45,7 +45,7 @@ struct GNUNET_CHAT_Uri
*/
struct GNUNET_CHAT_Uri*
uri_create (const struct GNUNET_CRYPTO_PublicKey *zone,
- const char *label);
+ const char *label);
/**
* Destroys a chat <i>uri</i> and frees its memory.
diff --git a/src/gnunet_chat_util.c b/src/gnunet_chat_util.c
@@ -1,6 +1,6 @@
/*
This file is part of GNUnet.
- Copyright (C) 2021--2023 GNUnet e.V.
+ Copyright (C) 2021--2024 GNUnet e.V.
GNUnet is free software: you can redistribute it and/or modify it
under the terms of the GNU Affero General Public License as published
@@ -29,7 +29,7 @@ static const char label_prefix_of_group [] = "group";
void
util_shorthash_from_member (const struct GNUNET_MESSENGER_Contact *member,
- struct GNUNET_ShortHashCode *shorthash)
+ struct GNUNET_ShortHashCode *shorthash)
{
GNUNET_assert(shorthash);
@@ -37,9 +37,9 @@ util_shorthash_from_member (const struct GNUNET_MESSENGER_Contact *member,
memset(shorthash, 0, sizeof(*shorthash));
GNUNET_memcpy(
- shorthash,
- &id,
- sizeof(id) < sizeof(*shorthash) ? sizeof(id) : sizeof(*shorthash)
+ shorthash,
+ &id,
+ sizeof(id) < sizeof(*shorthash) ? sizeof(id) : sizeof(*shorthash)
);
}
@@ -68,7 +68,7 @@ util_hash_file (const char *filename, struct GNUNET_HashCode *hash)
return GNUNET_SYSERR;
struct GNUNET_DISK_FileHandle *file = GNUNET_DISK_file_open(
- filename, GNUNET_DISK_OPEN_READ, GNUNET_DISK_PERM_USER_READ
+ filename, GNUNET_DISK_OPEN_READ, GNUNET_DISK_PERM_USER_READ
);
if (!file)
@@ -80,7 +80,7 @@ util_hash_file (const char *filename, struct GNUNET_HashCode *hash)
if (size > 0)
{
data = GNUNET_DISK_file_map(
- file, &mapping, GNUNET_DISK_MAP_TYPE_READ, size
+ file, &mapping, GNUNET_DISK_MAP_TYPE_READ, size
);
if ((!data) || (!mapping))
@@ -106,8 +106,8 @@ util_hash_file (const char *filename, struct GNUNET_HashCode *hash)
int
util_encrypt_file (const char *filename,
- const struct GNUNET_HashCode *hash,
- const struct GNUNET_CRYPTO_SymmetricSessionKey *key)
+ const struct GNUNET_HashCode *hash,
+ const struct GNUNET_CRYPTO_SymmetricSessionKey *key)
{
GNUNET_assert((filename) && (hash) && (key));
@@ -117,8 +117,8 @@ util_encrypt_file (const char *filename,
return GNUNET_SYSERR;
struct GNUNET_DISK_FileHandle *file = GNUNET_DISK_file_open(
- filename, GNUNET_DISK_OPEN_READWRITE,
- GNUNET_DISK_PERM_USER_READ | GNUNET_DISK_PERM_USER_WRITE
+ filename, GNUNET_DISK_OPEN_READWRITE,
+ GNUNET_DISK_PERM_USER_READ | GNUNET_DISK_PERM_USER_WRITE
);
if (!file)
@@ -129,7 +129,7 @@ util_encrypt_file (const char *filename,
struct GNUNET_DISK_MapHandle *mapping;
const void* data = GNUNET_DISK_file_map(
- file, &mapping, GNUNET_DISK_MAP_TYPE_READWRITE, size
+ file, &mapping, GNUNET_DISK_MAP_TYPE_READWRITE, size
);
if ((!data) || (!mapping))
@@ -186,8 +186,8 @@ util_encrypt_file (const char *filename,
int
util_decrypt_file (const char *filename,
- const struct GNUNET_HashCode *hash,
- const struct GNUNET_CRYPTO_SymmetricSessionKey *key)
+ const struct GNUNET_HashCode *hash,
+ const struct GNUNET_CRYPTO_SymmetricSessionKey *key)
{
GNUNET_assert((filename) && (hash) && (key));
@@ -197,8 +197,8 @@ util_decrypt_file (const char *filename,
return GNUNET_SYSERR;
struct GNUNET_DISK_FileHandle *file = GNUNET_DISK_file_open(
- filename, GNUNET_DISK_OPEN_READWRITE,
- GNUNET_DISK_PERM_USER_READ | GNUNET_DISK_PERM_USER_WRITE
+ filename, GNUNET_DISK_OPEN_READWRITE,
+ GNUNET_DISK_PERM_USER_READ | GNUNET_DISK_PERM_USER_WRITE
);
if (!file)
@@ -206,7 +206,7 @@ util_decrypt_file (const char *filename,
struct GNUNET_DISK_MapHandle *mapping = NULL;
void* data = GNUNET_DISK_file_map(
- file, &mapping, GNUNET_DISK_MAP_TYPE_READWRITE, size
+ file, &mapping, GNUNET_DISK_MAP_TYPE_READWRITE, size
);
if ((!data) || (!mapping))
@@ -234,11 +234,11 @@ util_decrypt_file (const char *filename,
memcpy(&iv, hash, sizeof(iv));
result = GNUNET_CRYPTO_symmetric_decrypt(
- location,
- remaining >= block_size? block_size : remaining,
- key,
- &iv,
- location
+ location,
+ remaining >= block_size? block_size : remaining,
+ key,
+ &iv,
+ location
);
if (result < 0)
@@ -268,40 +268,44 @@ util_decrypt_file (const char *filename,
int
util_get_dirname (const char *directory,
- const char *subdir,
- char **filename)
+ const char *subdir,
+ char **filename)
{
- GNUNET_assert((filename) &&
- (directory) &&
- (subdir));
+ GNUNET_assert(
+ (filename) &&
+ (directory) &&
+ (subdir)
+ );
return GNUNET_asprintf (
- filename,
- "%s/%s",
- directory,
- subdir
+ filename,
+ "%s/%s",
+ directory,
+ subdir
);
}
int
util_get_filename (const char *directory,
- const char *subdir,
- const struct GNUNET_HashCode *hash,
- char **filename)
+ const char *subdir,
+ const struct GNUNET_HashCode *hash,
+ char **filename)
{
- GNUNET_assert((filename) &&
+ GNUNET_assert(
+ (filename) &&
(directory) &&
(subdir) &&
- (hash));
+ (hash)
+ );
char* dirname;
util_get_dirname(directory, subdir, &dirname);
int result = GNUNET_asprintf (
- filename,
- "%s/%s",
- dirname,
- GNUNET_h2s_full(hash)
+ filename,
+ "%s/%s",
+ dirname,
+ GNUNET_h2s_full(hash)
);
GNUNET_free(dirname);
@@ -323,8 +327,8 @@ util_get_lower(const char *name)
int
util_get_context_label (enum GNUNET_CHAT_ContextType type,
- const struct GNUNET_HashCode *hash,
- char **label)
+ const struct GNUNET_HashCode *hash,
+ char **label)
{
const char *type_string = "chat";
@@ -343,10 +347,10 @@ util_get_context_label (enum GNUNET_CHAT_ContextType type,
char *low = util_get_lower(GNUNET_h2s(hash));
int result = GNUNET_asprintf (
- label,
- "%s_%s",
- type_string,
- low
+ label,
+ "%s_%s",
+ type_string,
+ low
);
GNUNET_free(low);
@@ -355,7 +359,7 @@ util_get_context_label (enum GNUNET_CHAT_ContextType type,
enum GNUNET_CHAT_ContextType
util_get_context_label_type (const char *label,
- const struct GNUNET_HashCode *hash)
+ const struct GNUNET_HashCode *hash)
{
enum GNUNET_CHAT_ContextType type = GNUNET_CHAT_CONTEXT_TYPE_UNKNOWN;
@@ -379,14 +383,14 @@ cleanup:
int
util_lobby_name (const struct GNUNET_HashCode *hash,
- char **name)
+ char **name)
{
char *low = util_get_lower(GNUNET_h2s(hash));
int result = GNUNET_asprintf (
- name,
- "chat_lobby_%s",
- low
+ name,
+ "chat_lobby_%s",
+ low
);
GNUNET_free(low);
diff --git a/src/gnunet_chat_util.h b/src/gnunet_chat_util.h
@@ -1,6 +1,6 @@
/*
This file is part of GNUnet.
- Copyright (C) 2021--2023 GNUnet e.V.
+ Copyright (C) 2021--2024 GNUnet e.V.
GNUnet is free software: you can redistribute it and/or modify it
under the terms of the GNU Affero General Public License as published
@@ -61,7 +61,7 @@ enum GNUNET_CHAT_ContextType
*/
void
util_shorthash_from_member (const struct GNUNET_MESSENGER_Contact *member,
- struct GNUNET_ShortHashCode *shorthash);
+ struct GNUNET_ShortHashCode *shorthash);
/**
* Updates the stored content of a <i>field</i> with
@@ -96,8 +96,8 @@ util_hash_file (const char *filename, struct GNUNET_HashCode *hash);
*/
int
util_encrypt_file (const char *filename,
- const struct GNUNET_HashCode *hash,
- const struct GNUNET_CRYPTO_SymmetricSessionKey *key);
+ const struct GNUNET_HashCode *hash,
+ const struct GNUNET_CRYPTO_SymmetricSessionKey *key);
/**
* Decrypts a file inplace under a given <i>filename</i>
@@ -112,8 +112,8 @@ util_encrypt_file (const char *filename,
*/
int
util_decrypt_file (const char *filename,
- const struct GNUNET_HashCode *hash,
- const struct GNUNET_CRYPTO_SymmetricSessionKey *key);
+ const struct GNUNET_HashCode *hash,
+ const struct GNUNET_CRYPTO_SymmetricSessionKey *key);
/**
* Append the path of a <i>directory</i> and a custom
@@ -126,8 +126,8 @@ util_decrypt_file (const char *filename,
*/
int
util_get_dirname (const char *directory,
- const char *subdir,
- char **filename);
+ const char *subdir,
+ char **filename);
/**
* Append the path of a <i>directory</i>, a custom
@@ -142,9 +142,9 @@ util_get_dirname (const char *directory,
*/
int
util_get_filename (const char *directory,
- const char *subdir,
- const struct GNUNET_HashCode *hash,
- char **filename);
+ const char *subdir,
+ const struct GNUNET_HashCode *hash,
+ char **filename);
/**
* Allocates a new string representing the lower case versionn
@@ -168,8 +168,8 @@ util_get_lower(const char *name);
*/
int
util_get_context_label (enum GNUNET_CHAT_ContextType type,
- const struct GNUNET_HashCode *hash,
- char **label);
+ const struct GNUNET_HashCode *hash,
+ char **label);
/**
* Extract the chat context type from a used <i>label</i> by
@@ -181,7 +181,7 @@ util_get_context_label (enum GNUNET_CHAT_ContextType type,
*/
enum GNUNET_CHAT_ContextType
util_get_context_label_type (const char *label,
- const struct GNUNET_HashCode *hash);
+ const struct GNUNET_HashCode *hash);
/**
* Provide a standardized <i>name</i> for a lobby using
@@ -193,7 +193,7 @@ util_get_context_label_type (const char *label,
*/
int
util_lobby_name (const struct GNUNET_HashCode *hash,
- char **name);
+ char **name);
/**
* Return the chat related kind for a messages original kind