mirror of
https://github.com/profanity-im/profanity.git
synced 2024-11-03 19:37:16 -05:00
Format code correctly
This commit is contained in:
parent
7e8cf4a3d6
commit
f21595597f
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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, "");
|
||||
|
@ -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];
|
||||
|
@ -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.
|
||||
|
@ -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);
|
||||
|
@ -1009,7 +1009,6 @@ ui_win_has_attention(int index)
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
char*
|
||||
ui_ask_password(gboolean confirm)
|
||||
{
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -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, "");
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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*
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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());
|
||||
|
@ -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");
|
||||
|
@ -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);
|
||||
|
@ -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 */
|
||||
|
@ -116,6 +116,7 @@ omemo_encrypt_file(FILE* in, FILE* out, off_t file_size, int* gcry_res)
|
||||
void omemo_free(void* a){};
|
||||
|
||||
uint32_t
|
||||
omemo_device_id() {
|
||||
return 123;
|
||||
omemo_device_id()
|
||||
{
|
||||
return 123;
|
||||
}
|
||||
|
@ -211,18 +211,21 @@ ui_win_unread(int index)
|
||||
}
|
||||
|
||||
gboolean
|
||||
ui_win_has_attention(int index) {
|
||||
return FALSE;
|
||||
ui_win_has_attention(int index)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
win_has_attention(ProfWin* window){
|
||||
return FALSE;
|
||||
win_has_attention(ProfWin* window)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
win_toggle_attention(ProfWin* window){
|
||||
return FALSE;
|
||||
win_toggle_attention(ProfWin* window)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
char*
|
||||
ui_ask_password(gboolean confirm)
|
||||
@ -843,7 +846,7 @@ cons_show_wins(gboolean unread)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
void
|
||||
cons_show_wins_attention()
|
||||
{
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user