1
0
Fork 0

auto-format

Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
This commit is contained in:
Steffen Jaeckel 2022-01-27 15:49:44 +01:00
parent 20a8ef7a3e
commit 9cf78e59d5
22 changed files with 137 additions and 134 deletions

View File

@ -22,6 +22,7 @@ AlignOperands: true
AlignTrailingComments: true AlignTrailingComments: true
AllowAllArgumentsOnNextLine: true AllowAllArgumentsOnNextLine: true
AllowShortBlocksOnASingleLine: true AllowShortBlocksOnASingleLine: true
IndentGotoLabels: false
IndentWidth: 4 IndentWidth: 4
BreakBeforeBraces: Custom BreakBeforeBraces: Custom
BraceWrapping: BraceWrapping:

View File

@ -1144,7 +1144,7 @@ cmd_export(ProfWin* window, const char* const command, gchar** args)
g_slist_free(list); g_slist_free(list);
close(fd); close(fd);
return TRUE; return TRUE;
write_error: write_error:
cons_show("error: write failed: %s", strerror(errno)); cons_show("error: write failed: %s", strerror(errno));
cons_show(""); cons_show("");
g_slist_free(list); g_slist_free(list);

View File

@ -178,7 +178,7 @@ _log_database_add_outgoing(char* type, const char* const id, const char* const b
msg->from_jid = jid_create(barejid); msg->from_jid = jid_create(barejid);
msg->plain = message ? strdup(message) : NULL; msg->plain = message ? strdup(message) : NULL;
msg->replace_id = replace_id ? strdup(replace_id) : NULL; msg->replace_id = replace_id ? strdup(replace_id) : NULL;
msg->timestamp = g_date_time_new_now_local(); //TODO: get from outside. best to have whole ProfMessage from outside msg->timestamp = g_date_time_new_now_local(); // TODO: get from outside. best to have whole ProfMessage from outside
msg->enc = enc; msg->enc = enc;
Jid* myjid = jid_create(connection_get_fulljid()); Jid* myjid = jid_create(connection_get_fulljid());

View File

@ -522,7 +522,7 @@ _sv_ev_incoming_ox(ProfChatWin* chatwin, gboolean new_win, ProfMessage* message,
chat_log_pgp_msg_in(message); chat_log_pgp_msg_in(message);
} }
chatwin->pgp_recv = TRUE; chatwin->pgp_recv = TRUE;
//p_gpg_free_decrypted(message->plain); // p_gpg_free_decrypted(message->plain);
message->plain = NULL; message->plain = NULL;
#endif #endif
} }

View File

