diff options
author | Michael Vetter <jubalh@iodoru.org> | 2021-10-05 10:01:27 +0200 |
---|---|---|
committer | Michael Vetter <jubalh@iodoru.org> | 2021-10-05 10:01:27 +0200 |
commit | f21595597f4fa872b77d7f76ae04916f4aae732e (patch) | |
tree | f0d4dec07da9a695a8627575b1837ba26441e911 /src | |
parent | 7e8cf4a3d680ef5b8f056021846818fb526635d9 (diff) | |
download | profani-tty-f21595597f4fa872b77d7f76ae04916f4aae732e.tar.gz |
Format code correctly
Diffstat (limited to 'src')
-rw-r--r-- | src/command/cmd_ac.c | 6 | ||||
-rw-r--r-- | src/command/cmd_funcs.c | 14 | ||||
-rw-r--r-- | src/config/files.c | 2 | ||||
-rw-r--r-- | src/database.c | 24 | ||||
-rw-r--r-- | src/log.c | 2 | ||||
-rw-r--r-- | src/main.c | 2 | ||||
-rw-r--r-- | src/omemo/omemo.c | 20 | ||||
-rw-r--r-- | src/omemo/store.c | 2 | ||||
-rw-r--r-- | src/pgp/gpg.c | 2 | ||||
-rw-r--r-- | src/tools/autocomplete.c | 2 | ||||
-rw-r--r-- | src/ui/chatwin.c | 4 | ||||
-rw-r--r-- | src/ui/console.c | 9 | ||||
-rw-r--r-- | src/ui/core.c | 1 | ||||
-rw-r--r-- | src/ui/inputwin.c | 9 | ||||
-rw-r--r-- | src/ui/mucwin.c | 2 | ||||
-rw-r--r-- | src/ui/notifier.c | 2 | ||||
-rw-r--r-- | src/ui/ui.h | 2 | ||||
-rw-r--r-- | src/ui/window.c | 7 | ||||
-rw-r--r-- | src/ui/window_list.c | 2 | ||||
-rw-r--r-- | src/xmpp/avatar.c | 4 | ||||
-rw-r--r-- | src/xmpp/connection.c | 6 | ||||
-rw-r--r-- | src/xmpp/iq.c | 15 | ||||
-rw-r--r-- | src/xmpp/omemo.c | 17 | ||||
-rw-r--r-- | src/xmpp/ox.c | 4 | ||||
-rw-r--r-- | src/xmpp/stanza.c | 10 | ||||
-rw-r--r-- | src/xmpp/xmpp.h | 2 |
26 files changed, 84 insertions, 88 deletions
diff --git a/src/command/cmd_ac.c b/src/command/cmd_ac.c index 39ab24bc..9db42841 100644 --- a/src/command/cmd_ac.c +++ b/src/command/cmd_ac.c @@ -1613,7 +1613,7 @@ cmd_ac_complete_filepath(const char* const input, char* const startstr, gboolean char* acstring; if (output_off) { tmp = g_strdup_printf("%s/%s", directory, dir->d_name); - if(!tmp) { + if (!tmp) { free(directory); free(foofile); return NULL; @@ -2482,8 +2482,8 @@ _ox_autocomplete(ProfWin* window, const char* const input, gboolean previous) if (conn_status == JABBER_CONNECTED) { found = autocomplete_param_with_func(input, "/ox discover", roster_contact_autocomplete, previous, NULL); - if (found) { - return found; + if (found) { + return found; } } diff --git a/src/command/cmd_funcs.c b/src/command/cmd_funcs.c index 2a206d5b..67c59802 100644 --- a/src/command/cmd_funcs.c +++ b/src/command/cmd_funcs.c @@ -1651,7 +1651,7 @@ cmd_help(ProfWin* window, const char* const command, gchar** args) cons_navigation_help(); } else { char* cmd = args[0]; - char *cmd_with_slash = g_strdup_printf("/%s", cmd); + char* cmd_with_slash = g_strdup_printf("/%s", cmd); Command* command = cmd_get(cmd_with_slash); if (command) { @@ -4708,8 +4708,8 @@ cmd_bookmark(ProfWin* window, const char* const command, gchar** args) cons_show_bookmarks(bookmarks); g_list_free(bookmarks); } else { - // list one bookmark - Bookmark *bookmark = bookmark_get_by_jid(bookmark_jid); + // list one bookmark + Bookmark* bookmark = bookmark_get_by_jid(bookmark_jid); cons_show_bookmark(bookmark); } @@ -7189,14 +7189,14 @@ cmd_plugins(ProfWin* window, const char* const command, gchar** args) } } if (global_pyp_dir) { - const gchar *filename; + const gchar* filename; cons_show("The following Python plugins are available globally and can be installed:"); while ((filename = g_dir_read_name(global_pyp_dir))) { cons_show(" %s", filename); } } if (global_cp_dir) { - const gchar *filename; + const gchar* filename; cons_show("The following C plugins are available globally and can be installed:"); while ((filename = g_dir_read_name(global_cp_dir))) { cons_show(" %s", filename); @@ -9460,8 +9460,8 @@ cmd_editor(ProfWin* window, const char* const command, gchar** args) } // create editor dir if not present - char *jid = connection_get_barejid(); - gchar *path = files_get_account_data_path(DIR_EDITOR, jid); + char* jid = connection_get_barejid(); + gchar* path = files_get_account_data_path(DIR_EDITOR, jid); if (g_mkdir_with_parents(path, S_IRWXU) != 0) { cons_show_error("Failed to create directory at '%s' with error '%s'", path, strerror(errno)); free(jid); diff --git a/src/config/files.c b/src/config/files.c index b6a8d490..ce3f1196 100644 --- a/src/config/files.c +++ b/src/config/files.c @@ -119,7 +119,7 @@ files_get_log_file(const char* const log_file) GString* logfile; if (log_file) { - gchar *log_path = g_path_get_dirname(log_file); + gchar* log_path = g_path_get_dirname(log_file); if (!mkdir_recursive(log_path)) { log_error("Error while creating directory %s", log_path); } diff --git a/src/database.c b/src/database.c index 00aff314..c05e3035 100644 --- a/src/database.c +++ b/src/database.c @@ -329,18 +329,18 @@ _add_to_db(ProfMessage* message, char* type, const Jid* const from_jid, const Ji } query = sqlite3_mprintf("INSERT INTO `ChatLogs` (`from_jid`, `from_resource`, `to_jid`, `to_resource`, `message`, `timestamp`, `stanza_id`, `archive_id`, `replace_id`, `type`, `encryption`) SELECT '%q', '%q', '%q', '%q', '%q', '%q', '%q', '%q', '%q', '%q', '%q' WHERE NOT EXISTS (SELECT 1 FROM `ChatLogs` WHERE `archive_id` = '%q')", - from_jid->barejid, - from_jid->resourcepart ? from_jid->resourcepart : "", - to_jid->barejid, - to_jid->resourcepart ? to_jid->resourcepart : "", - message->plain ? message->plain : "", - date_fmt ? date_fmt : "", - message->id ? message->id : "", - message->stanzaid ? message->stanzaid : "", - message->replace_id ? message->replace_id : "", - type ? type : "", - enc ? enc : "", - message->stanzaid ? message->stanzaid : ""); + from_jid->barejid, + from_jid->resourcepart ? from_jid->resourcepart : "", + to_jid->barejid, + to_jid->resourcepart ? to_jid->resourcepart : "", + message->plain ? message->plain : "", + date_fmt ? date_fmt : "", + message->id ? message->id : "", + message->stanzaid ? message->stanzaid : "", + message->replace_id ? message->replace_id : "", + type ? type : "", + enc ? enc : "", + message->stanzaid ? message->stanzaid : ""); if (!query) { log_error("log_database_add(): SQL query. could not allocate memory"); return; diff --git a/src/log.c b/src/log.c index ecc1038b..8249d70a 100644 --- a/src/log.c +++ b/src/log.c @@ -240,7 +240,7 @@ _rotate_log_file(void) gchar* log_file_new = malloc(len + 4); // find an empty name. from .log -> log.01 -> log.99 - for (int i=1; i < 100; i++) { + for (int i = 1; i < 100; i++) { g_sprintf(log_file_new, "%s.%02d", log_file, i); if (!g_file_test(log_file_new, G_FILE_TEST_EXISTS)) break; diff --git a/src/main.c b/src/main.c index bb4d4726..6ec9eff5 100644 --- a/src/main.c +++ b/src/main.c @@ -69,7 +69,7 @@ static char* theme_name = NULL; int main(int argc, char** argv) { - if (argc == 2 && g_strcmp0(PACKAGE_STATUS, "development") == 0) { + if (argc == 2 && g_strcmp0(PACKAGE_STATUS, "development") == 0) { if (g_strcmp0(argv[1], "docgen") == 0) { command_docgen(); return 0; diff --git a/src/omemo/omemo.c b/src/omemo/omemo.c index 952fea89..e1126e62 100644 --- a/src/omemo/omemo.c +++ b/src/omemo/omemo.c @@ -422,7 +422,7 @@ omemo_start_session(const char* const barejid) // Own devices are handled by _handle_own_device_list // We won't add _handle_device_list_start_session for ourself char* mybarejid = connection_get_barejid(); - if( g_strcmp0(mybarejid, barejid ) != 0 ) { + if (g_strcmp0(mybarejid, barejid) != 0) { g_hash_table_insert(omemo_ctx.device_list_handler, strdup(barejid), _handle_device_list_start_session); } free(mybarejid); @@ -681,12 +681,12 @@ omemo_start_device_session(const char* const jid, uint32_t device_id, } if (!trusted) { - log_debug("[OMEMO] We don't trust device %d for %s\n", device_id,jid); + log_debug("[OMEMO] We don't trust device %d for %s\n", device_id, jid); goto out; } if (!contains_session(&address, omemo_ctx.session_store)) { - log_debug("[OMEMO] There is no Session for %s ( %d) ,... building session.", address.name, address.device_id ); + log_debug("[OMEMO] There is no Session for %s ( %d) ,... building session.", address.name, address.device_id); int res; session_pre_key_bundle* bundle; signal_protocol_address* address; @@ -815,7 +815,7 @@ omemo_on_message_send(ProfWin* win, const char* const message, gboolean request_ // <https://xmpp.org/extensions/xep-0384.html#encrypt>). // Yourself as recipients in case of MUC char* mybarejid = connection_get_barejid(); - if ( !g_strcmp0(mybarejid, recipients_iter->data) ) { + if (!g_strcmp0(mybarejid, recipients_iter->data)) { if (GPOINTER_TO_INT(device_ids_iter->data) == omemo_ctx.device_id) { free(mybarejid); log_debug("[OMEMO][SEND] Skipping %d (my device) ", GPOINTER_TO_INT(device_ids_iter->data)); @@ -826,15 +826,15 @@ omemo_on_message_send(ProfWin* win, const char* const message, gboolean request_ log_debug("[OMEMO][SEND] recipients with device id %d for %s", GPOINTER_TO_INT(device_ids_iter->data), recipients_iter->data); res = session_cipher_create(&cipher, omemo_ctx.store, &address, omemo_ctx.signal); - if (res != SG_SUCCESS ) { + if (res != SG_SUCCESS) { log_error("[OMEMO][SEND] cannot create cipher for %s device id %d - code: %d", address.name, address.device_id, res); continue; } res = session_cipher_encrypt(cipher, key_tag, AES128_GCM_KEY_LENGTH + AES128_GCM_TAG_LENGTH, &ciphertext); session_cipher_free(cipher); - if (res != SG_SUCCESS ) { - log_info("[OMEMO][SEND] cannot encrypt key for %s device id %d - code: %d", address.name, address.device_id,res); + if (res != SG_SUCCESS) { + log_info("[OMEMO][SEND] cannot encrypt key for %s device id %d - code: %d", address.name, address.device_id, res); continue; } signal_buffer* buffer = ciphertext_message_get_serialized(ciphertext); @@ -855,9 +855,9 @@ omemo_on_message_send(ProfWin* win, const char* const message, gboolean request_ // (Since none of the recipients would be able to read the message.) if (keys == NULL) { win_println(win, THEME_ERROR, "!", "This message cannot be decrypted for any recipient.\n" - "You should trust your recipients' device fingerprint(s) using \"/omemo fingerprint trust FINGERPRINT\".\n" - "It could also be that the key bundle of the recipient(s) have not been received. " - "In this case, you could try \"omemo end\", \"omemo start\", and send the message again."); + "You should trust your recipients' device fingerprint(s) using \"/omemo fingerprint trust FINGERPRINT\".\n" + "It could also be that the key bundle of the recipient(s) have not been received. " + "In this case, you could try \"omemo end\", \"omemo start\", and send the message again."); goto out; } diff --git a/src/omemo/store.c b/src/omemo/store.c index 70fd91d3..d34ebf30 100644 --- a/src/omemo/store.c +++ b/src/omemo/store.c @@ -431,7 +431,7 @@ is_trusted_identity(const signal_protocol_address* address, uint8_t* key_data, signal_buffer* buffer = signal_buffer_create(key_data, key_len); signal_buffer* original = g_hash_table_lookup(trusted, GINT_TO_POINTER(address->device_id)); - if(!original) { + if (!original) { log_debug("[OMEMO][STORE] original not found %s (%d)", address->name, address->device_id); } ret = original != NULL && signal_buffer_compare(buffer, original) == 0; diff --git a/src/pgp/gpg.c b/src/pgp/gpg.c index 8aac50ff..d4863492 100644 --- a/src/pgp/gpg.c +++ b/src/pgp/gpg.c @@ -1143,7 +1143,7 @@ p_ox_gpg_decrypt(char* base64) { // if there is no private key avaibale, // we don't try do decrypt - if(!ox_is_private_key_available(connection_get_barejid())) { + if (!ox_is_private_key_available(connection_get_barejid())) { return NULL; } setlocale(LC_ALL, ""); diff --git a/src/tools/autocomplete.c b/src/tools/autocomplete.c index e1efdba9..9450b98f 100644 --- a/src/tools/autocomplete.c +++ b/src/tools/autocomplete.c @@ -324,7 +324,7 @@ _autocomplete_param_common(const char* const input, char* command, autocomplete_ if (strncmp(input, command_cpy, len) == 0) { int inp_len = strlen(input); char prefix[inp_len]; - char *found; + char* found; for (int i = len; i < inp_len; i++) { prefix[i - len] = input[i]; diff --git a/src/ui/chatwin.c b/src/ui/chatwin.c index 4dfe50ed..1c33e6c3 100644 --- a/src/ui/chatwin.c +++ b/src/ui/chatwin.c @@ -89,7 +89,7 @@ chatwin_new(const char* const barejid) #endif // HAVE_LIBOTR if (omemo_automatic_start(barejid) && is_otr_secure) { win_println(window, THEME_DEFAULT, "!", "This chat could be either OMEMO or OTR encrypted, but not both. " - "Use '/omemo start' or '/otr start' to select the encryption method."); + "Use '/omemo start' or '/otr start' to select the encryption method."); } else if (omemo_automatic_start(barejid)) { // Start the OMEMO session omemo_start_session(barejid); @@ -519,7 +519,7 @@ _chatwin_history(ProfChatWin* chatwin, const char* const contact_barejid) while (curr) { ProfMessage* msg = curr->data; - char *msg_plain = msg->plain; + char* msg_plain = msg->plain; msg->plain = plugins_pre_chat_message_display(msg->from_jid->barejid, msg->from_jid->resourcepart, msg->plain); // This is dirty workaround for memory leak. We reassign msg->plain above so have to free previous object // TODO: Make a better solution, for example, pass msg object to the function and it will replace msg->plain properly if needed. diff --git a/src/ui/console.c b/src/ui/console.c index 15512c77..bdb8f24d 100644 --- a/src/ui/console.c +++ b/src/ui/console.c @@ -507,7 +507,8 @@ cons_show_wins(gboolean unread) } void -cons_show_wins_attention() { +cons_show_wins_attention() +{ ProfWin* console = wins_get_console(); cons_show(""); GSList* window_strings = wins_create_summary_attention(); @@ -837,12 +838,14 @@ cons_show_disco_items(GSList* items, const char* const jid) cons_alert(NULL); } -static void _cons_print_contact_information_item(gpointer data, gpointer user_data) +static void +_cons_print_contact_information_item(gpointer data, gpointer user_data) { cons_show(" %s", (char*)data); } -static void _cons_print_contact_information_hashlist_item(gpointer key, gpointer value, gpointer userdata) +static void +_cons_print_contact_information_hashlist_item(gpointer key, gpointer value, gpointer userdata) { cons_show(" %s:", (char*)key); g_slist_foreach((GSList*)value, _cons_print_contact_information_item, NULL); diff --git a/src/ui/core.c b/src/ui/core.c index f4ee4a86..3b10888b 100644 --- a/src/ui/core.c +++ b/src/ui/core.c @@ -1009,7 +1009,6 @@ ui_win_has_attention(int index) return ret; } - char* ui_ask_password(gboolean confirm) { diff --git a/src/ui/inputwin.c b/src/ui/inputwin.c index 3e2f6a67..4ea773c8 100644 --- a/src/ui/inputwin.c +++ b/src/ui/inputwin.c @@ -811,9 +811,10 @@ _inp_rl_win_next_unread_handler(int count, int key) } static int -_inp_rl_win_attention_handler(int count, int key) { +_inp_rl_win_attention_handler(int count, int key) +{ ProfWin* current = wins_get_current(); - if ( current ) { + if (current) { gboolean attention = win_toggle_attention(current); if (attention) { win_println(current, THEME_DEFAULT, "!", "Attention flag has been activated"); @@ -826,7 +827,8 @@ _inp_rl_win_attention_handler(int count, int key) { } static int -_inp_rl_win_attention_next_handler(int count, int key) { +_inp_rl_win_attention_next_handler(int count, int key) +{ ProfWin* window = wins_get_next_attention(); if (window) { ui_focus_win(window); @@ -834,7 +836,6 @@ _inp_rl_win_attention_next_handler(int count, int key) { return 0; } - static int _inp_rl_win_pageup_handler(int count, int key) { diff --git a/src/ui/mucwin.c b/src/ui/mucwin.c index a0717282..5bf21722 100644 --- a/src/ui/mucwin.c +++ b/src/ui/mucwin.c @@ -391,7 +391,7 @@ _mucwin_print_mention(ProfWin* window, const char* const message, const char* co while (curr) { pos = GPOINTER_TO_INT(curr->data); - char *before_str = g_utf8_substring(message, last_pos, pos); + char* before_str = g_utf8_substring(message, last_pos, pos); if (last_pos == 0 && strncmp(before_str, "/me ", 4) == 0) { win_print_them(window, THEME_ROOMMENTION, ch, flags, ""); diff --git a/src/ui/notifier.c b/src/ui/notifier.c index a9aa38c7..9a0eb291 100644 --- a/src/ui/notifier.c +++ b/src/ui/notifier.c @@ -77,7 +77,7 @@ notifier_uninit(void) void notify_typing(const char* const name) { - gchar *message = g_strdup_printf("%s: typing...", name); + gchar* message = g_strdup_printf("%s: typing...", name); notify(message, 10000, "Incoming message"); g_free(message); } diff --git a/src/ui/ui.h b/src/ui/ui.h index dc2fc497..bb81dfc3 100644 --- a/src/ui/ui.h +++ b/src/ui/ui.h @@ -76,7 +76,7 @@ int ui_close_read_wins(void); void ui_close_win(int index); int ui_win_unread(int index); gboolean ui_win_has_attention(int index); -gboolean win_has_attention(ProfWin* window); +gboolean win_has_attention(ProfWin* window); gboolean win_toggle_attention(ProfWin* window); char* ui_ask_password(gboolean confirm); char* ui_get_line(void); diff --git a/src/ui/window.c b/src/ui/window.c index 4fb7d5f7..3123e211 100644 --- a/src/ui/window.c +++ b/src/ui/window.c @@ -1843,7 +1843,7 @@ win_unread(ProfWin* window) } gboolean -win_has_attention(ProfWin* window) +win_has_attention(ProfWin* window) { if (window->type == WIN_CHAT) { ProfChatWin* chatwin = (ProfChatWin*)window; @@ -1857,8 +1857,8 @@ win_has_attention(ProfWin* window) return FALSE; } -gboolean -win_toggle_attention(ProfWin* window) +gboolean +win_toggle_attention(ProfWin* window) { if (window->type == WIN_CHAT) { ProfChatWin* chatwin = (ProfChatWin*)window; @@ -1874,7 +1874,6 @@ win_toggle_attention(ProfWin* window) return FALSE; } - void win_sub_print(WINDOW* win, char* msg, gboolean newline, gboolean wrap, int indent) { diff --git a/src/ui/window_list.c b/src/ui/window_list.c index d698d778..01379804 100644 --- a/src/ui/window_list.c +++ b/src/ui/window_list.c @@ -1210,7 +1210,7 @@ wins_get_next_unread(void) GList* curr = values; while (curr) { - int curr_win_num = GPOINTER_TO_INT(curr->data); + int curr_win_num = GPOINTER_TO_INT(curr->data); ProfWin* window = wins_get_by_num(curr_win_num); // test if window has unread messages diff --git a/src/xmpp/avatar.c b/src/xmpp/avatar.c index 25889a75..89d34fbc 100644 --- a/src/xmpp/avatar.c +++ b/src/xmpp/avatar.c @@ -154,11 +154,11 @@ _avatar_metadata_handler(xmpp_stanza_t* const stanza, void* const userdata) const char* id = xmpp_stanza_get_id(info); const char* type = xmpp_stanza_get_attribute(info, "type"); - if(id && type) { + if (id && type) { log_debug("Avatar ID for %s is: %s", from, id); avatar_metadata* data = malloc(sizeof(avatar_metadata)); - if(data) { + if (data) { data->type = strdup(type); data->id = strdup(id); diff --git a/src/xmpp/connection.c b/src/xmpp/connection.c index e25b8f6f..30ef0a9e 100644 --- a/src/xmpp/connection.c +++ b/src/xmpp/connection.c @@ -522,7 +522,7 @@ connection_create_stanza_id(void) (guchar*)prof_identifier, strlen(prof_identifier), rndid, strlen(rndid)); - char *ret = g_strdup_printf("%s%s", rndid, hmac); + char* ret = g_strdup_printf("%s%s", rndid, hmac); free(rndid); g_free(hmac); @@ -746,8 +746,8 @@ _compute_identifier(const char* barejid) free(prof_identifier); prof_identifier = g_compute_hmac_for_string(G_CHECKSUM_SHA256, - (guchar*)profanity_instance_id, strlen(profanity_instance_id), - barejid, strlen(barejid)); + (guchar*)profanity_instance_id, strlen(profanity_instance_id), + barejid, strlen(barejid)); } const char* diff --git a/src/xmpp/iq.c b/src/xmpp/iq.c index 4a37b21f..dd3c2423 100644 --- a/src/xmpp/iq.c +++ b/src/xmpp/iq.c @@ -2343,7 +2343,7 @@ _disco_info_response_id_handler(xmpp_stanza_t* const stanza, void* const userdat } } } else if (g_strcmp0(child_type, STANZA_TYPE_RESULT) == 0) { - GHashTable *adr = stanza_get_service_contact_addresses(connection_get_ctx(), child); + GHashTable* adr = stanza_get_service_contact_addresses(connection_get_ctx(), child); cons_show_disco_contact_information(adr); g_hash_table_destroy(adr); } @@ -2456,14 +2456,11 @@ _http_upload_response_id_handler(xmpp_stanza_t* const stanza, void* const userda const char* header_name = xmpp_stanza_get_attribute(header, STANZA_ATTR_NAME); if (g_strcmp0(header_name, STANZA_HEADER_AUTHORIZATION) == 0) { upload->authorization = xmpp_stanza_get_text(header); - } - else if (g_strcmp0(header_name, STANZA_HEADER_COOKIE) == 0) { + } else if (g_strcmp0(header_name, STANZA_HEADER_COOKIE) == 0) { upload->cookie = xmpp_stanza_get_text(header); - } - else if (g_strcmp0(header_name, STANZA_HEADER_EXPIRES) == 0) { + } else if (g_strcmp0(header_name, STANZA_HEADER_EXPIRES) == 0) { upload->expires = xmpp_stanza_get_text(header); - } - else { + } else { log_warning("[HTTP upload] unknown header: %s", header_name); } } @@ -2629,8 +2626,8 @@ _mam_rsm_id_handler(xmpp_stanza_t* const stanza, void* const userdata) if (fin) { xmpp_stanza_t* set = xmpp_stanza_get_child_by_name_and_ns(fin, STANZA_TYPE_SET, STANZA_NS_RSM); if (set) { - char *lastid = NULL; - xmpp_stanza_t* last = xmpp_stanza_get_child_by_name(set, STANZA_NAME_LAST); + char* lastid = NULL; + xmpp_stanza_t* last = xmpp_stanza_get_child_by_name(set, STANZA_NAME_LAST); if (last) { lastid = xmpp_stanza_get_text(last); } diff --git a/src/xmpp/omemo.c b/src/xmpp/omemo.c index 549c88a6..66567e97 100644 --- a/src/xmpp/omemo.c +++ b/src/xmpp/omemo.c @@ -145,9 +145,9 @@ omemo_bundle_publish(gboolean first) if (connection_supports(XMPP_FEATURE_PUBSUB_PUBLISH_OPTIONS)) { stanza_attach_publish_options_va(ctx, iq, - 4, // 2 * number of key-value pairs - "pubsub#persist_items", "true", - "pubsub#access_model", "open"); + 4, // 2 * number of key-value pairs + "pubsub#persist_items", "true", + "pubsub#access_model", "open"); } iq_id_handler_add(id, _omemo_bundle_publish_result, NULL, GINT_TO_POINTER(first)); @@ -190,7 +190,7 @@ omemo_start_device_session_handle_bundle(xmpp_stanza_t* const stanza, void* cons log_debug("[OMEMO] omemo_start_device_session_handle_bundle: %s", from_attr); const char* type = xmpp_stanza_get_type(stanza); - if ( g_strcmp0( type, "error") == 0 ) { + if (g_strcmp0(type, "error") == 0) { log_error("[OMEMO] Error to get key for a device from : %s", from_attr); } @@ -555,13 +555,13 @@ _omemo_devicelist_publish_result(xmpp_stanza_t* const stanza, void* const userda if (g_strcmp0(type, STANZA_TYPE_ERROR) == 0) { log_error("[OMEMO] Publishing device list failed"); - xmpp_stanza_t *error = xmpp_stanza_get_child_by_name(stanza, "error"); + xmpp_stanza_t* error = xmpp_stanza_get_child_by_name(stanza, "error"); if (!error) { log_error("[OMEMO] Missing error element in device list publication result"); return 0; } - xmpp_stanza_t *pubsub_error = xmpp_stanza_get_child_by_ns(error, STANZA_NS_PUBSUB_ERROR); + xmpp_stanza_t* pubsub_error = xmpp_stanza_get_child_by_ns(error, STANZA_NS_PUBSUB_ERROR); if (!pubsub_error) { log_error("[OMEMO] Unknown error while publishing our own device list"); cons_show_error("Unknown error while publishing our own device list"); @@ -606,7 +606,7 @@ _omemo_devicelist_configure_submit(xmpp_stanza_t* const stanza, void* const user } DataForm* form = form_create(x); - form_set_value(form, "pubsub#access_model", "open"); + form_set_value(form, "pubsub#access_model", "open"); xmpp_ctx_t* const ctx = connection_get_ctx(); Jid* jid = jid_create(connection_get_fulljid()); @@ -644,7 +644,6 @@ _omemo_devicelist_configure_result(xmpp_stanza_t* const stanza, void* const user return 0; } - static int _omemo_bundle_publish_result(xmpp_stanza_t* const stanza, void* const userdata) { @@ -704,7 +703,7 @@ _omemo_bundle_publish_configure(xmpp_stanza_t* const stanza, void* const userdat } DataForm* form = form_create(x); - form_set_value(form, "pubsub#access_model", "open"); + form_set_value(form, "pubsub#access_model", "open"); xmpp_ctx_t* const ctx = connection_get_ctx(); Jid* jid = jid_create(connection_get_fulljid()); diff --git a/src/xmpp/ox.c b/src/xmpp/ox.c index 195cdedd..b8a0a41e 100644 --- a/src/xmpp/ox.c +++ b/src/xmpp/ox.c @@ -123,7 +123,7 @@ ox_announce_public_key(const char* const filename) xmpp_stanza_t* item = xmpp_stanza_new(ctx); xmpp_stanza_set_name(item, STANZA_NAME_ITEM); - char *timestamp = _gettimestamp(); + char* timestamp = _gettimestamp(); xmpp_stanza_set_attribute(item, STANZA_ATTR_ID, timestamp); free(timestamp); @@ -305,7 +305,7 @@ _ox_metadata_result(xmpp_conn_t* const conn, xmpp_stanza_t* const stanza, void* while (pubkeymetadata) { const char* fingerprint = xmpp_stanza_get_attribute(pubkeymetadata, STANZA_ATTR_V4_FINGERPRINT); - if ( strlen( fingerprint ) == KEYID_LENGTH ) { + if (strlen(fingerprint) == KEYID_LENGTH) { cons_show(fingerprint); } else { cons_show("OX: Wrong char size of public key"); diff --git a/src/xmpp/stanza.c b/src/xmpp/stanza.c index b1bc8f94..81a41bed 100644 --- a/src/xmpp/stanza.c +++ b/src/xmpp/stanza.c @@ -1947,7 +1947,7 @@ stanza_attach_publish_options_va(xmpp_ctx_t* const ctx, xmpp_stanza_t* const iq, int j; for (j = 0; j < count; j += 2) { const char* const option = va_arg(ap, char* const); - const char* const value = va_arg(ap, char* const); + const char* const value = va_arg(ap, char* const); xmpp_stanza_t* field = xmpp_stanza_new(ctx); xmpp_stanza_set_name(field, STANZA_NAME_FIELD); @@ -1966,7 +1966,6 @@ stanza_attach_publish_options_va(xmpp_ctx_t* const ctx, xmpp_stanza_t* const iq, } va_end(ap); - xmpp_stanza_release(form_type_value_text); xmpp_stanza_release(form_type_value); xmpp_stanza_release(form_type); @@ -1980,7 +1979,6 @@ stanza_attach_publish_options(xmpp_ctx_t* const ctx, xmpp_stanza_t* const iq, co stanza_attach_publish_options_va(ctx, iq, 2, option, value); } - void stanza_attach_priority(xmpp_ctx_t* const ctx, xmpp_stanza_t* const presence, const int pri) { @@ -2324,7 +2322,7 @@ stanza_create_omemo_devicelist_publish(xmpp_ctx_t* ctx, GList* const ids) xmpp_stanza_set_name(list, "list"); xmpp_stanza_set_ns(list, "eu.siacs.conversations.axolotl"); - for (GList *i = ids; i != NULL; i = i->next) { + for (GList* i = ids; i != NULL; i = i->next) { xmpp_stanza_t* device = xmpp_stanza_new(ctx); xmpp_stanza_set_name(device, "device"); char* id = g_strdup_printf("%d", GPOINTER_TO_INT(i->data)); @@ -2608,7 +2606,7 @@ stanza_attach_correction(xmpp_ctx_t* ctx, xmpp_stanza_t* stanza, const char* con } xmpp_stanza_t* -stanza_create_mam_iq(xmpp_ctx_t* ctx, const char* const jid, const char* const startdate, const char *const lastid) +stanza_create_mam_iq(xmpp_ctx_t* ctx, const char* const jid, const char* const startdate, const char* const lastid) { char* id = connection_create_stanza_id(); xmpp_stanza_t* iq = xmpp_iq_new(ctx, STANZA_TYPE_SET, id); @@ -2859,7 +2857,7 @@ stanza_get_service_contact_addresses(xmpp_ctx_t* ctx, xmpp_stanza_t* stanza) if (g_strcmp0(child_name, STANZA_NAME_FIELD) == 0 && g_strcmp0(child_type, STANZA_TYPE_LIST_MULTI) == 0) { // extract key (eg 'admin-addresses') - const char* var = xmpp_stanza_get_attribute(fields, STANZA_ATTR_VAR ); + const char* var = xmpp_stanza_get_attribute(fields, STANZA_ATTR_VAR); // extract values (a list of contact addresses eg mailto:xmpp@shakespeare.lit, xmpp:admins@shakespeare.lit) xmpp_stanza_t* values = xmpp_stanza_get_children(fields); diff --git a/src/xmpp/xmpp.h b/src/xmpp/xmpp.h index 61c7a642..4c49eb8b 100644 --- a/src/xmpp/xmpp.h +++ b/src/xmpp/xmpp.h @@ -165,7 +165,7 @@ typedef struct prof_message_t /* stanza-id from XEP 0359. Used for MAM. archive_id in our database (see database.c) * coming in as <stanza-id> for live messages * coming in as <result id=""> for MAM messages*/ - char *stanzaid; + char* stanzaid; /* The raw body from xmpp message, either plaintext or OTR encrypted text */ char* body; /* The encrypted message as for PGP */ |