Use gboolean consistently.

Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
This commit is contained in:
Steffen Jaeckel
2025-11-12 10:56:52 +01:00
parent b0221f6146
commit 62fd40c510
8 changed files with 34 additions and 34 deletions

View File

@@ -131,12 +131,12 @@ static gboolean _cmd_execute(ProfWin* window, const char* const command, const c
static gboolean _cmd_execute_default(ProfWin* window, const char* inp); static gboolean _cmd_execute_default(ProfWin* window, const char* inp);
static gboolean _cmd_execute_alias(ProfWin* window, const char* const inp, gboolean* ran); static gboolean _cmd_execute_alias(ProfWin* window, const char* const inp, gboolean* ran);
static gboolean static gboolean
_string_matches_one_of(const char* what, const char* is, bool is_can_be_null, const char* first, ...) __attribute__((sentinel)); _string_matches_one_of(const char* what, const char* is, gboolean is_can_be_null, const char* first, ...) __attribute__((sentinel));
static gboolean static gboolean
_download_install_plugin(ProfWin* window, gchar* url, gchar* path); _download_install_plugin(ProfWin* window, gchar* url, gchar* path);
static gboolean static gboolean
_string_matches_one_of(const char* what, const char* is, bool is_can_be_null, const char* first, ...) _string_matches_one_of(const char* what, const char* is, gboolean is_can_be_null, const char* first, ...)
{ {
gboolean ret = FALSE; gboolean ret = FALSE;
va_list ap; va_list ap;
@@ -475,7 +475,7 @@ cmd_connect(ProfWin* window, const char* const command, gchar** args)
// no account password setting, prompt // no account password setting, prompt
} else { } else {
account->password = ui_ask_password(false); account->password = ui_ask_password(FALSE);
conn_status = cl_ev_connect_account(account); conn_status = cl_ev_connect_account(account);
free(account->password); free(account->password);
account->password = NULL; account->password = NULL;
@@ -487,7 +487,7 @@ cmd_connect(ProfWin* window, const char* const command, gchar** args)
// connect with JID // connect with JID
} else { } else {
jid = g_utf8_strdown(user, -1); jid = g_utf8_strdown(user, -1);
auto_char char* passwd = ui_ask_password(false); auto_char char* passwd = ui_ask_password(FALSE);
conn_status = cl_ev_connect_jid(jid, passwd, altdomain, port, tls_policy, auth_policy); conn_status = cl_ev_connect_jid(jid, passwd, altdomain, port, tls_policy, auth_policy);
} }
@@ -853,7 +853,7 @@ _account_set_theme(char* account_name, char* theme)
ProfAccount* account = accounts_get_account(session_get_account_name()); ProfAccount* account = accounts_get_account(session_get_account_name());
if (account) { if (account) {
if (g_strcmp0(account->name, account_name) == 0) { if (g_strcmp0(account->name, account_name) == 0) {
theme_load(theme, false); theme_load(theme, FALSE);
ui_load_colours(); ui_load_colours();
if (prefs_get_boolean(PREF_ROSTER)) { if (prefs_get_boolean(PREF_ROSTER)) {
ui_show_roster(); ui_show_roster();
@@ -3637,9 +3637,9 @@ cmd_join(ProfWin* window, const char* const command, gchar** args)
if (!muc_active(room)) { if (!muc_active(room)) {
presence_join_room(room, nick, passwd); presence_join_room(room, nick, passwd);
muc_join(room, nick, passwd, FALSE); muc_join(room, nick, passwd, FALSE);
iq_room_affiliation_list(room, "member", false); iq_room_affiliation_list(room, "member", FALSE);
iq_room_affiliation_list(room, "admin", false); iq_room_affiliation_list(room, "admin", FALSE);
iq_room_affiliation_list(room, "owner", false); iq_room_affiliation_list(room, "owner", FALSE);
} else if (muc_roster_complete(room)) { } else if (muc_roster_complete(room)) {
ui_switch_to_room(room); ui_switch_to_room(room);
} }
@@ -4187,14 +4187,14 @@ cmd_affiliation(ProfWin* window, const char* const command, gchar** args)
if (g_strcmp0(cmd, "list") == 0) { if (g_strcmp0(cmd, "list") == 0) {
if (!affiliation) { if (!affiliation) {
iq_room_affiliation_list(mucwin->roomjid, "owner", true); iq_room_affiliation_list(mucwin->roomjid, "owner", TRUE);
iq_room_affiliation_list(mucwin->roomjid, "admin", true); iq_room_affiliation_list(mucwin->roomjid, "admin", TRUE);
iq_room_affiliation_list(mucwin->roomjid, "member", true); iq_room_affiliation_list(mucwin->roomjid, "member", TRUE);
iq_room_affiliation_list(mucwin->roomjid, "outcast", true); iq_room_affiliation_list(mucwin->roomjid, "outcast", TRUE);
} else if (g_strcmp0(affiliation, "none") == 0) { } else if (g_strcmp0(affiliation, "none") == 0) {
win_println(window, THEME_DEFAULT, "!", "Cannot list users with no affiliation."); win_println(window, THEME_DEFAULT, "!", "Cannot list users with no affiliation.");
} else { } else {
iq_room_affiliation_list(mucwin->roomjid, affiliation, true); iq_room_affiliation_list(mucwin->roomjid, affiliation, TRUE);
} }
return TRUE; return TRUE;
} }
@@ -9090,12 +9090,12 @@ cmd_color(ProfWin* window, const char* const command, gchar** args)
auto_gchar gchar* theme = prefs_get_string(PREF_THEME); auto_gchar gchar* theme = prefs_get_string(PREF_THEME);
if (theme) { if (theme) {
gboolean res = theme_load(theme, false); gboolean res = theme_load(theme, FALSE);
if (res) { if (res) {
cons_show("Theme reloaded: %s", theme); cons_show("Theme reloaded: %s", theme);
} else { } else {
theme_load("default", false); theme_load("default", FALSE);
} }
} }
@@ -9125,9 +9125,9 @@ cmd_avatar(ProfWin* window, const char* const command, gchar** args)
cons_show("Profanity has not been built with GDK Pixbuf support enabled which is needed to scale the avatar when uploading."); cons_show("Profanity has not been built with GDK Pixbuf support enabled which is needed to scale the avatar when uploading.");
#endif #endif
} else if (g_strcmp0(args[0], "get") == 0) { } else if (g_strcmp0(args[0], "get") == 0) {
avatar_get_by_nick(args[1], false); avatar_get_by_nick(args[1], FALSE);
} else if (g_strcmp0(args[0], "open") == 0) { } else if (g_strcmp0(args[0], "open") == 0) {
avatar_get_by_nick(args[1], true); avatar_get_by_nick(args[1], TRUE);
} else { } else {
cons_bad_cmd_usage(command); cons_bad_cmd_usage(command);
} }
@@ -9510,8 +9510,8 @@ cmd_change_password(ProfWin* window, const char* const command, gchar** args)
return TRUE; return TRUE;
} }
auto_char char* passwd = ui_ask_password(false); auto_char char* passwd = ui_ask_password(FALSE);
auto_char char* confirm_passwd = ui_ask_password(true); auto_char char* confirm_passwd = ui_ask_password(TRUE);
if (g_strcmp0(passwd, confirm_passwd) == 0) { if (g_strcmp0(passwd, confirm_passwd) == 0) {
iq_register_change_password(connection_get_user(), passwd); iq_register_change_password(connection_get_user(), passwd);
@@ -9621,8 +9621,8 @@ cmd_register(ProfWin* window, const char* const command, gchar** args)
char* username = args[0]; char* username = args[0];
char* server = args[1]; char* server = args[1];
auto_char char* passwd = ui_ask_password(false); auto_char char* passwd = ui_ask_password(FALSE);
auto_char char* confirm_passwd = ui_ask_password(true); auto_char char* confirm_passwd = ui_ask_password(TRUE);
if (g_strcmp0(passwd, confirm_passwd) == 0) { if (g_strcmp0(passwd, confirm_passwd) == 0) {
log_info("Attempting to register account %s on server %s.", username, server); log_info("Attempting to register account %s on server %s.", username, server);

View File

@@ -712,7 +712,7 @@ _unique_filename(const char* filename)
return unique; return unique;
} }
static bool static gboolean
_has_directory_suffix(const char* path) _has_directory_suffix(const char* path)
{ {
return (g_str_has_suffix(path, ".") return (g_str_has_suffix(path, ".")

View File

@@ -532,7 +532,7 @@ _theme_find(const char* const theme_name)
g_string_append(path, "/"); g_string_append(path, "/");
g_string_append(path, theme_name); g_string_append(path, theme_name);
if (!g_file_test(path->str, G_FILE_TEST_EXISTS)) { if (!g_file_test(path->str, G_FILE_TEST_EXISTS)) {
g_string_free(path, true); g_string_free(path, TRUE);
path = NULL; path = NULL;
} }
} }

View File

@@ -389,7 +389,7 @@ out:
gcry_error_t gcry_error_t
aes256gcm_crypt_file(FILE* in, FILE* out, off_t file_size, aes256gcm_crypt_file(FILE* in, FILE* out, off_t file_size,
unsigned char key[], unsigned char nonce[], bool encrypt) unsigned char key[], unsigned char nonce[], gboolean encrypt)
{ {
if (!gcry_control(GCRYCTL_INITIALIZATION_FINISHED_P)) { if (!gcry_control(GCRYCTL_INITIALIZATION_FINISHED_P)) {

View File

@@ -185,7 +185,7 @@ int aes128gcm_decrypt(unsigned char* plaintext,
const unsigned char* const key, const unsigned char* const tag); const unsigned char* const key, const unsigned char* const tag);
gcry_error_t aes256gcm_crypt_file(FILE* in, FILE* out, off_t file_size, gcry_error_t aes256gcm_crypt_file(FILE* in, FILE* out, off_t file_size,
unsigned char key[], unsigned char nonce[], bool encrypt); unsigned char key[], unsigned char nonce[], gboolean encrypt);
char* aes256gcm_create_secure_fragment(unsigned char* key, char* aes256gcm_create_secure_fragment(unsigned char* key,
unsigned char* nonce); unsigned char* nonce);

View File

@@ -749,7 +749,7 @@ omemo_on_message_send(ProfWin* win, const char* const message, gboolean request_
GList* device_ids_iter; GList* device_ids_iter;
omemo_ctx.identity_key_store.recv = false; omemo_ctx.identity_key_store.recv = FALSE;
// Encrypt keys for the recipients // Encrypt keys for the recipients
GList* recipients_iter; GList* recipients_iter;
@@ -952,14 +952,14 @@ omemo_on_message_recv(const char* const from_jid, uint32_t sid,
ec_public_key* their_identity_key; ec_public_key* their_identity_key;
signal_buffer* identity_buffer = NULL; signal_buffer* identity_buffer = NULL;
omemo_ctx.identity_key_store.recv = true; omemo_ctx.identity_key_store.recv = TRUE;
pre_key_signal_message_deserialize(&message, key->data, key->length, omemo_ctx.signal); pre_key_signal_message_deserialize(&message, key->data, key->length, omemo_ctx.signal);
their_identity_key = pre_key_signal_message_get_identity_key(message); their_identity_key = pre_key_signal_message_get_identity_key(message);
res = session_cipher_decrypt_pre_key_signal_message(cipher, message, NULL, &plaintext_key); res = session_cipher_decrypt_pre_key_signal_message(cipher, message, NULL, &plaintext_key);
omemo_ctx.identity_key_store.recv = false; omemo_ctx.identity_key_store.recv = FALSE;
/* Perform a real check of the identity */ /* Perform a real check of the identity */
ec_public_key_serialize(&identity_buffer, their_identity_key); ec_public_key_serialize(&identity_buffer, their_identity_key);
@@ -977,7 +977,7 @@ omemo_on_message_recv(const char* const from_jid, uint32_t sid,
SIGNAL_UNREF(new_pre_key); SIGNAL_UNREF(new_pre_key);
SIGNAL_UNREF(message); SIGNAL_UNREF(message);
SIGNAL_UNREF(ec_pair); SIGNAL_UNREF(ec_pair);
omemo_bundle_publish(true); omemo_bundle_publish(TRUE);
if (res == 0) { if (res == 0) {
/* Start a new session */ /* Start a new session */
@@ -994,7 +994,7 @@ omemo_on_message_recv(const char* const from_jid, uint32_t sid,
log_error("[OMEMO][RECV] cannot deserialize message"); log_error("[OMEMO][RECV] cannot deserialize message");
} else { } else {
res = session_cipher_decrypt_signal_message(cipher, message, NULL, &plaintext_key); res = session_cipher_decrypt_signal_message(cipher, message, NULL, &plaintext_key);
*trusted = true; *trusted = TRUE;
SIGNAL_UNREF(message); SIGNAL_UNREF(message);
} }
} }
@@ -1699,7 +1699,7 @@ omemo_encrypt_file(FILE* in, FILE* out, off_t file_size, int* gcry_res)
gcry_create_nonce(nonce, OMEMO_AESGCM_NONCE_LENGTH); gcry_create_nonce(nonce, OMEMO_AESGCM_NONCE_LENGTH);
char* fragment = aes256gcm_create_secure_fragment(key, nonce); char* fragment = aes256gcm_create_secure_fragment(key, nonce);
*gcry_res = aes256gcm_crypt_file(in, out, file_size, key, nonce, true); *gcry_res = aes256gcm_crypt_file(in, out, file_size, key, nonce, TRUE);
if (*gcry_res != GPG_ERR_NO_ERROR) { if (*gcry_res != GPG_ERR_NO_ERROR) {
gcry_free(fragment); gcry_free(fragment);
@@ -1758,7 +1758,7 @@ omemo_decrypt_file(FILE* in, FILE* out, off_t file_size, const char* fragment)
key, OMEMO_AESGCM_KEY_LENGTH); key, OMEMO_AESGCM_KEY_LENGTH);
gcry_error_t crypt_res; gcry_error_t crypt_res;
crypt_res = aes256gcm_crypt_file(in, out, file_size, key, nonce, false); crypt_res = aes256gcm_crypt_file(in, out, file_size, key, nonce, FALSE);
gcry_free(key); gcry_free(key);

View File

@@ -50,7 +50,7 @@ typedef struct
signal_buffer* private; signal_buffer* private;
uint32_t registration_id; uint32_t registration_id;
GHashTable* trusted; GHashTable* trusted;
bool recv; gboolean recv;
} identity_key_store_t; } identity_key_store_t;
GHashTable* session_store_new(void); GHashTable* session_store_new(void);

View File

@@ -361,7 +361,7 @@ void
ui_handle_login_account_success(ProfAccount* account, gboolean secured) ui_handle_login_account_success(ProfAccount* account, gboolean secured)
{ {
if (account->theme) { if (account->theme) {
if (theme_load(account->theme, false)) { if (theme_load(account->theme, FALSE)) {
ui_load_colours(); ui_load_colours();
if (prefs_get_boolean(PREF_ROSTER)) { if (prefs_get_boolean(PREF_ROSTER)) {
ui_show_roster(); ui_show_roster();