@ -43,110 +43,110 @@
int omemo_crypto_init(void); int omemo_crypto_init(void);
/** /**
* Callback for a secure random number generator. * Callback for a secure random number generator.
* This function shall fill the provided buffer with random bytes. * This function shall fill the provided buffer with random bytes.
* *
* @param data pointer to the output buffer * @param data pointer to the output buffer
* @param len size of the output buffer * @param len size of the output buffer
* @return 0 on success, negative on failure * @return 0 on success, negative on failure
*/ */
int omemo_random_func(uint8_t* data, size_t len, void* user_data); int omemo_random_func(uint8_t* data, size_t len, void* user_data);
/** /**
* Callback for an HMAC-SHA256 implementation. * Callback for an HMAC-SHA256 implementation.
* This function shall initialize an HMAC context with the provided key. * This function shall initialize an HMAC context with the provided key.
* *
* @param hmac_context private HMAC context pointer * @param hmac_context private HMAC context pointer
* @param key pointer to the key * @param key pointer to the key
* @param key_len length of the key * @param key_len length of the key
* @return 0 on success, negative on failure * @return 0 on success, negative on failure
*/ */
int omemo_hmac_sha256_init_func(void** hmac_context, const uint8_t* key, size_t key_len, void* user_data); int omemo_hmac_sha256_init_func(void** hmac_context, const uint8_t* key, size_t key_len, void* user_data);
/** /**
* Callback for an HMAC-SHA256 implementation. * Callback for an HMAC-SHA256 implementation.
* This function shall update the HMAC context with the provided data * This function shall update the HMAC context with the provided data
* *
* @param hmac_context private HMAC context pointer * @param hmac_context private HMAC context pointer
* @param data pointer to the data * @param data pointer to the data
* @param data_len length of the data * @param data_len length of the data
* @return 0 on success, negative on failure * @return 0 on success, negative on failure
*/ */
int omemo_hmac_sha256_update_func(void* hmac_context, const uint8_t* data, size_t data_len, void* user_data); int omemo_hmac_sha256_update_func(void* hmac_context, const uint8_t* data, size_t data_len, void* user_data);
/** /**
* Callback for an HMAC-SHA256 implementation. * Callback for an HMAC-SHA256 implementation.
* This function shall finalize an HMAC calculation and populate the output * This function shall finalize an HMAC calculation and populate the output
* buffer with the result. * buffer with the result.
* *
* @param hmac_context private HMAC context pointer * @param hmac_context private HMAC context pointer
* @param output buffer to be allocated and populated with the result * @param output buffer to be allocated and populated with the result
* @return 0 on success, negative on failure * @return 0 on success, negative on failure
*/ */
int omemo_hmac_sha256_final_func(void* hmac_context, signal_buffer** output, void* user_data); int omemo_hmac_sha256_final_func(void* hmac_context, signal_buffer** output, void* user_data);
/** /**
* Callback for an HMAC-SHA256 implementation. * Callback for an HMAC-SHA256 implementation.
* This function shall free the private context allocated in * This function shall free the private context allocated in
* hmac_sha256_init_func. * hmac_sha256_init_func.
* *
* @param hmac_context private HMAC context pointer * @param hmac_context private HMAC context pointer
*/ */
void omemo_hmac_sha256_cleanup_func(void* hmac_context, void* user_data); void omemo_hmac_sha256_cleanup_func(void* hmac_context, void* user_data);
/** /**
* Callback for a SHA512 message digest implementation. * Callback for a SHA512 message digest implementation.
* This function shall initialize a digest context. * This function shall initialize a digest context.
* *
* @param digest_context private digest context pointer * @param digest_context private digest context pointer
* @return 0 on success, negative on failure * @return 0 on success, negative on failure
*/ */
int omemo_sha512_digest_init_func(void** digest_context, void* user_data); int omemo_sha512_digest_init_func(void** digest_context, void* user_data);
/** /**
* Callback for a SHA512 message digest implementation. * Callback for a SHA512 message digest implementation.
* This function shall update the digest context with the provided data. * This function shall update the digest context with the provided data.
* *
* @param digest_context private digest context pointer * @param digest_context private digest context pointer
* @param data pointer to the data * @param data pointer to the data
* @param data_len length of the data * @param data_len length of the data
* @return 0 on success, negative on failure * @return 0 on success, negative on failure
*/ */
int omemo_sha512_digest_update_func(void* digest_context, const uint8_t* data, size_t data_len, void* user_data); int omemo_sha512_digest_update_func(void* digest_context, const uint8_t* data, size_t data_len, void* user_data);
/** /**
* Callback for a SHA512 message digest implementation. * Callback for a SHA512 message digest implementation.
* This function shall finalize the digest calculation, populate the * This function shall finalize the digest calculation, populate the
* output buffer with the result, and prepare the context for reuse. * output buffer with the result, and prepare the context for reuse.
* *
* @param digest_context private digest context pointer * @param digest_context private digest context pointer
* @param output buffer to be allocated and populated with the result * @param output buffer to be allocated and populated with the result
* @return 0 on success, negative on failure * @return 0 on success, negative on failure
*/ */
int omemo_sha512_digest_final_func(void* digest_context, signal_buffer** output, void* user_data); int omemo_sha512_digest_final_func(void* digest_context, signal_buffer** output, void* user_data);
/** /**
* Callback for a SHA512 message digest implementation. * Callback for a SHA512 message digest implementation.
* This function shall free the private context allocated in * This function shall free the private context allocated in
* sha512_digest_init_func. * sha512_digest_init_func.
* *
* @param digest_context private digest context pointer * @param digest_context private digest context pointer
*/ */
void omemo_sha512_digest_cleanup_func(void* digest_context, void* user_data); void omemo_sha512_digest_cleanup_func(void* digest_context, void* user_data);
/** /**
* Callback for an AES encryption implementation. * Callback for an AES encryption implementation.
* *
* @param output buffer to be allocated and populated with the ciphertext * @param output buffer to be allocated and populated with the ciphertext
* @param cipher specific cipher variant to use, either SG_CIPHER_AES_CTR_NOPADDING or SG_CIPHER_AES_CBC_PKCS5 * @param cipher specific cipher variant to use, either SG_CIPHER_AES_CTR_NOPADDING or SG_CIPHER_AES_CBC_PKCS5
* @param key the encryption key * @param key the encryption key
* @param key_len length of the encryption key * @param key_len length of the encryption key
* @param iv the initialization vector * @param iv the initialization vector
* @param iv_len length of the initialization vector * @param iv_len length of the initialization vector
* @param plaintext the plaintext to encrypt * @param plaintext the plaintext to encrypt
* @param plaintext_len length of the plaintext * @param plaintext_len length of the plaintext
* @return 0 on success, negative on failure * @return 0 on success, negative on failure
*/ */
int omemo_encrypt_func(signal_buffer** output, int omemo_encrypt_func(signal_buffer** output,
int cipher, int cipher,
const uint8_t* key, size_t key_len, const uint8_t* key, size_t key_len,
@ -155,18 +155,18 @@ int omemo_encrypt_func(signal_buffer** output,
void* user_data); void* user_data);
/** /**
* Callback for an AES decryption implementation. * Callback for an AES decryption implementation.
* *
* @param output buffer to be allocated and populated with the plaintext * @param output buffer to be allocated and populated with the plaintext
* @param cipher specific cipher variant to use, either SG_CIPHER_AES_CTR_NOPADDING or SG_CIPHER_AES_CBC_PKCS5 * @param cipher specific cipher variant to use, either SG_CIPHER_AES_CTR_NOPADDING or SG_CIPHER_AES_CBC_PKCS5
* @param key the encryption key * @param key the encryption key
* @param key_len length of the encryption key * @param key_len length of the encryption key
* @param iv the initialization vector * @param iv the initialization vector
* @param iv_len length of the initialization vector * @param iv_len length of the initialization vector
* @param ciphertext the ciphertext to decrypt * @param ciphertext the ciphertext to decrypt
* @param ciphertext_len length of the ciphertext * @param ciphertext_len length of the ciphertext
* @return 0 on success, negative on failure * @return 0 on success, negative on failure
*/ */
int omemo_decrypt_func(signal_buffer** output, int omemo_decrypt_func(signal_buffer** output,
int cipher, int cipher,
const uint8_t* key, size_t key_len, const uint8_t* key, size_t key_len,

View File

@ -388,7 +388,9 @@ omemo_publish_crypto_materials(void)
omemo_bundle_publish(true); omemo_bundle_publish(true);
} }
static void _acquire_sender_devices_list(void) { static void
_acquire_sender_devices_list(void)
{
char* barejid = connection_get_barejid(); char* barejid = connection_get_barejid();
g_hash_table_insert(omemo_ctx.device_list_handler, strdup(barejid), _handle_own_device_list); g_hash_table_insert(omemo_ctx.device_list_handler, strdup(barejid), _handle_own_device_list);

View File

@ -292,7 +292,7 @@ otr_on_message_recv(const char* const barejid, const char* const resource, const
prof_otrpolicy_t policy = otr_get_policy(barejid); prof_otrpolicy_t policy = otr_get_policy(barejid);
char* whitespace_base = strstr(message, OTRL_MESSAGE_TAG_BASE); char* whitespace_base = strstr(message, OTRL_MESSAGE_TAG_BASE);
//check for OTR whitespace (opportunistic or always) // check for OTR whitespace (opportunistic or always)
if (policy == PROF_OTRPOLICY_OPPORTUNISTIC || policy == PROF_OTRPOLICY_ALWAYS) { if (policy == PROF_OTRPOLICY_OPPORTUNISTIC || policy == PROF_OTRPOLICY_ALWAYS) {
if (whitespace_base) { if (whitespace_base) {
if (strstr(message, OTRL_MESSAGE_TAG_V2) || strstr(message, OTRL_MESSAGE_TAG_V1)) { if (strstr(message, OTRL_MESSAGE_TAG_V2) || strstr(message, OTRL_MESSAGE_TAG_V1)) {

View File

@ -871,15 +871,15 @@ ox_gpg_public_keys(void)
} }
gpgme_release(ctx); gpgme_release(ctx);
//autocomplete_clear(key_ac); // autocomplete_clear(key_ac);
// GList *ids = g_hash_table_get_keys(result); // GList *ids = g_hash_table_get_keys(result);
// GList *curr = ids; // GList *curr = ids;
// while (curr) { // while (curr) {
// ProfPGPKey *key = g_hash_table_lookup(result, curr->data); // ProfPGPKey *key = g_hash_table_lookup(result, curr->data);
// autocomplete_add(key_ac, key->id); // autocomplete_add(key_ac, key->id);
// curr = curr->next; // curr = curr->next;
// } // }
// g_list_free(ids); // g_list_free(ids);
return result; return result;
} }
@ -1210,14 +1210,14 @@ p_ox_gpg_decrypt(char* base64)
* *
* This function is used to read a key and push it on PEP. There are some checks * This function is used to read a key and push it on PEP. There are some checks
* in this function: * in this function:
* *
* Key is not * Key is not
* - gkey->revoked * - gkey->revoked
* - gkey->expired * - gkey->expired
* - gkey->disabled * - gkey->disabled
* - gkey->invalid * - gkey->invalid
* - gkey->secret * - gkey->secret
* *
* Only one key in the file. * Only one key in the file.
* *
* \param filename filename to read the file. * \param filename filename to read the file.

View File

@ -63,7 +63,7 @@ clipboard_get(void)
return NULL; return NULL;
} }
//while(!gtk_clipboard_wait_is_text_available(cld)) {} // while(!gtk_clipboard_wait_is_text_available(cld)) {}
clip = gtk_clipboard_wait_for_text(cl); clip = gtk_clipboard_wait_for_text(cl);
return clip; return clip;

View File

@ -298,11 +298,11 @@ chatwin_incoming_msg(ProfChatWin* chatwin, ProfMessage* message, gboolean win_cr
chatwin->unread++; chatwin->unread++;
//TODO: so far we don't ask for MAM when incoming message occurs. // TODO: so far we don't ask for MAM when incoming message occurs.
//Need to figure out: // Need to figure out:
//1) only send IQ once // 1) only send IQ once
//2) sort incoming messages on timestamp // 2) sort incoming messages on timestamp
//for now if experimental MAM is enabled we dont show no history from sql either // for now if experimental MAM is enabled we dont show no history from sql either
// MUCPMs also get printed here. In their case we don't save any logs (because nick owners can change) and thus we shouldn't read logs // MUCPMs also get printed here. In their case we don't save any logs (because nick owners can change) and thus we shouldn't read logs
// (and if we do we need to check the resourcepart) // (and if we do we need to check the resourcepart)

View File

@ -2159,8 +2159,8 @@ cons_executable_setting(void)
cons_show("Default '/avatar open' command (/executable avatar) : %s", avatar); cons_show("Default '/avatar open' command (/executable avatar) : %s", avatar);
g_free(avatar); g_free(avatar);
//TODO: there needs to be a way to get all the "locales"/schemes so we can // TODO: there needs to be a way to get all the "locales"/schemes so we can
//display the default openers for all filetypes // display the default openers for all filetypes
gchar* urlopen = prefs_get_string(PREF_URL_OPEN_CMD); gchar* urlopen = prefs_get_string(PREF_URL_OPEN_CMD);
cons_show("Default '/url open' command (/executable urlopen) : %s", urlopen); cons_show("Default '/url open' command (/executable urlopen) : %s", urlopen);
g_free(urlopen); g_free(urlopen);

View File

@ -234,10 +234,10 @@ notify(const char* const message, int timeout, const char* const category)
NOTIFYICONDATA nid; NOTIFYICONDATA nid;
memset(&nid, 0, sizeof(nid)); memset(&nid, 0, sizeof(nid));
nid.cbSize = sizeof(NOTIFYICONDATA); nid.cbSize = sizeof(NOTIFYICONDATA);
//nid.hWnd = hWnd; // nid.hWnd = hWnd;
nid.uID = 100; nid.uID = 100;
nid.uVersion = NOTIFYICON_VERSION; nid.uVersion = NOTIFYICON_VERSION;
//nid.uCallbackMessage = WM_MYMESSAGE; // nid.uCallbackMessage = WM_MYMESSAGE;
nid.hIcon = LoadIcon(NULL, IDI_APPLICATION); nid.hIcon = LoadIcon(NULL, IDI_APPLICATION);
strcpy(nid.szTip, "Tray Icon"); strcpy(nid.szTip, "Tray Icon");
nid.uFlags = NIF_MESSAGE | NIF_ICON | NIF_TIP; nid.uFlags = NIF_MESSAGE | NIF_ICON | NIF_TIP;

View File

@ -46,8 +46,8 @@
static void static void
_occuptantswin_occupant(ProfLayoutSplit* layout, GList* item, gboolean showjid, gboolean isoffline) _occuptantswin_occupant(ProfLayoutSplit* layout, GList* item, gboolean showjid, gboolean isoffline)
{ {
int colour = 0; //init to workaround compiler warning int colour = 0; // init to workaround compiler warning
theme_item_t presence_colour = THEME_ROSTER_ONLINE; //init to workaround compiler warning theme_item_t presence_colour = THEME_ROSTER_ONLINE; // init to workaround compiler warning
Occupant* occupant = item->data; Occupant* occupant = item->data;
if (isoffline) { if (isoffline) {

View File

@ -1439,7 +1439,7 @@ win_print_outgoing_with_receipt(ProfWin* window, const char* show_char, const ch
const char* myjid = connection_get_fulljid(); const char* myjid = connection_get_fulljid();
if (replace_id) { if (replace_id) {
_win_correct(window, message, id, replace_id, myjid); _win_correct(window, message, id, replace_id, myjid);
free(receipt); //TODO: probably we should use this in _win_correct() free(receipt); // TODO: probably we should use this in _win_correct()
} else { } else {
buffer_append(window->layout->buffer, show_char, 0, time, 0, THEME_TEXT_ME, from, myjid, message, receipt, id); buffer_append(window->layout->buffer, show_char, 0, time, 0, THEME_TEXT_ME, from, myjid, message, receipt, id);
_win_print_internal(window, show_char, 0, time, 0, THEME_TEXT_ME, from, message, receipt); _win_print_internal(window, show_char, 0, time, 0, THEME_TEXT_ME, from, message, receipt);

View File

@ -79,7 +79,7 @@ avatar_pep_subscribe(void)
message_pubsub_event_handler_add(STANZA_NS_USER_AVATAR_METADATA, _avatar_metadata_handler, NULL, NULL); message_pubsub_event_handler_add(STANZA_NS_USER_AVATAR_METADATA, _avatar_metadata_handler, NULL, NULL);
message_pubsub_event_handler_add(STANZA_NS_USER_AVATAR_DATA, _avatar_metadata_handler, NULL, NULL); message_pubsub_event_handler_add(STANZA_NS_USER_AVATAR_DATA, _avatar_metadata_handler, NULL, NULL);
//caps_add_feature(XMPP_FEATURE_USER_AVATAR_METADATA_NOTIFY); // caps_add_feature(XMPP_FEATURE_USER_AVATAR_METADATA_NOTIFY);
if (looking_for) { if (looking_for) {
g_hash_table_destroy(looking_for); g_hash_table_destroy(looking_for);

View File

@ -1074,7 +1074,7 @@ _random_bytes_close(void)
static void static void
_compute_identifier(const char* barejid) _compute_identifier(const char* barejid)
{ {
//in case of reconnect (lost connection) // in case of reconnect (lost connection)
free(prof_identifier); free(prof_identifier);
prof_identifier = g_compute_hmac_for_string(G_CHECKSUM_SHA256, prof_identifier = g_compute_hmac_for_string(G_CHECKSUM_SHA256,

View File

@ -437,7 +437,7 @@ omemo_receive_message(xmpp_stanza_t* const stanza, gboolean* trusted)
keys = g_list_append(keys, key); keys = g_list_append(keys, key);
continue; continue;
skip: skip:
free(key); free(key);
} }

View File

@ -222,7 +222,7 @@ ox_request_public_key(const char* const jid, const char* const fingerprint)
</item> </item>
</publish> </publish>
</pubsub> </pubsub>
</iq> </iq>
</pre> </pre>
* *
*/ */

View File

@ -2,7 +2,7 @@
* ox.h * ox.h
* vim: expandtab:ts=4:sts=4:sw=4 * vim: expandtab:ts=4:sts=4:sw=4
* *
* Copyright (C) 2020 Stefan Kropp <stefan@debxwoody.de> * Copyright (C) 2020 Stefan Kropp <stefan@debxwoody.de>
* *
* This file is part of Profanity. * This file is part of Profanity.
* *
@ -35,10 +35,10 @@
/*! /*!
* \page OX OX Implementation * \page OX OX Implementation
* *
* \section OX XEP-0373: OpenPGP for XMPP * \section OX XEP-0373: OpenPGP for XMPP
* XEP-0373: OpenPGP for XMPP (OX) is the implementation of OpenPGP for XMPP * XEP-0373: OpenPGP for XMPP (OX) is the implementation of OpenPGP for XMPP
* replace the XEP-0027. * replace the XEP-0027.
* *
* https://xmpp.org/extensions/xep-0373.html * https://xmpp.org/extensions/xep-0373.html
*/ */
@ -48,10 +48,10 @@
* *
* Reads the public key from the given file. Checks the key-information and * Reads the public key from the given file. Checks the key-information and
* pushes the key on PEP. * pushes the key on PEP.
* *
* https://xmpp.org/extensions/xep-0373.html#announcing-pubkey * https://xmpp.org/extensions/xep-0373.html#announcing-pubkey
* *
* \param filename name of the file with the public key * \param filename name of the file with the public key
* \return TRUE: success; FALSE: failed * \return TRUE: success; FALSE: failed
*/ */

View File

@ -2605,7 +2605,7 @@ stanza_create_mam_iq(xmpp_ctx_t* ctx, const char* const jid, const char* const s
char* id = connection_create_stanza_id(); char* id = connection_create_stanza_id();
xmpp_stanza_t* iq = xmpp_iq_new(ctx, STANZA_TYPE_SET, id); xmpp_stanza_t* iq = xmpp_iq_new(ctx, STANZA_TYPE_SET, id);
free(id); free(id);
//xmpp_stanza_set_to(iq, jid); // xmpp_stanza_set_to(iq, jid);
xmpp_stanza_t* query = xmpp_stanza_new(ctx); xmpp_stanza_t* query = xmpp_stanza_new(ctx);
xmpp_stanza_set_name(query, STANZA_NAME_QUERY); xmpp_stanza_set_name(query, STANZA_NAME_QUERY);

View File

@ -99,7 +99,7 @@ typedef struct bookmark_t
char* password; char* password;
char* name; char* name;
gboolean autojoin; gboolean autojoin;
int ext_gajim_minimize; //0 - non existent, 1 - true, 2 - false int ext_gajim_minimize; // 0 - non existent, 1 - true, 2 - false
} Bookmark; } Bookmark;
typedef struct disco_identity_t typedef struct disco_identity_t

View File

@ -61,6 +61,6 @@ returns_commands(void** state)
assert_true(foundCommand1 && foundCommand2 && foundCommand3); assert_true(foundCommand1 && foundCommand2 && foundCommand3);
g_list_free(names); g_list_free(names);
//TODO: why does this make the test fail? // TODO: why does this make the test fail?
//callbacks_close(); // callbacks_close();
} }