diff --git a/src/chat_session.c b/src/chat_session.c index 2758d603..162a60d5 100644 --- a/src/chat_session.c +++ b/src/chat_session.c @@ -46,8 +46,8 @@ static GHashTable *sessions; static void -_chat_session_new(const char * const barejid, const char * const resource, - gboolean resource_override, gboolean send_states) +_chat_session_new(const char *const barejid, const char *const resource, gboolean resource_override, + gboolean send_states) { assert(barejid != NULL); assert(resource != NULL); @@ -86,19 +86,19 @@ chat_sessions_clear(void) } void -chat_session_resource_override(const char * const barejid, const char * const resource) +chat_session_resource_override(const char *const barejid, const char *const resource) { _chat_session_new(barejid, resource, TRUE, TRUE); } ChatSession* -chat_session_get(const char * const barejid) +chat_session_get(const char *const barejid) { return g_hash_table_lookup(sessions, barejid); } void -chat_session_recipient_gone(const char * const barejid, const char * const resource) +chat_session_recipient_gone(const char *const barejid, const char *const resource) { assert(barejid != NULL); assert(resource != NULL); @@ -112,25 +112,25 @@ chat_session_recipient_gone(const char * const barejid, const char * const resou } void -chat_session_recipient_typing(const char * const barejid, const char * const resource) +chat_session_recipient_typing(const char *const barejid, const char *const resource) { chat_session_recipient_active(barejid, resource, TRUE); } void -chat_session_recipient_paused(const char * const barejid, const char * const resource) +chat_session_recipient_paused(const char *const barejid, const char *const resource) { chat_session_recipient_active(barejid, resource, TRUE); } void -chat_session_recipient_inactive(const char * const barejid, const char * const resource) +chat_session_recipient_inactive(const char *const barejid, const char *const resource) { chat_session_recipient_active(barejid, resource, TRUE); } void -chat_session_recipient_active(const char * const barejid, const char * const resource, +chat_session_recipient_active(const char *const barejid, const char *const resource, gboolean send_states) { assert(barejid != NULL); @@ -153,7 +153,7 @@ chat_session_recipient_active(const char * const barejid, const char * const res } void -chat_session_remove(const char * const barejid) +chat_session_remove(const char *const barejid) { g_hash_table_remove(sessions, barejid); -} \ No newline at end of file +} diff --git a/src/chat_session.h b/src/chat_session.h index f51a8341..9f84cbec 100644 --- a/src/chat_session.h +++ b/src/chat_session.h @@ -48,16 +48,15 @@ typedef struct chat_session_t { void chat_sessions_init(void); void chat_sessions_clear(void); -void chat_session_resource_override(const char * const barejid, const char * const resource); -ChatSession* chat_session_get(const char * const barejid); +void chat_session_resource_override(const char *const barejid, const char *const resource); +ChatSession* chat_session_get(const char *const barejid); -void chat_session_recipient_active(const char * const barejid, const char * const resource, - gboolean send_states); -void chat_session_recipient_typing(const char * const barejid, const char * const resource); -void chat_session_recipient_paused(const char * const barejid, const char * const resource); -void chat_session_recipient_gone(const char * const barejid, const char * const resource); -void chat_session_recipient_inactive(const char * const barejid, const char * const resource); +void chat_session_recipient_active(const char *const barejid, const char *const resource, gboolean send_states); +void chat_session_recipient_typing(const char *const barejid, const char *const resource); +void chat_session_recipient_paused(const char *const barejid, const char *const resource); +void chat_session_recipient_gone(const char *const barejid, const char *const resource); +void chat_session_recipient_inactive(const char *const barejid, const char *const resource); -void chat_session_remove(const char * const barejid); +void chat_session_remove(const char *const barejid); #endif diff --git a/src/chat_state.c b/src/chat_state.c index 8ddb6f1e..8e8e974f 100644 --- a/src/chat_state.c +++ b/src/chat_state.c @@ -44,7 +44,7 @@ #define PAUSED_TIMEOUT 10.0 #define INACTIVE_TIMEOUT 30.0 -static void _send_if_supported(const char * const barejid, void(*send_func)(const char * const)); +static void _send_if_supported(const char *const barejid, void (*send_func)(const char *const)); ChatState* chat_state_new(void) @@ -66,7 +66,7 @@ chat_state_free(ChatState *state) } void -chat_state_handle_idle(const char * const barejid, ChatState *state) +chat_state_handle_idle(const char *const barejid, ChatState *state) { gdouble elapsed = g_timer_elapsed(state->timer, NULL); @@ -118,7 +118,7 @@ chat_state_handle_idle(const char * const barejid, ChatState *state) } void -chat_state_handle_typing(const char * const barejid, ChatState *state) +chat_state_handle_typing(const char *const barejid, ChatState *state) { // ACTIVE|INACTIVE|PAUSED|GONE -> COMPOSING if (state->type != CHAT_STATE_COMPOSING) { @@ -138,7 +138,7 @@ chat_state_active(ChatState *state) } void -chat_state_gone(const char * const barejid, ChatState *state) +chat_state_gone(const char *const barejid, ChatState *state) { if (state->type != CHAT_STATE_GONE) { if (prefs_get_boolean(PREF_STATES)) { @@ -150,7 +150,7 @@ chat_state_gone(const char * const barejid, ChatState *state) } static void -_send_if_supported(const char * const barejid, void(*send_func)(const char * const)) +_send_if_supported(const char *const barejid, void (*send_func)(const char *const)) { gboolean send = TRUE; GString *jid = g_string_new(barejid); @@ -169,4 +169,4 @@ _send_if_supported(const char * const barejid, void(*send_func)(const char * con } g_string_free(jid, TRUE); -} \ No newline at end of file +} diff --git a/src/chat_state.h b/src/chat_state.h index 7f0d8832..00e175b3 100644 --- a/src/chat_state.h +++ b/src/chat_state.h @@ -53,9 +53,9 @@ typedef struct prof_chat_state_t { ChatState* chat_state_new(void); void chat_state_free(ChatState *state); -void chat_state_handle_idle(const char * const barejid, ChatState *state); -void chat_state_handle_typing(const char * const barejid, ChatState *state); +void chat_state_handle_idle(const char *const barejid, ChatState *state); +void chat_state_handle_typing(const char *const barejid, ChatState *state); void chat_state_active(ChatState *state); -void chat_state_gone(const char * const barejid, ChatState *state); +void chat_state_gone(const char *const barejid, ChatState *state); #endif diff --git a/src/command/command.c b/src/command/command.c index ec8696fe..d2ccef73 100644 --- a/src/command/command.c +++ b/src/command/command.c @@ -73,43 +73,43 @@ #include "ui/ui.h" #include "window_list.h" -static gboolean _cmd_execute(ProfWin *window, const char * const command, const char * const inp); +static gboolean _cmd_execute(ProfWin *window, const char *const command, const char *const inp); -static char * _cmd_complete_parameters(ProfWin *window, const char * const input); +static char* _cmd_complete_parameters(ProfWin *window, const char *const input); -static char * _sub_autocomplete(ProfWin *window, const char * const input); -static char * _notify_autocomplete(ProfWin *window, const char * const input); -static char * _theme_autocomplete(ProfWin *window, const char * const input); -static char * _autoaway_autocomplete(ProfWin *window, const char * const input); -static char * _autoconnect_autocomplete(ProfWin *window, const char * const input); -static char * _account_autocomplete(ProfWin *window, const char * const input); -static char * _who_autocomplete(ProfWin *window, const char * const input); -static char * _roster_autocomplete(ProfWin *window, const char * const input); -static char * _group_autocomplete(ProfWin *window, const char * const input); -static char * _bookmark_autocomplete(ProfWin *window, const char * const input); -static char * _otr_autocomplete(ProfWin *window, const char * const input); -static char * _pgp_autocomplete(ProfWin *window, const char * const input); -static char * _connect_autocomplete(ProfWin *window, const char * const input); -static char * _statuses_autocomplete(ProfWin *window, const char * const input); -static char * _alias_autocomplete(ProfWin *window, const char * const input); -static char * _join_autocomplete(ProfWin *window, const char * const input); -static char * _log_autocomplete(ProfWin *window, const char * const input); -static char * _form_autocomplete(ProfWin *window, const char * const input); -static char * _form_field_autocomplete(ProfWin *window, const char * const input); -static char * _occupants_autocomplete(ProfWin *window, const char * const input); -static char * _kick_autocomplete(ProfWin *window, const char * const input); -static char * _ban_autocomplete(ProfWin *window, const char * const input); -static char * _affiliation_autocomplete(ProfWin *window, const char * const input); -static char * _role_autocomplete(ProfWin *window, const char * const input); -static char * _resource_autocomplete(ProfWin *window, const char * const input); -static char * _titlebar_autocomplete(ProfWin *window, const char * const input); -static char * _inpblock_autocomplete(ProfWin *window, const char * const input); -static char * _time_autocomplete(ProfWin *window, const char * const input); -static char * _receipts_autocomplete(ProfWin *window, const char * const input); -static char * _help_autocomplete(ProfWin *window, const char * const input); -static char * _wins_autocomplete(ProfWin *window, const char * const input); -static char * _tls_autocomplete(ProfWin *window, const char * const input); -static char * _script_autocomplete(ProfWin *window, const char * const input); +static char* _sub_autocomplete(ProfWin *window, const char *const input); +static char* _notify_autocomplete(ProfWin *window, const char *const input); +static char* _theme_autocomplete(ProfWin *window, const char *const input); +static char* _autoaway_autocomplete(ProfWin *window, const char *const input); +static char* _autoconnect_autocomplete(ProfWin *window, const char *const input); +static char* _account_autocomplete(ProfWin *window, const char *const input); +static char* _who_autocomplete(ProfWin *window, const char *const input); +static char* _roster_autocomplete(ProfWin *window, const char *const input); +static char* _group_autocomplete(ProfWin *window, const char *const input); +static char* _bookmark_autocomplete(ProfWin *window, const char *const input); +static char* _otr_autocomplete(ProfWin *window, const char *const input); +static char* _pgp_autocomplete(ProfWin *window, const char *const input); +static char* _connect_autocomplete(ProfWin *window, const char *const input); +static char* _statuses_autocomplete(ProfWin *window, const char *const input); +static char* _alias_autocomplete(ProfWin *window, const char *const input); +static char* _join_autocomplete(ProfWin *window, const char *const input); +static char* _log_autocomplete(ProfWin *window, const char *const input); +static char* _form_autocomplete(ProfWin *window, const char *const input); +static char* _form_field_autocomplete(ProfWin *window, const char *const input); +static char* _occupants_autocomplete(ProfWin *window, const char *const input); +static char* _kick_autocomplete(ProfWin *window, const char *const input); +static char* _ban_autocomplete(ProfWin *window, const char *const input); +static char* _affiliation_autocomplete(ProfWin *window, const char *const input); +static char* _role_autocomplete(ProfWin *window, const char *const input); +static char* _resource_autocomplete(ProfWin *window, const char *const input); +static char* _titlebar_autocomplete(ProfWin *window, const char *const input); +static char* _inpblock_autocomplete(ProfWin *window, const char *const input); +static char* _time_autocomplete(ProfWin *window, const char *const input); +static char* _receipts_autocomplete(ProfWin *window, const char *const input); +static char* _help_autocomplete(ProfWin *window, const char *const input); +static char* _wins_autocomplete(ProfWin *window, const char *const input); +static char* _tls_autocomplete(ProfWin *window, const char *const input); +static char* _script_autocomplete(ProfWin *window, const char *const input); GHashTable *commands = NULL; @@ -2376,7 +2376,7 @@ cmd_alias_remove(char *value) // Command autocompletion functions char* -cmd_autocomplete(ProfWin *window, const char * const input) +cmd_autocomplete(ProfWin *window, const char *const input) { // autocomplete command if ((strncmp(input, "/", 1) == 0) && (!str_contains(input, strlen(input), ' '))) { @@ -2511,7 +2511,7 @@ cmd_reset_autocomplete(ProfWin *window) } gboolean -cmd_valid_tag(const char * const str) +cmd_valid_tag(const char *const str) { return ((g_strcmp0(str, CMD_TAG_CHAT) == 0) || (g_strcmp0(str, CMD_TAG_GROUPCHAT) == 0) || @@ -2523,7 +2523,7 @@ cmd_valid_tag(const char * const str) } gboolean -cmd_has_tag(Command *pcmd, const char * const tag) +cmd_has_tag(Command *pcmd, const char *const tag) { int i = 0; for (i = 0; pcmd->help.tags[i] != NULL; i++) { @@ -2568,7 +2568,7 @@ cmd_process_input(ProfWin *window, char *inp) // Command execution void -cmd_execute_connect(ProfWin *window, const char * const account) +cmd_execute_connect(ProfWin *window, const char *const account) { GString *command = g_string_new("/connect "); g_string_append(command, account); @@ -2577,7 +2577,7 @@ cmd_execute_connect(ProfWin *window, const char * const account) } static gboolean -_cmd_execute(ProfWin *window, const char * const command, const char * const inp) +_cmd_execute(ProfWin *window, const char *const command, const char *const inp) { if (g_str_has_prefix(command, "/field") && window->type == WIN_MUC_CONFIG) { gboolean result = FALSE; @@ -2620,8 +2620,8 @@ _cmd_execute(ProfWin *window, const char * const command, const char * const inp } } -static char * -_cmd_complete_parameters(ProfWin *window, const char * const input) +static char* +_cmd_complete_parameters(ProfWin *window, const char *const input) { int i; char *result = NULL; @@ -2771,8 +2771,8 @@ _cmd_complete_parameters(ProfWin *window, const char * const input) return NULL; } -static char * -_sub_autocomplete(ProfWin *window, const char * const input) +static char* +_sub_autocomplete(ProfWin *window, const char *const input) { char *result = NULL; result = autocomplete_param_with_func(input, "/sub allow", presence_sub_request_find); @@ -2791,8 +2791,8 @@ _sub_autocomplete(ProfWin *window, const char * const input) return NULL; } -static char * -_who_autocomplete(ProfWin *window, const char * const input) +static char* +_who_autocomplete(ProfWin *window, const char *const input) { char *result = NULL; @@ -2823,8 +2823,8 @@ _who_autocomplete(ProfWin *window, const char * const input) return NULL; } -static char * -_roster_autocomplete(ProfWin *window, const char * const input) +static char* +_roster_autocomplete(ProfWin *window, const char *const input) { char *result = NULL; result = autocomplete_param_with_func(input, "/roster nick", roster_barejid_autocomplete); @@ -2863,8 +2863,8 @@ _roster_autocomplete(ProfWin *window, const char * const input) return NULL; } -static char * -_group_autocomplete(ProfWin *window, const char * const input) +static char* +_group_autocomplete(ProfWin *window, const char *const input) { char *result = NULL; result = autocomplete_param_with_func(input, "/group show", roster_group_autocomplete); @@ -2896,8 +2896,8 @@ _group_autocomplete(ProfWin *window, const char * const input) return NULL; } -static char * -_bookmark_autocomplete(ProfWin *window, const char * const input) +static char* +_bookmark_autocomplete(ProfWin *window, const char *const input) { char *found = NULL; @@ -2975,8 +2975,8 @@ _bookmark_autocomplete(ProfWin *window, const char * const input) return found; } -static char * -_notify_autocomplete(ProfWin *window, const char * const input) +static char* +_notify_autocomplete(ProfWin *window, const char *const input) { int i = 0; char *result = NULL; @@ -3038,8 +3038,8 @@ _notify_autocomplete(ProfWin *window, const char * const input) return NULL; } -static char * -_autoaway_autocomplete(ProfWin *window, const char * const input) +static char* +_autoaway_autocomplete(ProfWin *window, const char *const input) { char *result = NULL; @@ -3070,8 +3070,8 @@ _autoaway_autocomplete(ProfWin *window, const char * const input) return NULL; } -static char * -_log_autocomplete(ProfWin *window, const char * const input) +static char* +_log_autocomplete(ProfWin *window, const char *const input) { char *result = NULL; @@ -3093,8 +3093,8 @@ _log_autocomplete(ProfWin *window, const char * const input) return NULL; } -static char * -_autoconnect_autocomplete(ProfWin *window, const char * const input) +static char* +_autoconnect_autocomplete(ProfWin *window, const char *const input) { char *result = NULL; @@ -3111,8 +3111,8 @@ _autoconnect_autocomplete(ProfWin *window, const char * const input) return NULL; } -static char * -_otr_autocomplete(ProfWin *window, const char * const input) +static char* +_otr_autocomplete(ProfWin *window, const char *const input) { char *found = NULL; @@ -3158,8 +3158,8 @@ _otr_autocomplete(ProfWin *window, const char * const input) return NULL; } -static char * -_pgp_autocomplete(ProfWin *window, const char * const input) +static char* +_pgp_autocomplete(ProfWin *window, const char *const input) { char *found = NULL; @@ -3206,8 +3206,8 @@ _pgp_autocomplete(ProfWin *window, const char * const input) return NULL; } -static char * -_theme_autocomplete(ProfWin *window, const char * const input) +static char* +_theme_autocomplete(ProfWin *window, const char *const input) { char *result = NULL; if ((strncmp(input, "/theme load ", 12) == 0) && (strlen(input) > 12)) { @@ -3235,8 +3235,8 @@ _theme_autocomplete(ProfWin *window, const char * const input) return NULL; } -static char * -_script_autocomplete(ProfWin *window, const char * const input) +static char* +_script_autocomplete(ProfWin *window, const char *const input) { char *result = NULL; if ((strncmp(input, "/script show ", 13) == 0) && (strlen(input) > 13)) { @@ -3281,8 +3281,8 @@ _script_autocomplete(ProfWin *window, const char * const input) return NULL; } -static char * -_resource_autocomplete(ProfWin *window, const char * const input) +static char* +_resource_autocomplete(ProfWin *window, const char *const input) { char *found = NULL; @@ -3317,8 +3317,8 @@ _resource_autocomplete(ProfWin *window, const char * const input) return NULL; } -static char * -_titlebar_autocomplete(ProfWin *window, const char * const input) +static char* +_titlebar_autocomplete(ProfWin *window, const char *const input) { char *found = NULL; @@ -3340,8 +3340,8 @@ _titlebar_autocomplete(ProfWin *window, const char * const input) return NULL; } -static char * -_inpblock_autocomplete(ProfWin *window, const char * const input) +static char* +_inpblock_autocomplete(ProfWin *window, const char *const input) { char *found = NULL; @@ -3358,8 +3358,8 @@ _inpblock_autocomplete(ProfWin *window, const char * const input) return NULL; } -static char * -_form_autocomplete(ProfWin *window, const char * const input) +static char* +_form_autocomplete(ProfWin *window, const char *const input) { if (window->type != WIN_MUC_CONFIG) { return NULL; @@ -3384,8 +3384,8 @@ _form_autocomplete(ProfWin *window, const char * const input) return NULL; } -static char * -_form_field_autocomplete(ProfWin *window, const char * const input) +static char* +_form_field_autocomplete(ProfWin *window, const char *const input) { if (window->type != WIN_MUC_CONFIG) { return NULL; @@ -3454,8 +3454,8 @@ _form_field_autocomplete(ProfWin *window, const char * const input) return found; } -static char * -_occupants_autocomplete(ProfWin *window, const char * const input) +static char* +_occupants_autocomplete(ProfWin *window, const char *const input) { char *found = NULL; @@ -3492,8 +3492,8 @@ _occupants_autocomplete(ProfWin *window, const char * const input) return NULL; } -static char * -_time_autocomplete(ProfWin *window, const char * const input) +static char* +_time_autocomplete(ProfWin *window, const char *const input) { char *found = NULL; @@ -3545,8 +3545,8 @@ _time_autocomplete(ProfWin *window, const char * const input) return NULL; } -static char * -_kick_autocomplete(ProfWin *window, const char * const input) +static char* +_kick_autocomplete(ProfWin *window, const char *const input) { char *result = NULL; @@ -3566,8 +3566,8 @@ _kick_autocomplete(ProfWin *window, const char * const input) return result; } -static char * -_ban_autocomplete(ProfWin *window, const char * const input) +static char* +_ban_autocomplete(ProfWin *window, const char *const input) { char *result = NULL; @@ -3587,8 +3587,8 @@ _ban_autocomplete(ProfWin *window, const char * const input) return result; } -static char * -_affiliation_autocomplete(ProfWin *window, const char * const input) +static char* +_affiliation_autocomplete(ProfWin *window, const char *const input) { char *result = NULL; @@ -3635,8 +3635,8 @@ _affiliation_autocomplete(ProfWin *window, const char * const input) return result; } -static char * -_role_autocomplete(ProfWin *window, const char * const input) +static char* +_role_autocomplete(ProfWin *window, const char *const input) { char *result = NULL; @@ -3683,8 +3683,8 @@ _role_autocomplete(ProfWin *window, const char * const input) return result; } -static char * -_statuses_autocomplete(ProfWin *window, const char * const input) +static char* +_statuses_autocomplete(ProfWin *window, const char *const input) { char *result = NULL; @@ -3711,8 +3711,8 @@ _statuses_autocomplete(ProfWin *window, const char * const input) return NULL; } -static char * -_wins_autocomplete(ProfWin *window, const char * const input) +static char* +_wins_autocomplete(ProfWin *window, const char *const input) { char *result = NULL; @@ -3729,8 +3729,8 @@ _wins_autocomplete(ProfWin *window, const char * const input) return NULL; } -static char * -_tls_autocomplete(ProfWin *window, const char * const input) +static char* +_tls_autocomplete(ProfWin *window, const char *const input) { char *result = NULL; @@ -3757,8 +3757,8 @@ _tls_autocomplete(ProfWin *window, const char * const input) return result; } -static char * -_receipts_autocomplete(ProfWin *window, const char * const input) +static char* +_receipts_autocomplete(ProfWin *window, const char *const input) { char *result = NULL; @@ -3780,8 +3780,8 @@ _receipts_autocomplete(ProfWin *window, const char * const input) return NULL; } -static char * -_alias_autocomplete(ProfWin *window, const char * const input) +static char* +_alias_autocomplete(ProfWin *window, const char *const input) { char *result = NULL; @@ -3798,8 +3798,8 @@ _alias_autocomplete(ProfWin *window, const char * const input) return NULL; } -static char * -_connect_autocomplete(ProfWin *window, const char * const input) +static char* +_connect_autocomplete(ProfWin *window, const char *const input) { char *found = NULL; gboolean result = FALSE; @@ -3879,8 +3879,8 @@ _connect_autocomplete(ProfWin *window, const char * const input) return NULL; } -static char * -_help_autocomplete(ProfWin *window, const char * const input) +static char* +_help_autocomplete(ProfWin *window, const char *const input) { char *result = NULL; @@ -3897,8 +3897,8 @@ _help_autocomplete(ProfWin *window, const char * const input) return NULL; } -static char * -_join_autocomplete(ProfWin *window, const char * const input) +static char* +_join_autocomplete(ProfWin *window, const char *const input) { char *found = NULL; gboolean result = FALSE; @@ -3932,8 +3932,8 @@ _join_autocomplete(ProfWin *window, const char * const input) return NULL; } -static char * -_account_autocomplete(ProfWin *window, const char * const input) +static char* +_account_autocomplete(ProfWin *window, const char *const input) { char *found = NULL; gboolean result = FALSE; diff --git a/src/command/command.h b/src/command/command.h index 78b4bf78..cbab33f4 100644 --- a/src/command/command.h +++ b/src/command/command.h @@ -45,7 +45,7 @@ GHashTable *commands; void cmd_init(void); void cmd_uninit(void); -char* cmd_autocomplete(ProfWin *window, const char * const input); +char* cmd_autocomplete(ProfWin *window, const char *const input); void cmd_reset_autocomplete(ProfWin *window); void cmd_autocomplete_add(char *value); void cmd_autocomplete_remove(char *value); @@ -54,21 +54,21 @@ void cmd_autocomplete_remove_form_fields(DataForm *form); void cmd_alias_add(char *value); void cmd_alias_remove(char *value); -gboolean cmd_valid_tag(const char * const str); -gboolean cmd_has_tag(Command *pcmd, const char * const tag); +gboolean cmd_valid_tag(const char *const str); +gboolean cmd_has_tag(Command *pcmd, const char *const tag); gboolean cmd_process_input(ProfWin *window, char *inp); -void cmd_execute_connect(ProfWin *window, const char * const account); +void cmd_execute_connect(ProfWin *window, const char *const account); gboolean cmd_exists(char *cmd); -GSList * cmd_get_basic_help(void); -GSList * cmd_get_settings_help(void); -GSList * cmd_get_presence_help(void); +GSList* cmd_get_basic_help(void); +GSList* cmd_get_settings_help(void); +GSList* cmd_get_presence_help(void); void cmd_history_append(char *inp); -char *cmd_history_previous(char *inp); -char *cmd_history_next(char *inp); +char* cmd_history_previous(char *inp); +char* cmd_history_next(char *inp); void command_docgen(void); diff --git a/src/command/commands.c b/src/command/commands.c index c37af0c7..eeb58305 100644 --- a/src/command/commands.c +++ b/src/command/commands.c @@ -73,17 +73,16 @@ #include "event/ui_events.h" static void _update_presence(const resource_presence_t presence, - const char * const show, gchar **args); -static gboolean _cmd_set_boolean_preference(gchar *arg, const char * const command, - const char * const display, preference_t pref); -//static void _cmd_show_filtered_help(char *heading, gchar *cmd_filter[], int filter_size); -static void _who_room(ProfWin *window, const char * const command, gchar **args); -static void _who_roster(ProfWin *window, const char * const command, gchar **args); + const char *const show, gchar **args); +static gboolean _cmd_set_boolean_preference(gchar *arg, const char *const command, + const char *const display, preference_t pref); +static void _who_room(ProfWin *window, const char *const command, gchar **args); +static void _who_roster(ProfWin *window, const char *const command, gchar **args); extern GHashTable *commands; gboolean -cmd_execute_default(ProfWin *window, const char * inp) +cmd_execute_default(ProfWin *window, const char *inp) { // handle escaped commands - treat as normal message if (g_str_has_prefix(inp, "//")) { @@ -138,7 +137,7 @@ cmd_execute_default(ProfWin *window, const char * inp) } gboolean -cmd_execute_alias(ProfWin *window, const char * const inp, gboolean *ran) +cmd_execute_alias(ProfWin *window, const char *const inp, gboolean *ran) { if (inp[0] != '/') { ran = FALSE; @@ -158,7 +157,7 @@ cmd_execute_alias(ProfWin *window, const char * const inp, gboolean *ran) } gboolean -cmd_tls(ProfWin *window, const char * const command, gchar **args) +cmd_tls(ProfWin *window, const char *const command, gchar **args) { if (g_strcmp0(args[0], "certpath") == 0) { if (g_strcmp0(args[1], "set") == 0) { @@ -247,7 +246,7 @@ cmd_tls(ProfWin *window, const char * const command, gchar **args) } gboolean -cmd_connect(ProfWin *window, const char * const command, gchar **args) +cmd_connect(ProfWin *window, const char *const command, gchar **args) { jabber_conn_status_t conn_status = jabber_get_connection_status(); if ((conn_status != JABBER_DISCONNECTED) && (conn_status != JABBER_STARTED)) { @@ -361,7 +360,7 @@ cmd_connect(ProfWin *window, const char * const command, gchar **args) } gboolean -cmd_account(ProfWin *window, const char * const command, gchar **args) +cmd_account(ProfWin *window, const char *const command, gchar **args) { char *subcmd = args[0]; @@ -711,7 +710,7 @@ cmd_account(ProfWin *window, const char * const command, gchar **args) } gboolean -cmd_script(ProfWin *window, const char * const command, gchar **args) +cmd_script(ProfWin *window, const char *const command, gchar **args) { if ((g_strcmp0(args[0], "run") == 0) && args[1]) { gboolean res = scripts_exec(args[1]); @@ -734,7 +733,7 @@ cmd_script(ProfWin *window, const char * const command, gchar **args) } gboolean -cmd_sub(ProfWin *window, const char * const command, gchar **args) +cmd_sub(ProfWin *window, const char *const command, gchar **args) { jabber_conn_status_t conn_status = jabber_get_connection_status(); @@ -824,7 +823,7 @@ cmd_sub(ProfWin *window, const char * const command, gchar **args) } gboolean -cmd_disconnect(ProfWin *window, const char * const command, gchar **args) +cmd_disconnect(ProfWin *window, const char *const command, gchar **args) { if (jabber_get_connection_status() == JABBER_CONNECTED) { char *jid = strdup(jabber_get_fulljid()); @@ -846,7 +845,7 @@ cmd_disconnect(ProfWin *window, const char * const command, gchar **args) } gboolean -cmd_quit(ProfWin *window, const char * const command, gchar **args) +cmd_quit(ProfWin *window, const char *const command, gchar **args) { log_info("Profanity is shutting down..."); exit(0); @@ -854,7 +853,7 @@ cmd_quit(ProfWin *window, const char * const command, gchar **args) } gboolean -cmd_wins(ProfWin *window, const char * const command, gchar **args) +cmd_wins(ProfWin *window, const char *const command, gchar **args) { if (args[0] == NULL) { cons_show_wins(); @@ -906,7 +905,7 @@ cmd_wins(ProfWin *window, const char * const command, gchar **args) } gboolean -cmd_win(ProfWin *window, const char * const command, gchar **args) +cmd_win(ProfWin *window, const char *const command, gchar **args) { int num = atoi(args[0]); @@ -921,7 +920,7 @@ cmd_win(ProfWin *window, const char * const command, gchar **args) } static void -_cmd_help_cmd_list(const char * const tag) +_cmd_help_cmd_list(const char *const tag) { cons_show(""); ProfWin *console = wins_get_console(); @@ -983,7 +982,7 @@ _cmd_help_cmd_list(const char * const tag) } gboolean -cmd_help(ProfWin *window, const char * const command, gchar **args) +cmd_help(ProfWin *window, const char *const command, gchar **args) { int num_args = g_strv_length(args); if (num_args == 0) { @@ -1018,14 +1017,14 @@ cmd_help(ProfWin *window, const char * const command, gchar **args) } gboolean -cmd_about(ProfWin *window, const char * const command, gchar **args) +cmd_about(ProfWin *window, const char *const command, gchar **args) { ui_about(); return TRUE; } gboolean -cmd_prefs(ProfWin *window, const char * const command, gchar **args) +cmd_prefs(ProfWin *window, const char *const command, gchar **args) { if (args[0] == NULL) { cons_prefs(); @@ -1070,7 +1069,7 @@ cmd_prefs(ProfWin *window, const char * const command, gchar **args) } gboolean -cmd_theme(ProfWin *window, const char * const command, gchar **args) +cmd_theme(ProfWin *window, const char *const command, gchar **args) { // list themes if (g_strcmp0(args[0], "list") == 0) { @@ -1112,7 +1111,7 @@ cmd_theme(ProfWin *window, const char * const command, gchar **args) } static void -_who_room(ProfWin *window, const char * const command, gchar **args) +_who_room(ProfWin *window, const char *const command, gchar **args) { if ((g_strv_length(args) == 2) && args[1]) { cons_show("Argument group is not applicable to chat rooms."); @@ -1242,7 +1241,7 @@ _who_room(ProfWin *window, const char * const command, gchar **args) } static void -_who_roster(ProfWin *window, const char * const command, gchar **args) +_who_roster(ProfWin *window, const char *const command, gchar **args) { char *presence = args[0]; @@ -1455,7 +1454,7 @@ _who_roster(ProfWin *window, const char * const command, gchar **args) } gboolean -cmd_who(ProfWin *window, const char * const command, gchar **args) +cmd_who(ProfWin *window, const char *const command, gchar **args) { jabber_conn_status_t conn_status = jabber_get_connection_status(); @@ -1475,7 +1474,7 @@ cmd_who(ProfWin *window, const char * const command, gchar **args) } gboolean -cmd_msg(ProfWin *window, const char * const command, gchar **args) +cmd_msg(ProfWin *window, const char *const command, gchar **args) { char *usr = args[0]; char *msg = args[1]; @@ -1542,7 +1541,7 @@ cmd_msg(ProfWin *window, const char * const command, gchar **args) } gboolean -cmd_group(ProfWin *window, const char * const command, gchar **args) +cmd_group(ProfWin *window, const char *const command, gchar **args) { jabber_conn_status_t conn_status = jabber_get_connection_status(); @@ -1649,7 +1648,7 @@ cmd_group(ProfWin *window, const char * const command, gchar **args) } gboolean -cmd_roster(ProfWin *window, const char * const command, gchar **args) +cmd_roster(ProfWin *window, const char *const command, gchar **args) { jabber_conn_status_t conn_status = jabber_get_connection_status(); @@ -1911,7 +1910,7 @@ cmd_roster(ProfWin *window, const char * const command, gchar **args) } gboolean -cmd_resource(ProfWin *window, const char * const command, gchar **args) +cmd_resource(ProfWin *window, const char *const command, gchar **args) { char *cmd = args[0]; char *setting = NULL; @@ -1983,7 +1982,7 @@ cmd_resource(ProfWin *window, const char * const command, gchar **args) } gboolean -cmd_status(ProfWin *window, const char * const command, gchar **args) +cmd_status(ProfWin *window, const char *const command, gchar **args) { char *usr = args[0]; @@ -2059,12 +2058,11 @@ cmd_status(ProfWin *window, const char * const command, gchar **args) } gboolean -cmd_info(ProfWin *window, const char * const command, gchar **args) +cmd_info(ProfWin *window, const char *const command, gchar **args) { char *usr = args[0]; jabber_conn_status_t conn_status = jabber_get_connection_status(); - PContact pcontact = NULL; if (conn_status != JABBER_CONNECTED) { cons_show("You are not currently connected."); @@ -2127,7 +2125,7 @@ cmd_info(ProfWin *window, const char * const command, gchar **args) if (usr_jid == NULL) { usr_jid = usr; } - pcontact = roster_get_contact(usr_jid); + PContact pcontact = roster_get_contact(usr_jid); if (pcontact) { cons_show_info(pcontact); } else { @@ -2145,10 +2143,9 @@ cmd_info(ProfWin *window, const char * const command, gchar **args) } gboolean -cmd_caps(ProfWin *window, const char * const command, gchar **args) +cmd_caps(ProfWin *window, const char *const command, gchar **args) { jabber_conn_status_t conn_status = jabber_get_connection_status(); - PContact pcontact = NULL; Occupant *occupant = NULL; if (conn_status != JABBER_CONNECTED) { @@ -2182,7 +2179,7 @@ cmd_caps(ProfWin *window, const char * const command, gchar **args) if (jid->fulljid == NULL) { cons_show("You must provide a full jid to the /caps command."); } else { - pcontact = roster_get_contact(jid->barejid); + PContact pcontact = roster_get_contact(jid->barejid); if (pcontact == NULL) { cons_show("Contact not found in roster: %s", jid->barejid); } else { @@ -2222,10 +2219,9 @@ cmd_caps(ProfWin *window, const char * const command, gchar **args) gboolean -cmd_software(ProfWin *window, const char * const command, gchar **args) +cmd_software(ProfWin *window, const char *const command, gchar **args) { jabber_conn_status_t conn_status = jabber_get_connection_status(); - Occupant *occupant = NULL; if (conn_status != JABBER_CONNECTED) { cons_show("You are not currently connected."); @@ -2238,7 +2234,7 @@ cmd_software(ProfWin *window, const char * const command, gchar **args) if (args[0]) { ProfMucWin *mucwin = (ProfMucWin*)window; assert(mucwin->memcheck == PROFMUCWIN_MEMCHECK); - occupant = muc_roster_item(mucwin->roomjid, args[0]); + Occupant *occupant = muc_roster_item(mucwin->roomjid, args[0]); if (occupant) { Jid *jid = jid_create_from_bare_and_resource(mucwin->roomjid, args[0]); iq_send_software_version(jid->fulljid); @@ -2310,7 +2306,7 @@ cmd_software(ProfWin *window, const char * const command, gchar **args) } gboolean -cmd_join(ProfWin *window, const char * const command, gchar **args) +cmd_join(ProfWin *window, const char *const command, gchar **args) { jabber_conn_status_t conn_status = jabber_get_connection_status(); if (conn_status != JABBER_CONNECTED) { @@ -2404,7 +2400,7 @@ cmd_join(ProfWin *window, const char * const command, gchar **args) } gboolean -cmd_invite(ProfWin *window, const char * const command, gchar **args) +cmd_invite(ProfWin *window, const char *const command, gchar **args) { char *contact = args[0]; char *reason = args[1]; @@ -2440,7 +2436,7 @@ cmd_invite(ProfWin *window, const char * const command, gchar **args) } gboolean -cmd_invites(ProfWin *window, const char * const command, gchar **args) +cmd_invites(ProfWin *window, const char *const command, gchar **args) { GSList *invites = muc_invites(); cons_show_room_invites(invites); @@ -2449,7 +2445,7 @@ cmd_invites(ProfWin *window, const char * const command, gchar **args) } gboolean -cmd_decline(ProfWin *window, const char * const command, gchar **args) +cmd_decline(ProfWin *window, const char *const command, gchar **args) { if (!muc_invites_contain(args[0])) { cons_show("No such invite exists."); @@ -2680,7 +2676,7 @@ cmd_form_field(ProfWin *window, char *tag, gchar **args) } gboolean -cmd_form(ProfWin *window, const char * const command, gchar **args) +cmd_form(ProfWin *window, const char *const command, gchar **args) { jabber_conn_status_t conn_status = jabber_get_connection_status(); @@ -2757,7 +2753,7 @@ cmd_form(ProfWin *window, const char * const command, gchar **args) } gboolean -cmd_kick(ProfWin *window, const char * const command, gchar **args) +cmd_kick(ProfWin *window, const char *const command, gchar **args) { jabber_conn_status_t conn_status = jabber_get_connection_status(); @@ -2790,7 +2786,7 @@ cmd_kick(ProfWin *window, const char * const command, gchar **args) } gboolean -cmd_ban(ProfWin *window, const char * const command, gchar **args) +cmd_ban(ProfWin *window, const char *const command, gchar **args) { jabber_conn_status_t conn_status = jabber_get_connection_status(); @@ -2818,7 +2814,7 @@ cmd_ban(ProfWin *window, const char * const command, gchar **args) } gboolean -cmd_subject(ProfWin *window, const char * const command, gchar **args) +cmd_subject(ProfWin *window, const char *const command, gchar **args) { jabber_conn_status_t conn_status = jabber_get_connection_status(); @@ -2865,7 +2861,7 @@ cmd_subject(ProfWin *window, const char * const command, gchar **args) } gboolean -cmd_affiliation(ProfWin *window, const char * const command, gchar **args) +cmd_affiliation(ProfWin *window, const char *const command, gchar **args) { jabber_conn_status_t conn_status = jabber_get_connection_status(); @@ -2935,7 +2931,7 @@ cmd_affiliation(ProfWin *window, const char * const command, gchar **args) } gboolean -cmd_role(ProfWin *window, const char * const command, gchar **args) +cmd_role(ProfWin *window, const char *const command, gchar **args) { jabber_conn_status_t conn_status = jabber_get_connection_status(); @@ -3003,7 +2999,7 @@ cmd_role(ProfWin *window, const char * const command, gchar **args) } gboolean -cmd_room(ProfWin *window, const char * const command, gchar **args) +cmd_room(ProfWin *window, const char *const command, gchar **args) { jabber_conn_status_t conn_status = jabber_get_connection_status(); @@ -3066,7 +3062,7 @@ cmd_room(ProfWin *window, const char * const command, gchar **args) } gboolean -cmd_occupants(ProfWin *window, const char * const command, gchar **args) +cmd_occupants(ProfWin *window, const char *const command, gchar **args) { jabber_conn_status_t conn_status = jabber_get_connection_status(); @@ -3151,7 +3147,7 @@ cmd_occupants(ProfWin *window, const char * const command, gchar **args) } gboolean -cmd_rooms(ProfWin *window, const char * const command, gchar **args) +cmd_rooms(ProfWin *window, const char *const command, gchar **args) { jabber_conn_status_t conn_status = jabber_get_connection_status(); @@ -3172,7 +3168,7 @@ cmd_rooms(ProfWin *window, const char * const command, gchar **args) } gboolean -cmd_bookmark(ProfWin *window, const char * const command, gchar **args) +cmd_bookmark(ProfWin *window, const char *const command, gchar **args) { jabber_conn_status_t conn_status = jabber_get_connection_status(); @@ -3283,7 +3279,7 @@ cmd_bookmark(ProfWin *window, const char * const command, gchar **args) } gboolean -cmd_disco(ProfWin *window, const char * const command, gchar **args) +cmd_disco(ProfWin *window, const char *const command, gchar **args) { jabber_conn_status_t conn_status = jabber_get_connection_status(); @@ -3313,7 +3309,7 @@ cmd_disco(ProfWin *window, const char * const command, gchar **args) } gboolean -cmd_lastactivity(ProfWin *window, const char * const command, gchar **args) +cmd_lastactivity(ProfWin *window, const char *const command, gchar **args) { if ((g_strcmp0(args[0], "on") == 0) || (g_strcmp0(args[0], "off") == 0)) { return _cmd_set_boolean_preference(args[0], command, "Last activity", PREF_LASTACTIVITY); @@ -3343,7 +3339,7 @@ cmd_lastactivity(ProfWin *window, const char * const command, gchar **args) } gboolean -cmd_nick(ProfWin *window, const char * const command, gchar **args) +cmd_nick(ProfWin *window, const char *const command, gchar **args) { jabber_conn_status_t conn_status = jabber_get_connection_status(); @@ -3365,7 +3361,7 @@ cmd_nick(ProfWin *window, const char * const command, gchar **args) } gboolean -cmd_alias(ProfWin *window, const char * const command, gchar **args) +cmd_alias(ProfWin *window, const char *const command, gchar **args) { char *subcmd = args[0]; @@ -3437,7 +3433,7 @@ cmd_alias(ProfWin *window, const char * const command, gchar **args) } gboolean -cmd_tiny(ProfWin *window, const char * const command, gchar **args) +cmd_tiny(ProfWin *window, const char *const command, gchar **args) { char *url = args[0]; @@ -3489,14 +3485,14 @@ cmd_tiny(ProfWin *window, const char * const command, gchar **args) } gboolean -cmd_clear(ProfWin *window, const char * const command, gchar **args) +cmd_clear(ProfWin *window, const char *const command, gchar **args) { ui_clear_win(window); return TRUE; } gboolean -cmd_close(ProfWin *window, const char * const command, gchar **args) +cmd_close(ProfWin *window, const char *const command, gchar **args) { jabber_conn_status_t conn_status = jabber_get_connection_status(); int index = 0; @@ -3568,7 +3564,7 @@ cmd_close(ProfWin *window, const char * const command, gchar **args) } gboolean -cmd_leave(ProfWin *window, const char * const command, gchar **args) +cmd_leave(ProfWin *window, const char *const command, gchar **args) { jabber_conn_status_t conn_status = jabber_get_connection_status(); int index = wins_get_current_num(); @@ -3591,7 +3587,7 @@ cmd_leave(ProfWin *window, const char * const command, gchar **args) } gboolean -cmd_privileges(ProfWin *window, const char * const command, gchar **args) +cmd_privileges(ProfWin *window, const char *const command, gchar **args) { gboolean result = _cmd_set_boolean_preference(args[0], command, "MUC privileges", PREF_MUC_PRIVILEGES); @@ -3601,19 +3597,19 @@ cmd_privileges(ProfWin *window, const char * const command, gchar **args) } gboolean -cmd_beep(ProfWin *window, const char * const command, gchar **args) +cmd_beep(ProfWin *window, const char *const command, gchar **args) { return _cmd_set_boolean_preference(args[0], command, "Sound", PREF_BEEP); } gboolean -cmd_presence(ProfWin *window, const char * const command, gchar **args) +cmd_presence(ProfWin *window, const char *const command, gchar **args) { return _cmd_set_boolean_preference(args[0], command, "Contact presence", PREF_PRESENCE); } gboolean -cmd_wrap(ProfWin *window, const char * const command, gchar **args) +cmd_wrap(ProfWin *window, const char *const command, gchar **args) { gboolean result = _cmd_set_boolean_preference(args[0], command, "Word wrap", PREF_WRAP); @@ -3623,7 +3619,7 @@ cmd_wrap(ProfWin *window, const char * const command, gchar **args) } gboolean -cmd_time(ProfWin *window, const char * const command, gchar **args) +cmd_time(ProfWin *window, const char *const command, gchar **args) { if (g_strcmp0(args[0], "lastactivity") == 0) { if (args[1] == NULL) { @@ -3775,7 +3771,7 @@ cmd_time(ProfWin *window, const char * const command, gchar **args) } gboolean -cmd_states(ProfWin *window, const char * const command, gchar **args) +cmd_states(ProfWin *window, const char *const command, gchar **args) { gboolean result = _cmd_set_boolean_preference(args[0], command, "Sending chat states", PREF_STATES); @@ -3790,7 +3786,7 @@ cmd_states(ProfWin *window, const char * const command, gchar **args) } gboolean -cmd_titlebar(ProfWin *window, const char * const command, gchar **args) +cmd_titlebar(ProfWin *window, const char *const command, gchar **args) { if (g_strcmp0(args[0], "show") != 0 && g_strcmp0(args[0], "goodbye") != 0) { cons_bad_cmd_usage(command); @@ -3807,7 +3803,7 @@ cmd_titlebar(ProfWin *window, const char * const command, gchar **args) } gboolean -cmd_outtype(ProfWin *window, const char * const command, gchar **args) +cmd_outtype(ProfWin *window, const char *const command, gchar **args) { gboolean result = _cmd_set_boolean_preference(args[0], command, "Sending typing notifications", PREF_OUTTYPE); @@ -3821,7 +3817,7 @@ cmd_outtype(ProfWin *window, const char * const command, gchar **args) } gboolean -cmd_gone(ProfWin *window, const char * const command, gchar **args) +cmd_gone(ProfWin *window, const char *const command, gchar **args) { char *value = args[0]; @@ -3845,7 +3841,7 @@ cmd_gone(ProfWin *window, const char * const command, gchar **args) gboolean -cmd_notify(ProfWin *window, const char * const command, gchar **args) +cmd_notify(ProfWin *window, const char *const command, gchar **args) { char *kind = args[0]; @@ -3988,7 +3984,7 @@ cmd_notify(ProfWin *window, const char * const command, gchar **args) } gboolean -cmd_inpblock(ProfWin *window, const char * const command, gchar **args) +cmd_inpblock(ProfWin *window, const char *const command, gchar **args) { char *subcmd = args[0]; char *value = args[1]; @@ -4034,7 +4030,7 @@ cmd_inpblock(ProfWin *window, const char * const command, gchar **args) } gboolean -cmd_log(ProfWin *window, const char * const command, gchar **args) +cmd_log(ProfWin *window, const char *const command, gchar **args) { char *subcmd = args[0]; char *value = args[1]; @@ -4090,7 +4086,7 @@ cmd_log(ProfWin *window, const char * const command, gchar **args) } gboolean -cmd_reconnect(ProfWin *window, const char * const command, gchar **args) +cmd_reconnect(ProfWin *window, const char *const command, gchar **args) { char *value = args[0]; @@ -4114,7 +4110,7 @@ cmd_reconnect(ProfWin *window, const char * const command, gchar **args) } gboolean -cmd_autoping(ProfWin *window, const char * const command, gchar **args) +cmd_autoping(ProfWin *window, const char *const command, gchar **args) { char *value = args[0]; @@ -4139,7 +4135,7 @@ cmd_autoping(ProfWin *window, const char * const command, gchar **args) } gboolean -cmd_ping(ProfWin *window, const char * const command, gchar **args) +cmd_ping(ProfWin *window, const char *const command, gchar **args) { jabber_conn_status_t conn_status = jabber_get_connection_status(); @@ -4159,7 +4155,7 @@ cmd_ping(ProfWin *window, const char * const command, gchar **args) } gboolean -cmd_autoaway(ProfWin *window, const char * const command, gchar **args) +cmd_autoaway(ProfWin *window, const char *const command, gchar **args) { if ((strcmp(args[0], "mode") != 0) && (strcmp(args[0], "time") != 0) && (strcmp(args[0], "message") != 0) && (strcmp(args[0], "check") != 0)) { @@ -4262,7 +4258,7 @@ cmd_autoaway(ProfWin *window, const char * const command, gchar **args) } gboolean -cmd_priority(ProfWin *window, const char * const command, gchar **args) +cmd_priority(ProfWin *window, const char *const command, gchar **args) { jabber_conn_status_t conn_status = jabber_get_connection_status(); @@ -4290,7 +4286,7 @@ cmd_priority(ProfWin *window, const char * const command, gchar **args) } gboolean -cmd_statuses(ProfWin *window, const char * const command, gchar **args) +cmd_statuses(ProfWin *window, const char *const command, gchar **args) { if (strcmp(args[0], "console") != 0 && strcmp(args[0], "chat") != 0 && @@ -4343,7 +4339,7 @@ cmd_statuses(ProfWin *window, const char * const command, gchar **args) } gboolean -cmd_vercheck(ProfWin *window, const char * const command, gchar **args) +cmd_vercheck(ProfWin *window, const char *const command, gchar **args) { int num_args = g_strv_length(args); @@ -4356,7 +4352,7 @@ cmd_vercheck(ProfWin *window, const char * const command, gchar **args) } gboolean -cmd_xmlconsole(ProfWin *window, const char * const command, gchar **args) +cmd_xmlconsole(ProfWin *window, const char *const command, gchar **args) { if (!ui_xmlconsole_exists()) { ui_create_xmlconsole_win(); @@ -4368,25 +4364,25 @@ cmd_xmlconsole(ProfWin *window, const char * const command, gchar **args) } gboolean -cmd_flash(ProfWin *window, const char * const command, gchar **args) +cmd_flash(ProfWin *window, const char *const command, gchar **args) { return _cmd_set_boolean_preference(args[0], command, "Screen flash", PREF_FLASH); } gboolean -cmd_intype(ProfWin *window, const char * const command, gchar **args) +cmd_intype(ProfWin *window, const char *const command, gchar **args) { return _cmd_set_boolean_preference(args[0], command, "Show contact typing", PREF_INTYPE); } gboolean -cmd_splash(ProfWin *window, const char * const command, gchar **args) +cmd_splash(ProfWin *window, const char *const command, gchar **args) { return _cmd_set_boolean_preference(args[0], command, "Splash screen", PREF_SPLASH); } gboolean -cmd_autoconnect(ProfWin *window, const char * const command, gchar **args) +cmd_autoconnect(ProfWin *window, const char *const command, gchar **args) { if (strcmp(args[0], "off") == 0) { prefs_set_string(PREF_CONNECT_ACCOUNT, NULL); @@ -4401,7 +4397,7 @@ cmd_autoconnect(ProfWin *window, const char * const command, gchar **args) } gboolean -cmd_chlog(ProfWin *window, const char * const command, gchar **args) +cmd_chlog(ProfWin *window, const char *const command, gchar **args) { gboolean result = _cmd_set_boolean_preference(args[0], command, "Chat logging", PREF_CHLOG); @@ -4414,7 +4410,7 @@ cmd_chlog(ProfWin *window, const char * const command, gchar **args) } gboolean -cmd_grlog(ProfWin *window, const char * const command, gchar **args) +cmd_grlog(ProfWin *window, const char *const command, gchar **args) { gboolean result = _cmd_set_boolean_preference(args[0], command, "Groupchat logging", PREF_GRLOG); @@ -4422,7 +4418,7 @@ cmd_grlog(ProfWin *window, const char * const command, gchar **args) } gboolean -cmd_history(ProfWin *window, const char * const command, gchar **args) +cmd_history(ProfWin *window, const char *const command, gchar **args) { gboolean result = _cmd_set_boolean_preference(args[0], command, "Chat history", PREF_HISTORY); @@ -4435,7 +4431,7 @@ cmd_history(ProfWin *window, const char * const command, gchar **args) } gboolean -cmd_carbons(ProfWin *window, const char * const command, gchar **args) +cmd_carbons(ProfWin *window, const char *const command, gchar **args) { gboolean result = _cmd_set_boolean_preference(args[0], command, "Message carbons preference", PREF_CARBONS); @@ -4455,7 +4451,7 @@ cmd_carbons(ProfWin *window, const char * const command, gchar **args) } gboolean -cmd_receipts(ProfWin *window, const char * const command, gchar **args) +cmd_receipts(ProfWin *window, const char *const command, gchar **args) { if (g_strcmp0(args[0], "send") == 0) { return _cmd_set_boolean_preference(args[1], command, "Send delivery receipts", PREF_RECEIPTS_SEND); @@ -4468,42 +4464,42 @@ cmd_receipts(ProfWin *window, const char * const command, gchar **args) } gboolean -cmd_away(ProfWin *window, const char * const command, gchar **args) +cmd_away(ProfWin *window, const char *const command, gchar **args) { _update_presence(RESOURCE_AWAY, "away", args); return TRUE; } gboolean -cmd_online(ProfWin *window, const char * const command, gchar **args) +cmd_online(ProfWin *window, const char *const command, gchar **args) { _update_presence(RESOURCE_ONLINE, "online", args); return TRUE; } gboolean -cmd_dnd(ProfWin *window, const char * const command, gchar **args) +cmd_dnd(ProfWin *window, const char *const command, gchar **args) { _update_presence(RESOURCE_DND, "dnd", args); return TRUE; } gboolean -cmd_chat(ProfWin *window, const char * const command, gchar **args) +cmd_chat(ProfWin *window, const char *const command, gchar **args) { _update_presence(RESOURCE_CHAT, "chat", args); return TRUE; } gboolean -cmd_xa(ProfWin *window, const char * const command, gchar **args) +cmd_xa(ProfWin *window, const char *const command, gchar **args) { _update_presence(RESOURCE_XA, "xa", args); return TRUE; } gboolean -cmd_pgp(ProfWin *window, const char * const command, gchar **args) +cmd_pgp(ProfWin *window, const char *const command, gchar **args) { #ifdef HAVE_LIBGPGME if (args[0] == NULL) { @@ -4738,7 +4734,7 @@ cmd_pgp(ProfWin *window, const char * const command, gchar **args) } gboolean -cmd_otr(ProfWin *window, const char * const command, gchar **args) +cmd_otr(ProfWin *window, const char *const command, gchar **args) { #ifdef HAVE_LIBOTR if (args[0] == NULL) { @@ -5058,7 +5054,7 @@ cmd_otr(ProfWin *window, const char * const command, gchar **args) } gboolean -cmd_encwarn(ProfWin *window, const char * const command, gchar **args) +cmd_encwarn(ProfWin *window, const char *const command, gchar **args) { return _cmd_set_boolean_preference(args[0], command, "Encryption warning message", PREF_ENC_WARN); } @@ -5066,7 +5062,7 @@ cmd_encwarn(ProfWin *window, const char * const command, gchar **args) // helper function for status change commands static void _update_presence(const resource_presence_t resource_presence, - const char * const show, gchar **args) + const char *const show, gchar **args) { char *msg = NULL; int num_args = g_strv_length(args); @@ -5086,8 +5082,8 @@ _update_presence(const resource_presence_t resource_presence, // helper function for boolean preference commands static gboolean -_cmd_set_boolean_preference(gchar *arg, const char * const command, - const char * const display, preference_t pref) +_cmd_set_boolean_preference(gchar *arg, const char *const command, + const char *const display, preference_t pref) { GString *enabled = g_string_new(display); g_string_append(enabled, " enabled."); diff --git a/src/command/commands.h b/src/command/commands.h index d75559c5..4256387e 100644 --- a/src/command/commands.h +++ b/src/command/commands.h @@ -58,98 +58,98 @@ typedef struct cmd_help_t { */ typedef struct cmd_t { gchar *cmd; - gboolean (*func)(ProfWin *window, const char * const command, gchar **args); - gchar** (*parser)(const char * const inp, int min, int max, gboolean *result); + gboolean (*func)(ProfWin *window, const char *const command, gchar **args); + gchar** (*parser)(const char *const inp, int min, int max, gboolean *result); int min_args; int max_args; void (*setting_func)(void); CommandHelp help; } Command; -gboolean cmd_execute_alias(ProfWin *window, const char * const inp, gboolean *ran); -gboolean cmd_execute_default(ProfWin *window, const char * inp); +gboolean cmd_execute_alias(ProfWin *window, const char *const inp, gboolean *ran); +gboolean cmd_execute_default(ProfWin *window, const char *inp); -gboolean cmd_about(ProfWin *window, const char * const command, gchar **args); -gboolean cmd_account(ProfWin *window, const char * const command, gchar **args); -gboolean cmd_autoaway(ProfWin *window, const char * const command, gchar **args); -gboolean cmd_autoconnect(ProfWin *window, const char * const command, gchar **args); -gboolean cmd_autoping(ProfWin *window, const char * const command, gchar **args); -gboolean cmd_away(ProfWin *window, const char * const command, gchar **args); -gboolean cmd_beep(ProfWin *window, const char * const command, gchar **args); -gboolean cmd_caps(ProfWin *window, const char * const command, gchar **args); -gboolean cmd_chat(ProfWin *window, const char * const command, gchar **args); -gboolean cmd_chlog(ProfWin *window, const char * const command, gchar **args); -gboolean cmd_clear(ProfWin *window, const char * const command, gchar **args); -gboolean cmd_close(ProfWin *window, const char * const command, gchar **args); -gboolean cmd_connect(ProfWin *window, const char * const command, gchar **args); -gboolean cmd_tls(ProfWin *window, const char * const command, gchar **args); -gboolean cmd_decline(ProfWin *window, const char * const command, gchar **args); -gboolean cmd_disco(ProfWin *window, const char * const command, gchar **args); -gboolean cmd_lastactivity(ProfWin *window, const char * const command, gchar **args); -gboolean cmd_disconnect(ProfWin *window, const char * const command, gchar **args); -gboolean cmd_dnd(ProfWin *window, const char * const command, gchar **args); -gboolean cmd_flash(ProfWin *window, const char * const command, gchar **args); -gboolean cmd_gone(ProfWin *window, const char * const command, gchar **args); -gboolean cmd_grlog(ProfWin *window, const char * const command, gchar **args); -gboolean cmd_group(ProfWin *window, const char * const command, gchar **args); -gboolean cmd_help(ProfWin *window, const char * const command, gchar **args); -gboolean cmd_history(ProfWin *window, const char * const command, gchar **args); -gboolean cmd_carbons(ProfWin *window, const char * const command, gchar **args); -gboolean cmd_receipts(ProfWin *window, const char * const command, gchar **args); -gboolean cmd_info(ProfWin *window, const char * const command, gchar **args); -gboolean cmd_intype(ProfWin *window, const char * const command, gchar **args); -gboolean cmd_invite(ProfWin *window, const char * const command, gchar **args); -gboolean cmd_invites(ProfWin *window, const char * const command, gchar **args); -gboolean cmd_join(ProfWin *window, const char * const command, gchar **args); -gboolean cmd_leave(ProfWin *window, const char * const command, gchar **args); -gboolean cmd_log(ProfWin *window, const char * const command, gchar **args); -gboolean cmd_msg(ProfWin *window, const char * const command, gchar **args); -gboolean cmd_nick(ProfWin *window, const char * const command, gchar **args); -gboolean cmd_notify(ProfWin *window, const char * const command, gchar **args); -gboolean cmd_online(ProfWin *window, const char * const command, gchar **args); -gboolean cmd_otr(ProfWin *window, const char * const command, gchar **args); -gboolean cmd_pgp(ProfWin *window, const char * const command, gchar **args); -gboolean cmd_outtype(ProfWin *window, const char * const command, gchar **args); -gboolean cmd_prefs(ProfWin *window, const char * const command, gchar **args); -gboolean cmd_priority(ProfWin *window, const char * const command, gchar **args); -gboolean cmd_quit(ProfWin *window, const char * const command, gchar **args); -gboolean cmd_reconnect(ProfWin *window, const char * const command, gchar **args); -gboolean cmd_room(ProfWin *window, const char * const command, gchar **args); -gboolean cmd_rooms(ProfWin *window, const char * const command, gchar **args); -gboolean cmd_bookmark(ProfWin *window, const char * const command, gchar **args); -gboolean cmd_roster(ProfWin *window, const char * const command, gchar **args); -gboolean cmd_software(ProfWin *window, const char * const command, gchar **args); -gboolean cmd_splash(ProfWin *window, const char * const command, gchar **args); -gboolean cmd_states(ProfWin *window, const char * const command, gchar **args); -gboolean cmd_status(ProfWin *window, const char * const command, gchar **args); -gboolean cmd_statuses(ProfWin *window, const char * const command, gchar **args); -gboolean cmd_sub(ProfWin *window, const char * const command, gchar **args); -gboolean cmd_theme(ProfWin *window, const char * const command, gchar **args); -gboolean cmd_tiny(ProfWin *window, const char * const command, gchar **args); -gboolean cmd_titlebar(ProfWin *window, const char * const command, gchar **args); -gboolean cmd_vercheck(ProfWin *window, const char * const command, gchar **args); -gboolean cmd_who(ProfWin *window, const char * const command, gchar **args); -gboolean cmd_win(ProfWin *window, const char * const command, gchar **args); -gboolean cmd_wins(ProfWin *window, const char * const command, gchar **args); -gboolean cmd_xa(ProfWin *window, const char * const command, gchar **args); -gboolean cmd_alias(ProfWin *window, const char * const command, gchar **args); -gboolean cmd_xmlconsole(ProfWin *window, const char * const command, gchar **args); -gboolean cmd_ping(ProfWin *window, const char * const command, gchar **args); -gboolean cmd_form(ProfWin *window, const char * const command, gchar **args); -gboolean cmd_occupants(ProfWin *window, const char * const command, gchar **args); -gboolean cmd_kick(ProfWin *window, const char * const command, gchar **args); -gboolean cmd_ban(ProfWin *window, const char * const command, gchar **args); -gboolean cmd_subject(ProfWin *window, const char * const command, gchar **args); -gboolean cmd_affiliation(ProfWin *window, const char * const command, gchar **args); -gboolean cmd_role(ProfWin *window, const char * const command, gchar **args); -gboolean cmd_privileges(ProfWin *window, const char * const command, gchar **args); -gboolean cmd_presence(ProfWin *window, const char * const command, gchar **args); -gboolean cmd_wrap(ProfWin *window, const char * const command, gchar **args); -gboolean cmd_time(ProfWin *window, const char * const command, gchar **args); -gboolean cmd_resource(ProfWin *window, const char * const command, gchar **args); -gboolean cmd_inpblock(ProfWin *window, const char * const command, gchar **args); -gboolean cmd_encwarn(ProfWin *window, const char * const command, gchar **args); -gboolean cmd_script(ProfWin *window, const char * const command, gchar **args); +gboolean cmd_about(ProfWin *window, const char *const command, gchar **args); +gboolean cmd_account(ProfWin *window, const char *const command, gchar **args); +gboolean cmd_autoaway(ProfWin *window, const char *const command, gchar **args); +gboolean cmd_autoconnect(ProfWin *window, const char *const command, gchar **args); +gboolean cmd_autoping(ProfWin *window, const char *const command, gchar **args); +gboolean cmd_away(ProfWin *window, const char *const command, gchar **args); +gboolean cmd_beep(ProfWin *window, const char *const command, gchar **args); +gboolean cmd_caps(ProfWin *window, const char *const command, gchar **args); +gboolean cmd_chat(ProfWin *window, const char *const command, gchar **args); +gboolean cmd_chlog(ProfWin *window, const char *const command, gchar **args); +gboolean cmd_clear(ProfWin *window, const char *const command, gchar **args); +gboolean cmd_close(ProfWin *window, const char *const command, gchar **args); +gboolean cmd_connect(ProfWin *window, const char *const command, gchar **args); +gboolean cmd_tls(ProfWin *window, const char *const command, gchar **args); +gboolean cmd_decline(ProfWin *window, const char *const command, gchar **args); +gboolean cmd_disco(ProfWin *window, const char *const command, gchar **args); +gboolean cmd_lastactivity(ProfWin *window, const char *const command, gchar **args); +gboolean cmd_disconnect(ProfWin *window, const char *const command, gchar **args); +gboolean cmd_dnd(ProfWin *window, const char *const command, gchar **args); +gboolean cmd_flash(ProfWin *window, const char *const command, gchar **args); +gboolean cmd_gone(ProfWin *window, const char *const command, gchar **args); +gboolean cmd_grlog(ProfWin *window, const char *const command, gchar **args); +gboolean cmd_group(ProfWin *window, const char *const command, gchar **args); +gboolean cmd_help(ProfWin *window, const char *const command, gchar **args); +gboolean cmd_history(ProfWin *window, const char *const command, gchar **args); +gboolean cmd_carbons(ProfWin *window, const char *const command, gchar **args); +gboolean cmd_receipts(ProfWin *window, const char *const command, gchar **args); +gboolean cmd_info(ProfWin *window, const char *const command, gchar **args); +gboolean cmd_intype(ProfWin *window, const char *const command, gchar **args); +gboolean cmd_invite(ProfWin *window, const char *const command, gchar **args); +gboolean cmd_invites(ProfWin *window, const char *const command, gchar **args); +gboolean cmd_join(ProfWin *window, const char *const command, gchar **args); +gboolean cmd_leave(ProfWin *window, const char *const command, gchar **args); +gboolean cmd_log(ProfWin *window, const char *const command, gchar **args); +gboolean cmd_msg(ProfWin *window, const char *const command, gchar **args); +gboolean cmd_nick(ProfWin *window, const char *const command, gchar **args); +gboolean cmd_notify(ProfWin *window, const char *const command, gchar **args); +gboolean cmd_online(ProfWin *window, const char *const command, gchar **args); +gboolean cmd_otr(ProfWin *window, const char *const command, gchar **args); +gboolean cmd_pgp(ProfWin *window, const char *const command, gchar **args); +gboolean cmd_outtype(ProfWin *window, const char *const command, gchar **args); +gboolean cmd_prefs(ProfWin *window, const char *const command, gchar **args); +gboolean cmd_priority(ProfWin *window, const char *const command, gchar **args); +gboolean cmd_quit(ProfWin *window, const char *const command, gchar **args); +gboolean cmd_reconnect(ProfWin *window, const char *const command, gchar **args); +gboolean cmd_room(ProfWin *window, const char *const command, gchar **args); +gboolean cmd_rooms(ProfWin *window, const char *const command, gchar **args); +gboolean cmd_bookmark(ProfWin *window, const char *const command, gchar **args); +gboolean cmd_roster(ProfWin *window, const char *const command, gchar **args); +gboolean cmd_software(ProfWin *window, const char *const command, gchar **args); +gboolean cmd_splash(ProfWin *window, const char *const command, gchar **args); +gboolean cmd_states(ProfWin *window, const char *const command, gchar **args); +gboolean cmd_status(ProfWin *window, const char *const command, gchar **args); +gboolean cmd_statuses(ProfWin *window, const char *const command, gchar **args); +gboolean cmd_sub(ProfWin *window, const char *const command, gchar **args); +gboolean cmd_theme(ProfWin *window, const char *const command, gchar **args); +gboolean cmd_tiny(ProfWin *window, const char *const command, gchar **args); +gboolean cmd_titlebar(ProfWin *window, const char *const command, gchar **args); +gboolean cmd_vercheck(ProfWin *window, const char *const command, gchar **args); +gboolean cmd_who(ProfWin *window, const char *const command, gchar **args); +gboolean cmd_win(ProfWin *window, const char *const command, gchar **args); +gboolean cmd_wins(ProfWin *window, const char *const command, gchar **args); +gboolean cmd_xa(ProfWin *window, const char *const command, gchar **args); +gboolean cmd_alias(ProfWin *window, const char *const command, gchar **args); +gboolean cmd_xmlconsole(ProfWin *window, const char *const command, gchar **args); +gboolean cmd_ping(ProfWin *window, const char *const command, gchar **args); +gboolean cmd_form(ProfWin *window, const char *const command, gchar **args); +gboolean cmd_occupants(ProfWin *window, const char *const command, gchar **args); +gboolean cmd_kick(ProfWin *window, const char *const command, gchar **args); +gboolean cmd_ban(ProfWin *window, const char *const command, gchar **args); +gboolean cmd_subject(ProfWin *window, const char *const command, gchar **args); +gboolean cmd_affiliation(ProfWin *window, const char *const command, gchar **args); +gboolean cmd_role(ProfWin *window, const char *const command, gchar **args); +gboolean cmd_privileges(ProfWin *window, const char *const command, gchar **args); +gboolean cmd_presence(ProfWin *window, const char *const command, gchar **args); +gboolean cmd_wrap(ProfWin *window, const char *const command, gchar **args); +gboolean cmd_time(ProfWin *window, const char *const command, gchar **args); +gboolean cmd_resource(ProfWin *window, const char *const command, gchar **args); +gboolean cmd_inpblock(ProfWin *window, const char *const command, gchar **args); +gboolean cmd_encwarn(ProfWin *window, const char *const command, gchar **args); +gboolean cmd_script(ProfWin *window, const char *const command, gchar **args); gboolean cmd_form_field(ProfWin *window, char *tag, gchar **args); diff --git a/src/common.c b/src/common.c index 0a314c91..390659af 100644 --- a/src/common.c +++ b/src/common.c @@ -62,7 +62,7 @@ static unsigned long unique_id = 0; static size_t _data_callback(void *ptr, size_t size, size_t nmemb, void *data); // taken from glib 2.30.3 -gchar * +gchar* p_utf8_substring(const gchar *str, glong start_pos, glong end_pos) { gchar *start, *end, *out; @@ -102,7 +102,7 @@ p_hash_table_add(GHashTable *hash_table, gpointer key) } gboolean -p_hash_table_contains(GHashTable *hash_table, gconstpointer key) +p_hash_table_contains(GHashTable *hash_table, gconstpointer key) { // doesn't handle when key exists, but value == NULL gpointer found = g_hash_table_lookup(hash_table, key); @@ -148,7 +148,7 @@ mkdir_recursive(const char *dir) return result; } -char * +char* str_replace(const char *string, const char *substr, const char *replacement) { @@ -193,7 +193,7 @@ str_replace(const char *string, const char *substr, } gboolean -str_contains_str(const char * const searchstr, const char * const substr) +str_contains_str(const char *const searchstr, const char *const substr) { if (!searchstr) { return FALSE; @@ -244,7 +244,7 @@ strtoi_range(char *str, int *saveptr, int min, int max, char **err_msg) } int -utf8_display_len(const char * const str) +utf8_display_len(const char *const str) { if (!str) { return 0; @@ -265,7 +265,7 @@ utf8_display_len(const char * const str) return len; } -char * +char* prof_getline(FILE *stream) { char *buf; @@ -309,8 +309,8 @@ prof_getline(FILE *stream) return s; } -char * -release_get_latest() +char* +release_get_latest(void) { char *url = "http://www.profanity.im/profanity_version.txt"; @@ -362,7 +362,7 @@ release_is_new(char *found_version) } gboolean -valid_resource_presence_string(const char * const str) +valid_resource_presence_string(const char *const str) { assert(str != NULL); if ((strcmp(str, "online") == 0) || (strcmp(str, "chat") == 0) || @@ -374,7 +374,7 @@ valid_resource_presence_string(const char * const str) } } -const char * +const char* string_from_resource_presence(resource_presence_t presence) { switch(presence) @@ -393,7 +393,7 @@ string_from_resource_presence(resource_presence_t presence) } resource_presence_t -resource_presence_from_string(const char * const str) +resource_presence_from_string(const char *const str) { if (str == NULL) { return RESOURCE_ONLINE; @@ -430,7 +430,7 @@ contact_presence_from_resource_presence(resource_presence_t resource_presence) } } -gchar * +gchar* xdg_get_config_home(void) { gchar *xdg_config_home = getenv("XDG_CONFIG_HOME"); @@ -449,7 +449,7 @@ xdg_get_config_home(void) } } -gchar * +gchar* xdg_get_data_home(void) { gchar *xdg_data_home = getenv("XDG_DATA_HOME"); @@ -468,7 +468,7 @@ xdg_get_data_home(void) } } -char * +char* create_unique_id(char *prefix) { char *result = NULL; @@ -492,7 +492,7 @@ reset_unique_id(void) unique_id = 0; } -char * +char* p_sha1_hash(char *str) { P_SHA1_CTX ctx; @@ -623,8 +623,8 @@ get_file_or_linked(char *loc, char *basedir) return true_loc; } -char * -strip_arg_quotes(const char * const input) +char* +strip_arg_quotes(const char *const input) { char *unquoted = strdup(input); @@ -644,3 +644,21 @@ strip_arg_quotes(const char * const input) return unquoted; } + +gboolean +is_notify_enabled(void) +{ + gboolean notify_enabled = FALSE; + +#ifdef HAVE_OSXNOTIFY + notify_enabled = TRUE; +#endif +#ifdef HAVE_LIBNOTIFY + notify_enabled = TRUE; +#endif +#ifdef PLATFORM_CYGWIN + notify_enabled = TRUE; +#endif + + return notify_enabled; +} diff --git a/src/common.h b/src/common.h index a1e0226e..45907514 100644 --- a/src/common.h +++ b/src/common.h @@ -98,35 +98,35 @@ gchar* p_utf8_substring(const gchar *str, glong start_pos, glong end_pos); void p_slist_free_full(GSList *items, GDestroyNotify free_func); void p_list_free_full(GList *items, GDestroyNotify free_func); gboolean p_hash_table_add(GHashTable *hash_table, gpointer key); -gboolean p_hash_table_contains(GHashTable *hash_table, gconstpointer key); +gboolean p_hash_table_contains(GHashTable *hash_table, gconstpointer key); gboolean create_dir(char *name); gboolean mkdir_recursive(const char *dir); -char * str_replace(const char *string, const char *substr, - const char *replacement); -gboolean str_contains_str(const char * const searchstr, const char * const substr); +char* str_replace(const char *string, const char *substr, const char *replacement); +gboolean str_contains_str(const char *const searchstr, const char *const substr); int str_contains(const char str[], int size, char ch); gboolean strtoi_range(char *str, int *saveptr, int min, int max, char **err_msg); -int utf8_display_len(const char * const str); -char * prof_getline(FILE *stream); +int utf8_display_len(const char *const str); +char* prof_getline(FILE *stream); char* release_get_latest(void); gboolean release_is_new(char *found_version); -gchar * xdg_get_config_home(void); -gchar * xdg_get_data_home(void); +gchar* xdg_get_config_home(void); +gchar* xdg_get_data_home(void); -gboolean valid_resource_presence_string(const char * const str); -const char * string_from_resource_presence(resource_presence_t presence); -resource_presence_t resource_presence_from_string(const char * const str); +gboolean valid_resource_presence_string(const char *const str); +const char* string_from_resource_presence(resource_presence_t presence); +resource_presence_t resource_presence_from_string(const char *const str); contact_presence_t contact_presence_from_resource_presence(resource_presence_t resource_presence); -char * p_sha1_hash(char *str); -char * create_unique_id(char *prefix); +char* p_sha1_hash(char *str); +char* create_unique_id(char *prefix); void reset_unique_id(void); int cmp_win_num(gconstpointer a, gconstpointer b); int get_next_available_win_num(GList *used); char* get_file_or_linked(char *loc, char *basedir); -char * strip_arg_quotes(const char * const input); +char* strip_arg_quotes(const char *const input); +gboolean is_notify_enabled(void); #endif diff --git a/src/config/account.c b/src/config/account.c index 534d1138..da6a4317 100644 --- a/src/config/account.c +++ b/src/config/account.c @@ -44,14 +44,14 @@ #include "log.h" ProfAccount* -account_new(const gchar * const name, const gchar * const jid, - const gchar * const password, const gchar * eval_password, gboolean enabled, const gchar * const server, - int port, const gchar * const resource, const gchar * const last_presence, - const gchar * const login_presence, int priority_online, int priority_chat, +account_new(const gchar *const name, const gchar *const jid, + const gchar *const password, const gchar *eval_password, gboolean enabled, const gchar *const server, + int port, const gchar *const resource, const gchar *const last_presence, + const gchar *const login_presence, int priority_online, int priority_chat, int priority_away, int priority_xa, int priority_dnd, - const gchar * const muc_service, const gchar * const muc_nick, - const gchar * const otr_policy, GList *otr_manual, GList *otr_opportunistic, - GList *otr_always, const gchar * const pgp_keyid, const char *const startscript, + const gchar *const muc_service, const gchar *const muc_nick, + const gchar *const otr_policy, GList *otr_manual, GList *otr_opportunistic, + GList *otr_always, const gchar *const pgp_keyid, const char *const startscript, gchar *tls_policy) { ProfAccount *new_account = malloc(sizeof(ProfAccount)); @@ -166,7 +166,7 @@ account_new(const gchar * const name, const gchar * const jid, return new_account; } -char * +char* account_create_full_jid(ProfAccount *account) { if (account->resource) { diff --git a/src/config/account.h b/src/config/account.h index bb5f27ce..2d45bdbd 100644 --- a/src/config/account.h +++ b/src/config/account.h @@ -64,14 +64,14 @@ typedef struct prof_account_t { gchar *tls_policy; } ProfAccount; -ProfAccount* account_new(const gchar * const name, const gchar * const jid, - const gchar * const passord, const gchar * eval_password, gboolean enabled, const gchar * const server, - int port, const gchar * const resource, const gchar * const last_presence, - const gchar * const login_presence, int priority_online, int priority_chat, +ProfAccount* account_new(const gchar *const name, const gchar *const jid, + const gchar *const passord, const gchar *eval_password, gboolean enabled, const gchar *const server, + int port, const gchar *const resource, const gchar *const last_presence, + const gchar *const login_presence, int priority_online, int priority_chat, int priority_away, int priority_xa, int priority_dnd, - const gchar * const muc_service, const gchar * const muc_nick, - const gchar * const otr_policy, GList *otr_manual, GList *otr_opportunistic, - GList *otr_always, const gchar * const pgp_keyid, const char *const startscript, + const gchar *const muc_service, const gchar *const muc_nick, + const gchar *const otr_policy, GList *otr_manual, GList *otr_opportunistic, + GList *otr_always, const gchar *const pgp_keyid, const char *const startscript, gchar *tls_policy); char* account_create_full_jid(ProfAccount *account); gboolean account_eval_password(ProfAccount *account); diff --git a/src/config/accounts.c b/src/config/accounts.c index 43239d76..2d4581ee 100644 --- a/src/config/accounts.c +++ b/src/config/accounts.c @@ -54,8 +54,8 @@ static Autocomplete all_ac; static Autocomplete enabled_ac; static void _save_accounts(void); -static gchar * _get_accounts_file(void); -static void _remove_from_list(GKeyFile *accounts, const char * const account_name, const char * const key, const char * const contact_jid); +static gchar* _get_accounts_file(void); +static void _remove_from_list(GKeyFile *accounts, const char *const account_name, const char *const key, const char *const contact_jid); void accounts_load(void) @@ -95,14 +95,14 @@ accounts_close(void) g_key_file_free(accounts); } -char * -accounts_find_enabled(const char * const prefix) +char* +accounts_find_enabled(const char *const prefix) { return autocomplete_complete(enabled_ac, prefix, TRUE); } -char * -accounts_find_all(const char * const prefix) +char* +accounts_find_all(const char *const prefix) { return autocomplete_complete(all_ac, prefix, TRUE); } @@ -193,7 +193,7 @@ accounts_get_list(void) } ProfAccount* -accounts_get_account(const char * const name) +accounts_get_account(const char *const name) { if (!g_key_file_has_group(accounts, name)) { return NULL; @@ -305,7 +305,7 @@ accounts_get_account(const char * const name) } gboolean -accounts_enable(const char * const name) +accounts_enable(const char *const name) { if (g_key_file_has_group(accounts, name)) { g_key_file_set_boolean(accounts, name, "enabled", TRUE); @@ -318,7 +318,7 @@ accounts_enable(const char * const name) } gboolean -accounts_disable(const char * const name) +accounts_disable(const char *const name) { if (g_key_file_has_group(accounts, name)) { g_key_file_set_boolean(accounts, name, "enabled", FALSE); @@ -331,7 +331,7 @@ accounts_disable(const char * const name) } gboolean -accounts_rename(const char * const account_name, const char * const new_name) +accounts_rename(const char *const account_name, const char *const new_name) { if (g_key_file_has_group(accounts, new_name)) { return FALSE; @@ -393,14 +393,14 @@ accounts_rename(const char * const account_name, const char * const new_name) } gboolean -accounts_account_exists(const char * const account_name) +accounts_account_exists(const char *const account_name) { return g_key_file_has_group(accounts, account_name); } void -accounts_set_jid(const char * const account_name, const char * const value) +accounts_set_jid(const char *const account_name, const char *const value) { Jid *jid = jid_create(value); if (jid) { @@ -428,7 +428,7 @@ accounts_set_jid(const char * const account_name, const char * const value) } void -accounts_set_server(const char * const account_name, const char * const value) +accounts_set_server(const char *const account_name, const char *const value) { if (accounts_account_exists(account_name)) { g_key_file_set_string(accounts, account_name, "server", value); @@ -437,7 +437,7 @@ accounts_set_server(const char * const account_name, const char * const value) } void -accounts_set_port(const char * const account_name, const int value) +accounts_set_port(const char *const account_name, const int value) { if (value != 0) { g_key_file_set_integer(accounts, account_name, "port", value); @@ -446,7 +446,7 @@ accounts_set_port(const char * const account_name, const int value) } void -accounts_set_resource(const char * const account_name, const char * const value) +accounts_set_resource(const char *const account_name, const char *const value) { if (accounts_account_exists(account_name)) { g_key_file_set_string(accounts, account_name, "resource", value); @@ -455,7 +455,7 @@ accounts_set_resource(const char * const account_name, const char * const value) } void -accounts_set_password(const char * const account_name, const char * const value) +accounts_set_password(const char *const account_name, const char *const value) { if (accounts_account_exists(account_name)) { g_key_file_set_string(accounts, account_name, "password", value); @@ -464,7 +464,7 @@ accounts_set_password(const char * const account_name, const char * const value) } void -accounts_set_eval_password(const char * const account_name, const char * const value) +accounts_set_eval_password(const char *const account_name, const char *const value) { if (accounts_account_exists(account_name)) { g_key_file_set_string(accounts, account_name, "eval_password", value); @@ -473,7 +473,7 @@ accounts_set_eval_password(const char * const account_name, const char * const v } void -accounts_set_pgp_keyid(const char * const account_name, const char * const value) +accounts_set_pgp_keyid(const char *const account_name, const char *const value) { if (accounts_account_exists(account_name)) { g_key_file_set_string(accounts, account_name, "pgp.keyid", value); @@ -482,7 +482,7 @@ accounts_set_pgp_keyid(const char * const account_name, const char * const value } void -accounts_set_script_start(const char * const account_name, const char * const value) +accounts_set_script_start(const char *const account_name, const char *const value) { if (accounts_account_exists(account_name)) { g_key_file_set_string(accounts, account_name, "script.start", value); @@ -491,7 +491,7 @@ accounts_set_script_start(const char * const account_name, const char * const va } void -accounts_clear_password(const char * const account_name) +accounts_clear_password(const char *const account_name) { if (accounts_account_exists(account_name)) { g_key_file_remove_key(accounts, account_name, "password", NULL); @@ -500,7 +500,7 @@ accounts_clear_password(const char * const account_name) } void -accounts_clear_eval_password(const char * const account_name) +accounts_clear_eval_password(const char *const account_name) { if (accounts_account_exists(account_name)) { g_key_file_remove_key(accounts, account_name, "eval_password", NULL); @@ -509,7 +509,7 @@ accounts_clear_eval_password(const char * const account_name) } void -accounts_clear_server(const char * const account_name) +accounts_clear_server(const char *const account_name) { if (accounts_account_exists(account_name)) { g_key_file_remove_key(accounts, account_name, "server", NULL); @@ -518,7 +518,7 @@ accounts_clear_server(const char * const account_name) } void -accounts_clear_port(const char * const account_name) +accounts_clear_port(const char *const account_name) { if (accounts_account_exists(account_name)) { g_key_file_remove_key(accounts, account_name, "port", NULL); @@ -527,7 +527,7 @@ accounts_clear_port(const char * const account_name) } void -accounts_clear_pgp_keyid(const char * const account_name) +accounts_clear_pgp_keyid(const char *const account_name) { if (accounts_account_exists(account_name)) { g_key_file_remove_key(accounts, account_name, "pgp.keyid", NULL); @@ -536,7 +536,7 @@ accounts_clear_pgp_keyid(const char * const account_name) } void -accounts_clear_script_start(const char * const account_name) +accounts_clear_script_start(const char *const account_name) { if (accounts_account_exists(account_name)) { g_key_file_remove_key(accounts, account_name, "script.start", NULL); @@ -544,7 +544,7 @@ accounts_clear_script_start(const char * const account_name) } } void -accounts_clear_otr(const char * const account_name) +accounts_clear_otr(const char *const account_name) { if (accounts_account_exists(account_name)) { g_key_file_remove_key(accounts, account_name, "otr.policy", NULL); @@ -553,7 +553,7 @@ accounts_clear_otr(const char * const account_name) } void -accounts_add_otr_policy(const char * const account_name, const char * const contact_jid, const char * const policy) +accounts_add_otr_policy(const char *const account_name, const char *const contact_jid, const char *const policy) { if (accounts_account_exists(account_name)) { GString *key = g_string_new("otr."); @@ -621,7 +621,7 @@ accounts_add_otr_policy(const char * const account_name, const char * const cont } static void -_remove_from_list(GKeyFile *accounts, const char * const account_name, const char * const key, const char * const contact_jid) +_remove_from_list(GKeyFile *accounts, const char *const account_name, const char *const key, const char *const contact_jid) { gsize length; gchar **list = g_key_file_get_string_list(accounts, account_name, key, &length, NULL); @@ -665,7 +665,7 @@ _remove_from_list(GKeyFile *accounts, const char * const account_name, const cha } void -accounts_set_muc_service(const char * const account_name, const char * const value) +accounts_set_muc_service(const char *const account_name, const char *const value) { if (accounts_account_exists(account_name)) { g_key_file_set_string(accounts, account_name, "muc.service", value); @@ -674,7 +674,7 @@ accounts_set_muc_service(const char * const account_name, const char * const val } void -accounts_set_muc_nick(const char * const account_name, const char * const value) +accounts_set_muc_nick(const char *const account_name, const char *const value) { if (accounts_account_exists(account_name)) { g_key_file_set_string(accounts, account_name, "muc.nick", value); @@ -683,7 +683,7 @@ accounts_set_muc_nick(const char * const account_name, const char * const value) } void -accounts_set_otr_policy(const char * const account_name, const char * const value) +accounts_set_otr_policy(const char *const account_name, const char *const value) { if (accounts_account_exists(account_name)) { g_key_file_set_string(accounts, account_name, "otr.policy", value); @@ -692,7 +692,7 @@ accounts_set_otr_policy(const char * const account_name, const char * const valu } void -accounts_set_tls_policy(const char * const account_name, const char * const value) +accounts_set_tls_policy(const char *const account_name, const char *const value) { if (accounts_account_exists(account_name)) { g_key_file_set_string(accounts, account_name, "tls.policy", value); @@ -701,7 +701,7 @@ accounts_set_tls_policy(const char * const account_name, const char * const valu } void -accounts_set_priority_online(const char * const account_name, const gint value) +accounts_set_priority_online(const char *const account_name, const gint value) { if (accounts_account_exists(account_name)) { g_key_file_set_integer(accounts, account_name, "priority.online", value); @@ -710,7 +710,7 @@ accounts_set_priority_online(const char * const account_name, const gint value) } void -accounts_set_priority_chat(const char * const account_name, const gint value) +accounts_set_priority_chat(const char *const account_name, const gint value) { if (accounts_account_exists(account_name)) { g_key_file_set_integer(accounts, account_name, "priority.chat", value); @@ -719,7 +719,7 @@ accounts_set_priority_chat(const char * const account_name, const gint value) } void -accounts_set_priority_away(const char * const account_name, const gint value) +accounts_set_priority_away(const char *const account_name, const gint value) { if (accounts_account_exists(account_name)) { g_key_file_set_integer(accounts, account_name, "priority.away", value); @@ -728,7 +728,7 @@ accounts_set_priority_away(const char * const account_name, const gint value) } void -accounts_set_priority_xa(const char * const account_name, const gint value) +accounts_set_priority_xa(const char *const account_name, const gint value) { if (accounts_account_exists(account_name)) { g_key_file_set_integer(accounts, account_name, "priority.xa", value); @@ -737,7 +737,7 @@ accounts_set_priority_xa(const char * const account_name, const gint value) } void -accounts_set_priority_dnd(const char * const account_name, const gint value) +accounts_set_priority_dnd(const char *const account_name, const gint value) { if (accounts_account_exists(account_name)) { g_key_file_set_integer(accounts, account_name, "priority.dnd", value); @@ -746,7 +746,7 @@ accounts_set_priority_dnd(const char * const account_name, const gint value) } void -accounts_set_priority_all(const char * const account_name, const gint value) +accounts_set_priority_all(const char *const account_name, const gint value) { if (accounts_account_exists(account_name)) { accounts_set_priority_online(account_name, value); @@ -759,7 +759,7 @@ accounts_set_priority_all(const char * const account_name, const gint value) } gint -accounts_get_priority_for_presence_type(const char * const account_name, +accounts_get_priority_for_presence_type(const char *const account_name, resource_presence_t presence_type) { gint result; @@ -790,7 +790,7 @@ accounts_get_priority_for_presence_type(const char * const account_name, } void -accounts_set_last_presence(const char * const account_name, const char * const value) +accounts_set_last_presence(const char *const account_name, const char *const value) { if (accounts_account_exists(account_name)) { g_key_file_set_string(accounts, account_name, "presence.last", value); @@ -799,7 +799,7 @@ accounts_set_last_presence(const char * const account_name, const char * const v } void -accounts_set_last_status(const char * const account_name, const char * const value) +accounts_set_last_status(const char *const account_name, const char *const value) { if (accounts_account_exists(account_name)) { if (value) { @@ -812,7 +812,7 @@ accounts_set_last_status(const char * const account_name, const char * const val } void -accounts_set_last_activity(const char * const account_name) +accounts_set_last_activity(const char *const account_name) { if (accounts_account_exists(account_name)) { GDateTime *nowdt = g_date_time_new_now_utc(); @@ -829,8 +829,8 @@ accounts_set_last_activity(const char * const account_name) } } -char * -accounts_get_last_activity(const char * const account_name) +char* +accounts_get_last_activity(const char *const account_name) { if (accounts_account_exists(account_name)) { return g_key_file_get_string(accounts, account_name, "last.activity", NULL); @@ -840,7 +840,7 @@ accounts_get_last_activity(const char * const account_name) } void -accounts_set_login_presence(const char * const account_name, const char * const value) +accounts_set_login_presence(const char *const account_name, const char *const value) { if (accounts_account_exists(account_name)) { g_key_file_set_string(accounts, account_name, "presence.login", value); @@ -849,7 +849,7 @@ accounts_set_login_presence(const char * const account_name, const char * const } resource_presence_t -accounts_get_last_presence(const char * const account_name) +accounts_get_last_presence(const char *const account_name) { resource_presence_t result; gchar *setting = g_key_file_get_string(accounts, account_name, "presence.last", NULL); @@ -876,14 +876,14 @@ accounts_get_last_presence(const char * const account_name) return result; } -char * -accounts_get_last_status(const char * const account_name) +char* +accounts_get_last_status(const char *const account_name) { return g_key_file_get_string(accounts, account_name, "presence.laststatus", NULL); } resource_presence_t -accounts_get_login_presence(const char * const account_name) +accounts_get_login_presence(const char *const account_name) { resource_presence_t result; gchar *setting = g_key_file_get_string(accounts, account_name, "presence.login", NULL); @@ -929,7 +929,7 @@ _save_accounts(void) g_string_free(base_str, TRUE); } -static gchar * +static gchar* _get_accounts_file(void) { gchar *xdg_data = xdg_get_data_home(); diff --git a/src/config/accounts.h b/src/config/accounts.h index bd9d9307..0417b6bd 100644 --- a/src/config/accounts.h +++ b/src/config/accounts.h @@ -43,54 +43,54 @@ void accounts_load(void); void accounts_close(void); -char * accounts_find_all(const char * const prefix); -char * accounts_find_enabled(const char * const prefix); +char* accounts_find_all(const char *const prefix); +char* accounts_find_enabled(const char *const prefix); void accounts_reset_all_search(void); void accounts_reset_enabled_search(void); void accounts_add(const char *jid, const char *altdomain, const int port, const char *const tls_policy); int accounts_remove(const char *jid); gchar** accounts_get_list(void); -ProfAccount* accounts_get_account(const char * const name); -gboolean accounts_enable(const char * const name); -gboolean accounts_disable(const char * const name); -gboolean accounts_rename(const char * const account_name, - const char * const new_name); -gboolean accounts_account_exists(const char * const account_name); -void accounts_set_jid(const char * const account_name, const char * const value); -void accounts_set_server(const char * const account_name, const char * const value); -void accounts_set_port(const char * const account_name, const int value); -void accounts_set_resource(const char * const account_name, const char * const value); -void accounts_set_password(const char * const account_name, const char * const value); -void accounts_set_eval_password(const char * const account_name, const char * const value); -void accounts_set_muc_service(const char * const account_name, const char * const value); -void accounts_set_muc_nick(const char * const account_name, const char * const value); -void accounts_set_otr_policy(const char * const account_name, const char * const value); -void accounts_set_tls_policy(const char * const account_name, const char * const value); -void accounts_set_last_presence(const char * const account_name, const char * const value); -void accounts_set_last_status(const char * const account_name, const char * const value); -void accounts_set_last_activity(const char * const account_name); -char * accounts_get_last_activity(const char * const account_name); -void accounts_set_login_presence(const char * const account_name, const char * const value); -resource_presence_t accounts_get_login_presence(const char * const account_name); -char * accounts_get_last_status(const char * const account_name); -resource_presence_t accounts_get_last_presence(const char * const account_name); -void accounts_set_priority_online(const char * const account_name, const gint value); -void accounts_set_priority_chat(const char * const account_name, const gint value); -void accounts_set_priority_away(const char * const account_name, const gint value); -void accounts_set_priority_xa(const char * const account_name, const gint value); -void accounts_set_priority_dnd(const char * const account_name, const gint value); -void accounts_set_priority_all(const char * const account_name, const gint value); -gint accounts_get_priority_for_presence_type(const char * const account_name, +ProfAccount* accounts_get_account(const char *const name); +gboolean accounts_enable(const char *const name); +gboolean accounts_disable(const char *const name); +gboolean accounts_rename(const char *const account_name, + const char *const new_name); +gboolean accounts_account_exists(const char *const account_name); +void accounts_set_jid(const char *const account_name, const char *const value); +void accounts_set_server(const char *const account_name, const char *const value); +void accounts_set_port(const char *const account_name, const int value); +void accounts_set_resource(const char *const account_name, const char *const value); +void accounts_set_password(const char *const account_name, const char *const value); +void accounts_set_eval_password(const char *const account_name, const char *const value); +void accounts_set_muc_service(const char *const account_name, const char *const value); +void accounts_set_muc_nick(const char *const account_name, const char *const value); +void accounts_set_otr_policy(const char *const account_name, const char *const value); +void accounts_set_tls_policy(const char *const account_name, const char *const value); +void accounts_set_last_presence(const char *const account_name, const char *const value); +void accounts_set_last_status(const char *const account_name, const char *const value); +void accounts_set_last_activity(const char *const account_name); +char* accounts_get_last_activity(const char *const account_name); +void accounts_set_login_presence(const char *const account_name, const char *const value); +resource_presence_t accounts_get_login_presence(const char *const account_name); +char* accounts_get_last_status(const char *const account_name); +resource_presence_t accounts_get_last_presence(const char *const account_name); +void accounts_set_priority_online(const char *const account_name, const gint value); +void accounts_set_priority_chat(const char *const account_name, const gint value); +void accounts_set_priority_away(const char *const account_name, const gint value); +void accounts_set_priority_xa(const char *const account_name, const gint value); +void accounts_set_priority_dnd(const char *const account_name, const gint value); +void accounts_set_priority_all(const char *const account_name, const gint value); +gint accounts_get_priority_for_presence_type(const char *const account_name, resource_presence_t presence_type); -void accounts_set_pgp_keyid(const char * const account_name, const char * const value); -void accounts_set_script_start(const char * const account_name, const char * const value); -void accounts_clear_password(const char * const account_name); -void accounts_clear_eval_password(const char * const account_name); -void accounts_clear_server(const char * const account_name); -void accounts_clear_port(const char * const account_name); -void accounts_clear_otr(const char * const account_name); -void accounts_clear_pgp_keyid(const char * const account_name); -void accounts_clear_script_start(const char * const account_name); -void accounts_add_otr_policy(const char * const account_name, const char * const contact_jid, const char * const policy); +void accounts_set_pgp_keyid(const char *const account_name, const char *const value); +void accounts_set_script_start(const char *const account_name, const char *const value); +void accounts_clear_password(const char *const account_name); +void accounts_clear_eval_password(const char *const account_name); +void accounts_clear_server(const char *const account_name); +void accounts_clear_port(const char *const account_name); +void accounts_clear_otr(const char *const account_name); +void accounts_clear_pgp_keyid(const char *const account_name); +void accounts_clear_script_start(const char *const account_name); +void accounts_add_otr_policy(const char *const account_name, const char *const contact_jid, const char *const policy); #endif diff --git a/src/config/preferences.c b/src/config/preferences.c index 283e9158..5ac4652b 100644 --- a/src/config/preferences.c +++ b/src/config/preferences.c @@ -66,11 +66,11 @@ gint log_maxsize = 0; static Autocomplete boolean_choice_ac; static void _save_prefs(void); -static gchar * _get_preferences_file(void); -static const char * _get_group(preference_t pref); -static const char * _get_key(preference_t pref); +static gchar* _get_preferences_file(void); +static const char* _get_group(preference_t pref); +static const char* _get_key(preference_t pref); static gboolean _get_default_boolean(preference_t pref); -static char * _get_default_string(preference_t pref); +static char* _get_default_string(preference_t pref); void prefs_load(void) @@ -142,8 +142,8 @@ prefs_close(void) prefs = NULL; } -char * -prefs_autocomplete_boolean_choice(const char * const prefix) +char* +prefs_autocomplete_boolean_choice(const char *const prefix) { return autocomplete_complete(boolean_choice_ac, prefix, TRUE); } @@ -177,7 +177,7 @@ prefs_set_boolean(preference_t pref, gboolean value) _save_prefs(); } -char * +char* prefs_get_string(preference_t pref) { const char *group = _get_group(pref); @@ -263,7 +263,8 @@ prefs_set_max_log_size(gint value) _save_prefs(); } -gint prefs_get_inpblock(void) +gint +prefs_get_inpblock(void) { int val = g_key_file_get_integer(prefs, PREF_GROUP_UI, "inpblock", NULL); if (val == 0) { @@ -273,7 +274,8 @@ gint prefs_get_inpblock(void) } } -void prefs_set_inpblock(gint value) +void +prefs_set_inpblock(gint value) { g_key_file_set_integer(prefs, PREF_GROUP_UI, "inpblock", value); _save_prefs(); @@ -444,7 +446,7 @@ prefs_set_pgp_char(char ch) } gboolean -prefs_add_alias(const char * const name, const char * const value) +prefs_add_alias(const char *const name, const char *const value) { if (g_key_file_has_key(prefs, PREF_GROUP_ALIAS, name, NULL)) { return FALSE; @@ -455,15 +457,15 @@ prefs_add_alias(const char * const name, const char * const value) } } -char * -prefs_get_alias(const char * const name) +char* +prefs_get_alias(const char *const name) { return g_key_file_get_string(prefs, PREF_GROUP_ALIAS, name, NULL); } gboolean -prefs_remove_alias(const char * const name) +prefs_remove_alias(const char *const name) { if (!g_key_file_has_key(prefs, PREF_GROUP_ALIAS, name, NULL)) { return FALSE; @@ -483,7 +485,7 @@ _alias_cmp(gconstpointer *p1, gconstpointer *p2) return strcmp(alias1->name, alias2->name); } -GList * +GList* prefs_get_aliases(void) { if (!g_key_file_has_group(prefs, PREF_GROUP_ALIAS)) { @@ -545,7 +547,7 @@ _save_prefs(void) g_string_free(base_str, TRUE); } -static gchar * +static gchar* _get_preferences_file(void) { gchar *xdg_config = xdg_get_config_home(); @@ -561,7 +563,7 @@ _get_preferences_file(void) // get the preference group for a specific preference // for example the PREF_BEEP setting ("beep" in .profrc, see _get_key) belongs // to the [ui] section. -static const char * +static const char* _get_group(preference_t pref) { switch (pref) @@ -648,7 +650,7 @@ _get_group(preference_t pref) // get the key used in .profrc for the preference // for example the PREF_AUTOAWAY_MODE maps to "autoaway.mode" in .profrc -static const char * +static const char* _get_key(preference_t pref) { switch (pref) @@ -833,7 +835,7 @@ _get_default_boolean(preference_t pref) // the default setting for a string type preference // if it is not specified in .profrc -static char * +static char* _get_default_string(preference_t pref) { switch (pref) diff --git a/src/config/preferences.h b/src/config/preferences.h index 46bdd550..9aa6ff72 100644 --- a/src/config/preferences.h +++ b/src/config/preferences.h @@ -124,9 +124,9 @@ typedef struct prof_alias_t { void prefs_load(void); void prefs_close(void); -char * prefs_find_login(char *prefix); +char* prefs_find_login(char *prefix); void prefs_reset_login_search(void); -char * prefs_autocomplete_boolean_choice(const char * const prefix); +char* prefs_autocomplete_boolean_choice(const char *const prefix); void prefs_reset_boolean_choice(void); gint prefs_get_gone(void); @@ -162,15 +162,15 @@ void prefs_set_pgp_char(char ch); void prefs_add_login(const char *jid); -gboolean prefs_add_alias(const char * const name, const char * const value); -gboolean prefs_remove_alias(const char * const name); -char* prefs_get_alias(const char * const name); +gboolean prefs_add_alias(const char *const name, const char *const value); +gboolean prefs_remove_alias(const char *const name); +char* prefs_get_alias(const char *const name); GList* prefs_get_aliases(void); void prefs_free_aliases(GList *aliases); gboolean prefs_get_boolean(preference_t pref); void prefs_set_boolean(preference_t pref, gboolean value); -char * prefs_get_string(preference_t pref); +char* prefs_get_string(preference_t pref); void prefs_free_string(char *pref); void prefs_set_string(preference_t pref, char *value); diff --git a/src/config/theme.c b/src/config/theme.c index 0c9a39b7..09d0fa1e 100644 --- a/src/config/theme.c +++ b/src/config/theme.c @@ -124,17 +124,17 @@ static struct colours_t { NCURSES_COLOR_T receiptsent; } colour_prefs; -static NCURSES_COLOR_T _lookup_colour(const char * const colour); +static NCURSES_COLOR_T _lookup_colour(const char *const colour); static void _set_colour(gchar *val, NCURSES_COLOR_T *pref, NCURSES_COLOR_T def, theme_item_t theme_item); static void _load_colours(void); static void _load_preferences(void); -static gchar * _get_themes_dir(void); -void _theme_list_dir(const gchar * const dir, GSList **result); -static GString * _theme_find(const char * const theme_name); -static gboolean _theme_load_file(const char * const theme_name); +static gchar* _get_themes_dir(void); +void _theme_list_dir(const gchar *const dir, GSList **result); +static GString* _theme_find(const char *const theme_name); +static gboolean _theme_load_file(const char *const theme_name); void -theme_init(const char * const theme_name) +theme_init(const char *const theme_name) { if (!_theme_load_file(theme_name) && !_theme_load_file("default")) { log_error("Theme initialisation failed"); @@ -144,7 +144,7 @@ theme_init(const char * const theme_name) } gboolean -theme_load(const char * const theme_name) +theme_load(const char *const theme_name) { if (_theme_load_file(theme_name)) { _load_colours(); @@ -156,7 +156,7 @@ theme_load(const char * const theme_name) } static gboolean -_theme_load_file(const char * const theme_name) +_theme_load_file(const char *const theme_name) { // use default theme if (theme_name == NULL || strcmp(theme_name, "default") == 0) { @@ -189,7 +189,7 @@ _theme_load_file(const char * const theme_name) return TRUE; } -GSList * +GSList* theme_list(void) { GSList *result = NULL; @@ -300,7 +300,7 @@ theme_init_colours(void) } static NCURSES_COLOR_T -_lookup_colour(const char * const colour) +_lookup_colour(const char *const colour) { int i; for (i = 0; i < num_colours; i++) { @@ -489,7 +489,7 @@ _load_preferences(void) } } -static gchar * +static gchar* _get_themes_dir(void) { gchar *xdg_config = xdg_get_config_home(); @@ -500,7 +500,7 @@ _get_themes_dir(void) } void -_theme_list_dir(const gchar * const dir, GSList **result) +_theme_list_dir(const gchar *const dir, GSList **result) { GDir *themes = g_dir_open(dir, 0, NULL); if (themes) { @@ -513,8 +513,8 @@ _theme_list_dir(const gchar * const dir, GSList **result) } } -static GString * -_theme_find(const char * const theme_name) +static GString* +_theme_find(const char *const theme_name) { GString *path = NULL; gchar *themes_dir = _get_themes_dir(); @@ -546,7 +546,7 @@ _theme_find(const char * const theme_name) } theme_item_t -theme_main_presence_attrs(const char * const presence) +theme_main_presence_attrs(const char *const presence) { if (g_strcmp0(presence, "online") == 0) { return THEME_ONLINE; diff --git a/src/config/theme.h b/src/config/theme.h index 2ddbb17b..59db9f57 100644 --- a/src/config/theme.h +++ b/src/config/theme.h @@ -105,12 +105,12 @@ typedef enum { THEME_MAGENTA_BOLD } theme_item_t; -void theme_init(const char * const theme_name); +void theme_init(const char *const theme_name); void theme_init_colours(void); -gboolean theme_load(const char * const theme_name); +gboolean theme_load(const char *const theme_name); GSList* theme_list(void); void theme_close(void); int theme_attrs(theme_item_t attrs); -theme_item_t theme_main_presence_attrs(const char * const presence); +theme_item_t theme_main_presence_attrs(const char *const presence); #endif diff --git a/src/config/tlscerts.c b/src/config/tlscerts.c index 3d0a0b24..17c32cb5 100644 --- a/src/config/tlscerts.c +++ b/src/config/tlscerts.c @@ -76,7 +76,7 @@ tlscerts_init(void) } gboolean -tlscerts_exists(const char * const fingerprint) +tlscerts_exists(const char *const fingerprint) { return g_key_file_has_group(tlscerts, fingerprint); } @@ -110,8 +110,8 @@ tlscerts_list(void) } TLSCertificate* -tlscerts_new(const char * const fingerprint, const char * const domain, const char * const organisation, - const char * const email, const char * const notbefore, const char * const notafter) +tlscerts_new(const char *const fingerprint, const char *const domain, const char *const organisation, + const char *const email, const char *const notbefore, const char *const notafter) { TLSCertificate *cert = malloc(sizeof(TLSCertificate)); if (fingerprint) { @@ -181,7 +181,7 @@ tlscerts_add(TLSCertificate *cert) } gboolean -tlscerts_revoke(const char * const fingerprint) +tlscerts_revoke(const char *const fingerprint) { gboolean result = g_key_file_remove_group(tlscerts, fingerprint, NULL); if (result) { @@ -193,8 +193,8 @@ tlscerts_revoke(const char * const fingerprint) return result; } -char * -tlscerts_complete(const char * const prefix) +char* +tlscerts_complete(const char *const prefix) { return autocomplete_complete(certs_ac, prefix, TRUE); } @@ -226,7 +226,7 @@ tlscerts_close(void) autocomplete_free(certs_ac); } -static gchar * +static gchar* _get_tlscerts_file(void) { gchar *xdg_data = xdg_get_data_home(); diff --git a/src/config/tlscerts.h b/src/config/tlscerts.h index b8a15c5b..dfb200b7 100644 --- a/src/config/tlscerts.h +++ b/src/config/tlscerts.h @@ -46,21 +46,21 @@ typedef struct tls_cert_t { void tlscerts_init(void); -TLSCertificate *tlscerts_new(const char * const fingerprint, const char * const domain, - const char * const organisation, const char * const email, - const char * const notbefore, const char * const notafter); +TLSCertificate* tlscerts_new(const char *const fingerprint, const char *const domain, + const char *const organisation, const char *const email, + const char *const notbefore, const char *const notafter); -gboolean tlscerts_exists(const char * const fingerprint); +gboolean tlscerts_exists(const char *const fingerprint); void tlscerts_add(TLSCertificate *cert); -gboolean tlscerts_revoke(const char * const fingerprint); +gboolean tlscerts_revoke(const char *const fingerprint); void tlscerts_free(TLSCertificate *cert); GList* tlscerts_list(void); -char* tlscerts_complete(const char * const prefix); +char* tlscerts_complete(const char *const prefix); void tlscerts_reset_ac(void); diff --git a/src/contact.c b/src/contact.c index 713af955..28fd69a1 100644 --- a/src/contact.c +++ b/src/contact.c @@ -58,9 +58,9 @@ struct p_contact_t { }; PContact -p_contact_new(const char * const barejid, const char * const name, - GSList *groups, const char * const subscription, - const char * const offline_message, gboolean pending_out) +p_contact_new(const char *const barejid, const char *const name, + GSList *groups, const char *const subscription, + const char *const offline_message, gboolean pending_out) { PContact contact = malloc(sizeof(struct p_contact_t)); contact->barejid = strdup(barejid); @@ -98,7 +98,7 @@ p_contact_new(const char * const barejid, const char * const name, } void -p_contact_set_name(const PContact contact, const char * const name) +p_contact_set_name(const PContact contact, const char *const name) { FREE_SET_NULL(contact->name); FREE_SET_NULL(contact->name_collate_key); @@ -120,7 +120,7 @@ p_contact_set_groups(const PContact contact, GSList *groups) } gboolean -p_contact_in_group(const PContact contact, const char * const group) +p_contact_in_group(const PContact contact, const char *const group) { GSList *groups = contact->groups; while (groups) { @@ -133,14 +133,14 @@ p_contact_in_group(const PContact contact, const char * const group) return FALSE; } -GSList * +GSList* p_contact_groups(const PContact contact) { return contact->groups; } gboolean -p_contact_remove_resource(PContact contact, const char * const resource) +p_contact_remove_resource(PContact contact, const char *const resource) { gboolean result = g_hash_table_remove(contact->available_resources, resource); autocomplete_remove(contact->resource_ac, resource); @@ -173,31 +173,31 @@ p_contact_free(PContact contact) } } -const char * +const char* p_contact_barejid(const PContact contact) { return contact->barejid; } -const char * +const char* p_contact_barejid_collate_key(const PContact contact) { return contact->barejid_collate_key; } -const char * +const char* p_contact_name(const PContact contact) { return contact->name; } -const char * +const char* p_contact_name_collate_key(const PContact contact) { return contact->name_collate_key; } -const char * +const char* p_contact_name_or_jid(const PContact contact) { if (contact->name) { @@ -207,8 +207,8 @@ p_contact_name_or_jid(const PContact contact) } } -char * -p_contact_create_display_string(const PContact contact, const char * const resource) +char* +p_contact_create_display_string(const PContact contact, const char *const resource) { GString *result_str = g_string_new(""); @@ -229,7 +229,7 @@ p_contact_create_display_string(const PContact contact, const char * const resou return result; } -static Resource * +static Resource* _highest_presence(Resource *first, Resource *second) { if (first->presence == RESOURCE_CHAT) { @@ -253,7 +253,7 @@ _highest_presence(Resource *first, Resource *second) } } -Resource * +Resource* _get_most_available_resource(PContact contact) { // find resource with highest priority, if more than one, @@ -287,7 +287,7 @@ _get_most_available_resource(PContact contact) return highest; } -const char * +const char* p_contact_presence(const PContact contact) { assert(contact != NULL); @@ -302,7 +302,7 @@ p_contact_presence(const PContact contact) return string_from_resource_presence(resource->presence); } -const char * +const char* p_contact_status(const PContact contact) { assert(contact != NULL); @@ -317,7 +317,7 @@ p_contact_status(const PContact contact) return resource->status; } -const char * +const char* p_contact_subscription(const PContact contact) { return contact->subscription; @@ -337,8 +337,8 @@ p_contact_subscribed(const PContact contact) } } -Resource * -p_contact_get_resource(const PContact contact, const char * const resource) +Resource* +p_contact_get_resource(const PContact contact, const char *const resource) { return g_hash_table_lookup(contact->available_resources, resource); } @@ -349,13 +349,13 @@ p_contact_pending_out(const PContact contact) return contact->pending_out; } -GDateTime * +GDateTime* p_contact_last_activity(const PContact contact) { return contact->last_activity; } -GList * +GList* p_contact_get_available_resources(const PContact contact) { assert(contact != NULL); @@ -406,7 +406,7 @@ p_contact_set_presence(const PContact contact, Resource *resource) } void -p_contact_set_subscription(const PContact contact, const char * const subscription) +p_contact_set_subscription(const PContact contact, const char *const subscription) { FREE_SET_NULL(contact->subscription); if (subscription) { @@ -443,4 +443,4 @@ void p_contact_resource_ac_reset(const PContact contact) { autocomplete_reset(contact->resource_ac); -} \ No newline at end of file +} diff --git a/src/contact.h b/src/contact.h index 343b230f..2d22db19 100644 --- a/src/contact.h +++ b/src/contact.h @@ -40,11 +40,10 @@ typedef struct p_contact_t *PContact; -PContact p_contact_new(const char * const barejid, const char * const name, - GSList *groups, const char * const subscription, - const char * const offline_message, gboolean pending_out); +PContact p_contact_new(const char *const barejid, const char *const name, GSList *groups, + const char *const subscription, const char *const offline_message, gboolean pending_out); void p_contact_add_resource(PContact contact, Resource *resource); -gboolean p_contact_remove_resource(PContact contact, const char * const resource); +gboolean p_contact_remove_resource(PContact contact, const char *const resource); void p_contact_free(PContact contact); const char* p_contact_barejid(PContact contact); const char* p_contact_barejid_collate_key(PContact contact); @@ -54,23 +53,23 @@ const char* p_contact_name_or_jid(const PContact contact); const char* p_contact_presence(PContact contact); const char* p_contact_status(PContact contact); const char* p_contact_subscription(const PContact contact); -GList * p_contact_get_available_resources(const PContact contact); +GList* p_contact_get_available_resources(const PContact contact); GDateTime* p_contact_last_activity(const PContact contact); gboolean p_contact_pending_out(const PContact contact); void p_contact_set_presence(const PContact contact, Resource *resource); -void p_contact_set_status(const PContact contact, const char * const status); -void p_contact_set_name(const PContact contact, const char * const name); -void p_contact_set_subscription(const PContact contact, const char * const subscription); +void p_contact_set_status(const PContact contact, const char *const status); +void p_contact_set_name(const PContact contact, const char *const name); +void p_contact_set_subscription(const PContact contact, const char *const subscription); void p_contact_set_pending_out(const PContact contact, gboolean pending_out); void p_contact_set_last_activity(const PContact contact, GDateTime *last_activity); gboolean p_contact_is_available(const PContact contact); gboolean p_contact_has_available_resource(const PContact contact); -Resource * p_contact_get_resource(const PContact contact, const char * const resource); +Resource* p_contact_get_resource(const PContact contact, const char *const resource); void p_contact_set_groups(const PContact contact, GSList *groups); -GSList * p_contact_groups(const PContact contact); -gboolean p_contact_in_group(const PContact contact, const char * const group); +GSList* p_contact_groups(const PContact contact); +gboolean p_contact_in_group(const PContact contact, const char *const group); gboolean p_contact_subscribed(const PContact contact); -char * p_contact_create_display_string(const PContact contact, const char * const resource); +char* p_contact_create_display_string(const PContact contact, const char *const resource); Autocomplete p_contact_resource_ac(const PContact contact); void p_contact_resource_ac_reset(const PContact contact); diff --git a/src/event/client_events.c b/src/event/client_events.c index 8f744c7e..ec9516a2 100644 --- a/src/event/client_events.c +++ b/src/event/client_events.c @@ -48,7 +48,7 @@ #endif jabber_conn_status_t -cl_ev_connect_jid(const char * const jid, const char * const passwd, const char * const altdomain, const int port, const char *const tls_policy) +cl_ev_connect_jid(const char *const jid, const char *const passwd, const char *const altdomain, const int port, const char *const tls_policy) { cons_show("Connecting as %s", jid); return jabber_connect_with_details(jid, passwd, altdomain, port, tls_policy); @@ -65,7 +65,7 @@ cl_ev_connect_account(ProfAccount *account) } void -cl_ev_presence_send(const resource_presence_t presence_type, const char * const msg, const int idle_secs) +cl_ev_presence_send(const resource_presence_t presence_type, const char *const msg, const int idle_secs) { char *signed_status = NULL; @@ -84,7 +84,7 @@ cl_ev_presence_send(const resource_presence_t presence_type, const char * const } void -cl_ev_send_msg(ProfChatWin *chatwin, const char * const msg) +cl_ev_send_msg(ProfChatWin *chatwin, const char *const msg) { chat_state_active(chatwin->state); @@ -154,13 +154,13 @@ cl_ev_send_msg(ProfChatWin *chatwin, const char * const msg) } void -cl_ev_send_muc_msg(ProfMucWin *mucwin, const char * const msg) +cl_ev_send_muc_msg(ProfMucWin *mucwin, const char *const msg) { message_send_groupchat(mucwin->roomjid, msg); } void -cl_ev_send_priv_msg(ProfPrivateWin *privwin, const char * const msg) +cl_ev_send_priv_msg(ProfPrivateWin *privwin, const char *const msg) { message_send_private(privwin->fulljid, msg); ui_outgoing_private_msg(privwin, msg); diff --git a/src/event/client_events.h b/src/event/client_events.h index dbd053f3..11d1fb38 100644 --- a/src/event/client_events.h +++ b/src/event/client_events.h @@ -35,13 +35,13 @@ #ifndef CLIENT_EVENTS_H #define CLIENT_EVENTS_H -jabber_conn_status_t cl_ev_connect_jid(const char * const jid, const char * const passwd, const char * const altdomain, const int port, const char *const tls_policy); +jabber_conn_status_t cl_ev_connect_jid(const char *const jid, const char *const passwd, const char *const altdomain, const int port, const char *const tls_policy); jabber_conn_status_t cl_ev_connect_account(ProfAccount *account); -void cl_ev_presence_send(const resource_presence_t presence_type, const char * const msg, const int idle_secs); +void cl_ev_presence_send(const resource_presence_t presence_type, const char *const msg, const int idle_secs); -void cl_ev_send_msg(ProfChatWin *chatwin, const char * const msg); -void cl_ev_send_muc_msg(ProfMucWin *mucwin, const char * const msg); -void cl_ev_send_priv_msg(ProfPrivateWin *privwin, const char * const msg); +void cl_ev_send_msg(ProfChatWin *chatwin, const char *const msg); +void cl_ev_send_muc_msg(ProfMucWin *mucwin, const char *const msg); +void cl_ev_send_priv_msg(ProfPrivateWin *privwin, const char *const msg); #endif diff --git a/src/event/server_events.c b/src/event/server_events.c index f46f14ad..d58633ce 100644 --- a/src/event/server_events.c +++ b/src/event/server_events.c @@ -123,8 +123,8 @@ sv_ev_failed_login(void) void sv_ev_room_invite(jabber_invite_t invite_type, - const char * const invitor, const char * const room, - const char * const reason, const char * const password) + const char *const invitor, const char *const room, + const char *const reason, const char *const password) { if (!muc_active(room) && !muc_invites_contain(room)) { cons_show_room_invite(invitor, room, reason); @@ -133,8 +133,7 @@ sv_ev_room_invite(jabber_invite_t invite_type, } void -sv_ev_room_broadcast(const char *const room_jid, - const char * const message) +sv_ev_room_broadcast(const char *const room_jid, const char *const message) { if (muc_roster_complete(room_jid)) { ui_room_broadcast(room_jid, message); @@ -144,7 +143,7 @@ sv_ev_room_broadcast(const char *const room_jid, } void -sv_ev_room_subject(const char * const room, const char * const nick, const char * const subject) +sv_ev_room_subject(const char *const room, const char *const nick, const char *const subject) { muc_set_subject(room, subject); if (muc_roster_complete(room)) { @@ -153,15 +152,15 @@ sv_ev_room_subject(const char * const room, const char * const nick, const char } void -sv_ev_room_history(const char * const room_jid, const char * const nick, - GDateTime *timestamp, const char * const message) +sv_ev_room_history(const char *const room_jid, const char *const nick, + GDateTime *timestamp, const char *const message) { ui_room_history(room_jid, nick, timestamp, message); } void -sv_ev_room_message(const char * const room_jid, const char * const nick, - const char * const message) +sv_ev_room_message(const char *const room_jid, const char *const nick, + const char *const message) { ui_room_message(room_jid, nick, message); @@ -173,7 +172,7 @@ sv_ev_room_message(const char * const room_jid, const char * const nick, } void -sv_ev_incoming_private_message(const char * const fulljid, char *message) +sv_ev_incoming_private_message(const char *const fulljid, char *message) { ui_incoming_private_msg(fulljid, message, NULL); } @@ -304,7 +303,7 @@ sv_ev_incoming_message(char *barejid, char *resource, char *message, char *pgp_m } void -sv_ev_delayed_private_message(const char * const fulljid, char *message, GDateTime *timestamp) +sv_ev_delayed_private_message(const char *const fulljid, char *message, GDateTime *timestamp) { ui_incoming_private_msg(fulljid, message, timestamp); } @@ -341,7 +340,7 @@ sv_ev_inactive(char *barejid, char *resource) } void -sv_ev_gone(const char * const barejid, const char * const resource) +sv_ev_gone(const char *const barejid, const char *const resource) { ui_recipient_gone(barejid, resource); if (ui_chat_win_exists(barejid)) { @@ -350,7 +349,7 @@ sv_ev_gone(const char * const barejid, const char * const resource) } void -sv_ev_activity(const char * const barejid, const char * const resource, gboolean send_states) +sv_ev_activity(const char *const barejid, const char *const resource, gboolean send_states) { if (ui_chat_win_exists(barejid)) { chat_session_recipient_active(barejid, resource, send_states); @@ -419,44 +418,44 @@ sv_ev_contact_online(char *barejid, Resource *resource, GDateTime *last_activity } void -sv_ev_leave_room(const char * const room) +sv_ev_leave_room(const char *const room) { muc_leave(room); ui_leave_room(room); } void -sv_ev_room_destroy(const char * const room) +sv_ev_room_destroy(const char *const room) { muc_leave(room); ui_room_destroy(room); } void -sv_ev_room_destroyed(const char * const room, const char * const new_jid, const char * const password, - const char * const reason) +sv_ev_room_destroyed(const char *const room, const char *const new_jid, const char *const password, + const char *const reason) { muc_leave(room); ui_room_destroyed(room, reason, new_jid, password); } void -sv_ev_room_kicked(const char * const room, const char * const actor, const char * const reason) +sv_ev_room_kicked(const char *const room, const char *const actor, const char *const reason) { muc_leave(room); ui_room_kicked(room, actor, reason); } void -sv_ev_room_banned(const char * const room, const char * const actor, const char * const reason) +sv_ev_room_banned(const char *const room, const char *const actor, const char *const reason) { muc_leave(room); ui_room_banned(room, actor, reason); } void -sv_ev_room_occupant_offline(const char * const room, const char * const nick, - const char * const show, const char * const status) +sv_ev_room_occupant_offline(const char *const room, const char *const nick, + const char *const show, const char *const status) { muc_roster_remove(room, nick); @@ -469,8 +468,8 @@ sv_ev_room_occupant_offline(const char * const room, const char * const nick, } void -sv_ev_room_occupent_kicked(const char * const room, const char * const nick, const char * const actor, - const char * const reason) +sv_ev_room_occupent_kicked(const char *const room, const char *const nick, const char *const actor, + const char *const reason) { muc_roster_remove(room, nick); ui_room_member_kicked(room, nick, actor, reason); @@ -478,8 +477,8 @@ sv_ev_room_occupent_kicked(const char * const room, const char * const nick, con } void -sv_ev_room_occupent_banned(const char * const room, const char * const nick, const char * const actor, - const char * const reason) +sv_ev_room_occupent_banned(const char *const room, const char *const nick, const char *const actor, + const char *const reason) { muc_roster_remove(room, nick); ui_room_member_banned(room, nick, actor, reason); @@ -487,23 +486,23 @@ sv_ev_room_occupent_banned(const char * const room, const char * const nick, con } void -sv_ev_roster_update(const char * const barejid, const char * const name, - GSList *groups, const char * const subscription, gboolean pending_out) +sv_ev_roster_update(const char *const barejid, const char *const name, + GSList *groups, const char *const subscription, gboolean pending_out) { roster_update(barejid, name, groups, subscription, pending_out); rosterwin_roster(); } void -sv_ev_xmpp_stanza(const char * const msg) +sv_ev_xmpp_stanza(const char *const msg) { ui_handle_stanza(msg); } void -sv_ev_muc_self_online(const char * const room, const char * const nick, gboolean config_required, - const char * const role, const char * const affiliation, const char * const actor, const char * const reason, - const char * const jid, const char * const show, const char * const status) +sv_ev_muc_self_online(const char *const room, const char *const nick, gboolean config_required, + const char *const role, const char *const affiliation, const char *const actor, const char *const reason, + const char *const jid, const char *const show, const char *const status) { muc_roster_add(room, nick, jid, role, affiliation, show, status); char *old_role = muc_role_str(room); @@ -578,9 +577,9 @@ sv_ev_muc_self_online(const char * const room, const char * const nick, gboolean } void -sv_ev_muc_occupant_online(const char * const room, const char * const nick, const char * const jid, - const char * const role, const char * const affiliation, const char * const actor, const char * const reason, - const char * const show, const char * const status) +sv_ev_muc_occupant_online(const char *const room, const char *const nick, const char *const jid, + const char *const role, const char *const affiliation, const char *const actor, const char *const reason, + const char *const show, const char *const status) { Occupant *occupant = muc_roster_item(room, nick); @@ -648,8 +647,8 @@ sv_ev_muc_occupant_online(const char * const room, const char * const nick, cons } int -sv_ev_certfail(const char * const errormsg, const char * const certname, const char * const certfp, - const char * const notbefore, const char * const notafter) +sv_ev_certfail(const char *const errormsg, const char *const certname, const char *const certfp, + const char *const notbefore, const char *const notafter) { if (tlscerts_exists(certfp)) { return 1; @@ -739,7 +738,7 @@ sv_ev_certfail(const char * const errormsg, const char * const certname, const c } void -sv_ev_lastactivity_response(const char * const from, const int seconds, const char * const msg) +sv_ev_lastactivity_response(const char *const from, const int seconds, const char *const msg) { Jid *jidp = jid_create(from); diff --git a/src/event/server_events.h b/src/event/server_events.h index 9ec08e6b..73c2ec03 100644 --- a/src/event/server_events.h +++ b/src/event/server_events.h @@ -41,53 +41,52 @@ void sv_ev_login_account_success(char *account_name, int secured); void sv_ev_lost_connection(void); void sv_ev_failed_login(void); void sv_ev_room_invite(jabber_invite_t invite_type, - const char * const invitor, const char * const room, - const char * const reason, const char * const password); -void sv_ev_room_broadcast(const char *const room_jid, - const char * const message); -void sv_ev_room_subject(const char * const room, const char * const nick, const char * const subject); -void sv_ev_room_history(const char * const room_jid, const char * const nick, - GDateTime *timestamp, const char * const message); -void sv_ev_room_message(const char * const room_jid, const char * const nick, - const char * const message); + const char *const invitor, const char *const room, + const char *const reason, const char *const password); +void sv_ev_room_broadcast(const char *const room_jid, const char *const message); +void sv_ev_room_subject(const char *const room, const char *const nick, const char *const subject); +void sv_ev_room_history(const char *const room_jid, const char *const nick, + GDateTime *timestamp, const char *const message); +void sv_ev_room_message(const char *const room_jid, const char *const nick, + const char *const message); void sv_ev_incoming_message(char *barejid, char *resource, char *message, char *pgp_message, GDateTime *timestamp); -void sv_ev_incoming_private_message(const char * const fulljid, char *message); -void sv_ev_delayed_private_message(const char * const fulljid, char *message, GDateTime *timestamp); +void sv_ev_incoming_private_message(const char *const fulljid, char *message); +void sv_ev_delayed_private_message(const char *const fulljid, char *message, GDateTime *timestamp); void sv_ev_typing(char *barejid, char *resource); void sv_ev_paused(char *barejid, char *resource); void sv_ev_inactive(char *barejid, char *resource); void sv_ev_activity(char *barejid, char *resource, gboolean send_states); -void sv_ev_gone(const char * const barejid, const char * const resource); +void sv_ev_gone(const char *const barejid, const char *const resource); void sv_ev_subscription(const char *from, jabber_subscr_t type); void sv_ev_message_receipt(char *barejid, char *id); void sv_ev_contact_offline(char *contact, char *resource, char *status); void sv_ev_contact_online(char *contact, Resource *resource, GDateTime *last_activity, char *pgpkey); -void sv_ev_leave_room(const char * const room); -void sv_ev_room_destroy(const char * const room); -void sv_ev_room_occupant_offline(const char * const room, const char * const nick, - const char * const show, const char * const status); -void sv_ev_room_destroyed(const char * const room, const char * const new_jid, const char * const password, - const char * const reason); -void sv_ev_room_kicked(const char * const room, const char * const actor, const char * const reason); -void sv_ev_room_occupent_kicked(const char * const room, const char * const nick, const char * const actor, - const char * const reason); -void sv_ev_room_banned(const char * const room, const char * const actor, const char * const reason); -void sv_ev_room_occupent_banned(const char * const room, const char * const nick, const char * const actor, - const char * const reason); +void sv_ev_leave_room(const char *const room); +void sv_ev_room_destroy(const char *const room); +void sv_ev_room_occupant_offline(const char *const room, const char *const nick, + const char *const show, const char *const status); +void sv_ev_room_destroyed(const char *const room, const char *const new_jid, const char *const password, + const char *const reason); +void sv_ev_room_kicked(const char *const room, const char *const actor, const char *const reason); +void sv_ev_room_occupent_kicked(const char *const room, const char *const nick, const char *const actor, + const char *const reason); +void sv_ev_room_banned(const char *const room, const char *const actor, const char *const reason); +void sv_ev_room_occupent_banned(const char *const room, const char *const nick, const char *const actor, + const char *const reason); void sv_ev_outgoing_carbon(char *barejid, char *message); void sv_ev_incoming_carbon(char *barejid, char *resource, char *message); -void sv_ev_xmpp_stanza(const char * const msg); -void sv_ev_muc_self_online(const char * const room, const char * const nick, gboolean config_required, - const char * const role, const char * const affiliation, const char * const actor, const char * const reason, - const char * const jid, const char * const show, const char * const status); -void sv_ev_muc_occupant_online(const char * const room, const char * const nick, const char * const jid, - const char * const role, const char * const affiliation, const char * const actor, const char * const reason, - const char * const show_str, const char * const status_str); -void sv_ev_roster_update(const char * const barejid, const char * const name, - GSList *groups, const char * const subscription, gboolean pending_out); +void sv_ev_xmpp_stanza(const char *const msg); +void sv_ev_muc_self_online(const char *const room, const char *const nick, gboolean config_required, + const char *const role, const char *const affiliation, const char *const actor, const char *const reason, + const char *const jid, const char *const show, const char *const status); +void sv_ev_muc_occupant_online(const char *const room, const char *const nick, const char *const jid, + const char *const role, const char *const affiliation, const char *const actor, const char *const reason, + const char *const show_str, const char *const status_str); +void sv_ev_roster_update(const char *const barejid, const char *const name, + GSList *groups, const char *const subscription, gboolean pending_out); void sv_ev_roster_received(void); -int sv_ev_certfail(const char * const errormsg, const char * const certname, const char * const certfp, - const char * const notbefore, const char * const notafter); -void sv_ev_lastactivity_response(const char * const from, const int seconds, const char * const msg); +int sv_ev_certfail(const char *const errormsg, const char *const certname, const char *const certfp, + const char *const notbefore, const char *const notafter); +void sv_ev_lastactivity_response(const char *const from, const int seconds, const char *const msg); #endif diff --git a/src/event/ui_events.c b/src/event/ui_events.c index 11296739..a9e71bbd 100644 --- a/src/event/ui_events.c +++ b/src/event/ui_events.c @@ -44,13 +44,13 @@ ui_ev_focus_win(ProfWin *win) } ProfChatWin* -ui_ev_new_chat_win(const char * const barejid) +ui_ev_new_chat_win(const char *const barejid) { return ui_new_chat_win(barejid); } ProfPrivateWin* -ui_ev_new_private_win(const char * const fulljid) +ui_ev_new_private_win(const char *const fulljid) { return ui_new_private_win(fulljid); } diff --git a/src/event/ui_events.h b/src/event/ui_events.h index 3f7fed02..279d1e2a 100644 --- a/src/event/ui_events.h +++ b/src/event/ui_events.h @@ -36,7 +36,7 @@ #define UI_EVENTS_H void ui_ev_focus_win(ProfWin *win); -ProfChatWin* ui_ev_new_chat_win(const char * const barejid); -ProfPrivateWin* ui_ev_new_private_win(const char * const fulljid); +ProfChatWin* ui_ev_new_chat_win(const char *const barejid); +ProfPrivateWin* ui_ev_new_private_win(const char *const fulljid); -#endif \ No newline at end of file +#endif diff --git a/src/jid.c b/src/jid.c index 8b40d16a..ae9bcc90 100644 --- a/src/jid.c +++ b/src/jid.c @@ -41,8 +41,8 @@ #include "common.h" -Jid * -jid_create(const gchar * const str) +Jid* +jid_create(const gchar *const str) { Jid *result = NULL; @@ -106,8 +106,8 @@ jid_create(const gchar * const str) return result; } -Jid * -jid_create_from_bare_and_resource(const char * const room, const char * const nick) +Jid* +jid_create_from_bare_and_resource(const char *const room, const char *const nick) { Jid *result; char *jid = create_fulljid(room, nick); @@ -142,8 +142,8 @@ jid_is_valid_room_form(Jid *jid) * barejid/resourcepart * Will return a newly created string that must be freed by the caller */ -char * -create_fulljid(const char * const barejid, const char * const resource) +char* +create_fulljid(const char *const barejid, const char *const resource) { gchar *barejidlower = g_utf8_strdown(barejid, -1); GString *full_jid = g_string_new(barejidlower); @@ -163,8 +163,8 @@ create_fulljid(const char * const barejid, const char * const resource) * Full JID = "test@conference.server/person" * returns "person" */ -char * -get_nick_from_full_jid(const char * const full_room_jid) +char* +get_nick_from_full_jid(const char *const full_room_jid) { char **tokens = g_strsplit(full_room_jid, "/", 0); char *nick_part = NULL; @@ -184,7 +184,7 @@ get_nick_from_full_jid(const char * const full_room_jid) /* * get the fulljid, fall back to the barejid */ -char * +char* jid_fulljid_or_barejid(Jid *jid) { if (jid->fulljid) { diff --git a/src/jid.h b/src/jid.h index 6d530c5a..23095df2 100644 --- a/src/jid.h +++ b/src/jid.h @@ -48,14 +48,14 @@ struct jid_t { typedef struct jid_t Jid; -Jid * jid_create(const gchar * const str); -Jid * jid_create_from_bare_and_resource(const char * const room, const char * const nick); +Jid* jid_create(const gchar *const str); +Jid* jid_create_from_bare_and_resource(const char *const room, const char *const nick); void jid_destroy(Jid *jid); gboolean jid_is_valid_room_form(Jid *jid); -char * create_fulljid(const char * const barejid, const char * const resource); -char * get_nick_from_full_jid(const char * const full_room_jid); +char* create_fulljid(const char *const barejid, const char *const resource); +char* get_nick_from_full_jid(const char *const full_room_jid); -char * jid_fulljid_or_barejid(Jid *jid); +char* jid_fulljid_or_barejid(Jid *jid); #endif diff --git a/src/log.c b/src/log.c index 5537c612..a5bd30fa 100644 --- a/src/log.c +++ b/src/log.c @@ -78,23 +78,22 @@ struct dated_chat_log { }; static gboolean _log_roll_needed(struct dated_chat_log *dated_log); -static struct dated_chat_log * _create_log(const char * const other, const char * const login); -static struct dated_chat_log * _create_groupchat_log(char *room, const char * const login); +static struct dated_chat_log* _create_log(const char *const other, const char *const login); +static struct dated_chat_log* _create_groupchat_log(char *room, const char *const login); static void _free_chat_log(struct dated_chat_log *dated_log); static gboolean _key_equals(void *key1, void *key2); -static char * _get_log_filename(const char * const other, const char * const login, - GDateTime *dt, gboolean create); -static char * _get_groupchat_log_filename(const char * const room, - const char * const login, GDateTime *dt, gboolean create); -static gchar * _get_chatlog_dir(void); -static gchar * _get_main_log_file(void); +static char* _get_log_filename(const char *const other, const char *const login, GDateTime *dt, gboolean create); +static char* _get_groupchat_log_filename(const char *const room, const char *const login, GDateTime *dt, + gboolean create); +static gchar* _get_chatlog_dir(void); +static gchar* _get_main_log_file(void); static void _rotate_log_file(void); static char* _log_string_from_level(log_level_t level); -static void _chat_log_chat(const char * const login, const char * const other, - const gchar * const msg, chat_log_direction_t direction, GDateTime *timestamp); +static void _chat_log_chat(const char *const login, const char *const other, const gchar *const msg, + chat_log_direction_t direction, GDateTime *timestamp); void -log_debug(const char * const msg, ...) +log_debug(const char *const msg, ...) { va_list arg; va_start(arg, msg); @@ -106,7 +105,7 @@ log_debug(const char * const msg, ...) } void -log_info(const char * const msg, ...) +log_info(const char *const msg, ...) { va_list arg; va_start(arg, msg); @@ -118,7 +117,7 @@ log_info(const char * const msg, ...) } void -log_warning(const char * const msg, ...) +log_warning(const char *const msg, ...) { va_list arg; va_start(arg, msg); @@ -130,7 +129,7 @@ log_warning(const char * const msg, ...) } void -log_error(const char * const msg, ...) +log_error(const char *const msg, ...) { va_list arg; va_start(arg, msg); @@ -160,7 +159,7 @@ log_reinit(void) log_init(level_filter); } -char * +char* get_log_file_location(void) { return mainlogfile->str; @@ -183,7 +182,7 @@ log_close(void) } void -log_msg(log_level_t level, const char * const area, const char * const msg) +log_msg(log_level_t level, const char *const area, const char *const msg) { if (level >= level_filter && logp) { dt = g_date_time_new_now(tz); @@ -263,7 +262,7 @@ groupchat_log_init(void) } void -chat_log_msg_out(const char * const barejid, const char * const msg) +chat_log_msg_out(const char *const barejid, const char *const msg) { if (prefs_get_boolean(PREF_CHLOG)) { const char *jid = jabber_get_fulljid(); @@ -274,7 +273,7 @@ chat_log_msg_out(const char * const barejid, const char * const msg) } void -chat_log_otr_msg_out(const char * const barejid, const char * const msg) +chat_log_otr_msg_out(const char *const barejid, const char *const msg) { if (prefs_get_boolean(PREF_CHLOG)) { const char *jid = jabber_get_fulljid(); @@ -291,7 +290,7 @@ chat_log_otr_msg_out(const char * const barejid, const char * const msg) } void -chat_log_pgp_msg_out(const char * const barejid, const char * const msg) +chat_log_pgp_msg_out(const char *const barejid, const char *const msg) { if (prefs_get_boolean(PREF_CHLOG)) { const char *jid = jabber_get_fulljid(); @@ -308,7 +307,7 @@ chat_log_pgp_msg_out(const char * const barejid, const char * const msg) } void -chat_log_otr_msg_in(const char * const barejid, const char * const msg, gboolean was_decrypted, GDateTime *timestamp) +chat_log_otr_msg_in(const char *const barejid, const char *const msg, gboolean was_decrypted, GDateTime *timestamp) { if (prefs_get_boolean(PREF_CHLOG)) { const char *jid = jabber_get_fulljid(); @@ -325,7 +324,7 @@ chat_log_otr_msg_in(const char * const barejid, const char * const msg, gboolean } void -chat_log_pgp_msg_in(const char * const barejid, const char * const msg, GDateTime *timestamp) +chat_log_pgp_msg_in(const char *const barejid, const char *const msg, GDateTime *timestamp) { if (prefs_get_boolean(PREF_CHLOG)) { const char *jid = jabber_get_fulljid(); @@ -342,7 +341,7 @@ chat_log_pgp_msg_in(const char * const barejid, const char * const msg, GDateTim } void -chat_log_msg_in(const char * const barejid, const char * const msg, GDateTime *timestamp) +chat_log_msg_in(const char *const barejid, const char *const msg, GDateTime *timestamp) { if (prefs_get_boolean(PREF_CHLOG)) { const char *jid = jabber_get_fulljid(); @@ -353,8 +352,8 @@ chat_log_msg_in(const char * const barejid, const char * const msg, GDateTime *t } static void -_chat_log_chat(const char * const login, const char * const other, - const char * const msg, chat_log_direction_t direction, GDateTime *timestamp) +_chat_log_chat(const char *const login, const char *const other, const char *const msg, + chat_log_direction_t direction, GDateTime *timestamp) { struct dated_chat_log *dated_log = g_hash_table_lookup(logs, other); @@ -404,8 +403,7 @@ _chat_log_chat(const char * const login, const char * const other, } void -groupchat_log_chat(const gchar * const login, const gchar * const room, - const gchar * const nick, const gchar * const msg) +groupchat_log_chat(const gchar *const login, const gchar *const room, const gchar *const nick, const gchar *const msg) { gchar *room_copy = strdup(room); struct dated_chat_log *dated_log = g_hash_table_lookup(groupchat_logs, room_copy); @@ -446,8 +444,8 @@ groupchat_log_chat(const gchar * const login, const gchar * const room, } -GSList * -chat_log_get_previous(const gchar * const login, const gchar * const recipient) +GSList* +chat_log_get_previous(const gchar *const login, const gchar *const recipient) { GSList *history = NULL; GDateTime *now = g_date_time_new_now_local(); @@ -502,8 +500,8 @@ chat_log_close(void) g_date_time_unref(session_started); } -static struct dated_chat_log * -_create_log(const char * const other, const char * const login) +static struct dated_chat_log* +_create_log(const char *const other, const char *const login) { GDateTime *now = g_date_time_new_now_local(); char *filename = _get_log_filename(other, login, now, TRUE); @@ -517,8 +515,8 @@ _create_log(const char * const other, const char * const login) return new_log; } -static struct dated_chat_log * -_create_groupchat_log(char *room, const char * const login) +static struct dated_chat_log* +_create_groupchat_log(char *room, const char *const login) { GDateTime *now = g_date_time_new_now_local(); char *filename = _get_groupchat_log_filename(room, login, now, TRUE); @@ -571,9 +569,8 @@ gboolean _key_equals(void *key1, void *key2) return (g_strcmp0(str1, str2) == 0); } -static char * -_get_log_filename(const char * const other, const char * const login, - GDateTime *dt, gboolean create) +static char* +_get_log_filename(const char *const other, const char *const login, GDateTime *dt, gboolean create) { gchar *chatlogs_dir = _get_chatlog_dir(); GString *log_file = g_string_new(chatlogs_dir); @@ -603,9 +600,8 @@ _get_log_filename(const char * const other, const char * const login, return result; } -static char * -_get_groupchat_log_filename(const char * const room, const char * const login, - GDateTime *dt, gboolean create) +static char* +_get_groupchat_log_filename(const char *const room, const char *const login, GDateTime *dt, gboolean create) { gchar *chatlogs_dir = _get_chatlog_dir(); GString *log_file = g_string_new(chatlogs_dir); @@ -640,7 +636,7 @@ _get_groupchat_log_filename(const char * const room, const char * const login, return result; } -static gchar * +static gchar* _get_chatlog_dir(void) { gchar *xdg_data = xdg_get_data_home(); @@ -653,7 +649,7 @@ _get_chatlog_dir(void) return result; } -static gchar * +static gchar* _get_main_log_file(void) { gchar *xdg_data = xdg_get_data_home(); diff --git a/src/log.h b/src/log.h index 87c96df9..c26c2fea 100644 --- a/src/log.h +++ b/src/log.h @@ -54,13 +54,12 @@ void log_init(log_level_t filter); log_level_t log_get_filter(void); void log_close(void); void log_reinit(void); -char * get_log_file_location(void); -void log_debug(const char * const msg, ...); -void log_info(const char * const msg, ...); -void log_warning(const char * const msg, ...); -void log_error(const char * const msg, ...); -void log_msg(log_level_t level, const char * const area, - const char * const msg); +char* get_log_file_location(void); +void log_debug(const char *const msg, ...); +void log_info(const char *const msg, ...); +void log_warning(const char *const msg, ...); +void log_error(const char *const msg, ...); +void log_msg(log_level_t level, const char *const area, const char *const msg); log_level_t log_level_from_string(char *log_level); void log_stderr_init(log_level_t level); @@ -69,19 +68,19 @@ void log_stderr_handler(void); void chat_log_init(void); -void chat_log_msg_out(const char * const barejid, const char * const msg); -void chat_log_otr_msg_out(const char * const barejid, const char * const msg); -void chat_log_pgp_msg_out(const char * const barejid, const char * const msg); +void chat_log_msg_out(const char *const barejid, const char *const msg); +void chat_log_otr_msg_out(const char *const barejid, const char *const msg); +void chat_log_pgp_msg_out(const char *const barejid, const char *const msg); -void chat_log_msg_in(const char * const barejid, const char * const msg, GDateTime *timestamp); -void chat_log_otr_msg_in(const char * const barejid, const char * const msg, gboolean was_decrypted, GDateTime *timestamp); -void chat_log_pgp_msg_in(const char * const barejid, const char * const msg, GDateTime *timestamp); +void chat_log_msg_in(const char *const barejid, const char *const msg, GDateTime *timestamp); +void chat_log_otr_msg_in(const char *const barejid, const char *const msg, gboolean was_decrypted, GDateTime *timestamp); +void chat_log_pgp_msg_in(const char *const barejid, const char *const msg, GDateTime *timestamp); void chat_log_close(void); -GSList * chat_log_get_previous(const gchar * const login, - const gchar * const recipient); +GSList* chat_log_get_previous(const gchar *const login, const gchar *const recipient); void groupchat_log_init(void); -void groupchat_log_chat(const gchar * const login, const gchar * const room, - const gchar * const nick, const gchar * const msg); +void groupchat_log_chat(const gchar *const login, const gchar *const room, const gchar *const nick, + const gchar *const msg); + #endif diff --git a/src/main.c b/src/main.c index 42730049..968ddf8a 100644 --- a/src/main.c +++ b/src/main.c @@ -40,6 +40,7 @@ #endif #include "profanity.h" +#include "common.h" #include "command/command.h" static gboolean version = FALSE; @@ -103,18 +104,7 @@ main(int argc, char **argv) g_print("XMPP library: libstrophe\n"); #endif - gboolean notify_enabled = FALSE; - -#ifdef HAVE_OSXNOTIFY - notify_enabled = TRUE; -#endif -#ifdef HAVE_LIBNOTIFY - notify_enabled = TRUE; -#endif -#ifdef PLATFORM_CYGWIN - notify_enabled = TRUE; -#endif - if (notify_enabled) { + if (is_notify_enabled()) { g_print("Desktop notification support: Enabled\n"); } else { g_print("Desktop notification support: Disabled\n"); diff --git a/src/muc.c b/src/muc.c index 8bc530aa..1ceb7ce0 100644 --- a/src/muc.c +++ b/src/muc.c @@ -72,12 +72,12 @@ Autocomplete invite_ac; static void _free_room(ChatRoom *room); static gint _compare_occupants(Occupant *a, Occupant *b); -static muc_role_t _role_from_string(const char * const role); -static muc_affiliation_t _affiliation_from_string(const char * const affiliation); +static muc_role_t _role_from_string(const char *const role); +static muc_affiliation_t _affiliation_from_string(const char *const affiliation); static char* _role_to_string(muc_role_t role); static char* _affiliation_to_string(muc_affiliation_t affiliation); -static Occupant* _muc_occupant_new(const char *const nick, const char * const jid, - muc_role_t role, muc_affiliation_t affiliation, resource_presence_t presence, const char * const status); +static Occupant* _muc_occupant_new(const char *const nick, const char *const jid, muc_role_t role, + muc_affiliation_t affiliation, resource_presence_t presence, const char *const status); static void _occupant_free(Occupant *occupant); void @@ -99,7 +99,7 @@ muc_close(void) } void -muc_invites_add(const char * const room, const char * const password) +muc_invites_add(const char *const room, const char *const password) { autocomplete_add(invite_ac, room); if (password) { @@ -108,7 +108,7 @@ muc_invites_add(const char * const room, const char * const password) } void -muc_invites_remove(const char * const room) +muc_invites_remove(const char *const room) { autocomplete_remove(invite_ac, room); g_hash_table_remove(invite_passwords, room); @@ -120,20 +120,20 @@ muc_invites_count(void) return autocomplete_length(invite_ac); } -GSList * +GSList* muc_invites(void) { return autocomplete_create_list(invite_ac); } -char * -muc_invite_password(const char * const room) +char* +muc_invite_password(const char *const room) { return g_hash_table_lookup(invite_passwords, room); } gboolean -muc_invites_contain(const char * const room) +muc_invites_contain(const char *const room) { GSList *invites = autocomplete_create_list(invite_ac); GSList *curr = invites; @@ -156,8 +156,8 @@ muc_invites_reset_ac(void) autocomplete_reset(invite_ac); } -char * -muc_invites_find(const char * const search_str) +char* +muc_invites_find(const char *const search_str) { return autocomplete_complete(invite_ac, search_str, TRUE); } @@ -172,8 +172,7 @@ muc_invites_clear(void) } void -muc_join(const char * const room, const char * const nick, - const char * const password, gboolean autojoin) +muc_join(const char *const room, const char *const nick, const char *const password, gboolean autojoin) { ChatRoom *new_room = malloc(sizeof(ChatRoom)); new_room->room = strdup(room); @@ -202,13 +201,13 @@ muc_join(const char * const room, const char * const nick, } void -muc_leave(const char * const room) +muc_leave(const char *const room) { g_hash_table_remove(rooms, room); } gboolean -muc_requires_config(const char * const room) +muc_requires_config(const char *const room) { ChatRoom *chat_room = g_hash_table_lookup(rooms, room); if (chat_room) { @@ -220,7 +219,7 @@ muc_requires_config(const char * const room) } void -muc_set_requires_config(const char * const room, gboolean val) +muc_set_requires_config(const char *const room, gboolean val) { ChatRoom *chat_room = g_hash_table_lookup(rooms, room); if (chat_room) { @@ -229,7 +228,7 @@ muc_set_requires_config(const char * const room, gboolean val) } void -muc_set_features(const char * const room, GSList *features) +muc_set_features(const char *const room, GSList *features) { ChatRoom *chat_room = g_hash_table_lookup(rooms, room); if (chat_room && features) { @@ -245,14 +244,14 @@ muc_set_features(const char * const room, GSList *features) * Returns TRUE if the user is currently in the room */ gboolean -muc_active(const char * const room) +muc_active(const char *const room) { ChatRoom *chat_room = g_hash_table_lookup(rooms, room); return (chat_room != NULL); } gboolean -muc_autojoin(const char * const room) +muc_autojoin(const char *const room) { ChatRoom *chat_room = g_hash_table_lookup(rooms, room); if (chat_room) { @@ -263,7 +262,7 @@ muc_autojoin(const char * const room) } void -muc_set_subject(const char * const room, const char * const subject) +muc_set_subject(const char *const room, const char *const subject) { ChatRoom *chat_room = g_hash_table_lookup(rooms, room); if (chat_room) { @@ -276,8 +275,8 @@ muc_set_subject(const char * const room, const char * const subject) } } -char * -muc_subject(const char * const room) +char* +muc_subject(const char *const room) { ChatRoom *chat_room = g_hash_table_lookup(rooms, room); if (chat_room) { @@ -288,7 +287,7 @@ muc_subject(const char * const room) } void -muc_pending_broadcasts_add(const char * const room, const char * const message) +muc_pending_broadcasts_add(const char *const room, const char *const message) { ChatRoom *chat_room = g_hash_table_lookup(rooms, room); if (chat_room) { @@ -296,8 +295,8 @@ muc_pending_broadcasts_add(const char * const room, const char * const message) } } -GList * -muc_pending_broadcasts(const char * const room) +GList* +muc_pending_broadcasts(const char *const room) { ChatRoom *chat_room = g_hash_table_lookup(rooms, room); if (chat_room) { @@ -307,8 +306,8 @@ muc_pending_broadcasts(const char * const room) } } -char * -muc_old_nick(const char * const room, const char * const new_nick) +char* +muc_old_nick(const char *const room, const char *const new_nick) { ChatRoom *chat_room = g_hash_table_lookup(rooms, room); if (chat_room && chat_room->pending_nick_change) { @@ -323,7 +322,7 @@ muc_old_nick(const char * const room, const char * const new_nick) * and is awaiting the response */ void -muc_nick_change_start(const char * const room, const char * const new_nick) +muc_nick_change_start(const char *const room, const char *const new_nick) { ChatRoom *chat_room = g_hash_table_lookup(rooms, room); if (chat_room) { @@ -337,7 +336,7 @@ muc_nick_change_start(const char * const room, const char * const new_nick) * nick change */ gboolean -muc_nick_change_pending(const char * const room) +muc_nick_change_pending(const char *const room) { ChatRoom *chat_room = g_hash_table_lookup(rooms, room); if (chat_room) { @@ -352,7 +351,7 @@ muc_nick_change_pending(const char * const room) * the service has responded */ void -muc_nick_change_complete(const char * const room, const char * const nick) +muc_nick_change_complete(const char *const room, const char *const nick) { ChatRoom *chat_room = g_hash_table_lookup(rooms, room); if (chat_room) { @@ -370,7 +369,7 @@ muc_nick_change_complete(const char * const room, const char * const nick) * The contents of the list are owned by the chat room and should not be * modified or freed. */ -GList * +GList* muc_rooms(void) { return g_hash_table_get_keys(rooms); @@ -380,8 +379,8 @@ muc_rooms(void) * Return current users nickname for the specified room * The nickname is owned by the chat room and should not be modified or freed */ -char * -muc_nick(const char * const room) +char* +muc_nick(const char *const room) { ChatRoom *chat_room = g_hash_table_lookup(rooms, room); if (chat_room) { @@ -395,8 +394,8 @@ muc_nick(const char * const room) * Return password for the specified room * The password is owned by the chat room and should not be modified or freed */ -char * -muc_password(const char * const room) +char* +muc_password(const char *const room) { ChatRoom *chat_room = g_hash_table_lookup(rooms, room); if (chat_room) { @@ -410,7 +409,7 @@ muc_password(const char * const room) * Returns TRUE if the specified nick exists in the room's roster */ gboolean -muc_roster_contains_nick(const char * const room, const char * const nick) +muc_roster_contains_nick(const char *const room, const char *const nick) { ChatRoom *chat_room = g_hash_table_lookup(rooms, room); if (chat_room) { @@ -425,8 +424,8 @@ muc_roster_contains_nick(const char * const room, const char * const nick) * Add a new chat room member to the room's roster */ gboolean -muc_roster_add(const char * const room, const char * const nick, const char * const jid, - const char * const role, const char * const affiliation, const char * const show, const char * const status) +muc_roster_add(const char *const room, const char *const nick, const char *const jid, const char *const role, + const char *const affiliation, const char *const show, const char *const status) { ChatRoom *chat_room = g_hash_table_lookup(rooms, room); gboolean updated = FALSE; @@ -465,7 +464,7 @@ muc_roster_add(const char * const room, const char * const nick, const char * co * Remove a room member from the room's roster */ void -muc_roster_remove(const char * const room, const char * const nick) +muc_roster_remove(const char *const room, const char *const nick) { ChatRoom *chat_room = g_hash_table_lookup(rooms, room); if (chat_room) { @@ -474,8 +473,8 @@ muc_roster_remove(const char * const room, const char * const nick) } } -Occupant * -muc_roster_item(const char * const room, const char * const nick) +Occupant* +muc_roster_item(const char *const room, const char *const nick) { ChatRoom *chat_room = g_hash_table_lookup(rooms, room); if (chat_room) { @@ -489,8 +488,8 @@ muc_roster_item(const char * const room, const char * const nick) /* * Return a list of PContacts representing the room members in the room's roster */ -GList * -muc_roster(const char * const room) +GList* +muc_roster(const char *const room) { ChatRoom *chat_room = g_hash_table_lookup(rooms, room); if (chat_room) { @@ -515,7 +514,7 @@ muc_roster(const char * const room) * Return a Autocomplete representing the room member's in the roster */ Autocomplete -muc_roster_ac(const char * const room) +muc_roster_ac(const char *const room) { ChatRoom *chat_room = g_hash_table_lookup(rooms, room); if (chat_room) { @@ -526,7 +525,7 @@ muc_roster_ac(const char * const room) } Autocomplete -muc_roster_jid_ac(const char * const room) +muc_roster_jid_ac(const char *const room) { ChatRoom *chat_room = g_hash_table_lookup(rooms, room); if (chat_room) { @@ -540,7 +539,7 @@ muc_roster_jid_ac(const char * const room) * Set to TRUE when the rooms roster has been fully received */ void -muc_roster_set_complete(const char * const room) +muc_roster_set_complete(const char *const room) { ChatRoom *chat_room = g_hash_table_lookup(rooms, room); if (chat_room) { @@ -552,7 +551,7 @@ muc_roster_set_complete(const char * const room) * Returns TRUE id the rooms roster has been fully received */ gboolean -muc_roster_complete(const char * const room) +muc_roster_complete(const char *const room) { ChatRoom *chat_room = g_hash_table_lookup(rooms, room); if (chat_room) { @@ -568,20 +567,20 @@ muc_occupant_available(Occupant *occupant) return (occupant->presence == RESOURCE_ONLINE || occupant->presence == RESOURCE_CHAT); } -const char * +const char* muc_occupant_affiliation_str(Occupant *occupant) { return _affiliation_to_string(occupant->affiliation); } -const char * +const char* muc_occupant_role_str(Occupant *occupant) { return _role_to_string(occupant->role); } -GSList * -muc_occupants_by_role(const char * const room, muc_role_t role) +GSList* +muc_occupants_by_role(const char *const room, muc_role_t role) { ChatRoom *chat_room = g_hash_table_lookup(rooms, room); if (chat_room) { @@ -603,8 +602,8 @@ muc_occupants_by_role(const char * const room, muc_role_t role) } } -GSList * -muc_occupants_by_affiliation(const char * const room, muc_affiliation_t affiliation) +GSList* +muc_occupants_by_affiliation(const char *const room, muc_affiliation_t affiliation) { ChatRoom *chat_room = g_hash_table_lookup(rooms, room); if (chat_room) { @@ -631,8 +630,7 @@ muc_occupants_by_affiliation(const char * const room, muc_affiliation_t affiliat * is in progress */ void -muc_occupant_nick_change_start(const char * const room, - const char * const new_nick, const char * const old_nick) +muc_occupant_nick_change_start(const char *const room, const char *const new_nick, const char *const old_nick) { ChatRoom *chat_room = g_hash_table_lookup(rooms, room); if (chat_room) { @@ -647,9 +645,8 @@ muc_occupant_nick_change_start(const char * const room, * The old nick name will be returned in a new string which must be freed by * the caller */ -char * -muc_roster_nick_change_complete(const char * const room, - const char * const nick) +char* +muc_roster_nick_change_complete(const char *const room, const char *const nick) { ChatRoom *chat_room = g_hash_table_lookup(rooms, room); if (chat_room) { @@ -665,8 +662,8 @@ muc_roster_nick_change_complete(const char * const room, return NULL; } -char * -muc_autocomplete(ProfWin *window, const char * const input) +char* +muc_autocomplete(ProfWin *window, const char *const input) { if (window->type == WIN_MUC) { ProfMucWin *mucwin = (ProfMucWin*)window; @@ -708,7 +705,7 @@ muc_autocomplete(ProfWin *window, const char * const input) } void -muc_jid_autocomplete_reset(const char * const room) +muc_jid_autocomplete_reset(const char *const room) { ChatRoom *chat_room = g_hash_table_lookup(rooms, room); if (chat_room) { @@ -719,7 +716,7 @@ muc_jid_autocomplete_reset(const char * const room) } void -muc_jid_autocomplete_add_all(const char * const room, GSList *jids) +muc_jid_autocomplete_add_all(const char *const room, GSList *jids) { ChatRoom *chat_room = g_hash_table_lookup(rooms, room); if (chat_room) { @@ -741,7 +738,7 @@ muc_jid_autocomplete_add_all(const char * const room, GSList *jids) } void -muc_autocomplete_reset(const char * const room) +muc_autocomplete_reset(const char *const room) { ChatRoom *chat_room = g_hash_table_lookup(rooms, room); if (chat_room) { @@ -756,8 +753,8 @@ muc_autocomplete_reset(const char * const room) } } -char * -muc_role_str(const char * const room) +char* +muc_role_str(const char *const room) { ChatRoom *chat_room = g_hash_table_lookup(rooms, room); if (chat_room) { @@ -768,7 +765,7 @@ muc_role_str(const char * const room) } void -muc_set_role(const char * const room, const char * const role) +muc_set_role(const char *const room, const char *const role) { ChatRoom *chat_room = g_hash_table_lookup(rooms, room); if (chat_room) { @@ -776,8 +773,8 @@ muc_set_role(const char * const room, const char * const role) } } -char * -muc_affiliation_str(const char * const room) +char* +muc_affiliation_str(const char *const room) { ChatRoom *chat_room = g_hash_table_lookup(rooms, room); if (chat_room) { @@ -788,7 +785,7 @@ muc_affiliation_str(const char * const room) } void -muc_set_affiliation(const char * const room, const char * const affiliation) +muc_set_affiliation(const char *const room, const char *const affiliation) { ChatRoom *chat_room = g_hash_table_lookup(rooms, room); if (chat_room) { @@ -797,7 +794,7 @@ muc_set_affiliation(const char * const room, const char * const affiliation) } muc_member_type_t -muc_member_type(const char * const room) +muc_member_type(const char *const room) { ChatRoom *chat_room = g_hash_table_lookup(rooms, room); if (chat_room) { @@ -832,8 +829,8 @@ _free_room(ChatRoom *room) } } -static -gint _compare_occupants(Occupant *a, Occupant *b) +static gint +_compare_occupants(Occupant *a, Occupant *b) { const char * utf8_str_a = a->nick_collate_key; const char * utf8_str_b = b->nick_collate_key; @@ -844,7 +841,7 @@ gint _compare_occupants(Occupant *a, Occupant *b) } static muc_role_t -_role_from_string(const char * const role) +_role_from_string(const char *const role) { if (role) { if (g_strcmp0(role, "visitor") == 0) { @@ -861,7 +858,7 @@ _role_from_string(const char * const role) } } -static char * +static char* _role_to_string(muc_role_t role) { char *result = NULL; @@ -888,7 +885,7 @@ _role_to_string(muc_role_t role) } static muc_affiliation_t -_affiliation_from_string(const char * const affiliation) +_affiliation_from_string(const char *const affiliation) { if (affiliation) { if (g_strcmp0(affiliation, "outcast") == 0) { @@ -907,7 +904,7 @@ _affiliation_from_string(const char * const affiliation) } } -static char * +static char* _affiliation_to_string(muc_affiliation_t affiliation) { char *result = NULL; @@ -937,8 +934,8 @@ _affiliation_to_string(muc_affiliation_t affiliation) } static Occupant* -_muc_occupant_new(const char *const nick, const char * const jid, muc_role_t role, muc_affiliation_t affiliation, resource_presence_t presence, - const char * const status) +_muc_occupant_new(const char *const nick, const char *const jid, muc_role_t role, muc_affiliation_t affiliation, + resource_presence_t presence, const char *const status) { Occupant *occupant = malloc(sizeof(Occupant)); diff --git a/src/muc.h b/src/muc.h index eb636aff..f9fcd0e1 100644 --- a/src/muc.h +++ b/src/muc.h @@ -76,75 +76,74 @@ typedef struct _muc_occupant_t { void muc_init(void); void muc_close(void); -void muc_join(const char * const room, const char * const nick, const char * const password, gboolean autojoin); -void muc_leave(const char * const room); +void muc_join(const char *const room, const char *const nick, const char *const password, gboolean autojoin); +void muc_leave(const char *const room); -gboolean muc_active(const char * const room); -gboolean muc_autojoin(const char * const room); +gboolean muc_active(const char *const room); +gboolean muc_autojoin(const char *const room); GList* muc_rooms(void); -void muc_set_features(const char * const room, GSList *features); +void muc_set_features(const char *const room, GSList *features); -char* muc_nick(const char * const room); -char* muc_password(const char * const room); +char* muc_nick(const char *const room); +char* muc_password(const char *const room); -void muc_nick_change_start(const char * const room, const char * const new_nick); -void muc_nick_change_complete(const char * const room, const char * const nick); -gboolean muc_nick_change_pending(const char * const room); -char* muc_old_nick(const char * const room, const char * const new_nick); +void muc_nick_change_start(const char *const room, const char *const new_nick); +void muc_nick_change_complete(const char *const room, const char *const nick); +gboolean muc_nick_change_pending(const char *const room); +char* muc_old_nick(const char *const room, const char *const new_nick); -gboolean muc_roster_contains_nick(const char * const room, const char * const nick); -gboolean muc_roster_complete(const char * const room); -gboolean muc_roster_add(const char * const room, const char * const nick, const char * const jid, - const char * const role, const char * const affiliation, const char * const show, - const char * const status); -void muc_roster_remove(const char * const room, const char * const nick); -void muc_roster_set_complete(const char * const room); -GList * muc_roster(const char * const room); -Autocomplete muc_roster_ac(const char * const room); -Autocomplete muc_roster_jid_ac(const char * const room); -void muc_jid_autocomplete_reset(const char * const room); -void muc_jid_autocomplete_add_all(const char * const room, GSList *jids); +gboolean muc_roster_contains_nick(const char *const room, const char *const nick); +gboolean muc_roster_complete(const char *const room); +gboolean muc_roster_add(const char *const room, const char *const nick, const char *const jid, const char *const role, + const char *const affiliation, const char *const show, const char *const status); +void muc_roster_remove(const char *const room, const char *const nick); +void muc_roster_set_complete(const char *const room); +GList* muc_roster(const char *const room); +Autocomplete muc_roster_ac(const char *const room); +Autocomplete muc_roster_jid_ac(const char *const room); +void muc_jid_autocomplete_reset(const char *const room); +void muc_jid_autocomplete_add_all(const char *const room, GSList *jids); -Occupant* muc_roster_item(const char * const room, const char * const nick); +Occupant* muc_roster_item(const char *const room, const char *const nick); gboolean muc_occupant_available(Occupant *occupant); -const char * muc_occupant_affiliation_str(Occupant *occupant); -const char * muc_occupant_role_str(Occupant *occupant); -GSList * muc_occupants_by_role(const char * const room, muc_role_t role); -GSList * muc_occupants_by_affiliation(const char * const room, muc_affiliation_t affiliation); +const char* muc_occupant_affiliation_str(Occupant *occupant); +const char* muc_occupant_role_str(Occupant *occupant); +GSList* muc_occupants_by_role(const char *const room, muc_role_t role); +GSList* muc_occupants_by_affiliation(const char *const room, muc_affiliation_t affiliation); -void muc_occupant_nick_change_start(const char * const room, const char * const new_nick, const char * const old_nick); -char* muc_roster_nick_change_complete(const char * const room, const char * const nick); +void muc_occupant_nick_change_start(const char *const room, const char *const new_nick, const char *const old_nick); +char* muc_roster_nick_change_complete(const char *const room, const char *const nick); -void muc_invites_add(const char * const room, const char * const password); -void muc_invites_remove(const char * const room); +void muc_invites_add(const char *const room, const char *const password); +void muc_invites_remove(const char *const room); gint muc_invites_count(void); GSList* muc_invites(void); -gboolean muc_invites_contain(const char * const room); +gboolean muc_invites_contain(const char *const room); void muc_invites_reset_ac(void); -char* muc_invites_find(const char * const search_str); +char* muc_invites_find(const char *const search_str); void muc_invites_clear(void); -char* muc_invite_password(const char * const room); +char* muc_invite_password(const char *const room); -void muc_set_subject(const char * const room, const char * const subject); -char* muc_subject(const char * const room); +void muc_set_subject(const char *const room, const char *const subject); +char* muc_subject(const char *const room); -void muc_pending_broadcasts_add(const char * const room, const char * const message); -GList * muc_pending_broadcasts(const char * const room); +void muc_pending_broadcasts_add(const char *const room, const char *const message); +GList* muc_pending_broadcasts(const char *const room); -char* muc_autocomplete(ProfWin *window, const char * const input); -void muc_autocomplete_reset(const char * const room); +char* muc_autocomplete(ProfWin *window, const char *const input); +void muc_autocomplete_reset(const char *const room); -gboolean muc_requires_config(const char * const room); -void muc_set_requires_config(const char * const room, gboolean val); +gboolean muc_requires_config(const char *const room); +void muc_set_requires_config(const char *const room, gboolean val); -void muc_set_role(const char * const room, const char * const role); -void muc_set_affiliation(const char * const room, const char * const affiliation); -char *muc_role_str(const char * const room); -char *muc_affiliation_str(const char * const room); +void muc_set_role(const char *const room, const char *const role); +void muc_set_affiliation(const char *const room, const char *const affiliation); +char* muc_role_str(const char *const room); +char* muc_affiliation_str(const char *const room); -muc_member_type_t muc_member_type(const char * const room); +muc_member_type_t muc_member_type(const char *const room); #endif diff --git a/src/otr/otr.c b/src/otr/otr.c index 511d6843..9ff4a503 100644 --- a/src/otr/otr.c +++ b/src/otr/otr.c @@ -63,13 +63,13 @@ otr_userstate(void) return user_state; } -OtrlMessageAppOps * +OtrlMessageAppOps* otr_messageops(void) { return &ops; } -GHashTable * +GHashTable* otr_smpinitators(void) { return smp_initiators; @@ -146,13 +146,13 @@ cb_gone_secure(void *opdata, ConnContext *context) ui_gone_secure(context->username, otr_is_trusted(context->username)); } -char * +char* otr_libotr_version(void) { return OTRL_VERSION; } -char * +char* otr_start_query(void) { return otrlib_start_query(); @@ -274,7 +274,7 @@ otr_on_connect(ProfAccount *account) } char* -otr_on_message_recv(const char * const barejid, const char * const resource, const char * const message, gboolean *decrypted) +otr_on_message_recv(const char *const barejid, const char *const resource, const char *const message, gboolean *decrypted) { prof_otrpolicy_t policy = otr_get_policy(barejid); char *whitespace_base = strstr(message, OTRL_MESSAGE_TAG_BASE); @@ -314,7 +314,7 @@ otr_on_message_recv(const char * const barejid, const char * const resource, con } gboolean -otr_on_message_send(ProfChatWin *chatwin, const char * const message) +otr_on_message_send(ProfChatWin *chatwin, const char *const message) { char *id = NULL; prof_otrpolicy_t policy = otr_get_policy(chatwin->barejid); @@ -451,8 +451,8 @@ otr_key_loaded(void) return data_loaded; } -char * -otr_tag_message(const char * const msg) +char* +otr_tag_message(const char *const msg) { GString *otr_message = g_string_new(msg); g_string_append(otr_message, OTRL_MESSAGE_TAG_BASE); @@ -464,7 +464,7 @@ otr_tag_message(const char * const msg) } gboolean -otr_is_secure(const char * const recipient) +otr_is_secure(const char *const recipient) { ConnContext *context = otrlib_context_find(user_state, recipient, jid); @@ -480,7 +480,7 @@ otr_is_secure(const char * const recipient) } gboolean -otr_is_trusted(const char * const recipient) +otr_is_trusted(const char *const recipient) { ConnContext *context = otrlib_context_find(user_state, recipient, jid); @@ -506,7 +506,7 @@ otr_is_trusted(const char * const recipient) } void -otr_trust(const char * const recipient) +otr_trust(const char *const recipient) { ConnContext *context = otrlib_context_find(user_state, recipient, jid); @@ -530,7 +530,7 @@ otr_trust(const char * const recipient) } void -otr_untrust(const char * const recipient) +otr_untrust(const char *const recipient) { ConnContext *context = otrlib_context_find(user_state, recipient, jid); @@ -554,7 +554,7 @@ otr_untrust(const char * const recipient) } void -otr_smp_secret(const char * const recipient, const char *secret) +otr_smp_secret(const char *const recipient, const char *secret) { ConnContext *context = otrlib_context_find(user_state, recipient, jid); @@ -578,7 +578,7 @@ otr_smp_secret(const char * const recipient, const char *secret) } void -otr_smp_question(const char * const recipient, const char *question, const char *answer) +otr_smp_question(const char *const recipient, const char *question, const char *answer) { ConnContext *context = otrlib_context_find(user_state, recipient, jid); @@ -595,7 +595,7 @@ otr_smp_question(const char * const recipient, const char *question, const char } void -otr_smp_answer(const char * const recipient, const char *answer) +otr_smp_answer(const char *const recipient, const char *answer) { ConnContext *context = otrlib_context_find(user_state, recipient, jid); @@ -612,12 +612,12 @@ otr_smp_answer(const char * const recipient, const char *answer) } void -otr_end_session(const char * const recipient) +otr_end_session(const char *const recipient) { otrlib_end_session(user_state, recipient, jid, &ops); } -char * +char* otr_get_my_fingerprint(void) { char fingerprint[45]; @@ -627,8 +627,8 @@ otr_get_my_fingerprint(void) return result; } -char * -otr_get_their_fingerprint(const char * const recipient) +char* +otr_get_their_fingerprint(const char *const recipient) { ConnContext *context = otrlib_context_find(user_state, recipient, jid); @@ -643,7 +643,7 @@ otr_get_their_fingerprint(const char * const recipient) } prof_otrpolicy_t -otr_get_policy(const char * const recipient) +otr_get_policy(const char *const recipient) { char *account_name = jabber_get_account_name(); ProfAccount *account = accounts_get_account(account_name); @@ -695,8 +695,8 @@ otr_get_policy(const char * const recipient) return result; } -char * -otr_encrypt_message(const char * const to, const char * const message) +char* +otr_encrypt_message(const char *const to, const char *const message) { char *newmessage = NULL; gcry_error_t err = otrlib_encrypt_message(user_state, &ops, jid, to, message, &newmessage); @@ -716,8 +716,8 @@ _otr_tlv_free(OtrlTLV *tlvs) } } -char * -otr_decrypt_message(const char * const from, const char * const message, gboolean *decrypted) +char* +otr_decrypt_message(const char *const from, const char *const message, gboolean *decrypted) { char *newmessage = NULL; OtrlTLV *tlvs = NULL; diff --git a/src/otr/otr.h b/src/otr/otr.h index cd11709f..f966239e 100644 --- a/src/otr/otr.h +++ b/src/otr/otr.h @@ -58,35 +58,35 @@ char* otr_start_query(void); void otr_poll(void); void otr_on_connect(ProfAccount *account); -char* otr_on_message_recv(const char * const barejid, const char * const resource, const char * const message, gboolean *decrypted); -gboolean otr_on_message_send(ProfChatWin *chatwin, const char * const message); +char* otr_on_message_recv(const char *const barejid, const char *const resource, const char *const message, gboolean *decrypted); +gboolean otr_on_message_send(ProfChatWin *chatwin, const char *const message); void otr_keygen(ProfAccount *account); -char* otr_tag_message(const char * const msg); +char* otr_tag_message(const char *const msg); gboolean otr_key_loaded(void); -gboolean otr_is_secure(const char * const recipient); +gboolean otr_is_secure(const char *const recipient); -gboolean otr_is_trusted(const char * const recipient); -void otr_trust(const char * const recipient); -void otr_untrust(const char * const recipient); +gboolean otr_is_trusted(const char *const recipient); +void otr_trust(const char *const recipient); +void otr_untrust(const char *const recipient); -void otr_smp_secret(const char * const recipient, const char *secret); -void otr_smp_question(const char * const recipient, const char *question, const char *answer); -void otr_smp_answer(const char * const recipient, const char *answer); +void otr_smp_secret(const char *const recipient, const char *secret); +void otr_smp_question(const char *const recipient, const char *question, const char *answer); +void otr_smp_answer(const char *const recipient, const char *answer); -void otr_end_session(const char * const recipient); +void otr_end_session(const char *const recipient); -char * otr_get_my_fingerprint(void); -char * otr_get_their_fingerprint(const char * const recipient); +char* otr_get_my_fingerprint(void); +char* otr_get_their_fingerprint(const char *const recipient); -char * otr_encrypt_message(const char * const to, const char * const message); -char * otr_decrypt_message(const char * const from, const char * const message, +char* otr_encrypt_message(const char *const to, const char *const message); +char* otr_decrypt_message(const char *const from, const char *const message, gboolean *decrypted); void otr_free_message(char *message); -prof_otrpolicy_t otr_get_policy(const char * const recipient); +prof_otrpolicy_t otr_get_policy(const char *const recipient); #endif diff --git a/src/otr/otrlib.h b/src/otr/otrlib.h index 0310c9e6..f4b9b804 100644 --- a/src/otr/otrlib.h +++ b/src/otr/otrlib.h @@ -44,15 +44,15 @@ void otrlib_init_ops(OtrlMessageAppOps *ops); void otrlib_init_timer(void); void otrlib_poll(void); -ConnContext * otrlib_context_find(OtrlUserState user_state, const char * const recipient, char *jid); +ConnContext* otrlib_context_find(OtrlUserState user_state, const char *const recipient, char *jid); -void otrlib_end_session(OtrlUserState user_state, const char * const recipient, char *jid, OtrlMessageAppOps *ops); +void otrlib_end_session(OtrlUserState user_state, const char *const recipient, char *jid, OtrlMessageAppOps *ops); -gcry_error_t otrlib_encrypt_message(OtrlUserState user_state, OtrlMessageAppOps *ops, char *jid, const char * const to, - const char * const message, char **newmessage); +gcry_error_t otrlib_encrypt_message(OtrlUserState user_state, OtrlMessageAppOps *ops, char *jid, const char *const to, + const char *const message, char **newmessage); -int otrlib_decrypt_message(OtrlUserState user_state, OtrlMessageAppOps *ops, char *jid, const char * const from, - const char * const message, char **decrypted, OtrlTLV **tlvs); +int otrlib_decrypt_message(OtrlUserState user_state, OtrlMessageAppOps *ops, char *jid, const char *const from, + const char *const message, char **decrypted, OtrlTLV **tlvs); void otrlib_handle_tlvs(OtrlUserState user_state, OtrlMessageAppOps *ops, ConnContext *context, OtrlTLV *tlvs, GHashTable *smp_initiators); diff --git a/src/otr/otrlibv3.c b/src/otr/otrlibv3.c index 0b81796c..9bab4eed 100644 --- a/src/otr/otrlibv3.c +++ b/src/otr/otrlibv3.c @@ -55,7 +55,7 @@ otrlib_poll(void) { } -char * +char* otrlib_start_query(void) { return "?OTR?v2? This user has requested an Off-the-Record private conversation. However, you do not have a plugin to support that. See http://otr.cypherpunks.ca/ for more information."; @@ -75,14 +75,14 @@ otrlib_init_ops(OtrlMessageAppOps *ops) ops->display_otr_message = cb_display_otr_message; } -ConnContext * -otrlib_context_find(OtrlUserState user_state, const char * const recipient, char *jid) +ConnContext* +otrlib_context_find(OtrlUserState user_state, const char *const recipient, char *jid) { return otrl_context_find(user_state, recipient, jid, "xmpp", 0, NULL, NULL, NULL); } void -otrlib_end_session(OtrlUserState user_state, const char * const recipient, char *jid, OtrlMessageAppOps *ops) +otrlib_end_session(OtrlUserState user_state, const char *const recipient, char *jid, OtrlMessageAppOps *ops) { ConnContext *context = otrl_context_find(user_state, recipient, jid, "xmpp", 0, NULL, NULL, NULL); @@ -93,8 +93,8 @@ otrlib_end_session(OtrlUserState user_state, const char * const recipient, char } gcry_error_t -otrlib_encrypt_message(OtrlUserState user_state, OtrlMessageAppOps *ops, char *jid, const char * const to, - const char * const message, char **newmessage) +otrlib_encrypt_message(OtrlUserState user_state, OtrlMessageAppOps *ops, char *jid, const char *const to, + const char *const message, char **newmessage) { gcry_error_t err; err = otrl_message_sending( @@ -114,8 +114,8 @@ otrlib_encrypt_message(OtrlUserState user_state, OtrlMessageAppOps *ops, char *j } int -otrlib_decrypt_message(OtrlUserState user_state, OtrlMessageAppOps *ops, char *jid, const char * const from, - const char * const message, char **decrypted, OtrlTLV **tlvs) +otrlib_decrypt_message(OtrlUserState user_state, OtrlMessageAppOps *ops, char *jid, const char *const from, + const char *const message, char **decrypted, OtrlTLV **tlvs) { return otrl_message_receiving( user_state, diff --git a/src/otr/otrlibv4.c b/src/otr/otrlibv4.c index fc1f5285..8ed17fcf 100644 --- a/src/otr/otrlibv4.c +++ b/src/otr/otrlibv4.c @@ -71,15 +71,14 @@ otrlib_poll(void) } } -char * +char* otrlib_start_query(void) { return "?OTR?v2? This user has requested an Off-the-Record private conversation. However, you do not have a plugin to support that. See http://otr.cypherpunks.ca/ for more information."; } static const char* -cb_otr_error_message(void *opdata, ConnContext *context, - OtrlErrorCode err_code) +cb_otr_error_message(void *opdata, ConnContext *context, OtrlErrorCode err_code) { switch(err_code) { @@ -241,14 +240,14 @@ otrlib_init_ops(OtrlMessageAppOps *ops) ops->timer_control = cb_timer_control; } -ConnContext * -otrlib_context_find(OtrlUserState user_state, const char * const recipient, char *jid) +ConnContext* +otrlib_context_find(OtrlUserState user_state, const char *const recipient, char *jid) { return otrl_context_find(user_state, recipient, jid, "xmpp", OTRL_INSTAG_MASTER, 0, NULL, NULL, NULL); } void -otrlib_end_session(OtrlUserState user_state, const char * const recipient, char *jid, OtrlMessageAppOps *ops) +otrlib_end_session(OtrlUserState user_state, const char *const recipient, char *jid, OtrlMessageAppOps *ops) { ConnContext *context = otrl_context_find(user_state, recipient, jid, "xmpp", OTRL_INSTAG_MASTER, 0, NULL, NULL, NULL); @@ -259,8 +258,8 @@ otrlib_end_session(OtrlUserState user_state, const char * const recipient, char } gcry_error_t -otrlib_encrypt_message(OtrlUserState user_state, OtrlMessageAppOps *ops, char *jid, const char * const to, - const char * const message, char **newmessage) +otrlib_encrypt_message(OtrlUserState user_state, OtrlMessageAppOps *ops, char *jid, const char *const to, + const char *const message, char **newmessage) { gcry_error_t err; @@ -284,8 +283,8 @@ otrlib_encrypt_message(OtrlUserState user_state, OtrlMessageAppOps *ops, char *j } int -otrlib_decrypt_message(OtrlUserState user_state, OtrlMessageAppOps *ops, char *jid, const char * const from, - const char * const message, char **decrypted, OtrlTLV **tlvs) +otrlib_decrypt_message(OtrlUserState user_state, OtrlMessageAppOps *ops, char *jid, const char *const from, + const char *const message, char **decrypted, OtrlTLV **tlvs) { return otrl_message_receiving( user_state, diff --git a/src/pgp/gpg.c b/src/pgp/gpg.c index bb20261e..7828c934 100644 --- a/src/pgp/gpg.c +++ b/src/pgp/gpg.c @@ -66,8 +66,8 @@ static char *passphrase_attempt; static Autocomplete key_ac; -static char* _remove_header_footer(char *str, const char * const footer); -static char* _add_header_footer(const char * const str, const char * const header, const char * const footer); +static char* _remove_header_footer(char *str, const char *const footer); +static char* _add_header_footer(const char *const str, const char *const header, const char *const footer); static void _save_pubkeys(void); void @@ -79,7 +79,7 @@ _p_gpg_free_pubkeyid(ProfPGPPubKeyId *pubkeyid) free(pubkeyid); } -static gpgme_error_t * +static gpgme_error_t* _p_gpg_passphrase_cb(void *hook, const char *uid_hint, const char *passphrase_info, int prev_was_bad, int fd) { if (passphrase) { @@ -154,7 +154,7 @@ p_gpg_close(void) } void -p_gpg_on_connect(const char * const barejid) +p_gpg_on_connect(const char *const barejid) { gchar *data_home = xdg_get_data_home(); GString *pubsfile = g_string_new(data_home); @@ -262,7 +262,7 @@ p_gpg_on_disconnect(void) } gboolean -p_gpg_addkey(const char * const jid, const char * const keyid) +p_gpg_addkey(const char *const jid, const char *const keyid) { gpgme_ctx_t ctx; gpgme_error_t error = gpgme_new(&ctx); @@ -294,7 +294,7 @@ p_gpg_addkey(const char * const jid, const char * const keyid) return TRUE; } -static ProfPGPKey * +static ProfPGPKey* _p_gpg_key_new(void) { ProfPGPKey *p_pgpkey = malloc(sizeof(ProfPGPKey)); @@ -321,7 +321,7 @@ _p_gpg_free_key(ProfPGPKey *key) } } -GHashTable * +GHashTable* p_gpg_list_keys(void) { gpgme_error_t error; @@ -411,7 +411,7 @@ p_gpg_free_keys(GHashTable *keys) } -GHashTable * +GHashTable* p_gpg_pubkeys(void) { return pubkeys; @@ -424,7 +424,7 @@ p_gpg_libver(void) } gboolean -p_gpg_valid_key(const char * const keyid) +p_gpg_valid_key(const char *const keyid) { gpgme_ctx_t ctx; gpgme_error_t error = gpgme_new(&ctx); @@ -453,14 +453,14 @@ p_gpg_valid_key(const char * const keyid) } gboolean -p_gpg_available(const char * const barejid) +p_gpg_available(const char *const barejid) { char *pubkey = g_hash_table_lookup(pubkeys, barejid); return (pubkey != NULL); } void -p_gpg_verify(const char * const barejid, const char *const sign) +p_gpg_verify(const char *const barejid, const char *const sign) { if (!sign) { return; @@ -515,7 +515,7 @@ p_gpg_verify(const char * const barejid, const char *const sign) } char* -p_gpg_sign(const char * const str, const char * const fp) +p_gpg_sign(const char *const str, const char *const fp) { gpgme_ctx_t ctx; gpgme_error_t error = gpgme_new(&ctx); @@ -588,8 +588,8 @@ p_gpg_sign(const char * const str, const char * const fp) return result; } -char * -p_gpg_encrypt(const char * const barejid, const char * const message) +char* +p_gpg_encrypt(const char *const barejid, const char *const message) { ProfPGPPubKeyId *pubkeyid = g_hash_table_lookup(pubkeys, barejid); if (!pubkeyid) { @@ -654,8 +654,8 @@ p_gpg_encrypt(const char * const barejid, const char * const message) return result; } -char * -p_gpg_decrypt(const char * const cipher) +char* +p_gpg_decrypt(const char *const cipher) { gpgme_ctx_t ctx; gpgme_error_t error = gpgme_new(&ctx); @@ -725,8 +725,8 @@ p_gpg_free_decrypted(char *decrypted) g_free(decrypted); } -char * -p_gpg_autocomplete_key(const char * const search_str) +char* +p_gpg_autocomplete_key(const char *const search_str) { return autocomplete_complete(key_ac, search_str, TRUE); } @@ -737,7 +737,7 @@ p_gpg_autocomplete_key_reset(void) autocomplete_reset(key_ac); } -char * +char* p_gpg_format_fp_str(char *fp) { if (!fp) { @@ -761,7 +761,7 @@ p_gpg_format_fp_str(char *fp) } static char* -_remove_header_footer(char *str, const char * const footer) +_remove_header_footer(char *str, const char *const footer) { int pos = 0; int newlines = 0; @@ -785,7 +785,7 @@ _remove_header_footer(char *str, const char * const footer) } static char* -_add_header_footer(const char * const str, const char * const header, const char * const footer) +_add_header_footer(const char *const str, const char *const header, const char *const footer) { GString *result_str = g_string_new(""); diff --git a/src/pgp/gpg.h b/src/pgp/gpg.h index 3c84efaa..f699e889 100644 --- a/src/pgp/gpg.h +++ b/src/pgp/gpg.h @@ -53,23 +53,22 @@ typedef struct pgp_pubkeyid_t { void p_gpg_init(void); void p_gpg_close(void); -void p_gpg_on_connect(const char * const barejid); +void p_gpg_on_connect(const char *const barejid); void p_gpg_on_disconnect(void); GHashTable* p_gpg_list_keys(void); void p_gpg_free_keys(GHashTable *keys); -gboolean p_gpg_addkey(const char * const jid, const char * const keyid); +gboolean p_gpg_addkey(const char *const jid, const char *const keyid); GHashTable* p_gpg_pubkeys(void); -gboolean p_gpg_valid_key(const char * const keyid); -gboolean p_gpg_available(const char * const barejid); +gboolean p_gpg_valid_key(const char *const keyid); +gboolean p_gpg_available(const char *const barejid); const char* p_gpg_libver(void); -char* p_gpg_sign(const char * const str, const char * const fp); -void p_gpg_verify(const char * const barejid, const char *const sign); -char* p_gpg_encrypt(const char * const barejid, const char * const message); -char* p_gpg_decrypt(const char * const cipher); +char* p_gpg_sign(const char *const str, const char *const fp); +void p_gpg_verify(const char *const barejid, const char *const sign); +char* p_gpg_encrypt(const char *const barejid, const char *const message); +char* p_gpg_decrypt(const char *const cipher); void p_gpg_free_decrypted(char *decrypted); -char* p_gpg_autocomplete_key(const char * const search_str); +char* p_gpg_autocomplete_key(const char *const search_str); void p_gpg_autocomplete_key_reset(void); char* p_gpg_format_fp_str(char *fp); - #endif diff --git a/src/profanity.c b/src/profanity.c index 8233178b..d316ba2f 100644 --- a/src/profanity.c +++ b/src/profanity.c @@ -162,7 +162,7 @@ prof_handle_activity(void) } static void -_connect_default(const char * const account) +_connect_default(const char *const account) { ProfWin *window = wins_get_current(); if (account) { @@ -177,7 +177,7 @@ _connect_default(const char * const account) } static void -_check_autoaway() +_check_autoaway(void) { jabber_conn_status_t conn_status = jabber_get_connection_status(); if (conn_status != JABBER_CONNECTED) { diff --git a/src/resource.c b/src/resource.c index 1598c7b2..ec122e0a 100644 --- a/src/resource.c +++ b/src/resource.c @@ -39,8 +39,8 @@ #include #include -Resource * resource_new(const char * const name, resource_presence_t presence, - const char * const status, const int priority) +Resource* +resource_new(const char *const name, resource_presence_t presence, const char *const status, const int priority) { assert(name != NULL); Resource *new_resource = malloc(sizeof(struct resource_t)); @@ -86,7 +86,8 @@ resource_compare_availability(Resource *first, Resource *second) } } -void resource_destroy(Resource *resource) +void +resource_destroy(Resource *resource) { if (resource) { free(resource->name); diff --git a/src/resource.h b/src/resource.h index 43bb6d18..ce400740 100644 --- a/src/resource.h +++ b/src/resource.h @@ -44,10 +44,9 @@ typedef struct resource_t { int priority; } Resource; -Resource * resource_new(const char * const name, resource_presence_t presence, - const char * const status, const int priority); +Resource* resource_new(const char *const name, resource_presence_t presence, const char *const status, + const int priority); void resource_destroy(Resource *resource); - int resource_compare_availability(Resource *first, Resource *second); #endif diff --git a/src/roster_list.c b/src/roster_list.c index 2d9df860..26776c68 100644 --- a/src/roster_list.c +++ b/src/roster_list.c @@ -64,10 +64,8 @@ static GHashTable *name_to_barejid; static gboolean _key_equals(void *key1, void *key2); static gboolean _datetimes_equal(GDateTime *dt1, GDateTime *dt2); -static void _replace_name(const char * const current_name, - const char * const new_name, const char * const barejid); -static void _add_name_and_barejid(const char * const name, - const char * const barejid); +static void _replace_name(const char *const current_name, const char *const new_name, const char *const barejid); +static void _add_name_and_barejid(const char *const name, const char *const barejid); static gint _compare_contacts(PContact a, PContact b); void @@ -86,8 +84,7 @@ roster_clear(void) } gboolean -roster_update_presence(const char * const barejid, Resource *resource, - GDateTime *last_activity) +roster_update_presence(const char *const barejid, Resource *resource, GDateTime *last_activity) { assert(barejid != NULL); assert(resource != NULL); @@ -108,7 +105,7 @@ roster_update_presence(const char * const barejid, Resource *resource, } PContact -roster_get_contact(const char * const barejid) +roster_get_contact(const char *const barejid) { gchar *barejidlower = g_utf8_strdown(barejid, -1); PContact contact = g_hash_table_lookup(contacts, barejidlower); @@ -117,8 +114,8 @@ roster_get_contact(const char * const barejid) return contact; } -char * -roster_get_msg_display_name(const char * const barejid, const char * const resource) +char* +roster_get_msg_display_name(const char *const barejid, const char *const resource) { GString *result = g_string_new(""); @@ -145,8 +142,7 @@ roster_get_msg_display_name(const char * const barejid, const char * const resou } gboolean -roster_contact_offline(const char * const barejid, - const char * const resource, const char * const status) +roster_contact_offline(const char *const barejid, const char *const resource, const char *const status) { PContact contact = roster_get_contact(barejid); @@ -199,7 +195,7 @@ roster_free(void) } void -roster_change_name(PContact contact, const char * const new_name) +roster_change_name(PContact contact, const char *const new_name) { assert(contact != NULL); @@ -215,7 +211,7 @@ roster_change_name(PContact contact, const char * const new_name) } void -roster_remove(const char * const name, const char * const barejid) +roster_remove(const char *const name, const char *const barejid) { autocomplete_remove(barejid_ac, barejid); autocomplete_remove(name_ac, name); @@ -241,8 +237,8 @@ roster_remove(const char * const name, const char * const barejid) } void -roster_update(const char * const barejid, const char * const name, - GSList *groups, const char * const subscription, gboolean pending_out) +roster_update(const char *const barejid, const char *const name, GSList *groups, const char *const subscription, + gboolean pending_out) { PContact contact = roster_get_contact(barejid); assert(contact != NULL); @@ -268,8 +264,8 @@ roster_update(const char * const barejid, const char * const name, } gboolean -roster_add(const char * const barejid, const char * const name, GSList *groups, - const char * const subscription, gboolean pending_out) +roster_add(const char *const barejid, const char *const name, GSList *groups, const char *const subscription, + gboolean pending_out) { PContact contact = roster_get_contact(barejid); if (contact) { @@ -292,8 +288,8 @@ roster_add(const char * const barejid, const char * const name, GSList *groups, return TRUE; } -char * -roster_barejid_from_name(const char * const name) +char* +roster_barejid_from_name(const char *const name) { if (name) { return g_hash_table_lookup(name_to_barejid, name); @@ -302,8 +298,8 @@ roster_barejid_from_name(const char * const name) } } -GSList * -roster_get_contacts_by_presence(const char * const presence) +GSList* +roster_get_contacts_by_presence(const char *const presence) { GSList *result = NULL; GHashTableIter iter; @@ -322,7 +318,7 @@ roster_get_contacts_by_presence(const char * const presence) return result; } -GSList * +GSList* roster_get_contacts(void) { GSList *result = NULL; @@ -339,7 +335,7 @@ roster_get_contacts(void) return result; } -GSList * +GSList* roster_get_contacts_online(void) { GSList *result = NULL; @@ -375,19 +371,19 @@ roster_has_pending_subscriptions(void) return FALSE; } -char * -roster_contact_autocomplete(const char * const search_str) +char* +roster_contact_autocomplete(const char *const search_str) { return autocomplete_complete(name_ac, search_str, TRUE); } -char * -roster_fulljid_autocomplete(const char * const search_str) +char* +roster_fulljid_autocomplete(const char *const search_str) { return autocomplete_complete(fulljid_ac, search_str, TRUE); } -GSList * +GSList* roster_get_nogroup(void) { GSList *result = NULL; @@ -407,8 +403,8 @@ roster_get_nogroup(void) return result; } -GSList * -roster_get_group(const char * const group) +GSList* +roster_get_group(const char *const group) { GSList *result = NULL; GHashTableIter iter; @@ -431,26 +427,26 @@ roster_get_group(const char * const group) return result; } -GSList * +GSList* roster_get_groups(void) { return autocomplete_create_list(groups_ac); } -char * -roster_group_autocomplete(const char * const search_str) +char* +roster_group_autocomplete(const char *const search_str) { return autocomplete_complete(groups_ac, search_str, TRUE); } -char * -roster_barejid_autocomplete(const char * const search_str) +char* +roster_barejid_autocomplete(const char *const search_str) { return autocomplete_complete(barejid_ac, search_str, TRUE); } -static -gboolean _key_equals(void *key1, void *key2) +static gboolean +_key_equals(void *key1, void *key2) { gchar *str1 = (gchar *) key1; gchar *str2 = (gchar *) key2; @@ -473,8 +469,7 @@ _datetimes_equal(GDateTime *dt1, GDateTime *dt2) } static void -_replace_name(const char * const current_name, const char * const new_name, - const char * const barejid) +_replace_name(const char *const current_name, const char *const new_name, const char *const barejid) { // current handle exists already if (current_name) { @@ -490,7 +485,7 @@ _replace_name(const char * const current_name, const char * const new_name, } static void -_add_name_and_barejid(const char * const name, const char * const barejid) +_add_name_and_barejid(const char *const name, const char *const barejid) { if (name) { autocomplete_add(name_ac, name); @@ -501,8 +496,8 @@ _add_name_and_barejid(const char * const name, const char * const barejid) } } -static -gint _compare_contacts(PContact a, PContact b) +static gint +_compare_contacts(PContact a, PContact b) { const char * utf8_str_a = NULL; const char * utf8_str_b = NULL; diff --git a/src/roster_list.h b/src/roster_list.h index 4417c763..01def408 100644 --- a/src/roster_list.h +++ b/src/roster_list.h @@ -41,32 +41,30 @@ #include "contact.h" void roster_clear(void); -gboolean roster_update_presence(const char * const barejid, Resource *resource, - GDateTime *last_activity); -PContact roster_get_contact(const char * const barejid); -gboolean roster_contact_offline(const char * const barejid, - const char * const resource, const char * const status); +gboolean roster_update_presence(const char *const barejid, Resource *resource, GDateTime *last_activity); +PContact roster_get_contact(const char *const barejid); +gboolean roster_contact_offline(const char *const barejid, const char *const resource, const char *const status); void roster_reset_search_attempts(void); void roster_init(void); void roster_free(void); -void roster_change_name(PContact contact, const char * const new_name); -void roster_remove(const char * const name, const char * const barejid); -void roster_update(const char * const barejid, const char * const name, - GSList *groups, const char * const subscription, gboolean pending_out); -gboolean roster_add(const char * const barejid, const char * const name, GSList *groups, - const char * const subscription, gboolean pending_out); -char * roster_barejid_from_name(const char * const name); -GSList * roster_get_contacts(void); -GSList * roster_get_contacts_online(void); +void roster_change_name(PContact contact, const char *const new_name); +void roster_remove(const char *const name, const char *const barejid); +void roster_update(const char *const barejid, const char *const name, GSList *groups, const char *const subscription, + gboolean pending_out); +gboolean roster_add(const char *const barejid, const char *const name, GSList *groups, const char *const subscription, + gboolean pending_out); +char* roster_barejid_from_name(const char *const name); +GSList* roster_get_contacts(void); +GSList* roster_get_contacts_online(void); gboolean roster_has_pending_subscriptions(void); -char * roster_contact_autocomplete(const char * const search_str); -char * roster_fulljid_autocomplete(const char * const search_str); -GSList * roster_get_group(const char * const group); -GSList * roster_get_groups(void); -char * roster_group_autocomplete(const char * const search_str); -char * roster_barejid_autocomplete(const char * const search_str); -GSList * roster_get_contacts_by_presence(const char * const presence); -GSList * roster_get_nogroup(void); -char * roster_get_msg_display_name(const char * const barejid, const char * const resource); +char* roster_contact_autocomplete(const char *const search_str); +char* roster_fulljid_autocomplete(const char *const search_str); +GSList* roster_get_group(const char *const group); +GSList* roster_get_groups(void); +char* roster_group_autocomplete(const char *const search_str); +char* roster_barejid_autocomplete(const char *const search_str); +GSList* roster_get_contacts_by_presence(const char *const presence); +GSList* roster_get_nogroup(void); +char* roster_get_msg_display_name(const char *const barejid, const char *const resource); #endif diff --git a/src/tools/autocomplete.c b/src/tools/autocomplete.c index 7624f1df..f7f97309 100644 --- a/src/tools/autocomplete.c +++ b/src/tools/autocomplete.c @@ -46,7 +46,7 @@ struct autocomplete_t { gchar *search_str; }; -static gchar * _search_from(Autocomplete ac, GSList *curr, gboolean quote); +static gchar* _search_from(Autocomplete ac, GSList *curr, gboolean quote); Autocomplete autocomplete_new(void) @@ -118,7 +118,7 @@ autocomplete_add(Autocomplete ac, const char *item) } void -autocomplete_remove(Autocomplete ac, const char * const item) +autocomplete_remove(Autocomplete ac, const char *const item) { if (ac) { GSList *curr = g_slist_find_custom(ac->items, item, (GCompareFunc)strcmp); @@ -139,7 +139,7 @@ autocomplete_remove(Autocomplete ac, const char * const item) return; } -GSList * +GSList* autocomplete_create_list(Autocomplete ac) { GSList *copy = NULL; @@ -168,7 +168,7 @@ autocomplete_contains(Autocomplete ac, const char *value) return FALSE; } -gchar * +gchar* autocomplete_complete(Autocomplete ac, const gchar *search_str, gboolean quote) { gchar *found = NULL; @@ -215,8 +215,8 @@ autocomplete_complete(Autocomplete ac, const gchar *search_str, gboolean quote) } } -char * -autocomplete_param_with_func(const char * const input, char *command, autocomplete_func func) +char* +autocomplete_param_with_func(const char *const input, char *command, autocomplete_func func) { GString *auto_msg = NULL; char *result = NULL; @@ -246,8 +246,8 @@ autocomplete_param_with_func(const char * const input, char *command, autocomple return result; } -char * -autocomplete_param_with_ac(const char * const input, char *command, Autocomplete ac, gboolean quote) +char* +autocomplete_param_with_ac(const char *const input, char *command, Autocomplete ac, gboolean quote) { GString *auto_msg = NULL; char *result = NULL; @@ -277,8 +277,8 @@ autocomplete_param_with_ac(const char * const input, char *command, Autocomplete return result; } -char * -autocomplete_param_no_with_func(const char * const input, char *command, int arg_number, autocomplete_func func) +char* +autocomplete_param_no_with_func(const char *const input, char *command, int arg_number, autocomplete_func func) { if (strncmp(input, command, strlen(command)) == 0 && (strlen(input) > strlen(command))) { GString *result_str = NULL; @@ -309,7 +309,7 @@ autocomplete_param_no_with_func(const char * const input, char *command, int arg return NULL; } -static gchar * +static gchar* _search_from(Autocomplete ac, GSList *curr, gboolean quote) { while(curr) { diff --git a/src/tools/autocomplete.h b/src/tools/autocomplete.h index c4b94b09..df741c99 100644 --- a/src/tools/autocomplete.h +++ b/src/tools/autocomplete.h @@ -37,7 +37,7 @@ #include -typedef char*(*autocomplete_func)(const char * const); +typedef char* (*autocomplete_func)(const char *const); typedef struct autocomplete_t *Autocomplete; // allocate new autocompleter with no items @@ -50,21 +50,21 @@ void autocomplete_clear(Autocomplete ac); void autocomplete_free(Autocomplete ac); void autocomplete_add(Autocomplete ac, const char *item); -void autocomplete_remove(Autocomplete ac, const char * const item); +void autocomplete_remove(Autocomplete ac, const char *const item); // find the next item prefixed with search string -gchar * autocomplete_complete(Autocomplete ac, const gchar *search_str, gboolean quote); +gchar* autocomplete_complete(Autocomplete ac, const gchar *search_str, gboolean quote); -GSList * autocomplete_create_list(Autocomplete ac); +GSList* autocomplete_create_list(Autocomplete ac); gint autocomplete_length(Autocomplete ac); -char * autocomplete_param_with_func(const char * const input, char *command, +char* autocomplete_param_with_func(const char *const input, char *command, autocomplete_func func); -char * autocomplete_param_with_ac(const char * const input, char *command, +char* autocomplete_param_with_ac(const char *const input, char *command, Autocomplete ac, gboolean quote); -char * autocomplete_param_no_with_func(const char * const input, char *command, +char* autocomplete_param_no_with_func(const char *const input, char *command, int arg_number, autocomplete_func func); void autocomplete_reset(Autocomplete ac); diff --git a/src/tools/parser.c b/src/tools/parser.c index d3a23264..b0fc9234 100644 --- a/src/tools/parser.c +++ b/src/tools/parser.c @@ -61,8 +61,8 @@ * { "arg1", "arg2", NULL } * */ -gchar ** -parse_args(const char * const inp, int min, int max, gboolean *result) +gchar** +parse_args(const char *const inp, int min, int max, gboolean *result) { if (inp == NULL) { *result = FALSE; @@ -195,8 +195,8 @@ parse_args(const char * const inp, int min, int max, gboolean *result) * { "arg1", "arg2", "some free text", NULL } * */ -gchar ** -parse_args_with_freetext(const char * const inp, int min, int max, gboolean *result) +gchar** +parse_args_with_freetext(const char *const inp, int min, int max, gboolean *result) { if (inp == NULL) { *result = FALSE; @@ -316,7 +316,7 @@ parse_args_with_freetext(const char * const inp, int min, int max, gboolean *res } int -count_tokens(const char * const string) +count_tokens(const char *const string) { int length = g_utf8_strlen(string, -1); gboolean in_quotes = FALSE; @@ -346,8 +346,8 @@ count_tokens(const char * const string) return num_tokens; } -char * -get_start(const char * const string, int tokens) +char* +get_start(const char *const string, int tokens) { GString *result = g_string_new(""); int length = g_utf8_strlen(string, -1); @@ -388,7 +388,7 @@ get_start(const char * const string, int tokens) return result_str; } -GHashTable * +GHashTable* parse_options(gchar **args, gchar **opt_keys, gboolean *res) { GList *keys = NULL; diff --git a/src/tools/parser.h b/src/tools/parser.h index 34fa55a0..f01df374 100644 --- a/src/tools/parser.h +++ b/src/tools/parser.h @@ -37,11 +37,11 @@ #include -gchar** parse_args(const char * const inp, int min, int max, gboolean *result); -gchar** parse_args_with_freetext(const char * const inp, int min, int max, gboolean *result); -int count_tokens(const char * const string); -char* get_start(const char * const string, int tokens); +gchar** parse_args(const char *const inp, int min, int max, gboolean *result); +gchar** parse_args_with_freetext(const char *const inp, int min, int max, gboolean *result); +int count_tokens(const char *const string); +char* get_start(const char *const string, int tokens); GHashTable* parse_options(gchar **args, gchar **keys, gboolean *res); void options_destroy(GHashTable *options); -#endif \ No newline at end of file +#endif diff --git a/src/tools/tinyurl.c b/src/tools/tinyurl.c index 92ff97b8..b12e0dd6 100644 --- a/src/tools/tinyurl.c +++ b/src/tools/tinyurl.c @@ -54,7 +54,7 @@ tinyurl_valid(char *url) g_str_has_prefix(url, "https://")); } -char * +char* tinyurl_get(char *url) { GString *full_url = g_string_new("http://tinyurl.com/api-create.php?url="); diff --git a/src/tools/tinyurl.h b/src/tools/tinyurl.h index f69570c3..69db4587 100644 --- a/src/tools/tinyurl.h +++ b/src/tools/tinyurl.h @@ -38,6 +38,6 @@ #include gboolean tinyurl_valid(char *url); -char * tinyurl_get(char *url); +char* tinyurl_get(char *url); #endif diff --git a/src/ui/buffer.c b/src/ui/buffer.c index a464de4e..20528de4 100644 --- a/src/ui/buffer.c +++ b/src/ui/buffer.c @@ -58,7 +58,7 @@ struct prof_buff_t { static void _free_entry(ProfBuffEntry *entry); ProfBuff -buffer_create() +buffer_create(void) { ProfBuff new_buff = malloc(sizeof(struct prof_buff_t)); new_buff->entries = NULL; @@ -81,7 +81,7 @@ buffer_free(ProfBuff buffer) void buffer_push(ProfBuff buffer, const char show_char, int pad_indent, GDateTime *time, - int flags, theme_item_t theme_item, const char * const from, const char * const message, DeliveryReceipt *receipt) + int flags, theme_item_t theme_item, const char *const from, const char *const message, DeliveryReceipt *receipt) { ProfBuffEntry *e = malloc(sizeof(struct prof_buff_entry_t)); e->show_char = show_char; @@ -102,7 +102,7 @@ buffer_push(ProfBuff buffer, const char show_char, int pad_indent, GDateTime *ti } gboolean -buffer_mark_received(ProfBuff buffer, const char * const id) +buffer_mark_received(ProfBuff buffer, const char *const id) { GSList *entries = buffer->entries; while (entries) { diff --git a/src/ui/buffer.h b/src/ui/buffer.h index dcee0aff..0693d1ba 100644 --- a/src/ui/buffer.h +++ b/src/ui/buffer.h @@ -61,10 +61,9 @@ typedef struct prof_buff_t *ProfBuff; ProfBuff buffer_create(); void buffer_free(ProfBuff buffer); void buffer_push(ProfBuff buffer, const char show_char, int pad_indent, GDateTime *time, int flags, theme_item_t theme_item, - const char * const from, const char * const message, DeliveryReceipt *receipt); + const char *const from, const char *const message, DeliveryReceipt *receipt); int buffer_size(ProfBuff buffer); ProfBuffEntry* buffer_yield_entry(ProfBuff buffer, int entry); -gboolean buffer_mark_received(ProfBuff buffer, const char * const id); - +gboolean buffer_mark_received(ProfBuff buffer, const char *const id); #endif diff --git a/src/ui/console.c b/src/ui/console.c index bda808c7..665da9c5 100644 --- a/src/ui/console.c +++ b/src/ui/console.c @@ -71,14 +71,14 @@ cons_show_time(void) } void -cons_show_word(const char * const word) +cons_show_word(const char *const word) { ProfWin *console = wins_get_console(); win_print(console, '-', 0, NULL, NO_DATE | NO_EOL, 0, "", word); } void -cons_debug(const char * const msg, ...) +cons_debug(const char *const msg, ...) { ProfWin *console = wins_get_console(); if (strcmp(PACKAGE_STATUS, "development") == 0) { @@ -93,7 +93,7 @@ cons_debug(const char * const msg, ...) } void -cons_show(const char * const msg, ...) +cons_show(const char *const msg, ...) { ProfWin *console = wins_get_console(); va_list arg; @@ -106,7 +106,7 @@ cons_show(const char * const msg, ...) } void -cons_show_padded(int pad, const char * const msg, ...) +cons_show_padded(int pad, const char *const msg, ...) { ProfWin *console = wins_get_console(); va_list arg; @@ -162,7 +162,7 @@ cons_show_help(Command *command) } void -cons_bad_cmd_usage(const char * const cmd) +cons_bad_cmd_usage(const char *const cmd) { GString *msg = g_string_new(""); g_string_printf(msg, "Invalid usage, see '/help %s' for details.", &cmd[1]); @@ -174,7 +174,7 @@ cons_bad_cmd_usage(const char * const cmd) } void -cons_show_error(const char * const msg, ...) +cons_show_error(const char *const msg, ...) { ProfWin *console = wins_get_console(); va_list arg; @@ -189,7 +189,7 @@ cons_show_error(const char * const msg, ...) } void -cons_show_typing(const char * const barejid) +cons_show_typing(const char *const barejid) { ProfWin *console = wins_get_console(); const char * display_usr = NULL; @@ -209,7 +209,7 @@ cons_show_typing(const char * const barejid) } void -cons_show_incoming_message(const char * const short_from, const int win_index) +cons_show_incoming_message(const char *const short_from, const int win_index) { ProfWin *console = wins_get_console(); @@ -355,7 +355,7 @@ cons_show_info(PContact pcontact) } void -cons_show_caps(const char * const fulljid, resource_presence_t presence) +cons_show_caps(const char *const fulljid, resource_presence_t presence) { ProfWin *console = wins_get_console(); cons_show(""); @@ -466,7 +466,7 @@ cons_show_sent_subs(void) } void -cons_show_room_list(GSList *rooms, const char * const conference_node) +cons_show_room_list(GSList *rooms, const char *const conference_node) { ProfWin *console = wins_get_console(); if (rooms && (g_slist_length(rooms) > 0)) { @@ -574,7 +574,7 @@ cons_show_disco_info(const char *jid, GSList *identities, GSList *features) } void -cons_show_disco_items(GSList *items, const char * const jid) +cons_show_disco_items(GSList *items, const char *const jid) { ProfWin *console = wins_get_console(); if (items && (g_slist_length(items) > 0)) { @@ -598,7 +598,7 @@ cons_show_disco_items(GSList *items, const char * const jid) } void -cons_show_status(const char * const barejid) +cons_show_status(const char *const barejid) { ProfWin *console = wins_get_console(); PContact pcontact = roster_get_contact(barejid); @@ -613,8 +613,8 @@ cons_show_status(const char * const barejid) } void -cons_show_room_invite(const char * const invitor, const char * const room, - const char * const reason) +cons_show_room_invite(const char *const invitor, const char * const room, + const char *const reason) { char *display_from = NULL; PContact contact = roster_get_contact(invitor); @@ -1170,18 +1170,7 @@ cons_show_ui_prefs(void) void cons_notify_setting(void) { - gboolean notify_enabled = FALSE; -#ifdef HAVE_OSXNOTIFY - notify_enabled = TRUE; -#endif -#ifdef HAVE_LIBNOTIFY - notify_enabled = TRUE; -#endif -#ifdef PLATFORM_CYGWIN - notify_enabled = TRUE; -#endif - - if (notify_enabled) { + if (is_notify_enabled()) { if (prefs_get_boolean(PREF_NOTIFY_MESSAGE)) cons_show("Messages (/notify message) : ON"); else @@ -1684,7 +1673,7 @@ cons_navigation_help(void) } void -cons_show_roster_group(const char * const group, GSList *list) +cons_show_roster_group(const char *const group, GSList *list) { cons_show(""); diff --git a/src/ui/core.c b/src/ui/core.c index 3fda21e8..645ed4eb 100644 --- a/src/ui/core.c +++ b/src/ui/core.c @@ -89,7 +89,7 @@ static Display *display; static GTimer *ui_idle_time; //static void _win_handle_switch(const wint_t ch); -static void _win_show_history(ProfChatWin *chatwin, const char * const contact); +static void _win_show_history(ProfChatWin *chatwin, const char *const contact); static void _ui_draw_term_title(void); void @@ -195,7 +195,7 @@ ui_close(void) endwin(); } -char * +char* ui_readline(void) { return inp_readline(); @@ -290,7 +290,7 @@ ui_xmlconsole_exists(void) } void -ui_handle_stanza(const char * const msg) +ui_handle_stanza(const char *const msg) { if (ui_xmlconsole_exists()) { ProfXMLWin *xmlconsole = wins_get_xmlconsole(); @@ -309,7 +309,7 @@ ui_handle_stanza(const char * const msg) } gboolean -ui_chat_win_exists(const char * const barejid) +ui_chat_win_exists(const char *const barejid) { ProfChatWin *chatwin = wins_get_chat(barejid); return (chatwin != NULL); @@ -352,7 +352,7 @@ ui_contact_online(char *barejid, Resource *resource, GDateTime *last_activity) } void -ui_contact_typing(const char * const barejid, const char * const resource) +ui_contact_typing(const char *const barejid, const char *const resource) { ProfChatWin *chatwin = wins_get_chat(barejid); ProfWin *window = (ProfWin*) chatwin; @@ -394,7 +394,7 @@ ui_contact_typing(const char * const barejid, const char * const resource) } } -GSList * +GSList* ui_get_chat_recipients(void) { GSList *recipients = wins_get_chat_recipients(); @@ -402,7 +402,7 @@ ui_get_chat_recipients(void) } void -ui_message_receipt(const char * const barejid, const char * const id) +ui_message_receipt(const char *const barejid, const char *const id) { ProfChatWin *chatwin = wins_get_chat(barejid); if (chatwin) { @@ -412,7 +412,7 @@ ui_message_receipt(const char * const barejid, const char * const id) } void -ui_incoming_msg(ProfChatWin *chatwin, const char * const resource, const char * const message, GDateTime *timestamp, gboolean win_created, prof_enc_t enc_mode) +ui_incoming_msg(ProfChatWin *chatwin, const char *const resource, const char *const message, GDateTime *timestamp, gboolean win_created, prof_enc_t enc_mode) { ProfWin *window = (ProfWin*)chatwin; int num = wins_get_num(window); @@ -462,7 +462,7 @@ ui_incoming_msg(ProfChatWin *chatwin, const char * const resource, const char * } void -ui_incoming_private_msg(const char * const fulljid, const char * const message, GDateTime *timestamp) +ui_incoming_private_msg(const char *const fulljid, const char *const message, GDateTime *timestamp) { char *display_from = NULL; display_from = get_nick_from_full_jid(fulljid); @@ -506,7 +506,7 @@ ui_incoming_private_msg(const char * const fulljid, const char * const message, } void -ui_roster_add(const char * const barejid, const char * const name) +ui_roster_add(const char *const barejid, const char *const name) { if (name) { cons_show("Roster item added: %s (%s)", barejid, name); @@ -517,35 +517,35 @@ ui_roster_add(const char * const barejid, const char * const name) } void -ui_roster_remove(const char * const barejid) +ui_roster_remove(const char *const barejid) { cons_show("Roster item removed: %s", barejid); rosterwin_roster(); } void -ui_contact_already_in_group(const char * const contact, const char * const group) +ui_contact_already_in_group(const char *const contact, const char *const group) { cons_show("%s already in group %s", contact, group); rosterwin_roster(); } void -ui_contact_not_in_group(const char * const contact, const char * const group) +ui_contact_not_in_group(const char *const contact, const char *const group) { cons_show("%s is not currently in group %s", contact, group); rosterwin_roster(); } void -ui_group_added(const char * const contact, const char * const group) +ui_group_added(const char *const contact, const char *const group) { cons_show("%s added to group %s", contact, group); rosterwin_roster(); } void -ui_group_removed(const char * const contact, const char * const group) +ui_group_removed(const char *const contact, const char *const group) { cons_show("%s removed from group %s", contact, group); rosterwin_roster(); @@ -577,7 +577,7 @@ ui_handle_login_account_success(ProfAccount *account, int secured) void ui_update_presence(const resource_presence_t resource_presence, - const char * const message, const char * const show) + const char *const message, const char *const show) { contact_presence_t contact_presence = contact_presence_from_resource_presence(resource_presence); title_bar_set_presence(contact_presence); @@ -590,7 +590,7 @@ ui_update_presence(const resource_presence_t resource_presence, } void -ui_handle_recipient_not_found(const char * const recipient, const char * const err_msg) +ui_handle_recipient_not_found(const char *const recipient, const char *const err_msg) { // intended recipient was invalid chat room ProfMucWin *mucwin = wins_get_muc(recipient); @@ -602,7 +602,7 @@ ui_handle_recipient_not_found(const char * const recipient, const char * const e } void -ui_handle_recipient_error(const char * const recipient, const char * const err_msg) +ui_handle_recipient_error(const char *const recipient, const char *const err_msg) { // always show in console cons_show_error("Error from %s: %s", recipient, err_msg); @@ -627,7 +627,7 @@ ui_handle_recipient_error(const char * const recipient, const char * const err_m } void -ui_handle_error(const char * const err_msg) +ui_handle_error(const char *const err_msg) { GString *msg = g_string_new(""); g_string_printf(msg, "Error %s", err_msg); @@ -638,7 +638,7 @@ ui_handle_error(const char * const err_msg) } void -ui_invalid_command_usage(const char * const cmd, void (*setting_func)(void)) +ui_invalid_command_usage(const char *const cmd, void (*setting_func)(void)) { GString *msg = g_string_new(""); g_string_printf(msg, "Invalid usage, see '/help %s' for details.", &cmd[1]); @@ -856,7 +856,7 @@ ui_switch_win(ProfWin *window) } void -ui_gone_secure(const char * const barejid, gboolean trusted) +ui_gone_secure(const char *const barejid, gboolean trusted) { ProfWin *window = NULL; @@ -892,7 +892,7 @@ ui_gone_secure(const char * const barejid, gboolean trusted) } void -ui_gone_insecure(const char * const barejid) +ui_gone_insecure(const char *const barejid) { ProfChatWin *chatwin = wins_get_chat(barejid); if (chatwin) { @@ -908,7 +908,7 @@ ui_gone_insecure(const char * const barejid) } void -ui_smp_recipient_initiated(const char * const barejid) +ui_smp_recipient_initiated(const char *const barejid) { ProfChatWin *chatwin = wins_get_chat(barejid); if (chatwin) { @@ -917,7 +917,7 @@ ui_smp_recipient_initiated(const char * const barejid) } void -ui_smp_recipient_initiated_q(const char * const barejid, const char *question) +ui_smp_recipient_initiated_q(const char *const barejid, const char *question) { ProfChatWin *chatwin = wins_get_chat(barejid); if (chatwin) { @@ -928,7 +928,7 @@ ui_smp_recipient_initiated_q(const char * const barejid, const char *question) } void -ui_smp_unsuccessful_sender(const char * const barejid) +ui_smp_unsuccessful_sender(const char *const barejid) { ProfChatWin *chatwin = wins_get_chat(barejid); if (chatwin) { @@ -937,7 +937,7 @@ ui_smp_unsuccessful_sender(const char * const barejid) } void -ui_smp_unsuccessful_receiver(const char * const barejid) +ui_smp_unsuccessful_receiver(const char *const barejid) { ProfChatWin *chatwin = wins_get_chat(barejid); if (chatwin) { @@ -946,7 +946,7 @@ ui_smp_unsuccessful_receiver(const char * const barejid) } void -ui_smp_aborted(const char * const barejid) +ui_smp_aborted(const char *const barejid) { ProfChatWin *chatwin = wins_get_chat(barejid); if (chatwin) { @@ -955,7 +955,7 @@ ui_smp_aborted(const char * const barejid) } void -ui_smp_successful(const char * const barejid) +ui_smp_successful(const char *const barejid) { ProfChatWin *chatwin = wins_get_chat(barejid); if (chatwin) { @@ -964,7 +964,7 @@ ui_smp_successful(const char * const barejid) } void -ui_smp_answer_success(const char * const barejid) +ui_smp_answer_success(const char *const barejid) { ProfChatWin *chatwin = wins_get_chat(barejid); if (chatwin) { @@ -973,7 +973,7 @@ ui_smp_answer_success(const char * const barejid) } void -ui_smp_answer_failure(const char * const barejid) +ui_smp_answer_failure(const char *const barejid) { ProfChatWin *chatwin = wins_get_chat(barejid); if (chatwin) { @@ -982,7 +982,7 @@ ui_smp_answer_failure(const char * const barejid) } void -ui_otr_authenticating(const char * const barejid) +ui_otr_authenticating(const char *const barejid) { ProfChatWin *chatwin = wins_get_chat(barejid); if (chatwin) { @@ -991,7 +991,7 @@ ui_otr_authenticating(const char * const barejid) } void -ui_otr_authetication_waiting(const char * const barejid) +ui_otr_authetication_waiting(const char *const barejid) { ProfChatWin *chatwin = wins_get_chat(barejid); if (chatwin) { @@ -1000,7 +1000,7 @@ ui_otr_authetication_waiting(const char * const barejid) } void -ui_handle_otr_error(const char * const barejid, const char * const message) +ui_handle_otr_error(const char *const barejid, const char *const message) { ProfChatWin *chatwin = wins_get_chat(barejid); if (chatwin) { @@ -1011,7 +1011,7 @@ ui_handle_otr_error(const char * const barejid, const char * const message) } void -ui_trust(const char * const barejid) +ui_trust(const char *const barejid) { ProfChatWin *chatwin = wins_get_chat(barejid); if (chatwin) { @@ -1027,7 +1027,7 @@ ui_trust(const char * const barejid) } void -ui_untrust(const char * const barejid) +ui_untrust(const char *const barejid) { ProfChatWin *chatwin = wins_get_chat(barejid); if (chatwin) { @@ -1118,7 +1118,7 @@ ui_win_type(int index) } void -ui_current_print_line(const char * const msg, ...) +ui_current_print_line(const char *const msg, ...) { ProfWin *window = wins_get_current(); va_list arg; @@ -1131,7 +1131,7 @@ ui_current_print_line(const char * const msg, ...) } void -ui_current_print_formatted_line(const char show_char, int attrs, const char * const msg, ...) +ui_current_print_formatted_line(const char show_char, int attrs, const char *const msg, ...) { ProfWin *current = wins_get_current(); va_list arg; @@ -1144,20 +1144,20 @@ ui_current_print_formatted_line(const char show_char, int attrs, const char * co } void -ui_win_error_line(ProfWin *window, const char * const msg) +ui_win_error_line(ProfWin *window, const char *const msg) { win_print(window, '-', 0, NULL, 0, THEME_ERROR, "", msg); } void -ui_current_error_line(const char * const msg) +ui_current_error_line(const char *const msg) { ProfWin *current = wins_get_current(); win_print(current, '-', 0, NULL, 0, THEME_ERROR, "", msg); } void -ui_print_system_msg_from_recipient(const char * const barejid, const char *message) +ui_print_system_msg_from_recipient(const char *const barejid, const char *message) { if (barejid == NULL || message == NULL) return; @@ -1180,7 +1180,7 @@ ui_print_system_msg_from_recipient(const char * const barejid, const char *messa } void -ui_recipient_gone(const char * const barejid, const char * const resource) +ui_recipient_gone(const char *const barejid, const char *const resource) { if (barejid == NULL) return; @@ -1214,7 +1214,7 @@ ui_recipient_gone(const char * const barejid, const char * const resource) } ProfPrivateWin* -ui_new_private_win(const char * const fulljid) +ui_new_private_win(const char *const fulljid) { ProfWin *window = wins_new_private(fulljid); return (ProfPrivateWin*)window; @@ -1237,7 +1237,7 @@ ui_open_xmlconsole_win(void) } ProfChatWin* -ui_new_chat_win(const char * const barejid) +ui_new_chat_win(const char *const barejid) { ProfWin *window = wins_new_chat(barejid); ProfChatWin *chatwin = (ProfChatWin *)window; @@ -1260,7 +1260,7 @@ ui_new_chat_win(const char * const barejid) } void -ui_outgoing_chat_msg(ProfChatWin *chatwin, const char * const message, char *id, prof_enc_t enc_mode) +ui_outgoing_chat_msg(ProfChatWin *chatwin, const char *const message, char *id, prof_enc_t enc_mode) { char enc_char = '-'; if (enc_mode == PROF_MSG_OTR) { @@ -1277,7 +1277,7 @@ ui_outgoing_chat_msg(ProfChatWin *chatwin, const char * const message, char *id, } void -ui_outgoing_chat_msg_carbon(const char * const barejid, const char * const message) +ui_outgoing_chat_msg_carbon(const char *const barejid, const char *const message) { ProfChatWin *chatwin = wins_get_chat(barejid); @@ -1295,13 +1295,13 @@ ui_outgoing_chat_msg_carbon(const char * const barejid, const char * const messa } void -ui_outgoing_private_msg(ProfPrivateWin *privwin, const char * const message) +ui_outgoing_private_msg(ProfPrivateWin *privwin, const char *const message) { win_print((ProfWin*)privwin, '-', 0, NULL, 0, THEME_TEXT_ME, "me", message); } void -ui_room_join(const char * const roomjid, gboolean focus) +ui_room_join(const char *const roomjid, gboolean focus) { ProfWin *window = (ProfWin*)wins_get_muc(roomjid); if (!window) { @@ -1335,15 +1335,15 @@ ui_room_join(const char * const roomjid, gboolean focus) } void -ui_switch_to_room(const char * const roomjid) +ui_switch_to_room(const char *const roomjid) { ProfWin *window = (ProfWin*)wins_get_muc(roomjid); ui_ev_focus_win(window); } void -ui_room_role_change(const char * const roomjid, const char * const role, const char * const actor, - const char * const reason) +ui_room_role_change(const char *const roomjid, const char *const role, const char *const actor, + const char *const reason) { ProfWin *window = (ProfWin*)wins_get_muc(roomjid); win_vprint(window, '!', 0, NULL, NO_EOL, THEME_ROOMINFO, "", "Your role has been changed to: %s", role); @@ -1357,8 +1357,8 @@ ui_room_role_change(const char * const roomjid, const char * const role, const c } void -ui_room_affiliation_change(const char * const roomjid, const char * const affiliation, const char * const actor, - const char * const reason) +ui_room_affiliation_change(const char *const roomjid, const char *const affiliation, const char *const actor, + const char *const reason) { ProfWin *window = (ProfWin*)wins_get_muc(roomjid); win_vprint(window, '!', 0, NULL, NO_EOL, THEME_ROOMINFO, "", "Your affiliation has been changed to: %s", affiliation); @@ -1372,8 +1372,8 @@ ui_room_affiliation_change(const char * const roomjid, const char * const affili } void -ui_room_role_and_affiliation_change(const char * const roomjid, const char * const role, const char * const affiliation, - const char * const actor, const char * const reason) +ui_room_role_and_affiliation_change(const char *const roomjid, const char *const role, const char *const affiliation, + const char *const actor, const char *const reason) { ProfWin *window = (ProfWin*)wins_get_muc(roomjid); win_vprint(window, '!', 0, NULL, NO_EOL, THEME_ROOMINFO, "", "Your role and affiliation have been changed, role: %s, affiliation: %s", role, affiliation); @@ -1388,8 +1388,8 @@ ui_room_role_and_affiliation_change(const char * const roomjid, const char * con void -ui_room_occupant_role_change(const char * const roomjid, const char * const nick, const char * const role, - const char * const actor, const char * const reason) +ui_room_occupant_role_change(const char *const roomjid, const char *const nick, const char *const role, + const char *const actor, const char *const reason) { ProfWin *window = (ProfWin*)wins_get_muc(roomjid); win_vprint(window, '!', 0, NULL, NO_EOL, THEME_ROOMINFO, "", "%s's role has been changed to: %s", nick, role); @@ -1403,8 +1403,8 @@ ui_room_occupant_role_change(const char * const roomjid, const char * const nick } void -ui_room_occupant_affiliation_change(const char * const roomjid, const char * const nick, const char * const affiliation, - const char * const actor, const char * const reason) +ui_room_occupant_affiliation_change(const char *const roomjid, const char *const nick, const char *const affiliation, + const char *const actor, const char *const reason) { ProfWin *window = (ProfWin*)wins_get_muc(roomjid); win_vprint(window, '!', 0, NULL, NO_EOL, THEME_ROOMINFO, "", "%s's affiliation has been changed to: %s", nick, affiliation); @@ -1418,8 +1418,8 @@ ui_room_occupant_affiliation_change(const char * const roomjid, const char * con } void -ui_room_occupant_role_and_affiliation_change(const char * const roomjid, const char * const nick, const char * const role, - const char * const affiliation, const char * const actor, const char * const reason) +ui_room_occupant_role_and_affiliation_change(const char *const roomjid, const char *const nick, const char *const role, + const char *const affiliation, const char *const actor, const char *const reason) { ProfWin *window = (ProfWin*)wins_get_muc(roomjid); win_vprint(window, '!', 0, NULL, NO_EOL, THEME_ROOMINFO, "", "%s's role and affiliation have been changed, role: %s, affiliation: %s", nick, role, affiliation); @@ -1433,7 +1433,7 @@ ui_room_occupant_role_and_affiliation_change(const char * const roomjid, const c } void -ui_handle_room_info_error(const char * const roomjid, const char * const error) +ui_handle_room_info_error(const char *const roomjid, const char *const error) { ProfWin *window = (ProfWin*)wins_get_muc(roomjid); if (window) { @@ -1443,7 +1443,7 @@ ui_handle_room_info_error(const char * const roomjid, const char * const error) } void -ui_show_room_disco_info(const char * const roomjid, GSList *identities, GSList *features) +ui_show_room_disco_info(const char *const roomjid, GSList *identities, GSList *features) { ProfWin *window = (ProfWin*)wins_get_muc(roomjid); if (window) { @@ -1484,7 +1484,7 @@ ui_show_room_disco_info(const char * const roomjid, GSList *identities, GSList * } void -ui_room_roster(const char * const roomjid, GList *roster, const char * const presence) +ui_room_roster(const char *const roomjid, GList *roster, const char *const presence) { ProfWin *window = (ProfWin*)wins_get_muc(roomjid); if (window == NULL) { @@ -1524,13 +1524,13 @@ ui_room_roster(const char * const roomjid, GList *roster, const char * const pre } void -ui_handle_room_join_error(const char * const roomjid, const char * const err) +ui_handle_room_join_error(const char *const roomjid, const char *const err) { cons_show_error("Error joining room %s, reason: %s", roomjid, err); } void -ui_room_member_offline(const char * const roomjid, const char * const nick) +ui_room_member_offline(const char *const roomjid, const char *const nick) { ProfWin *window = (ProfWin*)wins_get_muc(roomjid); if (window == NULL) { @@ -1541,8 +1541,8 @@ ui_room_member_offline(const char * const roomjid, const char * const nick) } void -ui_room_member_kicked(const char * const roomjid, const char * const nick, const char * const actor, - const char * const reason) +ui_room_member_kicked(const char *const roomjid, const char *const nick, const char *const actor, + const char *const reason) { ProfWin *window = (ProfWin*)wins_get_muc(roomjid); if (window == NULL) { @@ -1565,8 +1565,8 @@ ui_room_member_kicked(const char * const roomjid, const char * const nick, const } void -ui_room_member_banned(const char * const roomjid, const char * const nick, const char * const actor, - const char * const reason) +ui_room_member_banned(const char *const roomjid, const char *const nick, const char *const actor, + const char *const reason) { ProfWin *window = (ProfWin*)wins_get_muc(roomjid); if (window == NULL) { @@ -1589,8 +1589,8 @@ ui_room_member_banned(const char * const roomjid, const char * const nick, const } void -ui_room_member_online(const char * const roomjid, const char * const nick, const char * const role, - const char * const affiliation, const char * const show, const char * const status) +ui_room_member_online(const char *const roomjid, const char *const nick, const char *const role, + const char *const affiliation, const char *const show, const char *const status) { ProfWin *window = (ProfWin*)wins_get_muc(roomjid); if (window == NULL) { @@ -1610,8 +1610,8 @@ ui_room_member_online(const char * const roomjid, const char * const nick, const } void -ui_room_member_presence(const char * const roomjid, const char * const nick, - const char * const show, const char * const status) +ui_room_member_presence(const char *const roomjid, const char *const nick, + const char *const show, const char *const status) { ProfWin *window = (ProfWin*)wins_get_muc(roomjid); if (window == NULL) { @@ -1622,8 +1622,8 @@ ui_room_member_presence(const char * const roomjid, const char * const nick, } void -ui_room_member_nick_change(const char * const roomjid, - const char * const old_nick, const char * const nick) +ui_room_member_nick_change(const char *const roomjid, + const char *const old_nick, const char *const nick) { ProfWin *window = (ProfWin*)wins_get_muc(roomjid); if (window == NULL) { @@ -1634,7 +1634,7 @@ ui_room_member_nick_change(const char * const roomjid, } void -ui_room_nick_change(const char * const roomjid, const char * const nick) +ui_room_nick_change(const char *const roomjid, const char *const nick) { ProfWin *window = (ProfWin*)wins_get_muc(roomjid); if (window == NULL) { @@ -1645,8 +1645,8 @@ ui_room_nick_change(const char * const roomjid, const char * const nick) } void -ui_room_history(const char * const roomjid, const char * const nick, - GDateTime *timestamp, const char * const message) +ui_room_history(const char *const roomjid, const char *const nick, + GDateTime *timestamp, const char *const message) { ProfWin *window = (ProfWin*)wins_get_muc(roomjid); if (window == NULL) { @@ -1671,8 +1671,8 @@ ui_room_history(const char * const roomjid, const char * const nick, } void -ui_room_message(const char * const roomjid, const char * const nick, - const char * const message) +ui_room_message(const char *const roomjid, const char *const nick, + const char *const message) { ProfMucWin *mucwin = wins_get_muc(roomjid); if (mucwin == NULL) { @@ -1755,7 +1755,7 @@ ui_room_message(const char * const roomjid, const char * const nick, } void -ui_room_requires_config(const char * const roomjid) +ui_room_requires_config(const char *const roomjid) { ProfWin *window = (ProfWin*)wins_get_muc(roomjid); if (window == NULL) { @@ -1790,7 +1790,7 @@ ui_room_requires_config(const char * const roomjid) } void -ui_room_destroy(const char * const roomjid) +ui_room_destroy(const char *const roomjid) { ProfWin *window = (ProfWin*)wins_get_muc(roomjid); if (window == NULL) { @@ -1803,7 +1803,7 @@ ui_room_destroy(const char * const roomjid) } void -ui_leave_room(const char * const roomjid) +ui_leave_room(const char *const roomjid) { ProfWin *window = (ProfWin*)wins_get_muc(roomjid); if (window) { @@ -1813,8 +1813,8 @@ ui_leave_room(const char * const roomjid) } void -ui_room_destroyed(const char * const roomjid, const char * const reason, const char * const new_jid, - const char * const password) +ui_room_destroyed(const char *const roomjid, const char *const reason, const char *const new_jid, + const char *const password) { ProfWin *window = (ProfWin*)wins_get_muc(roomjid); if (window == NULL) { @@ -1841,7 +1841,7 @@ ui_room_destroyed(const char * const roomjid, const char * const reason, const c } void -ui_room_kicked(const char * const roomjid, const char * const actor, const char * const reason) +ui_room_kicked(const char *const roomjid, const char *const actor, const char *const reason) { ProfWin *window = (ProfWin*)wins_get_muc(roomjid); if (window == NULL) { @@ -1868,7 +1868,7 @@ ui_room_kicked(const char * const roomjid, const char * const actor, const char } void -ui_room_banned(const char * const roomjid, const char * const actor, const char * const reason) +ui_room_banned(const char *const roomjid, const char *const actor, const char *const reason) { ProfWin *window = (ProfWin*)wins_get_muc(roomjid); if (window == NULL) { @@ -1895,7 +1895,7 @@ ui_room_banned(const char * const roomjid, const char * const actor, const char } void -ui_room_subject(const char * const roomjid, const char * const nick, const char * const subject) +ui_room_subject(const char *const roomjid, const char *const nick, const char *const subject) { ProfWin *window = (ProfWin*)wins_get_muc(roomjid); if (window == NULL) { @@ -1931,7 +1931,7 @@ ui_room_subject(const char * const roomjid, const char * const nick, const char } void -ui_handle_room_kick_error(const char * const roomjid, const char * const nick, const char * const error) +ui_handle_room_kick_error(const char *const roomjid, const char *const nick, const char *const error) { ProfWin *window = (ProfWin*)wins_get_muc(roomjid); if (window == NULL) { @@ -1942,7 +1942,7 @@ ui_handle_room_kick_error(const char * const roomjid, const char * const nick, c } void -ui_room_broadcast(const char * const roomjid, const char * const message) +ui_room_broadcast(const char *const roomjid, const char *const message) { ProfWin *window = (ProfWin*)wins_get_muc(roomjid); if (window == NULL) { @@ -1965,8 +1965,8 @@ ui_room_broadcast(const char * const roomjid, const char * const message) } void -ui_handle_room_affiliation_list_error(const char * const roomjid, const char * const affiliation, - const char * const error) +ui_handle_room_affiliation_list_error(const char *const roomjid, const char *const affiliation, + const char *const error) { ProfWin *window = (ProfWin*)wins_get_muc(roomjid); if (window) { @@ -1975,7 +1975,7 @@ ui_handle_room_affiliation_list_error(const char * const roomjid, const char * c } void -ui_handle_room_affiliation_list(const char * const roomjid, const char * const affiliation, GSList *jids) +ui_handle_room_affiliation_list(const char *const roomjid, const char *const affiliation, GSList *jids) { ProfWin *window = (ProfWin*)wins_get_muc(roomjid); if (window) { @@ -1996,7 +1996,7 @@ ui_handle_room_affiliation_list(const char * const roomjid, const char * const a } void -ui_handle_room_role_list_error(const char * const roomjid, const char * const role, const char * const error) +ui_handle_room_role_list_error(const char *const roomjid, const char *const role, const char *const error) { ProfWin *window = (ProfWin*)wins_get_muc(roomjid); if (window) { @@ -2005,7 +2005,7 @@ ui_handle_room_role_list_error(const char * const roomjid, const char * const ro } void -ui_handle_room_role_list(const char * const roomjid, const char * const role, GSList *nicks) +ui_handle_room_role_list(const char *const roomjid, const char *const role, GSList *nicks) { ProfWin *window = (ProfWin*)wins_get_muc(roomjid); if (window) { @@ -2035,8 +2035,8 @@ ui_handle_room_role_list(const char * const roomjid, const char * const role, GS } void -ui_handle_room_affiliation_set_error(const char * const roomjid, const char * const jid, const char * const affiliation, - const char * const error) +ui_handle_room_affiliation_set_error(const char *const roomjid, const char *const jid, const char *const affiliation, + const char *const error) { ProfWin *window = (ProfWin*)wins_get_muc(roomjid); if (window) { @@ -2045,8 +2045,8 @@ ui_handle_room_affiliation_set_error(const char * const roomjid, const char * co } void -ui_handle_room_role_set_error(const char * const roomjid, const char * const nick, const char * const role, - const char * const error) +ui_handle_room_role_set_error(const char *const roomjid, const char *const nick, const char *const role, + const char *const error) { ProfWin *window = (ProfWin*)wins_get_muc(roomjid); if (window) { @@ -2071,7 +2071,7 @@ ui_win_unread(int index) } } -char * +char* ui_ask_password(void) { status_bar_get_password(); @@ -2079,14 +2079,14 @@ ui_ask_password(void) return inp_get_password(); } -char * +char* ui_get_line(void) { status_bar_update_virtual(); return inp_get_line(); } -char * +char* ui_ask_pgp_passphrase(const char *hint, int prev_fail) { ProfWin *current = wins_get_current(); @@ -2543,7 +2543,7 @@ ui_show_form_field(ProfWin *window, DataForm *form, char *tag) } void -ui_handle_room_configuration(const char * const roomjid, DataForm *form) +ui_handle_room_configuration(const char *const roomjid, DataForm *form) { ProfWin *window = wins_new_muc_config(roomjid, form); ProfMucConfWin *confwin = (ProfMucConfWin*)window; @@ -2560,7 +2560,7 @@ ui_handle_room_configuration(const char * const roomjid, DataForm *form) } void -ui_handle_room_configuration_form_error(const char * const roomjid, const char * const message) +ui_handle_room_configuration_form_error(const char *const roomjid, const char *const message) { ProfWin *window = NULL; GString *message_str = g_string_new(""); @@ -2584,14 +2584,11 @@ ui_handle_room_configuration_form_error(const char * const roomjid, const char * } void -ui_handle_room_config_submit_result(const char * const roomjid) +ui_handle_room_config_submit_result(const char *const roomjid) { - ProfWin *muc_window = NULL; - ProfWin *form_window = NULL; - int num; - if (roomjid) { - muc_window = (ProfWin*)wins_get_muc(roomjid); + ProfWin *form_window = NULL; + ProfWin *muc_window = (ProfWin*)wins_get_muc(roomjid); GString *form_recipient = g_string_new(roomjid); g_string_append(form_recipient, " config"); @@ -2599,7 +2596,7 @@ ui_handle_room_config_submit_result(const char * const roomjid) g_string_free(form_recipient, TRUE); if (form_window) { - num = wins_get_num(form_window); + int num = wins_get_num(form_window); wins_close_by_num(num); } @@ -2617,13 +2614,12 @@ ui_handle_room_config_submit_result(const char * const roomjid) } void -ui_handle_room_config_submit_result_error(const char * const roomjid, const char * const message) +ui_handle_room_config_submit_result_error(const char *const roomjid, const char *const message) { ProfWin *console = wins_get_console(); - ProfWin *muc_window = NULL; - ProfWin *form_window = NULL; - if (roomjid) { + ProfWin *muc_window = NULL; + ProfWin *form_window = NULL; muc_window = (ProfWin*)wins_get_muc(roomjid); GString *form_recipient = g_string_new(roomjid); @@ -2759,7 +2755,7 @@ ui_show_lines(ProfWin *window, const gchar** lines) } void -ui_room_update_occupants(const char * const roomjid) +ui_room_update_occupants(const char *const roomjid) { ProfWin *window = (ProfWin*)wins_get_muc(roomjid); if (window && win_has_active_subwin(window)) { @@ -2768,7 +2764,7 @@ ui_room_update_occupants(const char * const roomjid) } void -ui_room_show_occupants(const char * const roomjid) +ui_room_show_occupants(const char *const roomjid) { ProfWin *window = (ProfWin*)wins_get_muc(roomjid); if (window && !win_has_active_subwin(window)) { @@ -2778,7 +2774,7 @@ ui_room_show_occupants(const char * const roomjid) } void -ui_room_hide_occupants(const char * const roomjid) +ui_room_hide_occupants(const char *const roomjid) { ProfWin *window = (ProfWin*)wins_get_muc(roomjid); if (window && win_has_active_subwin(window)) { @@ -2806,7 +2802,7 @@ ui_hide_roster(void) } void -ui_handle_software_version_error(const char * const roomjid, const char * const message) +ui_handle_software_version_error(const char *const roomjid, const char *const message) { GString *message_str = g_string_new(""); @@ -2824,8 +2820,8 @@ ui_handle_software_version_error(const char * const roomjid, const char * const } void -ui_show_software_version(const char * const jid, const char * const presence, - const char * const name, const char * const version, const char * const os) +ui_show_software_version(const char *const jid, const char *const presence, + const char *const name, const char *const version, const char *const os) { Jid *jidp = jid_create(jid); ProfWin *window = NULL; @@ -2875,7 +2871,7 @@ ui_show_software_version(const char * const jid, const char * const presence, } static void -_win_show_history(ProfChatWin *chatwin, const char * const contact) +_win_show_history(ProfChatWin *chatwin, const char *const contact) { if (!chatwin->history_shown) { Jid *jid = jid_create(jabber_get_fulljid()); @@ -2903,4 +2899,3 @@ _win_show_history(ProfChatWin *chatwin, const char * const contact) g_slist_free_full(history, free); } } - diff --git a/src/ui/inputwin.c b/src/ui/inputwin.c index 43e2a3a7..8faa2082 100644 --- a/src/ui/inputwin.c +++ b/src/ui/inputwin.c @@ -129,7 +129,7 @@ create_input_window(void) _inp_win_update_virtual(); } -char * +char* inp_readline(void) { free(inp_line); @@ -225,7 +225,7 @@ inp_close(void) rl_callback_handler_remove(); } -char * +char* inp_get_line(void) { werase(inp_win); diff --git a/src/ui/inputwin.h b/src/ui/inputwin.h index 4f732e67..25faba38 100644 --- a/src/ui/inputwin.h +++ b/src/ui/inputwin.h @@ -47,6 +47,6 @@ void inp_win_clear(void); void inp_win_resize(void); void inp_put_back(void); char* inp_get_password(void); -char * inp_get_line(void); +char* inp_get_line(void); #endif diff --git a/src/ui/notifier.c b/src/ui/notifier.c index 12367190..3c24324f 100644 --- a/src/ui/notifier.c +++ b/src/ui/notifier.c @@ -51,7 +51,7 @@ #include "window_list.h" #include "config/preferences.h" -static void _notify(const char * const message, int timeout, const char * const category); +static void _notify(const char *const message, int timeout, const char *const category); static GTimer *remind_timer; @@ -73,7 +73,7 @@ notifier_uninit(void) } void -notify_typing(const char * const handle) +notify_typing(const char *const handle) { char message[strlen(handle) + 1 + 11]; sprintf(message, "%s: typing...", handle); @@ -82,8 +82,8 @@ notify_typing(const char * const handle) } void -notify_invite(const char * const from, const char * const room, - const char * const reason) +notify_invite(const char *const from, const char *const room, + const char *const reason) { GString *message = g_string_new("Room invite\nfrom: "); g_string_append(message, from); @@ -99,7 +99,7 @@ notify_invite(const char * const from, const char * const room, } void -notify_message(ProfWin *window, const char * const name, const char * const text) +notify_message(ProfWin *window, const char *const name, const char *const text) { int num = wins_get_num(window); if (num == 10) { @@ -121,7 +121,7 @@ notify_message(ProfWin *window, const char * const name, const char * const text } void -notify_room_message(const char * const handle, const char * const room, int win, const char * const text) +notify_room_message(const char *const handle, const char *const room, int win, const char *const text) { GString *message = g_string_new(""); g_string_append_printf(message, "%s in %s (win %d)", handle, room, win); @@ -135,7 +135,7 @@ notify_room_message(const char * const handle, const char * const room, int win, } void -notify_subscription(const char * const from) +notify_subscription(const char *const from) { GString *message = g_string_new("Subscription request: \n"); g_string_append(message, from); @@ -195,8 +195,7 @@ notify_remind(void) } static void -_notify(const char * const message, int timeout, - const char * const category) +_notify(const char *const message, int timeout, const char *const category) { #ifdef HAVE_LIBNOTIFY log_debug("Attempting notification: %s", message); diff --git a/src/ui/occupantswin.c b/src/ui/occupantswin.c index fe4a600c..36447437 100644 --- a/src/ui/occupantswin.c +++ b/src/ui/occupantswin.c @@ -62,7 +62,7 @@ _occuptantswin_occupant(ProfLayoutSplit *layout, Occupant *occupant, gboolean sh } void -occupantswin_occupants(const char * const roomjid) +occupantswin_occupants(const char *const roomjid) { ProfMucWin *mucwin = wins_get_muc(roomjid); if (mucwin) { diff --git a/src/ui/rosterwin.c b/src/ui/rosterwin.c index e48be866..d7d4012d 100644 --- a/src/ui/rosterwin.c +++ b/src/ui/rosterwin.c @@ -82,7 +82,7 @@ _rosterwin_contact(ProfLayoutSplit *layout, PContact contact) } static void -_rosterwin_contacts_by_presence(ProfLayoutSplit *layout, const char * const presence, char *title) +_rosterwin_contacts_by_presence(ProfLayoutSplit *layout, const char *const presence, char *title) { GSList *contacts = roster_get_contacts_by_presence(presence); diff --git a/src/ui/statusbar.c b/src/ui/statusbar.c index 47aa1b1a..5156aae2 100644 --- a/src/ui/statusbar.c +++ b/src/ui/statusbar.c @@ -304,7 +304,7 @@ status_bar_get_password(void) } void -status_bar_print_message(const char * const msg) +status_bar_print_message(const char *const msg) { werase(status_bar); diff --git a/src/ui/statusbar.h b/src/ui/statusbar.h index c37f43f3..d014274e 100644 --- a/src/ui/statusbar.h +++ b/src/ui/statusbar.h @@ -41,7 +41,7 @@ void status_bar_resize(void); void status_bar_clear(void); void status_bar_clear_message(void); void status_bar_get_password(void); -void status_bar_print_message(const char * const msg); +void status_bar_print_message(const char *const msg); void status_bar_current(int i); #endif diff --git a/src/ui/ui.h b/src/ui/ui.h index b7c7a8ae..16bdfa0b 100644 --- a/src/ui/ui.h +++ b/src/ui/ui.h @@ -62,146 +62,146 @@ GSList* ui_get_chat_recipients(void); void ui_switch_win(ProfWin *window); void ui_sigwinch_handler(int sig); -void ui_gone_secure(const char * const barejid, gboolean trusted); -void ui_gone_insecure(const char * const barejid); -void ui_trust(const char * const barejid); -void ui_untrust(const char * const barejid); -void ui_smp_recipient_initiated(const char * const barejid); -void ui_smp_recipient_initiated_q(const char * const barejid, const char *question); +void ui_gone_secure(const char *const barejid, gboolean trusted); +void ui_gone_insecure(const char *const barejid); +void ui_trust(const char *const barejid); +void ui_untrust(const char *const barejid); +void ui_smp_recipient_initiated(const char *const barejid); +void ui_smp_recipient_initiated_q(const char *const barejid, const char *question); -void ui_smp_successful(const char * const barejid); -void ui_smp_unsuccessful_sender(const char * const barejid); -void ui_smp_unsuccessful_receiver(const char * const barejid); -void ui_smp_aborted(const char * const barejid); +void ui_smp_successful(const char *const barejid); +void ui_smp_unsuccessful_sender(const char *const barejid); +void ui_smp_unsuccessful_receiver(const char *const barejid); +void ui_smp_aborted(const char *const barejid); -void ui_smp_answer_success(const char * const barejid); -void ui_smp_answer_failure(const char * const barejid); +void ui_smp_answer_success(const char *const barejid); +void ui_smp_answer_failure(const char *const barejid); -void ui_otr_authenticating(const char * const barejid); -void ui_otr_authetication_waiting(const char * const recipient); +void ui_otr_authenticating(const char *const barejid); +void ui_otr_authetication_waiting(const char *const recipient); -void ui_handle_otr_error(const char * const barejid, const char * const message); +void ui_handle_otr_error(const char *const barejid, const char *const message); unsigned long ui_get_idle_time(void); void ui_reset_idle_time(void); -ProfPrivateWin* ui_new_private_win(const char * const fulljid); -ProfChatWin* ui_new_chat_win(const char * const barejid); -void ui_print_system_msg_from_recipient(const char * const barejid, const char *message); +ProfPrivateWin* ui_new_private_win(const char *const fulljid); +ProfChatWin* ui_new_chat_win(const char *const barejid); +void ui_print_system_msg_from_recipient(const char *const barejid, const char *message); gint ui_unread(void); void ui_close_connected_win(int index); int ui_close_all_wins(void); int ui_close_read_wins(void); // current window actions -void ui_current_print_line(const char * const msg, ...); -void ui_current_print_formatted_line(const char show_char, int attrs, const char * const msg, ...); -void ui_current_error_line(const char * const msg); -void ui_win_error_line(ProfWin *window, const char * const msg); +void ui_current_print_line(const char *const msg, ...); +void ui_current_print_formatted_line(const char show_char, int attrs, const char *const msg, ...); +void ui_current_error_line(const char *const msg); +void ui_win_error_line(ProfWin *window, const char *const msg); win_type_t ui_win_type(int index); void ui_close_win(int index); int ui_win_unread(int index); -char * ui_ask_password(void); -char * ui_get_line(void); -char * ui_ask_pgp_passphrase(const char *hint, int prev_fail); +char* ui_ask_password(void); +char* ui_get_line(void); +char* ui_ask_pgp_passphrase(const char *hint, int prev_fail); -void ui_handle_stanza(const char * const msg); +void ui_handle_stanza(const char *const msg); // ui events void ui_contact_online(char *barejid, Resource *resource, GDateTime *last_activity); -void ui_contact_typing(const char * const barejid, const char * const resource); -void ui_incoming_msg(ProfChatWin *chatwin, const char * const resource, const char * const message, GDateTime *timestamp, gboolean win_created, prof_enc_t enc_mode); -void ui_incoming_private_msg(const char * const fulljid, const char * const message, GDateTime *timestamp); -void ui_message_receipt(const char * const barejid, const char * const id); +void ui_contact_typing(const char *const barejid, const char *const resource); +void ui_incoming_msg(ProfChatWin *chatwin, const char *const resource, const char *const message, GDateTime *timestamp, gboolean win_created, prof_enc_t enc_mode); +void ui_incoming_private_msg(const char *const fulljid, const char *const message, GDateTime *timestamp); +void ui_message_receipt(const char *const barejid, const char *const id); void ui_disconnected(void); -void ui_recipient_gone(const char * const barejid, const char * const resource); +void ui_recipient_gone(const char *const barejid, const char *const resource); -void ui_outgoing_chat_msg(ProfChatWin *chatwin, const char * const message, char *id, prof_enc_t enc_mode); -void ui_outgoing_chat_msg_carbon(const char * const barejid, const char * const message); -void ui_outgoing_private_msg(ProfPrivateWin *privwin, const char * const message); +void ui_outgoing_chat_msg(ProfChatWin *chatwin, const char *const message, char *id, prof_enc_t enc_mode); +void ui_outgoing_chat_msg_carbon(const char *const barejid, const char *const message); +void ui_outgoing_private_msg(ProfPrivateWin *privwin, const char *const message); -void ui_room_join(const char * const roomjid, gboolean focus); -void ui_switch_to_room(const char * const roomjid); +void ui_room_join(const char *const roomjid, gboolean focus); +void ui_switch_to_room(const char *const roomjid); -void ui_room_role_change(const char * const roomjid, const char * const role, const char * const actor, - const char * const reason); -void ui_room_affiliation_change(const char * const roomjid, const char * const affiliation, const char * const actor, - const char * const reason); -void ui_room_role_and_affiliation_change(const char * const roomjid, const char * const role, - const char * const affiliation, const char * const actor, const char * const reason); -void ui_room_occupant_role_change(const char * const roomjid, const char * const nick, const char * const role, - const char * const actor, const char * const reason); -void ui_room_occupant_affiliation_change(const char * const roomjid, const char * const nick, const char * const affiliation, - const char * const actor, const char * const reason); -void ui_room_occupant_role_and_affiliation_change(const char * const roomjid, const char * const nick, const char * const role, - const char * const affiliation, const char * const actor, const char * const reason); -void ui_room_roster(const char * const roomjid, GList *occupants, const char * const presence); -void ui_room_history(const char * const roomjid, const char * const nick, - GDateTime *timestamp, const char * const message); -void ui_room_message(const char * const roomjid, const char * const nick, - const char * const message); -void ui_room_subject(const char * const roomjid, const char * const nick, const char * const subject); -void ui_room_requires_config(const char * const roomjid); -void ui_room_destroy(const char * const roomjid); +void ui_room_role_change(const char *const roomjid, const char *const role, const char *const actor, + const char *const reason); +void ui_room_affiliation_change(const char *const roomjid, const char *const affiliation, const char *const actor, + const char *const reason); +void ui_room_role_and_affiliation_change(const char *const roomjid, const char *const role, + const char *const affiliation, const char *const actor, const char *const reason); +void ui_room_occupant_role_change(const char *const roomjid, const char *const nick, const char *const role, + const char *const actor, const char *const reason); +void ui_room_occupant_affiliation_change(const char *const roomjid, const char *const nick, const char *const affiliation, + const char *const actor, const char *const reason); +void ui_room_occupant_role_and_affiliation_change(const char *const roomjid, const char *const nick, const char *const role, + const char *const affiliation, const char *const actor, const char *const reason); +void ui_room_roster(const char *const roomjid, GList *occupants, const char *const presence); +void ui_room_history(const char *const roomjid, const char *const nick, + GDateTime *timestamp, const char *const message); +void ui_room_message(const char *const roomjid, const char *const nick, + const char *const message); +void ui_room_subject(const char *const roomjid, const char *const nick, const char *const subject); +void ui_room_requires_config(const char *const roomjid); +void ui_room_destroy(const char *const roomjid); void ui_show_room_info(ProfMucWin *mucwin); void ui_show_room_role_list(ProfMucWin *mucwin, muc_role_t role); void ui_show_room_affiliation_list(ProfMucWin *mucwin, muc_affiliation_t affiliation); -void ui_handle_room_info_error(const char * const roomjid, const char * const error); -void ui_show_room_disco_info(const char * const roomjid, GSList *identities, GSList *features); -void ui_room_destroyed(const char * const roomjid, const char * const reason, const char * const new_jid, - const char * const password); -void ui_room_kicked(const char * const roomjid, const char * const actor, const char * const reason); -void ui_room_member_kicked(const char * const roomjid, const char * const nick, const char * const actor, - const char * const reason); -void ui_room_banned(const char * const roomjid, const char * const actor, const char * const reason); -void ui_room_member_banned(const char * const roomjid, const char * const nick, const char * const actor, - const char * const reason); -void ui_leave_room(const char * const roomjid); -void ui_room_broadcast(const char * const roomjid, - const char * const message); -void ui_room_member_offline(const char * const roomjid, const char * const nick); -void ui_room_member_online(const char * const roomjid, const char * const nick, const char * const roles, - const char * const affiliation, const char * const show, const char * const status); -void ui_room_member_nick_change(const char * const roomjid, - const char * const old_nick, const char * const nick); -void ui_room_nick_change(const char * const roomjid, const char * const nick); -void ui_room_member_presence(const char * const roomjid, - const char * const nick, const char * const show, const char * const status); -void ui_room_update_occupants(const char * const roomjid); -void ui_room_show_occupants(const char * const roomjid); -void ui_room_hide_occupants(const char * const roomjid); +void ui_handle_room_info_error(const char *const roomjid, const char *const error); +void ui_show_room_disco_info(const char *const roomjid, GSList *identities, GSList *features); +void ui_room_destroyed(const char *const roomjid, const char *const reason, const char *const new_jid, + const char *const password); +void ui_room_kicked(const char *const roomjid, const char *const actor, const char *const reason); +void ui_room_member_kicked(const char *const roomjid, const char *const nick, const char *const actor, + const char *const reason); +void ui_room_banned(const char *const roomjid, const char *const actor, const char *const reason); +void ui_room_member_banned(const char *const roomjid, const char *const nick, const char *const actor, + const char *const reason); +void ui_leave_room(const char *const roomjid); +void ui_room_broadcast(const char *const roomjid, + const char *const message); +void ui_room_member_offline(const char *const roomjid, const char *const nick); +void ui_room_member_online(const char *const roomjid, const char *const nick, const char *const roles, + const char *const affiliation, const char *const show, const char *const status); +void ui_room_member_nick_change(const char *const roomjid, + const char *const old_nick, const char *const nick); +void ui_room_nick_change(const char *const roomjid, const char *const nick); +void ui_room_member_presence(const char *const roomjid, + const char *const nick, const char *const show, const char *const status); +void ui_room_update_occupants(const char *const roomjid); +void ui_room_show_occupants(const char *const roomjid); +void ui_room_hide_occupants(const char *const roomjid); void ui_show_roster(void); void ui_hide_roster(void); -void ui_roster_add(const char * const barejid, const char * const name); -void ui_roster_remove(const char * const barejid); -void ui_contact_already_in_group(const char * const contact, const char * const group); -void ui_contact_not_in_group(const char * const contact, const char * const group); -void ui_group_added(const char * const contact, const char * const group); -void ui_group_removed(const char * const contact, const char * const group); +void ui_roster_add(const char *const barejid, const char *const name); +void ui_roster_remove(const char *const barejid); +void ui_contact_already_in_group(const char *const contact, const char *const group); +void ui_contact_not_in_group(const char *const contact, const char *const group); +void ui_group_added(const char *const contact, const char *const group); +void ui_group_removed(const char *const contact, const char *const group); void ui_chat_win_contact_online(PContact contact, Resource *resource, GDateTime *last_activity); void ui_chat_win_contact_offline(PContact contact, char *resource, char *status); void ui_contact_offline(char *barejid, char *resource, char *status); -void ui_handle_recipient_not_found(const char * const recipient, const char * const err_msg); -void ui_handle_recipient_error(const char * const recipient, const char * const err_msg); -void ui_handle_error(const char * const err_msg); +void ui_handle_recipient_not_found(const char *const recipient, const char *const err_msg); +void ui_handle_recipient_error(const char *const recipient, const char *const err_msg); +void ui_handle_error(const char *const err_msg); void ui_clear_win_title(void); void ui_goodbye_title(void); -void ui_handle_room_join_error(const char * const roomjid, const char * const err); -void ui_handle_room_configuration(const char * const roomjid, DataForm *form); -void ui_handle_room_configuration_form_error(const char * const roomjid, const char * const message); -void ui_handle_room_config_submit_result(const char * const roomjid); -void ui_handle_room_config_submit_result_error(const char * const roomjid, const char * const message); -void ui_handle_room_affiliation_list_error(const char * const roomjid, const char * const affiliation, - const char * const error); -void ui_handle_room_affiliation_list(const char * const roomjid, const char * const affiliation, GSList *jids); -void ui_handle_room_affiliation_set_error(const char * const roomjid, const char * const jid, - const char * const affiliation, const char * const error); -void ui_handle_room_role_set_error(const char * const roomjid, const char * const nick, const char * const role, - const char * const error); -void ui_handle_room_role_list_error(const char * const roomjid, const char * const role, const char * const error); -void ui_handle_room_role_list(const char * const roomjid, const char * const role, GSList *nicks); -void ui_handle_room_kick_error(const char * const roomjid, const char * const nick, const char * const error); +void ui_handle_room_join_error(const char *const roomjid, const char *const err); +void ui_handle_room_configuration(const char *const roomjid, DataForm *form); +void ui_handle_room_configuration_form_error(const char *const roomjid, const char *const message); +void ui_handle_room_config_submit_result(const char *const roomjid); +void ui_handle_room_config_submit_result_error(const char *const roomjid, const char *const message); +void ui_handle_room_affiliation_list_error(const char *const roomjid, const char *const affiliation, + const char *const error); +void ui_handle_room_affiliation_list(const char *const roomjid, const char *const affiliation, GSList *jids); +void ui_handle_room_affiliation_set_error(const char *const roomjid, const char *const jid, + const char *const affiliation, const char *const error); +void ui_handle_room_role_set_error(const char *const roomjid, const char *const nick, const char *const role, + const char *const error); +void ui_handle_room_role_list_error(const char *const roomjid, const char *const role, const char *const error); +void ui_handle_room_role_list(const char *const roomjid, const char *const role, GSList *nicks); +void ui_handle_room_kick_error(const char *const roomjid, const char *const nick, const char *const error); void ui_show_form(ProfMucConfWin *confwin); void ui_show_form_field(ProfWin *window, DataForm *form, char *tag); void ui_show_form_help(ProfMucConfWin *confwin); @@ -210,10 +210,10 @@ void ui_show_lines(ProfWin *window, const gchar** lines); void ui_redraw_all_room_rosters(void); void ui_show_all_room_rosters(void); void ui_hide_all_room_rosters(void); -gboolean ui_chat_win_exists(const char * const barejid); -void ui_handle_software_version_error(const char * const roomjid, const char * const message); -void ui_show_software_version(const char * const jid, const char * const presence, - const char * const name, const char * const version, const char * const os); +gboolean ui_chat_win_exists(const char *const barejid); +void ui_handle_software_version_error(const char *const roomjid, const char *const message); +void ui_show_software_version(const char *const jid, const char *const presence, + const char *const name, const char *const version, const char *const os); gboolean ui_tidy_wins(void); void ui_prune_wins(void); @@ -229,7 +229,7 @@ void ui_auto_away(char *message, gint time, resource_presence_t res_presence); void ui_titlebar_presence(contact_presence_t presence); void ui_handle_login_account_success(ProfAccount *account, int secured); void ui_update_presence(const resource_presence_t resource_presence, - const char * const message, const char * const show); + const char *const message, const char *const show); void ui_about(void); void ui_statusbar_new(const int win); @@ -238,7 +238,7 @@ void ui_input_clear(void); void ui_input_nonblocking(gboolean); void ui_write(char *line, int offset); -void ui_invalid_command_usage(const char * const cmd, void (*setting_func)(void)); +void ui_invalid_command_usage(const char *const cmd, void (*setting_func)(void)); void ui_create_xmlconsole_win(void); gboolean ui_xmlconsole_exists(void); @@ -249,12 +249,12 @@ gboolean ui_win_has_unsaved_form(int num); void ui_inp_history_append(char *inp); // console window actions -void cons_show(const char * const msg, ...); -void cons_show_padded(int pad, const char * const msg, ...); +void cons_show(const char *const msg, ...); +void cons_show_padded(int pad, const char *const msg, ...); void cons_about(void); void cons_help(void); void cons_show_help(Command *command); -void cons_bad_cmd_usage(const char * const cmd); +void cons_bad_cmd_usage(const char *const cmd); void cons_navigation_help(void); void cons_prefs(void); void cons_show_ui_prefs(void); @@ -266,35 +266,35 @@ void cons_show_connection_prefs(void); void cons_show_otr_prefs(void); void cons_show_pgp_prefs(void); void cons_show_account(ProfAccount *account); -void cons_debug(const char * const msg, ...); +void cons_debug(const char *const msg, ...); void cons_show_time(void); -void cons_show_word(const char * const word); -void cons_show_error(const char * const cmd, ...); -void cons_show_contacts(GSList * list); -void cons_show_roster(GSList * list); -void cons_show_roster_group(const char * const group, GSList * list); +void cons_show_word(const char *const word); +void cons_show_error(const char *const cmd, ...); +void cons_show_contacts(GSList *list); +void cons_show_roster(GSList *list); +void cons_show_roster_group(const char *const group, GSList *list); void cons_show_wins(void); -void cons_show_status(const char * const barejid); +void cons_show_status(const char *const barejid); void cons_show_info(PContact pcontact); -void cons_show_caps(const char * const fulljid, resource_presence_t presence); +void cons_show_caps(const char *const fulljid, resource_presence_t presence); void cons_show_themes(GSList *themes); void cons_show_scripts(GSList *scripts); void cons_show_script(const char *const script, GSList *commands); void cons_show_aliases(GList *aliases); void cons_show_login_success(ProfAccount *account, int secured); -void cons_show_software_version(const char * const jid, - const char * const presence, const char * const name, - const char * const version, const char * const os); +void cons_show_software_version(const char *const jid, + const char *const presence, const char *const name, + const char *const version, const char *const os); void cons_show_account_list(gchar **accounts); -void cons_show_room_list(GSList *room, const char * const conference_node); +void cons_show_room_list(GSList *room, const char *const conference_node); void cons_show_bookmarks(const GList *list); -void cons_show_disco_items(GSList *items, const char * const jid); +void cons_show_disco_items(GSList *items, const char *const jid); void cons_show_disco_info(const char *from, GSList *identities, GSList *features); -void cons_show_room_invite(const char * const invitor, const char * const room, - const char * const reason); +void cons_show_room_invite(const char *const invitor, const char *const room, + const char *const reason); void cons_check_version(gboolean not_available_msg); -void cons_show_typing(const char * const barejid); -void cons_show_incoming_message(const char * const short_from, const int win_index); +void cons_show_typing(const char *const barejid); +void cons_show_incoming_message(const char *const short_from, const int win_index); void cons_show_room_invites(GSList *invites); void cons_show_received_subs(void); void cons_show_sent_subs(void); @@ -348,15 +348,15 @@ void status_bar_set_all_inactive(void); void rosterwin_roster(void); // occupants window -void occupantswin_occupants(const char * const room); +void occupantswin_occupants(const char *const room); // window interface ProfWin* win_create_console(void); ProfWin* win_create_xmlconsole(void); -ProfWin* win_create_chat(const char * const barejid); -ProfWin* win_create_muc(const char * const roomjid); -ProfWin* win_create_muc_config(const char * const title, DataForm *form); -ProfWin* win_create_private(const char * const fulljid); +ProfWin* win_create_chat(const char *const barejid); +ProfWin* win_create_muc(const char *const roomjid); +ProfWin* win_create_muc_config(const char *const title, DataForm *form); +ProfWin* win_create_private(const char *const fulljid); void win_update_virtual(ProfWin *window); void win_free(ProfWin *window); @@ -366,26 +366,26 @@ void win_hide_subwin(ProfWin *window); void win_show_subwin(ProfWin *window); void win_refresh_without_subwin(ProfWin *window); void win_refresh_with_subwin(ProfWin *window); -void win_print(ProfWin *window, const char show_char, int pad_indent, GDateTime *timestamp, int flags, theme_item_t theme_item, const char * const from, const char * const message); -void win_vprint(ProfWin *window, const char show_char, int pad_indent, GDateTime *timestamp, int flags, theme_item_t theme_item, const char * const from, const char * const message, ...); +void win_print(ProfWin *window, const char show_char, int pad_indent, GDateTime *timestamp, int flags, theme_item_t theme_item, const char *const from, const char *const message); +void win_vprint(ProfWin *window, const char show_char, int pad_indent, GDateTime *timestamp, int flags, theme_item_t theme_item, const char *const from, const char *const message, ...); char* win_get_title(ProfWin *window); void win_show_occupant(ProfWin *window, Occupant *occupant); -void win_show_occupant_info(ProfWin *window, const char * const room, Occupant *occupant); +void win_show_occupant_info(ProfWin *window, const char *const room, Occupant *occupant); void win_show_contact(ProfWin *window, PContact contact); void win_show_info(ProfWin *window, PContact contact); -void win_println(ProfWin *window, int pad, const char * const message); +void win_println(ProfWin *window, int pad, const char *const message); // desktop notifier actions void notifier_initialise(void); void notifier_uninit(void); -void notify_typing(const char * const handle); -void notify_message(ProfWin *window, const char * const name, const char * const text); -void notify_room_message(const char * const handle, const char * const room, - int win, const char * const text); +void notify_typing(const char *const handle); +void notify_message(ProfWin *window, const char *const name, const char *const text); +void notify_room_message(const char *const handle, const char *const room, + int win, const char *const text); void notify_remind(void); -void notify_invite(const char * const from, const char * const room, - const char * const reason); -void notify_subscription(const char * const from); +void notify_invite(const char *const from, const char *const room, + const char *const reason); +void notify_subscription(const char *const from); #endif diff --git a/src/ui/window.c b/src/ui/window.c index 8579b02f..2b3a9c54 100644 --- a/src/ui/window.c +++ b/src/ui/window.c @@ -60,8 +60,8 @@ #define CEILING(X) (X-(int)(X) > 0 ? (int)(X+1) : (int)(X)) static void _win_print(ProfWin *window, const char show_char, int pad_indent, GDateTime *time, - int flags, theme_item_t theme_item, const char * const from, const char * const message, DeliveryReceipt *receipt); -static void _win_print_wrapped(WINDOW *win, const char * const message, size_t indent, int pad_indent); + int flags, theme_item_t theme_item, const char *const from, const char *const message, DeliveryReceipt *receipt); +static void _win_print_wrapped(WINDOW *win, const char *const message, size_t indent, int pad_indent); int win_roster_cols(void) @@ -127,7 +127,7 @@ win_create_console(void) } ProfWin* -win_create_chat(const char * const barejid) +win_create_chat(const char *const barejid) { ProfChatWin *new_win = malloc(sizeof(ProfChatWin)); new_win->window.type = WIN_CHAT; @@ -149,7 +149,7 @@ win_create_chat(const char * const barejid) } ProfWin* -win_create_muc(const char * const roomjid) +win_create_muc(const char *const roomjid) { ProfMucWin *new_win = malloc(sizeof(ProfMucWin)); int cols = getmaxx(stdscr); @@ -192,7 +192,7 @@ win_create_muc(const char * const roomjid) } ProfWin* -win_create_muc_config(const char * const roomjid, DataForm *form) +win_create_muc_config(const char *const roomjid, DataForm *form) { ProfMucConfWin *new_win = malloc(sizeof(ProfMucConfWin)); new_win->window.type = WIN_MUC_CONFIG; @@ -207,7 +207,7 @@ win_create_muc_config(const char * const roomjid, DataForm *form) } ProfWin* -win_create_private(const char * const fulljid) +win_create_private(const char *const fulljid) { ProfPrivateWin *new_win = malloc(sizeof(ProfPrivateWin)); new_win->window.type = WIN_PRIVATE; @@ -233,7 +233,7 @@ win_create_xmlconsole(void) return &new_win->window; } -char * +char* win_get_title(ProfWin *window) { if (window == NULL) { @@ -471,12 +471,12 @@ win_clear(ProfWin *window) void win_resize(ProfWin *window) { - int subwin_cols = 0; int cols = getmaxx(stdscr); if (window->layout->type == LAYOUT_SPLIT) { ProfLayoutSplit *layout = (ProfLayoutSplit*)window->layout; if (layout->subwin) { + int subwin_cols = 0; if (window->type == WIN_CONSOLE) { subwin_cols = win_roster_cols(); } else if (window->type == WIN_MUC) { @@ -506,11 +506,11 @@ win_update_virtual(ProfWin *window) { int rows, cols; getmaxyx(stdscr, rows, cols); - int subwin_cols = 0; if (window->layout->type == LAYOUT_SPLIT) { ProfLayoutSplit *layout = (ProfLayoutSplit*)window->layout; if (layout->subwin) { + int subwin_cols = 0; if (window->type == WIN_MUC) { subwin_cols = win_occpuants_cols(); } else { @@ -634,7 +634,7 @@ win_show_contact(ProfWin *window, PContact contact) } void -win_show_occupant_info(ProfWin *window, const char * const room, Occupant *occupant) +win_show_occupant_info(ProfWin *window, const char *const room, Occupant *occupant) { const char *presence_str = string_from_resource_presence(occupant->presence); const char *occupant_affiliation = muc_occupant_affiliation_str(occupant); @@ -828,10 +828,10 @@ win_show_info(ProfWin *window, PContact contact) } void -win_show_status_string(ProfWin *window, const char * const from, - const char * const show, const char * const status, - GDateTime *last_activity, const char * const pre, - const char * const default_show) +win_show_status_string(ProfWin *window, const char *const from, + const char *const show, const char *const status, + GDateTime *last_activity, const char *const pre, + const char *const default_show) { theme_item_t presence_colour; @@ -872,7 +872,7 @@ win_show_status_string(ProfWin *window, const char * const from, void win_print_incoming_message(ProfWin *window, GDateTime *timestamp, - const char * const from, const char * const message, prof_enc_t enc_mode) + const char *const from, const char *const message, prof_enc_t enc_mode) { char enc_char = '-'; @@ -897,7 +897,7 @@ win_print_incoming_message(ProfWin *window, GDateTime *timestamp, void win_vprint(ProfWin *window, const char show_char, int pad_indent, GDateTime *timestamp, - int flags, theme_item_t theme_item, const char * const from, const char * const message, ...) + int flags, theme_item_t theme_item, const char *const from, const char *const message, ...) { va_list arg; va_start(arg, message); @@ -905,11 +905,12 @@ win_vprint(ProfWin *window, const char show_char, int pad_indent, GDateTime *tim g_string_vprintf(fmt_msg, message, arg); win_print(window, show_char, pad_indent, timestamp, flags, theme_item, from, fmt_msg->str); g_string_free(fmt_msg, TRUE); + va_end(arg); } void win_print(ProfWin *window, const char show_char, int pad_indent, GDateTime *timestamp, - int flags, theme_item_t theme_item, const char * const from, const char * const message) + int flags, theme_item_t theme_item, const char *const from, const char *const message) { if (timestamp == NULL) { timestamp = g_date_time_new_now_local(); @@ -926,7 +927,7 @@ win_print(ProfWin *window, const char show_char, int pad_indent, GDateTime *time void win_print_with_receipt(ProfWin *window, const char show_char, int pad_indent, GTimeVal *tstamp, - int flags, theme_item_t theme_item, const char * const from, const char * const message, char *id) + int flags, theme_item_t theme_item, const char *const from, const char *const message, char *id) { GDateTime *time; @@ -948,7 +949,7 @@ win_print_with_receipt(ProfWin *window, const char show_char, int pad_indent, GT } void -win_mark_received(ProfWin *window, const char * const id) +win_mark_received(ProfWin *window, const char *const id) { gboolean received = buffer_mark_received(window->layout->buffer, id); if (received) { @@ -957,7 +958,7 @@ win_mark_received(ProfWin *window, const char * const id) } void -win_println(ProfWin *window, int pad, const char * const message) +win_println(ProfWin *window, int pad, const char *const message) { win_print(window, '-', pad, NULL, 0, 0, "", message); } @@ -970,7 +971,7 @@ win_newline(ProfWin *window) static void _win_print(ProfWin *window, const char show_char, int pad_indent, GDateTime *time, - int flags, theme_item_t theme_item, const char * const from, const char * const message, DeliveryReceipt *receipt) + int flags, theme_item_t theme_item, const char *const from, const char *const message, DeliveryReceipt *receipt) { // flags : 1st bit = 0/1 - me/not me // 2nd bit = 0/1 - date/no date @@ -1097,7 +1098,7 @@ _win_indent(WINDOW *win, int size) } static void -_win_print_wrapped(WINDOW *win, const char * const message, size_t indent, int pad_indent) +_win_print_wrapped(WINDOW *win, const char *const message, size_t indent, int pad_indent) { int starty = getcury(win); int wordi = 0; diff --git a/src/ui/window.h b/src/ui/window.h index 603f1cc3..07191fc0 100644 --- a/src/ui/window.h +++ b/src/ui/window.h @@ -55,20 +55,20 @@ #define PAD_SIZE 1000 void win_move_to_end(ProfWin *window); -void win_show_status_string(ProfWin *window, const char * const from, - const char * const show, const char * const status, - GDateTime *last_activity, const char * const pre, - const char * const default_show); +void win_show_status_string(ProfWin *window, const char *const from, + const char *const show, const char *const status, + GDateTime *last_activity, const char *const pre, + const char *const default_show); void win_print_incoming_message(ProfWin *window, GDateTime *timestamp, - const char * const from, const char * const message, prof_enc_t enc_mode); + const char *const from, const char *const message, prof_enc_t enc_mode); void win_print_with_receipt(ProfWin *window, const char show_char, int pad_indent, GTimeVal *tstamp, int flags, - theme_item_t theme_item, const char * const from, const char * const message, char *id); + theme_item_t theme_item, const char *const from, const char *const message, char *id); void win_newline(ProfWin *window); void win_redraw(ProfWin *window); int win_roster_cols(void); int win_occpuants_cols(void); void win_printline_nowrap(WINDOW *win, char *msg); -void win_mark_received(ProfWin *window, const char * const id); +void win_mark_received(ProfWin *window, const char *const id); gboolean win_has_active_subwin(ProfWin *window); diff --git a/src/window_list.c b/src/window_list.c index a300bd82..ad43f888 100644 --- a/src/window_list.c +++ b/src/window_list.c @@ -63,14 +63,14 @@ wins_init(void) current = 1; } -ProfWin * +ProfWin* wins_get_console(void) { return g_hash_table_lookup(windows, GINT_TO_POINTER(1)); } -ProfChatWin * -wins_get_chat(const char * const barejid) +ProfChatWin* +wins_get_chat(const char *const barejid) { GList *values = g_hash_table_get_values(windows); GList *curr = values; @@ -91,8 +91,8 @@ wins_get_chat(const char * const barejid) return NULL; } -ProfMucConfWin * -wins_get_muc_conf(const char * const roomjid) +ProfMucConfWin* +wins_get_muc_conf(const char *const roomjid) { GList *values = g_hash_table_get_values(windows); GList *curr = values; @@ -113,8 +113,8 @@ wins_get_muc_conf(const char * const roomjid) return NULL; } -ProfMucWin * -wins_get_muc(const char * const roomjid) +ProfMucWin* +wins_get_muc(const char *const roomjid) { GList *values = g_hash_table_get_values(windows); GList *curr = values; @@ -135,8 +135,8 @@ wins_get_muc(const char * const roomjid) return NULL; } -ProfPrivateWin * -wins_get_private(const char * const fulljid) +ProfPrivateWin* +wins_get_private(const char *const fulljid) { GList *values = g_hash_table_get_values(windows); GList *curr = values; @@ -157,7 +157,7 @@ wins_get_private(const char * const fulljid) return NULL; } -ProfWin * +ProfWin* wins_get_current(void) { if (windows) { @@ -167,7 +167,7 @@ wins_get_current(void) } } -GList * +GList* wins_get_nums(void) { return g_hash_table_get_keys(windows); @@ -194,13 +194,13 @@ wins_set_current_by_num(int i) } } -ProfWin * +ProfWin* wins_get_by_num(int i) { return g_hash_table_lookup(windows, GINT_TO_POINTER(i)); } -ProfWin * +ProfWin* wins_get_next(void) { // get and sort win nums @@ -229,7 +229,7 @@ wins_get_next(void) } } -ProfWin * +ProfWin* wins_get_previous(void) { // get and sort win nums @@ -321,7 +321,7 @@ wins_is_current(ProfWin *window) } } -ProfWin * +ProfWin* wins_new_xmlconsole(void) { GList *keys = g_hash_table_get_keys(windows); @@ -332,8 +332,8 @@ wins_new_xmlconsole(void) return newwin; } -ProfWin * -wins_new_chat(const char * const barejid) +ProfWin* +wins_new_chat(const char *const barejid) { GList *keys = g_hash_table_get_keys(windows); int result = get_next_available_win_num(keys); @@ -343,8 +343,8 @@ wins_new_chat(const char * const barejid) return newwin; } -ProfWin * -wins_new_muc(const char * const roomjid) +ProfWin* +wins_new_muc(const char *const roomjid) { GList *keys = g_hash_table_get_keys(windows); int result = get_next_available_win_num(keys); @@ -354,8 +354,8 @@ wins_new_muc(const char * const roomjid) return newwin; } -ProfWin * -wins_new_muc_config(const char * const roomjid, DataForm *form) +ProfWin* +wins_new_muc_config(const char *const roomjid, DataForm *form) { GList *keys = g_hash_table_get_keys(windows); int result = get_next_available_win_num(keys); @@ -365,8 +365,8 @@ wins_new_muc_config(const char * const roomjid, DataForm *form) return newwin; } -ProfWin * -wins_new_private(const char * const fulljid) +ProfWin* +wins_new_private(const char *const fulljid) { GList *keys = g_hash_table_get_keys(windows); int result = get_next_available_win_num(keys); @@ -426,7 +426,7 @@ wins_show_subwin(ProfWin *window) win_refresh_with_subwin(current_win); } -ProfXMLWin * +ProfXMLWin* wins_get_xmlconsole(void) { GList *values = g_hash_table_get_values(windows); @@ -447,7 +447,7 @@ wins_get_xmlconsole(void) return NULL; } -GSList * +GSList* wins_get_chat_recipients(void) { GSList *result = NULL; @@ -466,7 +466,7 @@ wins_get_chat_recipients(void) return result; } -GSList * +GSList* wins_get_prune_wins(void) { GSList *result = NULL; @@ -620,7 +620,7 @@ wins_tidy(void) } } -GSList * +GSList* wins_create_summary(void) { GSList *result = NULL; diff --git a/src/window_list.h b/src/window_list.h index 74073bd6..e3e446f4 100644 --- a/src/window_list.h +++ b/src/window_list.h @@ -39,27 +39,27 @@ void wins_init(void); -ProfWin * wins_new_xmlconsole(void); -ProfWin * wins_new_chat(const char * const barejid); -ProfWin * wins_new_muc(const char * const roomjid); -ProfWin * wins_new_muc_config(const char * const roomjid, DataForm *form); -ProfWin * wins_new_private(const char * const fulljid); +ProfWin* wins_new_xmlconsole(void); +ProfWin* wins_new_chat(const char *const barejid); +ProfWin* wins_new_muc(const char *const roomjid); +ProfWin* wins_new_muc_config(const char *const roomjid, DataForm *form); +ProfWin* wins_new_private(const char *const fulljid); -ProfWin * wins_get_console(void); -ProfChatWin *wins_get_chat(const char * const barejid); -ProfMucWin * wins_get_muc(const char * const roomjid); -ProfMucConfWin * wins_get_muc_conf(const char * const roomjid); -ProfPrivateWin *wins_get_private(const char * const fulljid); -ProfXMLWin * wins_get_xmlconsole(void); +ProfWin* wins_get_console(void); +ProfChatWin* wins_get_chat(const char *const barejid); +ProfMucWin* wins_get_muc(const char *const roomjid); +ProfMucConfWin* wins_get_muc_conf(const char *const roomjid); +ProfPrivateWin* wins_get_private(const char *const fulljid); +ProfXMLWin* wins_get_xmlconsole(void); -ProfWin * wins_get_current(void); +ProfWin* wins_get_current(void); void wins_set_current_by_num(int i); -ProfWin * wins_get_by_num(int i); +ProfWin* wins_get_by_num(int i); -ProfWin * wins_get_next(void); -ProfWin * wins_get_previous(void); +ProfWin* wins_get_next(void); +ProfWin* wins_get_previous(void); int wins_get_num(ProfWin *window); int wins_get_current_num(void); void wins_close_current(void); @@ -67,13 +67,13 @@ void wins_close_by_num(int i); gboolean wins_is_current(ProfWin *window); int wins_get_total_unread(void); void wins_resize_all(void); -GSList * wins_get_chat_recipients(void); -GSList * wins_get_prune_wins(void); +GSList* wins_get_chat_recipients(void); +GSList* wins_get_prune_wins(void); void wins_lost_connection(void); gboolean wins_tidy(void); -GSList * wins_create_summary(void); +GSList* wins_create_summary(void); void wins_destroy(void); -GList * wins_get_nums(void); +GList* wins_get_nums(void); gboolean wins_swap(int source_win, int target_win); void wins_hide_subwin(ProfWin *window); void wins_show_subwin(ProfWin *window); diff --git a/src/xmpp/bookmark.c b/src/xmpp/bookmark.c index 3705d699..682aa2b2 100644 --- a/src/xmpp/bookmark.c +++ b/src/xmpp/bookmark.c @@ -62,10 +62,10 @@ static Autocomplete bookmark_ac; static GList *bookmark_list; -static int _bookmark_handle_result(xmpp_conn_t * const conn, - xmpp_stanza_t * const stanza, void * const userdata); -static int _bookmark_handle_delete(xmpp_conn_t * const conn, - void * const userdata); +static int _bookmark_handle_result(xmpp_conn_t *const conn, + xmpp_stanza_t *const stanza, void *const userdata); +static int _bookmark_handle_delete(xmpp_conn_t *const conn, + void *const userdata); static void _bookmark_item_destroy(gpointer item); static int _match_bookmark_by_jid(gconstpointer a, gconstpointer b); static void _send_bookmarks(void); @@ -221,14 +221,14 @@ bookmark_remove(const char *jid) } } -const GList * +const GList* bookmark_get_list(void) { return bookmark_list; } -char * -bookmark_find(const char * const search_str) +char* +bookmark_find(const char *const search_str) { return autocomplete_complete(bookmark_ac, search_str, TRUE); } @@ -242,8 +242,8 @@ bookmark_autocomplete_reset(void) } static int -_bookmark_handle_result(xmpp_conn_t * const conn, - xmpp_stanza_t * const stanza, void * const userdata) +_bookmark_handle_result(xmpp_conn_t *const conn, + xmpp_stanza_t *const stanza, void *const userdata) { xmpp_ctx_t *ctx = connection_get_ctx(); char *id = (char *)userdata; @@ -360,8 +360,8 @@ _bookmark_handle_result(xmpp_conn_t * const conn, } static int -_bookmark_handle_delete(xmpp_conn_t * const conn, - void * const userdata) +_bookmark_handle_delete(xmpp_conn_t *const conn, + void *const userdata) { char *id = (char *)userdata; diff --git a/src/xmpp/capabilities.c b/src/xmpp/capabilities.c index cdbb9e4a..b425c6f1 100644 --- a/src/xmpp/capabilities.c +++ b/src/xmpp/capabilities.c @@ -68,9 +68,9 @@ static char *my_sha1; static gchar* _get_cache_file(void); static void _save_cache(void); -static Capabilities * _caps_by_ver(const char * const ver); -static Capabilities * _caps_by_jid(const char * const jid); -Capabilities * _caps_copy(Capabilities *caps); +static Capabilities* _caps_by_ver(const char *const ver); +static Capabilities* _caps_by_jid(const char *const jid); +Capabilities* _caps_copy(Capabilities *caps); void caps_init(void) @@ -93,7 +93,7 @@ caps_init(void) } void -caps_add_by_ver(const char * const ver, Capabilities *caps) +caps_add_by_ver(const char *const ver, Capabilities *caps) { gboolean cached = g_key_file_has_group(cache, ver); if (!cached) { @@ -135,25 +135,25 @@ caps_add_by_ver(const char * const ver, Capabilities *caps) } void -caps_add_by_jid(const char * const jid, Capabilities *caps) +caps_add_by_jid(const char *const jid, Capabilities *caps) { g_hash_table_insert(jid_to_caps, strdup(jid), caps); } void -caps_map_jid_to_ver(const char * const jid, const char * const ver) +caps_map_jid_to_ver(const char *const jid, const char *const ver) { g_hash_table_insert(jid_to_ver, strdup(jid), strdup(ver)); } gboolean -caps_contains(const char * const ver) +caps_contains(const char *const ver) { return (g_key_file_has_group(cache, ver)); } -static Capabilities * -_caps_by_ver(const char * const ver) +static Capabilities* +_caps_by_ver(const char *const ver) { if (g_key_file_has_group(cache, ver)) { Capabilities *new_caps = malloc(sizeof(struct capabilities_t)); @@ -226,14 +226,14 @@ _caps_by_ver(const char * const ver) } } -static Capabilities * -_caps_by_jid(const char * const jid) +static Capabilities* +_caps_by_jid(const char *const jid) { return g_hash_table_lookup(jid_to_caps, jid); } -Capabilities * -caps_lookup(const char * const jid) +Capabilities* +caps_lookup(const char *const jid) { char *ver = g_hash_table_lookup(jid_to_ver, jid); if (ver) { @@ -254,7 +254,7 @@ caps_lookup(const char * const jid) return NULL; } -Capabilities * +Capabilities* _caps_copy(Capabilities *caps) { if (!caps) { @@ -280,8 +280,8 @@ _caps_copy(Capabilities *caps) } } -char * -caps_create_sha1_str(xmpp_stanza_t * const query) +char* +caps_create_sha1_str(xmpp_stanza_t *const query) { char *category = NULL; char *type = NULL; @@ -388,7 +388,7 @@ caps_create_sha1_str(xmpp_stanza_t * const query) return result; } -Capabilities * +Capabilities* caps_create(xmpp_stanza_t *query) { char *category = NULL; @@ -541,7 +541,7 @@ caps_create(xmpp_stanza_t *query) } char* -caps_get_my_sha1(xmpp_ctx_t * const ctx) +caps_get_my_sha1(xmpp_ctx_t *const ctx) { if (my_sha1 == NULL) { xmpp_stanza_t *query = caps_create_query_response_stanza(ctx); @@ -552,8 +552,8 @@ caps_get_my_sha1(xmpp_ctx_t * const ctx) return my_sha1; } -xmpp_stanza_t * -caps_create_query_response_stanza(xmpp_ctx_t * const ctx) +xmpp_stanza_t* +caps_create_query_response_stanza(xmpp_ctx_t *const ctx) { xmpp_stanza_t *query = xmpp_stanza_new(ctx); xmpp_stanza_set_name(query, STANZA_NAME_QUERY); @@ -674,7 +674,7 @@ caps_destroy(Capabilities *caps) } } -static gchar * +static gchar* _get_cache_file(void) { gchar *xdg_data = xdg_get_data_home(); diff --git a/src/xmpp/capabilities.h b/src/xmpp/capabilities.h index 3e281d1c..812a7eb1 100644 --- a/src/xmpp/capabilities.h +++ b/src/xmpp/capabilities.h @@ -48,14 +48,14 @@ void caps_init(void); -void caps_add_by_ver(const char * const ver, Capabilities *caps); -void caps_add_by_jid(const char * const jid, Capabilities *caps); -void caps_map_jid_to_ver(const char * const jid, const char * const ver); -gboolean caps_contains(const char * const ver); +void caps_add_by_ver(const char *const ver, Capabilities *caps); +void caps_add_by_jid(const char *const jid, Capabilities *caps); +void caps_map_jid_to_ver(const char *const jid, const char *const ver); +gboolean caps_contains(const char *const ver); -char* caps_create_sha1_str(xmpp_stanza_t * const query); -xmpp_stanza_t* caps_create_query_response_stanza(xmpp_ctx_t * const ctx); +char* caps_create_sha1_str(xmpp_stanza_t *const query); +xmpp_stanza_t* caps_create_query_response_stanza(xmpp_ctx_t *const ctx); Capabilities* caps_create(xmpp_stanza_t *query); -char* caps_get_my_sha1(xmpp_ctx_t * const ctx); +char* caps_get_my_sha1(xmpp_ctx_t *const ctx); #endif diff --git a/src/xmpp/connection.c b/src/xmpp/connection.c index 4b3ef803..27711a4c 100644 --- a/src/xmpp/connection.c +++ b/src/xmpp/connection.c @@ -95,20 +95,20 @@ static GTimer *reconnect_timer; static log_level_t _get_log_level(xmpp_log_level_t xmpp_level); static xmpp_log_level_t _get_xmpp_log_level(); -static void _xmpp_file_logger(void * const userdata, - const xmpp_log_level_t level, const char * const area, - const char * const msg); +static void _xmpp_file_logger(void *const userdata, + const xmpp_log_level_t level, const char *const area, + const char *const msg); -static xmpp_log_t * _xmpp_get_file_logger(); +static xmpp_log_t* _xmpp_get_file_logger(); -static jabber_conn_status_t _jabber_connect(const char * const fulljid, - const char * const passwd, const char * const altdomain, int port, const char *const tls_policy); +static jabber_conn_status_t _jabber_connect(const char *const fulljid, + const char *const passwd, const char *const altdomain, int port, const char *const tls_policy); static void _jabber_reconnect(void); -static void _connection_handler(xmpp_conn_t * const conn, +static void _connection_handler(xmpp_conn_t *const conn, const xmpp_conn_event_t status, const int error, - xmpp_stream_error_t * const stream_error, void * const userdata); + xmpp_stream_error_t *const stream_error, void *const userdata); void _connection_free_saved_account(void); void _connection_free_saved_details(void); @@ -131,7 +131,7 @@ jabber_init(void) } jabber_conn_status_t -jabber_connect_with_account(const ProfAccount * const account) +jabber_connect_with_account(const ProfAccount *const account) { assert(account != NULL); @@ -157,8 +157,8 @@ jabber_connect_with_account(const ProfAccount * const account) } jabber_conn_status_t -jabber_connect_with_details(const char * const jid, - const char * const passwd, const char * const altdomain, const int port, const char *const tls_policy) +jabber_connect_with_details(const char *const jid, + const char *const passwd, const char *const altdomain, const int port, const char *const tls_policy) { assert(jid != NULL); assert(passwd != NULL); @@ -271,7 +271,7 @@ jabber_process_events(int millis) } } -GList * +GList* jabber_get_available_resources(void) { return g_hash_table_get_values(available_resources); @@ -283,37 +283,37 @@ jabber_get_connection_status(void) return (jabber_conn.conn_status); } -xmpp_conn_t * +xmpp_conn_t* connection_get_conn(void) { return jabber_conn.conn; } -xmpp_ctx_t * +xmpp_ctx_t* connection_get_ctx(void) { return jabber_conn.ctx; } -const char * +const char* jabber_get_fulljid(void) { return xmpp_conn_get_jid(jabber_conn.conn); } -const char * +const char* jabber_get_domain(void) { return jabber_conn.domain; } -char * +char* jabber_get_presence_message(void) { return jabber_conn.presence_message; } -char * +char* jabber_get_account_name(void) { return saved_account.name; @@ -334,7 +334,7 @@ jabber_free_uuid(char *uuid) } void -connection_set_presence_message(const char * const message) +connection_set_presence_message(const char *const message) { FREE_SET_NULL(jabber_conn.presence_message); if (message) { @@ -355,7 +355,7 @@ connection_add_available_resource(Resource *resource) } void -connection_remove_available_resource(const char * const resource) +connection_remove_available_resource(const char *const resource) { g_hash_table_remove(available_resources, resource); } @@ -387,16 +387,16 @@ _connection_free_session_data(void) #ifdef HAVE_LIBMESODE static int -_connection_certfail_cb(const char * const certname, const char * const certfp, - char * const notbefore, const char * const notafter, const char * const errormsg) +_connection_certfail_cb(const char *const certname, const char *const certfp, + char *const notbefore, const char *const notafter, const char *const errormsg) { return sv_ev_certfail(errormsg, certname, certfp, notbefore, notafter); } #endif static jabber_conn_status_t -_jabber_connect(const char * const fulljid, const char * const passwd, - const char * const altdomain, int port, const char *const tls_policy) +_jabber_connect(const char *const fulljid, const char *const passwd, + const char *const altdomain, int port, const char *const tls_policy) { assert(fulljid != NULL); assert(passwd != NULL); @@ -488,9 +488,9 @@ _jabber_reconnect(void) } static void -_connection_handler(xmpp_conn_t * const conn, +_connection_handler(xmpp_conn_t *const conn, const xmpp_conn_event_t status, const int error, - xmpp_stream_error_t * const stream_error, void * const userdata) + xmpp_stream_error_t *const stream_error, void *const userdata) { // login success if (status == XMPP_CONN_CONNECT) { @@ -619,8 +619,8 @@ _get_xmpp_log_level() } static void -_xmpp_file_logger(void * const userdata, const xmpp_log_level_t level, - const char * const area, const char * const msg) +_xmpp_file_logger(void *const userdata, const xmpp_log_level_t level, + const char *const area, const char *const msg) { log_level_t prof_level = _get_log_level(level); log_msg(prof_level, area, msg); @@ -629,7 +629,7 @@ _xmpp_file_logger(void * const userdata, const xmpp_log_level_t level, } } -static xmpp_log_t * +static xmpp_log_t* _xmpp_get_file_logger() { xmpp_log_level_t level = _get_xmpp_log_level(); diff --git a/src/xmpp/connection.h b/src/xmpp/connection.h index 705dd129..0f9407f9 100644 --- a/src/xmpp/connection.h +++ b/src/xmpp/connection.h @@ -46,11 +46,11 @@ #include "resource.h" -xmpp_conn_t *connection_get_conn(void); -xmpp_ctx_t *connection_get_ctx(void); +xmpp_conn_t* connection_get_conn(void); +xmpp_ctx_t* connection_get_ctx(void); void connection_set_priority(int priority); -void connection_set_presence_message(const char * const message); +void connection_set_presence_message(const char *const message); void connection_add_available_resource(Resource *resource); -void connection_remove_available_resource(const char * const resource); +void connection_remove_available_resource(const char *const resource); #endif diff --git a/src/xmpp/form.c b/src/xmpp/form.c index fdec2a49..9631e8b6 100644 --- a/src/xmpp/form.c +++ b/src/xmpp/form.c @@ -78,7 +78,7 @@ _is_valid_form_element(xmpp_stanza_t *stanza) return TRUE; } -static DataForm * +static DataForm* _form_new(void) { DataForm *form = malloc(sizeof(DataForm)); @@ -93,7 +93,7 @@ _form_new(void) return form; } -static FormField * +static FormField* _field_new(void) { FormField *field = malloc(sizeof(FormField)); @@ -108,8 +108,8 @@ _field_new(void) return field; } -static char * -_get_property(xmpp_stanza_t * const stanza, const char * const property) +static char* +_get_property(xmpp_stanza_t *const stanza, const char *const property) { char *result = NULL; xmpp_ctx_t *ctx = connection_get_ctx(); @@ -126,8 +126,8 @@ _get_property(xmpp_stanza_t * const stanza, const char * const property) return result; } -static char * -_get_attr(xmpp_stanza_t * const stanza, const char * const attr) +static char* +_get_attr(xmpp_stanza_t *const stanza, const char *const attr) { char *result = xmpp_stanza_get_attribute(stanza, attr); if (result) { @@ -138,7 +138,7 @@ _get_attr(xmpp_stanza_t * const stanza, const char * const attr) } static gboolean -_is_required(xmpp_stanza_t * const stanza) +_is_required(xmpp_stanza_t *const stanza) { xmpp_stanza_t *child = xmpp_stanza_get_child_by_name(stanza, "required"); if (child) { @@ -149,7 +149,7 @@ _is_required(xmpp_stanza_t * const stanza) } static form_field_type_t -_get_field_type(const char * const type) +_get_field_type(const char *const type) { if (g_strcmp0(type, "hidden") == 0) { return FIELD_HIDDEN; @@ -184,8 +184,8 @@ _get_field_type(const char * const type) return FIELD_UNKNOWN; } -DataForm * -form_create(xmpp_stanza_t * const form_stanza) +DataForm* +form_create(xmpp_stanza_t *const form_stanza) { xmpp_ctx_t *ctx = connection_get_ctx(); @@ -281,7 +281,7 @@ form_create(xmpp_stanza_t * const form_stanza) return form; } -xmpp_stanza_t * +xmpp_stanza_t* form_create_submission(DataForm *form) { xmpp_ctx_t *ctx = connection_get_ctx(); @@ -408,7 +408,7 @@ _field_compare_by_var(FormField *a, FormField *b) return g_strcmp0(a->var, b->var); } -GSList * +GSList* form_get_non_form_type_fields_sorted(DataForm *form) { GSList *sorted = NULL; @@ -424,7 +424,7 @@ form_get_non_form_type_fields_sorted(DataForm *form) return sorted; } -GSList * +GSList* form_get_field_values_sorted(FormField *field) { GSList *sorted = NULL; @@ -440,7 +440,7 @@ form_get_field_values_sorted(FormField *field) return sorted; } -char * +char* form_get_form_type_field(DataForm *form) { GSList *curr = form->fields; @@ -456,7 +456,7 @@ form_get_form_type_field(DataForm *form) } gboolean -form_tag_exists(DataForm *form, const char * const tag) +form_tag_exists(DataForm *form, const char *const tag) { GList *tags = g_hash_table_get_keys(form->tag_to_var); GList *curr = tags; @@ -472,7 +472,7 @@ form_tag_exists(DataForm *form, const char * const tag) } form_field_type_t -form_get_field_type(DataForm *form, const char * const tag) +form_get_field_type(DataForm *form, const char *const tag) { char *var = g_hash_table_lookup(form->tag_to_var, tag); if (var) { @@ -489,7 +489,7 @@ form_get_field_type(DataForm *form, const char * const tag) } void -form_set_value(DataForm *form, const char * const tag, char *value) +form_set_value(DataForm *form, const char *const tag, char *value) { char *var = g_hash_table_lookup(form->tag_to_var, tag); if (var) { @@ -514,7 +514,7 @@ form_set_value(DataForm *form, const char * const tag, char *value) } void -form_add_value(DataForm *form, const char * const tag, char *value) +form_add_value(DataForm *form, const char *const tag, char *value) { char *var = g_hash_table_lookup(form->tag_to_var, tag); if (var) { @@ -539,7 +539,7 @@ form_add_value(DataForm *form, const char * const tag, char *value) } gboolean -form_add_unique_value(DataForm *form, const char * const tag, char *value) +form_add_unique_value(DataForm *form, const char *const tag, char *value) { char *var = g_hash_table_lookup(form->tag_to_var, tag); if (var) { @@ -570,7 +570,7 @@ form_add_unique_value(DataForm *form, const char * const tag, char *value) } gboolean -form_remove_value(DataForm *form, const char * const tag, char *value) +form_remove_value(DataForm *form, const char *const tag, char *value) { char *var = g_hash_table_lookup(form->tag_to_var, tag); if (var) { @@ -600,7 +600,7 @@ form_remove_value(DataForm *form, const char * const tag, char *value) } gboolean -form_remove_text_multi_value(DataForm *form, const char * const tag, int index) +form_remove_text_multi_value(DataForm *form, const char *const tag, int index) { index--; char *var = g_hash_table_lookup(form->tag_to_var, tag); @@ -632,7 +632,7 @@ form_remove_text_multi_value(DataForm *form, const char * const tag, int index) } int -form_get_value_count(DataForm *form, const char * const tag) +form_get_value_count(DataForm *form, const char *const tag) { char *var = g_hash_table_lookup(form->tag_to_var, tag); if (var) { @@ -654,7 +654,7 @@ form_get_value_count(DataForm *form, const char * const tag) } gboolean -form_field_contains_option(DataForm *form, const char * const tag, char *value) +form_field_contains_option(DataForm *form, const char *const tag, char *value) { char *var = g_hash_table_lookup(form->tag_to_var, tag); if (var) { @@ -678,8 +678,8 @@ form_field_contains_option(DataForm *form, const char * const tag, char *value) return FALSE; } -FormField * -form_get_field_by_tag(DataForm *form, const char * const tag) +FormField* +form_get_field_by_tag(DataForm *form, const char *const tag) { char *var = g_hash_table_lookup(form->tag_to_var, tag); if (var) { @@ -696,7 +696,7 @@ form_get_field_by_tag(DataForm *form, const char * const tag) } Autocomplete -form_get_value_ac(DataForm *form, const char * const tag) +form_get_value_ac(DataForm *form, const char *const tag) { char *var = g_hash_table_lookup(form->tag_to_var, tag); if (var) { diff --git a/src/xmpp/form.h b/src/xmpp/form.h index 86cd4b7b..5b31141f 100644 --- a/src/xmpp/form.h +++ b/src/xmpp/form.h @@ -37,7 +37,7 @@ #include "xmpp/xmpp.h" -DataForm* form_create(xmpp_stanza_t * const stanza); +DataForm* form_create(xmpp_stanza_t *const stanza); xmpp_stanza_t* form_create_submission(DataForm *form); #endif diff --git a/src/xmpp/iq.c b/src/xmpp/iq.c index 99327b41..8f19871b 100644 --- a/src/xmpp/iq.c +++ b/src/xmpp/iq.c @@ -70,32 +70,32 @@ typedef struct p_room_info_data_t { gboolean display; } ProfRoomInfoData; -static int _error_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, void * const userdata); -static int _ping_get_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, void * const userdata); -static int _version_get_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, void * const userdata); -static int _version_result_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, void * const userdata); -static int _disco_info_get_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, void * const userdata); -static int _disco_info_response_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, void * const userdata); -static int _last_activity_get_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, void * const userdata); -static int _last_activity_response_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, void * const userdata); -static int _room_info_response_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, void * const userdata); -static int _disco_items_result_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, void * const userdata); -static int _disco_items_get_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, void * const userdata); -static int _destroy_room_result_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, void * const userdata); -static int _room_config_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, void * const userdata); -static int _room_config_submit_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, void * const userdata); -static int _room_affiliation_list_result_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, void * const userdata); -static int _room_affiliation_set_result_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, void * const userdata); -static int _room_role_set_result_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, void * const userdata); -static int _room_role_list_result_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, void * const userdata); -static int _room_kick_result_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, void * const userdata); -static int _enable_carbons_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, void * const userdata); -static int _disable_carbons_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, void * const userdata); -static int _manual_pong_handler(xmpp_conn_t *const conn, xmpp_stanza_t * const stanza, void * const userdata); -static int _ping_timed_handler(xmpp_conn_t * const conn, void * const userdata); -static int _caps_response_handler(xmpp_conn_t *const conn, xmpp_stanza_t * const stanza, void * const userdata); -static int _caps_response_handler_for_jid(xmpp_conn_t *const conn, xmpp_stanza_t * const stanza, void * const userdata); -static int _caps_response_handler_legacy(xmpp_conn_t *const conn, xmpp_stanza_t * const stanza, void * const userdata); +static int _error_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, void *const userdata); +static int _ping_get_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, void *const userdata); +static int _version_get_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, void *const userdata); +static int _version_result_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, void *const userdata); +static int _disco_info_get_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, void *const userdata); +static int _disco_info_response_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, void *const userdata); +static int _last_activity_get_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, void *const userdata); +static int _last_activity_response_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, void *const userdata); +static int _room_info_response_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, void *const userdata); +static int _disco_items_result_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, void *const userdata); +static int _disco_items_get_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, void *const userdata); +static int _destroy_room_result_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, void *const userdata); +static int _room_config_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, void *const userdata); +static int _room_config_submit_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, void *const userdata); +static int _room_affiliation_list_result_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, void *const userdata); +static int _room_affiliation_set_result_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, void *const userdata); +static int _room_role_set_result_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, void *const userdata); +static int _room_role_list_result_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, void *const userdata); +static int _room_kick_result_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, void *const userdata); +static int _enable_carbons_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, void *const userdata); +static int _disable_carbons_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, void *const userdata); +static int _manual_pong_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, void *const userdata); +static int _ping_timed_handler(xmpp_conn_t *const conn, void *const userdata); +static int _caps_response_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, void *const userdata); +static int _caps_response_handler_for_jid(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, void *const userdata); +static int _caps_response_handler_legacy(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, void *const userdata); void iq_add_handlers(void) @@ -150,7 +150,7 @@ iq_room_list_request(gchar *conferencejid) } void -iq_enable_carbons() +iq_enable_carbons(void) { xmpp_conn_t * const conn = connection_get_conn(); xmpp_ctx_t * const ctx = connection_get_ctx(); @@ -164,7 +164,7 @@ iq_enable_carbons() } void -iq_disable_carbons() +iq_disable_carbons(void) { xmpp_conn_t * const conn = connection_get_conn(); xmpp_ctx_t * const ctx = connection_get_ctx(); @@ -210,7 +210,7 @@ iq_last_activity_request(gchar *jid) } void -iq_room_info_request(const char * const room, gboolean display_result) +iq_room_info_request(const char *const room, gboolean display_result) { xmpp_conn_t * const conn = connection_get_conn(); xmpp_ctx_t * const ctx = connection_get_ctx(); @@ -232,8 +232,8 @@ iq_room_info_request(const char * const room, gboolean display_result) void -iq_send_caps_request_for_jid(const char * const to, const char * const id, - const char * const node, const char * const ver) +iq_send_caps_request_for_jid(const char *const to, const char *const id, + const char *const node, const char *const ver) { xmpp_conn_t * const conn = connection_get_conn(); xmpp_ctx_t * const ctx = connection_get_ctx(); @@ -259,8 +259,8 @@ iq_send_caps_request_for_jid(const char * const to, const char * const id, } void -iq_send_caps_request(const char * const to, const char * const id, - const char * const node, const char * const ver) +iq_send_caps_request(const char *const to, const char *const id, + const char *const node, const char *const ver) { xmpp_conn_t * const conn = connection_get_conn(); xmpp_ctx_t * const ctx = connection_get_ctx(); @@ -286,8 +286,8 @@ iq_send_caps_request(const char * const to, const char * const id, } void -iq_send_caps_request_legacy(const char * const to, const char * const id, - const char * const node, const char * const ver) +iq_send_caps_request_legacy(const char *const to, const char *const id, + const char *const node, const char *const ver) { xmpp_conn_t * const conn = connection_get_conn(); xmpp_ctx_t * const ctx = connection_get_ctx(); @@ -323,7 +323,7 @@ iq_disco_items_request(gchar *jid) } void -iq_send_software_version(const char * const fulljid) +iq_send_software_version(const char *const fulljid) { xmpp_conn_t * const conn = connection_get_conn(); xmpp_ctx_t * const ctx = connection_get_ctx(); @@ -337,7 +337,7 @@ iq_send_software_version(const char * const fulljid) } void -iq_confirm_instant_room(const char * const room_jid) +iq_confirm_instant_room(const char *const room_jid) { xmpp_conn_t * const conn = connection_get_conn(); xmpp_ctx_t * const ctx = connection_get_ctx(); @@ -347,7 +347,7 @@ iq_confirm_instant_room(const char * const room_jid) } void -iq_destroy_room(const char * const room_jid) +iq_destroy_room(const char *const room_jid) { xmpp_conn_t * const conn = connection_get_conn(); xmpp_ctx_t * const ctx = connection_get_ctx(); @@ -361,7 +361,7 @@ iq_destroy_room(const char * const room_jid) } void -iq_request_room_config_form(const char * const room_jid) +iq_request_room_config_form(const char *const room_jid) { xmpp_conn_t * const conn = connection_get_conn(); xmpp_ctx_t * const ctx = connection_get_ctx(); @@ -375,7 +375,7 @@ iq_request_room_config_form(const char * const room_jid) } void -iq_submit_room_config(const char * const room, DataForm *form) +iq_submit_room_config(const char *const room, DataForm *form) { xmpp_conn_t * const conn = connection_get_conn(); xmpp_ctx_t * const ctx = connection_get_ctx(); @@ -389,7 +389,7 @@ iq_submit_room_config(const char * const room, DataForm *form) } void -iq_room_config_cancel(const char * const room_jid) +iq_room_config_cancel(const char *const room_jid) { xmpp_conn_t * const conn = connection_get_conn(); xmpp_ctx_t * const ctx = connection_get_ctx(); @@ -399,7 +399,7 @@ iq_room_config_cancel(const char * const room_jid) } void -iq_room_affiliation_list(const char * const room, char *affiliation) +iq_room_affiliation_list(const char *const room, char *affiliation) { xmpp_conn_t * const conn = connection_get_conn(); xmpp_ctx_t * const ctx = connection_get_ctx(); @@ -413,7 +413,7 @@ iq_room_affiliation_list(const char * const room, char *affiliation) } void -iq_room_kick_occupant(const char * const room, const char * const nick, const char * const reason) +iq_room_kick_occupant(const char *const room, const char *const nick, const char *const reason) { xmpp_conn_t * const conn = connection_get_conn(); xmpp_ctx_t * const ctx = connection_get_ctx(); @@ -432,8 +432,8 @@ struct privilege_set_t { }; void -iq_room_affiliation_set(const char * const room, const char * const jid, char *affiliation, - const char * const reason) +iq_room_affiliation_set(const char *const room, const char *const jid, char *affiliation, + const char *const reason) { xmpp_conn_t * const conn = connection_get_conn(); xmpp_ctx_t * const ctx = connection_get_ctx(); @@ -452,8 +452,8 @@ iq_room_affiliation_set(const char * const room, const char * const jid, char *a } void -iq_room_role_set(const char * const room, const char * const nick, char *role, - const char * const reason) +iq_room_role_set(const char *const room, const char *const nick, char *role, + const char *const reason) { xmpp_conn_t * const conn = connection_get_conn(); xmpp_ctx_t * const ctx = connection_get_ctx(); @@ -472,7 +472,7 @@ iq_room_role_set(const char * const room, const char * const nick, char *role, } void -iq_room_role_list(const char * const room, char *role) +iq_room_role_list(const char *const room, char *role) { xmpp_conn_t * const conn = connection_get_conn(); xmpp_ctx_t * const ctx = connection_get_ctx(); @@ -486,7 +486,7 @@ iq_room_role_list(const char * const room, char *role) } void -iq_send_ping(const char * const target) +iq_send_ping(const char *const target) { xmpp_conn_t * const conn = connection_get_conn(); xmpp_ctx_t * const ctx = connection_get_ctx(); @@ -501,8 +501,8 @@ iq_send_ping(const char * const target) } static int -_error_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, - void * const userdata) +_error_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, + void *const userdata) { const char *id = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_ID); char *error_msg = stanza_get_error_message(stanza); @@ -521,8 +521,8 @@ _error_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, } static int -_pong_handler(xmpp_conn_t *const conn, xmpp_stanza_t * const stanza, - void * const userdata) +_pong_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, + void *const userdata) { char *id = xmpp_stanza_get_id(stanza); char *type = xmpp_stanza_get_type(stanza); @@ -561,8 +561,8 @@ _pong_handler(xmpp_conn_t *const conn, xmpp_stanza_t * const stanza, } static int -_caps_response_handler(xmpp_conn_t *const conn, xmpp_stanza_t * const stanza, - void * const userdata) +_caps_response_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, + void *const userdata) { const char *id = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_ID); xmpp_stanza_t *query = xmpp_stanza_get_child_by_name(stanza, STANZA_NAME_QUERY); @@ -635,8 +635,8 @@ _caps_response_handler(xmpp_conn_t *const conn, xmpp_stanza_t * const stanza, } static int -_caps_response_handler_for_jid(xmpp_conn_t *const conn, xmpp_stanza_t * const stanza, - void * const userdata) +_caps_response_handler_for_jid(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, + void *const userdata) { char *jid = (char *)userdata; const char *id = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_ID); @@ -694,8 +694,8 @@ _caps_response_handler_for_jid(xmpp_conn_t *const conn, xmpp_stanza_t * const st } static int -_caps_response_handler_legacy(xmpp_conn_t *const conn, xmpp_stanza_t * const stanza, - void * const userdata) +_caps_response_handler_legacy(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, + void *const userdata) { const char *id = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_ID); xmpp_stanza_t *query = xmpp_stanza_get_child_by_name(stanza, STANZA_NAME_QUERY); @@ -767,7 +767,7 @@ _caps_response_handler_legacy(xmpp_conn_t *const conn, xmpp_stanza_t * const sta } static int -_enable_carbons_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, void * const userdata) +_enable_carbons_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, void *const userdata) { char *type = xmpp_stanza_get_type(stanza); if (g_strcmp0(type, "error") == 0) { @@ -783,7 +783,7 @@ _enable_carbons_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, } static int -_disable_carbons_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, void * const userdata) +_disable_carbons_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, void *const userdata) { char *type = xmpp_stanza_get_type(stanza); if (g_strcmp0(type, "error") == 0) { @@ -799,8 +799,8 @@ _disable_carbons_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, } static int -_manual_pong_handler(xmpp_conn_t *const conn, xmpp_stanza_t * const stanza, - void * const userdata) +_manual_pong_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, + void *const userdata) { char *from = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_FROM); char *type = xmpp_stanza_get_type(stanza); @@ -838,7 +838,7 @@ _manual_pong_handler(xmpp_conn_t *const conn, xmpp_stanza_t * const stanza, } static int -_ping_timed_handler(xmpp_conn_t * const conn, void * const userdata) +_ping_timed_handler(xmpp_conn_t *const conn, void *const userdata) { xmpp_ctx_t *ctx = (xmpp_ctx_t *)userdata; @@ -858,8 +858,8 @@ _ping_timed_handler(xmpp_conn_t * const conn, void * const userdata) } static int -_version_result_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, - void * const userdata) +_version_result_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, + void *const userdata) { char *id = xmpp_stanza_get_id(stanza); @@ -953,8 +953,8 @@ _version_result_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, } static int -_ping_get_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, - void * const userdata) +_ping_get_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, + void *const userdata) { xmpp_ctx_t *ctx = (xmpp_ctx_t *)userdata; const char *id = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_ID); @@ -988,8 +988,8 @@ _ping_get_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, } static int -_version_get_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, - void * const userdata) +_version_get_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, + void *const userdata) { xmpp_ctx_t *ctx = (xmpp_ctx_t *)userdata; const char *id = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_ID); @@ -1056,8 +1056,8 @@ _version_get_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, } static int -_disco_items_get_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, - void * const userdata) +_disco_items_get_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, + void *const userdata) { xmpp_ctx_t *ctx = (xmpp_ctx_t *)userdata; const char *id = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_ID); @@ -1088,8 +1088,8 @@ _disco_items_get_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, } static int -_last_activity_get_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, - void * const userdata) +_last_activity_get_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, + void *const userdata) { xmpp_ctx_t *ctx = connection_get_ctx(); const char *from = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_FROM); @@ -1150,8 +1150,8 @@ _last_activity_get_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanz } static int -_disco_info_get_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, - void * const userdata) +_disco_info_get_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, + void *const userdata) { xmpp_ctx_t *ctx = (xmpp_ctx_t *)userdata; const char *from = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_FROM); @@ -1188,8 +1188,8 @@ _disco_info_get_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, } static int -_destroy_room_result_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, - void * const userdata) +_destroy_room_result_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, + void *const userdata) { const char *id = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_ID); @@ -1210,8 +1210,8 @@ _destroy_room_result_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const sta } static int -_room_config_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, - void * const userdata) +_room_config_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, + void *const userdata) { const char *id = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_ID); const char *type = xmpp_stanza_get_type(stanza); @@ -1264,8 +1264,9 @@ _room_config_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, return 0; } -static int _room_affiliation_set_result_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, - void * const userdata) +static int +_room_affiliation_set_result_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, + void *const userdata) { const char *id = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_ID); const char *type = xmpp_stanza_get_type(stanza); @@ -1293,8 +1294,9 @@ static int _room_affiliation_set_result_handler(xmpp_conn_t * const conn, xmpp_s return 0; } -static int _room_role_set_result_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, - void * const userdata) +static int +_room_role_set_result_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, + void *const userdata) { const char *id = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_ID); const char *type = xmpp_stanza_get_type(stanza); @@ -1323,7 +1325,7 @@ static int _room_role_set_result_handler(xmpp_conn_t * const conn, xmpp_stanza_t } static int -_room_affiliation_list_result_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, void * const userdata) +_room_affiliation_list_result_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, void *const userdata) { const char *id = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_ID); const char *type = xmpp_stanza_get_type(stanza); @@ -1371,7 +1373,7 @@ _room_affiliation_list_result_handler(xmpp_conn_t * const conn, xmpp_stanza_t * } static int -_room_role_list_result_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, void * const userdata) +_room_role_list_result_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, void *const userdata) { const char *id = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_ID); const char *type = xmpp_stanza_get_type(stanza); @@ -1418,8 +1420,8 @@ _room_role_list_result_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const s } static int -_room_config_submit_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, - void * const userdata) +_room_config_submit_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, + void *const userdata) { const char *id = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_ID); const char *type = xmpp_stanza_get_type(stanza); @@ -1445,7 +1447,7 @@ _room_config_submit_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stan } static int -_room_kick_result_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, void * const userdata) +_room_kick_result_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, void *const userdata) { const char *id = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_ID); const char *type = xmpp_stanza_get_type(stanza); @@ -1494,8 +1496,8 @@ _item_destroy(DiscoItem *item) } static int -_room_info_response_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, - void * const userdata) +_room_info_response_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, + void *const userdata) { const char *type = xmpp_stanza_get_type(stanza); ProfRoomInfoData *cb_data = (ProfRoomInfoData *)userdata; @@ -1573,8 +1575,8 @@ _room_info_response_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stan } static int -_last_activity_response_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, - void * const userdata) +_last_activity_response_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, + void *const userdata) { const char *from = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_FROM); if (!from) { @@ -1628,8 +1630,8 @@ _last_activity_response_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const } static int -_disco_info_response_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, - void * const userdata) +_disco_info_response_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, + void *const userdata) { const char *from = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_FROM); const char *type = xmpp_stanza_get_type(stanza); @@ -1706,8 +1708,8 @@ _disco_info_response_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const sta } static int -_disco_items_result_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, - void * const userdata) +_disco_items_result_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, + void *const userdata) { log_debug("Received diso#items response"); diff --git a/src/xmpp/message.c b/src/xmpp/message.c index ad75735b..810cb6e1 100644 --- a/src/xmpp/message.c +++ b/src/xmpp/message.c @@ -61,13 +61,13 @@ #define HANDLE(ns, type, func) xmpp_handler_add(conn, func, ns, STANZA_NAME_MESSAGE, type, ctx) -static int _groupchat_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, void * const userdata); -static int _chat_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, void * const userdata); -static int _muc_user_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, void * const userdata); -static int _conference_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, void * const userdata); -static int _captcha_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, void * const userdata); -static int _message_error_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, void * const userdata); -static int _receipt_received_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, void * const userdata); +static int _groupchat_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, void *const userdata); +static int _chat_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, void *const userdata); +static int _muc_user_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, void *const userdata); +static int _conference_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, void *const userdata); +static int _captcha_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, void *const userdata); +static int _message_error_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, void *const userdata); +static int _receipt_received_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, void *const userdata); void message_add_handlers(void) @@ -85,7 +85,7 @@ message_add_handlers(void) } static char* -_session_jid(const char * const barejid) +_session_jid(const char *const barejid) { ChatSession *session = chat_session_get(barejid); char *jid = NULL; @@ -101,7 +101,7 @@ _session_jid(const char * const barejid) } static char* -_session_state(const char * const barejid) +_session_state(const char *const barejid) { ChatSession *session = chat_session_get(barejid); char *state = NULL; @@ -118,8 +118,8 @@ _session_state(const char * const barejid) return state; } -char * -message_send_chat(const char * const barejid, const char * const msg) +char* +message_send_chat(const char *const barejid, const char *const msg) { xmpp_conn_t * const conn = connection_get_conn(); xmpp_ctx_t * const ctx = connection_get_ctx(); @@ -145,8 +145,8 @@ message_send_chat(const char * const barejid, const char * const msg) return id; } -char * -message_send_chat_pgp(const char * const barejid, const char * const msg) +char* +message_send_chat_pgp(const char *const barejid, const char *const msg) { xmpp_conn_t * const conn = connection_get_conn(); xmpp_ctx_t * const ctx = connection_get_ctx(); @@ -203,8 +203,8 @@ message_send_chat_pgp(const char * const barejid, const char * const msg) return id; } -char * -message_send_chat_otr(const char * const barejid, const char * const msg) +char* +message_send_chat_otr(const char *const barejid, const char *const msg) { xmpp_conn_t * const conn = connection_get_conn(); xmpp_ctx_t * const ctx = connection_get_ctx(); @@ -235,7 +235,7 @@ message_send_chat_otr(const char * const barejid, const char * const msg) } void -message_send_private(const char * const fulljid, const char * const msg) +message_send_private(const char *const fulljid, const char *const msg) { xmpp_conn_t * const conn = connection_get_conn(); xmpp_ctx_t * const ctx = connection_get_ctx(); @@ -248,7 +248,7 @@ message_send_private(const char * const fulljid, const char * const msg) } void -message_send_groupchat(const char * const roomjid, const char * const msg) +message_send_groupchat(const char *const roomjid, const char *const msg) { xmpp_conn_t * const conn = connection_get_conn(); xmpp_ctx_t * const ctx = connection_get_ctx(); @@ -261,7 +261,7 @@ message_send_groupchat(const char * const roomjid, const char * const msg) } void -message_send_groupchat_subject(const char * const roomjid, const char * const subject) +message_send_groupchat_subject(const char *const roomjid, const char *const subject) { xmpp_conn_t * const conn = connection_get_conn(); xmpp_ctx_t * const ctx = connection_get_ctx(); @@ -272,8 +272,8 @@ message_send_groupchat_subject(const char * const roomjid, const char * const su } void -message_send_invite(const char * const roomjid, const char * const contact, - const char * const reason) +message_send_invite(const char *const roomjid, const char *const contact, + const char *const reason) { xmpp_conn_t * const conn = connection_get_conn(); xmpp_ctx_t * const ctx = connection_get_ctx(); @@ -295,7 +295,7 @@ message_send_invite(const char * const roomjid, const char * const contact, } void -message_send_composing(const char * const jid) +message_send_composing(const char *const jid) { xmpp_conn_t * const conn = connection_get_conn(); xmpp_ctx_t * const ctx = connection_get_ctx(); @@ -307,7 +307,7 @@ message_send_composing(const char * const jid) } void -message_send_paused(const char * const jid) +message_send_paused(const char *const jid) { xmpp_conn_t * const conn = connection_get_conn(); xmpp_ctx_t * const ctx = connection_get_ctx(); @@ -317,7 +317,7 @@ message_send_paused(const char * const jid) } void -message_send_inactive(const char * const jid) +message_send_inactive(const char *const jid) { xmpp_conn_t * const conn = connection_get_conn(); xmpp_ctx_t * const ctx = connection_get_ctx(); @@ -328,7 +328,7 @@ message_send_inactive(const char * const jid) } void -message_send_gone(const char * const jid) +message_send_gone(const char *const jid) { xmpp_conn_t * const conn = connection_get_conn(); xmpp_ctx_t * const ctx = connection_get_ctx(); @@ -338,7 +338,7 @@ message_send_gone(const char * const jid) } static int -_message_error_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, void * const userdata) +_message_error_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, void *const userdata) { char *id = xmpp_stanza_get_id(stanza); char *jid = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_FROM); @@ -388,7 +388,7 @@ _message_error_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, v } static int -_muc_user_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, void * const userdata) +_muc_user_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, void *const userdata) { xmpp_ctx_t *ctx = connection_get_ctx(); xmpp_stanza_t *xns_muc_user = xmpp_stanza_get_child_by_ns(stanza, STANZA_NS_MUC_USER); @@ -442,7 +442,7 @@ _muc_user_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, void * } static int -_conference_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, void * const userdata) +_conference_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, void *const userdata) { xmpp_stanza_t *xns_conference = xmpp_stanza_get_child_by_ns(stanza, STANZA_NS_CONFERENCE); @@ -474,7 +474,7 @@ _conference_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, void } static int -_captcha_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, void * const userdata) +_captcha_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, void *const userdata) { xmpp_ctx_t *ctx = connection_get_ctx(); char *from = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_FROM); @@ -502,7 +502,7 @@ _captcha_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, void * } static int -_groupchat_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, void * const userdata) +_groupchat_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, void *const userdata) { xmpp_ctx_t *ctx = connection_get_ctx(); char *message = NULL; @@ -584,7 +584,7 @@ _groupchat_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, void } void -_message_send_receipt(const char * const fulljid, const char * const message_id) +_message_send_receipt(const char *const fulljid, const char *const message_id) { xmpp_conn_t * const conn = connection_get_conn(); xmpp_ctx_t * const ctx = connection_get_ctx(); @@ -608,7 +608,7 @@ _message_send_receipt(const char * const fulljid, const char * const message_id) } static int -_receipt_received_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, void * const userdata) +_receipt_received_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, void *const userdata) { xmpp_stanza_t *receipt = xmpp_stanza_get_child_by_ns(stanza, STANZA_NS_RECEIPTS); char *name = xmpp_stanza_get_name(receipt); @@ -634,7 +634,7 @@ _receipt_received_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza } void -_receipt_request_handler(xmpp_stanza_t * const stanza) +_receipt_request_handler(xmpp_stanza_t *const stanza) { if (!prefs_get_boolean(PREF_RECEIPTS_SEND)) { return; @@ -662,7 +662,7 @@ _receipt_request_handler(xmpp_stanza_t * const stanza) } void -_private_chat_handler(xmpp_stanza_t * const stanza, const char * const fulljid) +_private_chat_handler(xmpp_stanza_t *const stanza, const char *const fulljid) { xmpp_stanza_t *body = xmpp_stanza_get_child_by_name(stanza, STANZA_NAME_BODY); if (!body) { @@ -687,7 +687,7 @@ _private_chat_handler(xmpp_stanza_t * const stanza, const char * const fulljid) } static gboolean -_handle_carbons(xmpp_stanza_t * const stanza) +_handle_carbons(xmpp_stanza_t *const stanza) { xmpp_stanza_t *carbons = xmpp_stanza_get_child_by_ns(stanza, STANZA_NS_CARBONS); if (!carbons) { @@ -739,7 +739,7 @@ _handle_carbons(xmpp_stanza_t * const stanza) } static int -_chat_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, void * const userdata) +_chat_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, void *const userdata) { // ignore if type not chat or absent char *type = xmpp_stanza_get_type(stanza); diff --git a/src/xmpp/presence.c b/src/xmpp/presence.c index e475f599..1cfa9e4e 100644 --- a/src/xmpp/presence.c +++ b/src/xmpp/presence.c @@ -62,23 +62,15 @@ static Autocomplete sub_requests_ac; -#define HANDLE(ns, type, func) xmpp_handler_add(conn, func, ns, \ - STANZA_NAME_PRESENCE, type, ctx) +#define HANDLE(ns, type, func) xmpp_handler_add(conn, func, ns, STANZA_NAME_PRESENCE, type, ctx) -static int _unavailable_handler(xmpp_conn_t * const conn, - xmpp_stanza_t * const stanza, void * const userdata); -static int _subscribe_handler(xmpp_conn_t * const conn, - xmpp_stanza_t * const stanza, void * const userdata); -static int _subscribed_handler(xmpp_conn_t * const conn, - xmpp_stanza_t * const stanza, void * const userdata); -static int _unsubscribed_handler(xmpp_conn_t * const conn, - xmpp_stanza_t * const stanza, void * const userdata); -static int _available_handler(xmpp_conn_t * const conn, - xmpp_stanza_t * const stanza, void * const userdata); -static int _muc_user_handler(xmpp_conn_t * const conn, - xmpp_stanza_t * const stanza, void * const userdata); -static int _presence_error_handler(xmpp_conn_t * const conn, - xmpp_stanza_t * const stanza, void * const userdata); +static int _unavailable_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, void *const userdata); +static int _subscribe_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, void *const userdata); +static int _subscribed_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, void *const userdata); +static int _unsubscribed_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, void *const userdata); +static int _available_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, void *const userdata); +static int _muc_user_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, void *const userdata); +static int _presence_error_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, void *const userdata); void _send_caps_request(char *node, char *caps_key, char *id, char *from); static void _send_room_presence(xmpp_conn_t *conn, xmpp_stanza_t *presence); @@ -105,7 +97,7 @@ presence_add_handlers(void) } void -presence_subscription(const char * const jid, const jabber_subscr_t action) +presence_subscription(const char *const jid, const jabber_subscr_t action) { assert(jid != NULL); @@ -149,7 +141,7 @@ presence_subscription(const char * const jid, const jabber_subscr_t action) free(id); } -GSList * +GSList* presence_get_subscription_requests(void) { return autocomplete_create_list(sub_requests_ac); @@ -167,14 +159,14 @@ presence_clear_sub_requests(void) autocomplete_clear(sub_requests_ac); } -char * -presence_sub_request_find(const char * const search_str) +char* +presence_sub_request_find(const char *const search_str) { return autocomplete_complete(sub_requests_ac, search_str, TRUE); } gboolean -presence_sub_request_exists(const char * const bare_jid) +presence_sub_request_exists(const char *const bare_jid) { gboolean result = FALSE; GSList *requests_p = autocomplete_create_list(sub_requests_ac); @@ -202,7 +194,7 @@ presence_reset_sub_request_search(void) } void -presence_send(const resource_presence_t presence_type, const char * const msg, const int idle, char *signed_status) +presence_send(const resource_presence_t presence_type, const char *const msg, const int idle, char *signed_status) { if (jabber_get_connection_status() != JABBER_CONNECTED) { log_warning("Error setting presence, not connected."); @@ -317,7 +309,7 @@ presence_join_room(char *room, char *nick, char * passwd) } void -presence_change_room_nick(const char * const room, const char * const nick) +presence_change_room_nick(const char *const room, const char *const nick) { assert(room != NULL); assert(nick != NULL); @@ -347,7 +339,7 @@ presence_change_room_nick(const char * const room, const char * const nick) } void -presence_leave_chat_room(const char * const room_jid) +presence_leave_chat_room(const char *const room_jid) { assert(room_jid != NULL); @@ -365,8 +357,8 @@ presence_leave_chat_room(const char * const room_jid) } static int -_presence_error_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, - void * const userdata) +_presence_error_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, + void *const userdata) { char *id = xmpp_stanza_get_id(stanza); char *from = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_FROM); @@ -439,8 +431,8 @@ _presence_error_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, static int -_unsubscribed_handler(xmpp_conn_t * const conn, - xmpp_stanza_t * const stanza, void * const userdata) +_unsubscribed_handler(xmpp_conn_t *const conn, + xmpp_stanza_t *const stanza, void *const userdata) { char *from = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_FROM); Jid *from_jid = jid_create(from); @@ -455,8 +447,8 @@ _unsubscribed_handler(xmpp_conn_t * const conn, } static int -_subscribed_handler(xmpp_conn_t * const conn, - xmpp_stanza_t * const stanza, void * const userdata) +_subscribed_handler(xmpp_conn_t *const conn, + xmpp_stanza_t *const stanza, void *const userdata) { char *from = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_FROM); Jid *from_jid = jid_create(from); @@ -471,8 +463,8 @@ _subscribed_handler(xmpp_conn_t * const conn, } static int -_subscribe_handler(xmpp_conn_t * const conn, - xmpp_stanza_t * const stanza, void * const userdata) +_subscribe_handler(xmpp_conn_t *const conn, + xmpp_stanza_t *const stanza, void *const userdata) { char *from = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_FROM); log_debug("Subscribe presence handler fired for %s", from); @@ -491,8 +483,8 @@ _subscribe_handler(xmpp_conn_t * const conn, } static int -_unavailable_handler(xmpp_conn_t * const conn, - xmpp_stanza_t * const stanza, void * const userdata) +_unavailable_handler(xmpp_conn_t *const conn, + xmpp_stanza_t *const stanza, void *const userdata) { ui_input_nonblocking(TRUE); @@ -568,8 +560,8 @@ _handle_caps(char *jid, XMPPCaps *caps) } static int -_available_handler(xmpp_conn_t * const conn, - xmpp_stanza_t * const stanza, void * const userdata) +_available_handler(xmpp_conn_t *const conn, + xmpp_stanza_t *const stanza, void *const userdata) { ui_input_nonblocking(TRUE); @@ -668,7 +660,7 @@ _send_caps_request(char *node, char *caps_key, char *id, char *from) } static int -_muc_user_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, void * const userdata) +_muc_user_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, void *const userdata) { ui_input_nonblocking(TRUE); diff --git a/src/xmpp/roster.c b/src/xmpp/roster.c index 1138061b..516d291c 100644 --- a/src/xmpp/roster.c +++ b/src/xmpp/roster.c @@ -60,8 +60,7 @@ #include "xmpp/stanza.h" #include "xmpp/xmpp.h" -#define HANDLE(type, func) xmpp_handler_add(conn, func, XMPP_NS_ROSTER, \ -STANZA_NAME_IQ, type, ctx) +#define HANDLE(type, func) xmpp_handler_add(conn, func, XMPP_NS_ROSTER, STANZA_NAME_IQ, type, ctx) // callback data for group commands typedef struct _group_data { @@ -70,21 +69,15 @@ typedef struct _group_data { } GroupData; // event handlers -static int _roster_set_handler(xmpp_conn_t * const conn, - xmpp_stanza_t * const stanza, void * const userdata); -static int _roster_result_handler(xmpp_conn_t * const conn, - xmpp_stanza_t * const stanza, void * const userdata); +static int _roster_set_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, void *const userdata); +static int _roster_result_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, void *const userdata); // id handlers -static int -_group_add_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, - void * const userdata); -static int -_group_remove_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, - void * const userdata); +static int _group_add_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, void *const userdata); +static int _group_remove_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, void *const userdata); // helper functions -GSList * _get_groups_from_item(xmpp_stanza_t *item); +GSList* _get_groups_from_item(xmpp_stanza_t *item); void roster_add_handlers(void) @@ -107,7 +100,7 @@ roster_request(void) } void -roster_send_add_new(const char * const barejid, const char * const name) +roster_send_add_new(const char *const barejid, const char *const name) { xmpp_conn_t * const conn = connection_get_conn(); xmpp_ctx_t * const ctx = connection_get_ctx(); @@ -119,7 +112,7 @@ roster_send_add_new(const char * const barejid, const char * const name) } void -roster_send_remove(const char * const barejid) +roster_send_remove(const char *const barejid) { xmpp_conn_t * const conn = connection_get_conn(); xmpp_ctx_t * const ctx = connection_get_ctx(); @@ -129,7 +122,7 @@ roster_send_remove(const char * const barejid) } void -roster_send_name_change(const char * const barejid, const char * const new_name, GSList *groups) +roster_send_name_change(const char *const barejid, const char *const new_name, GSList *groups) { xmpp_conn_t * const conn = connection_get_conn(); xmpp_ctx_t * const ctx = connection_get_ctx(); @@ -141,7 +134,7 @@ roster_send_name_change(const char * const barejid, const char * const new_name, } void -roster_send_add_to_group(const char * const group, PContact contact) +roster_send_add_to_group(const char *const group, PContact contact) { GSList *groups = p_contact_groups(contact); GSList *new_groups = NULL; @@ -172,8 +165,8 @@ roster_send_add_to_group(const char * const group, PContact contact) } static int -_group_add_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, - void * const userdata) +_group_add_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, + void *const userdata) { if (userdata) { GroupData *data = userdata; @@ -186,7 +179,7 @@ _group_add_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, } void -roster_send_remove_from_group(const char * const group, PContact contact) +roster_send_remove_from_group(const char *const group, PContact contact) { GSList *groups = p_contact_groups(contact); GSList *new_groups = NULL; @@ -219,8 +212,8 @@ roster_send_remove_from_group(const char * const group, PContact contact) } static int -_group_remove_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, - void * const userdata) +_group_remove_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, + void *const userdata) { if (userdata) { GroupData *data = userdata; @@ -233,8 +226,8 @@ _group_remove_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, } static int -_roster_set_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, - void * const userdata) +_roster_set_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, + void *const userdata) { xmpp_stanza_t *query = xmpp_stanza_get_child_by_name(stanza, STANZA_NAME_QUERY); @@ -303,7 +296,7 @@ _roster_set_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, } static int -_roster_result_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, void * const userdata) +_roster_result_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, void *const userdata) { const char *id = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_ID); @@ -375,7 +368,7 @@ _roster_result_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, v return 1; } -GSList * +GSList* _get_groups_from_item(xmpp_stanza_t *item) { GSList *groups = NULL; diff --git a/src/xmpp/stanza.c b/src/xmpp/stanza.c index 765b9c4b..7679e6c3 100644 --- a/src/xmpp/stanza.c +++ b/src/xmpp/stanza.c @@ -56,7 +56,7 @@ #include "muc.h" #if 0 -xmpp_stanza_t * +xmpp_stanza_t* stanza_create_bookmarks_pubsub_request(xmpp_ctx_t *ctx) { xmpp_stanza_t *iq, *pubsub, *items; @@ -84,7 +84,7 @@ stanza_create_bookmarks_pubsub_request(xmpp_ctx_t *ctx) } #endif -xmpp_stanza_t * +xmpp_stanza_t* stanza_create_bookmarks_storage_request(xmpp_ctx_t *ctx) { xmpp_stanza_t *iq, *query, *storage; @@ -113,9 +113,9 @@ stanza_create_bookmarks_storage_request(xmpp_ctx_t *ctx) } #if 0 -xmpp_stanza_t * -stanza_create_bookmarks_pubsub_add(xmpp_ctx_t *ctx, const char * const jid, - const gboolean autojoin, const char * const nick) +xmpp_stanza_t* +stanza_create_bookmarks_pubsub_add(xmpp_ctx_t *ctx, const char *const jid, + const gboolean autojoin, const char *const nick) { xmpp_stanza_t *stanza = xmpp_stanza_new(ctx); xmpp_stanza_set_name(stanza, STANZA_NAME_IQ); @@ -206,8 +206,9 @@ stanza_create_bookmarks_pubsub_add(xmpp_ctx_t *ctx, const char * const jid, } #endif -xmpp_stanza_t * -stanza_enable_carbons(xmpp_ctx_t *ctx){ +xmpp_stanza_t* +stanza_enable_carbons(xmpp_ctx_t *ctx) +{ xmpp_stanza_t *iq = xmpp_stanza_new(ctx); char *id = create_unique_id("carbons"); @@ -226,8 +227,9 @@ stanza_enable_carbons(xmpp_ctx_t *ctx){ return iq; } -xmpp_stanza_t * -stanza_disable_carbons(xmpp_ctx_t *ctx){ +xmpp_stanza_t* +stanza_disable_carbons(xmpp_ctx_t *ctx) +{ xmpp_stanza_t *iq = xmpp_stanza_new(ctx); char *id = create_unique_id("carbons"); @@ -246,8 +248,8 @@ stanza_disable_carbons(xmpp_ctx_t *ctx){ return iq; } -xmpp_stanza_t * -stanza_create_chat_state(xmpp_ctx_t *ctx, const char * const fulljid, const char * const state) +xmpp_stanza_t* +stanza_create_chat_state(xmpp_ctx_t *ctx, const char *const fulljid, const char *const state) { xmpp_stanza_t *msg, *chat_state; @@ -268,8 +270,8 @@ stanza_create_chat_state(xmpp_ctx_t *ctx, const char * const fulljid, const char return msg; } -xmpp_stanza_t * -stanza_create_room_subject_message(xmpp_ctx_t *ctx, const char * const room, const char * const subject) +xmpp_stanza_t* +stanza_create_room_subject_message(xmpp_ctx_t *ctx, const char *const room, const char *const subject) { xmpp_stanza_t *msg = xmpp_stanza_new(ctx); xmpp_stanza_set_name(msg, STANZA_NAME_MESSAGE); @@ -291,8 +293,8 @@ stanza_create_room_subject_message(xmpp_ctx_t *ctx, const char * const room, con return msg; } -xmpp_stanza_t * -stanza_attach_state(xmpp_ctx_t *ctx, xmpp_stanza_t *stanza, const char * const state) +xmpp_stanza_t* +stanza_attach_state(xmpp_ctx_t *ctx, xmpp_stanza_t *stanza, const char *const state) { xmpp_stanza_t *chat_state = xmpp_stanza_new(ctx); xmpp_stanza_set_name(chat_state, state); @@ -303,7 +305,7 @@ stanza_attach_state(xmpp_ctx_t *ctx, xmpp_stanza_t *stanza, const char * const s return stanza; } -xmpp_stanza_t * +xmpp_stanza_t* stanza_attach_carbons_private(xmpp_ctx_t *ctx, xmpp_stanza_t *stanza) { xmpp_stanza_t *private_carbon = xmpp_stanza_new(ctx); @@ -315,7 +317,7 @@ stanza_attach_carbons_private(xmpp_ctx_t *ctx, xmpp_stanza_t *stanza) return stanza; } -xmpp_stanza_t * +xmpp_stanza_t* stanza_attach_hints_no_copy(xmpp_ctx_t *ctx, xmpp_stanza_t *stanza) { xmpp_stanza_t *no_copy = xmpp_stanza_new(ctx); @@ -327,7 +329,7 @@ stanza_attach_hints_no_copy(xmpp_ctx_t *ctx, xmpp_stanza_t *stanza) return stanza; } -xmpp_stanza_t * +xmpp_stanza_t* stanza_attach_hints_no_store(xmpp_ctx_t *ctx, xmpp_stanza_t *stanza) { xmpp_stanza_t *no_store = xmpp_stanza_new(ctx); @@ -339,7 +341,7 @@ stanza_attach_hints_no_store(xmpp_ctx_t *ctx, xmpp_stanza_t *stanza) return stanza; } -xmpp_stanza_t * +xmpp_stanza_t* stanza_attach_receipt_request(xmpp_ctx_t *ctx, xmpp_stanza_t *stanza) { xmpp_stanza_t *receipet_request = xmpp_stanza_new(ctx); @@ -351,9 +353,9 @@ stanza_attach_receipt_request(xmpp_ctx_t *ctx, xmpp_stanza_t *stanza) return stanza; } -xmpp_stanza_t * -stanza_create_message(xmpp_ctx_t *ctx, char *id, const char * const recipient, - const char * const type, const char * const message) +xmpp_stanza_t* +stanza_create_message(xmpp_ctx_t *ctx, char *id, const char *const recipient, + const char *const type, const char *const message) { xmpp_stanza_t *msg, *body, *text; @@ -376,8 +378,8 @@ stanza_create_message(xmpp_ctx_t *ctx, char *id, const char * const recipient, return msg; } -xmpp_stanza_t * -stanza_create_roster_remove_set(xmpp_ctx_t *ctx, const char * const barejid) +xmpp_stanza_t* +stanza_create_roster_remove_set(xmpp_ctx_t *ctx, const char *const barejid) { xmpp_stanza_t *iq = xmpp_stanza_new(ctx); xmpp_stanza_set_name(iq, STANZA_NAME_IQ); @@ -405,9 +407,9 @@ stanza_create_roster_remove_set(xmpp_ctx_t *ctx, const char * const barejid) } -xmpp_stanza_t * -stanza_create_roster_set(xmpp_ctx_t *ctx, const char * const id, - const char * const jid, const char * const handle, GSList *groups) +xmpp_stanza_t* +stanza_create_roster_set(xmpp_ctx_t *ctx, const char *const id, + const char *const jid, const char *const handle, GSList *groups) { xmpp_stanza_t *iq = xmpp_stanza_new(ctx); xmpp_stanza_set_name(iq, STANZA_NAME_IQ); @@ -450,9 +452,9 @@ stanza_create_roster_set(xmpp_ctx_t *ctx, const char * const id, return iq; } -xmpp_stanza_t * -stanza_create_invite(xmpp_ctx_t *ctx, const char * const room, - const char * const contact, const char * const reason, const char * const password) +xmpp_stanza_t* +stanza_create_invite(xmpp_ctx_t *ctx, const char *const room, + const char *const contact, const char *const reason, const char *const password) { xmpp_stanza_t *message, *x; @@ -481,9 +483,9 @@ stanza_create_invite(xmpp_ctx_t *ctx, const char * const room, return message; } -xmpp_stanza_t * -stanza_create_mediated_invite(xmpp_ctx_t *ctx, const char * const room, - const char * const contact, const char * const reason) +xmpp_stanza_t* +stanza_create_mediated_invite(xmpp_ctx_t *ctx, const char *const room, + const char *const contact, const char *const reason) { xmpp_stanza_t *message, *x, *invite; @@ -521,9 +523,9 @@ stanza_create_mediated_invite(xmpp_ctx_t *ctx, const char * const room, return message; } -xmpp_stanza_t * -stanza_create_room_join_presence(xmpp_ctx_t * const ctx, - const char * const full_room_jid, const char * const passwd) +xmpp_stanza_t* +stanza_create_room_join_presence(xmpp_ctx_t *const ctx, + const char *const full_room_jid, const char *const passwd) { xmpp_stanza_t *presence = xmpp_stanza_new(ctx); xmpp_stanza_set_name(presence, STANZA_NAME_PRESENCE); @@ -554,9 +556,9 @@ stanza_create_room_join_presence(xmpp_ctx_t * const ctx, return presence; } -xmpp_stanza_t * +xmpp_stanza_t* stanza_create_room_newnick_presence(xmpp_ctx_t *ctx, - const char * const full_room_jid) + const char *const full_room_jid) { xmpp_stanza_t *presence = xmpp_stanza_new(ctx); char *id = create_unique_id("sub"); @@ -568,9 +570,9 @@ stanza_create_room_newnick_presence(xmpp_ctx_t *ctx, return presence; } -xmpp_stanza_t * -stanza_create_room_leave_presence(xmpp_ctx_t *ctx, const char * const room, - const char * const nick) +xmpp_stanza_t* +stanza_create_room_leave_presence(xmpp_ctx_t *ctx, const char *const room, + const char *const nick) { GString *full_jid = g_string_new(room); g_string_append(full_jid, "/"); @@ -589,8 +591,8 @@ stanza_create_room_leave_presence(xmpp_ctx_t *ctx, const char * const room, return presence; } -xmpp_stanza_t * -stanza_create_instant_room_request_iq(xmpp_ctx_t *ctx, const char * const room_jid) +xmpp_stanza_t* +stanza_create_instant_room_request_iq(xmpp_ctx_t *ctx, const char *const room_jid) { xmpp_stanza_t *iq = xmpp_stanza_new(ctx); xmpp_stanza_set_name(iq, STANZA_NAME_IQ); @@ -618,8 +620,8 @@ stanza_create_instant_room_request_iq(xmpp_ctx_t *ctx, const char * const room_j return iq; } -xmpp_stanza_t * -stanza_create_instant_room_destroy_iq(xmpp_ctx_t *ctx, const char * const room_jid) +xmpp_stanza_t* +stanza_create_instant_room_destroy_iq(xmpp_ctx_t *ctx, const char *const room_jid) { xmpp_stanza_t *iq = xmpp_stanza_new(ctx); xmpp_stanza_set_name(iq, STANZA_NAME_IQ); @@ -645,8 +647,8 @@ stanza_create_instant_room_destroy_iq(xmpp_ctx_t *ctx, const char * const room_j return iq; } -xmpp_stanza_t * -stanza_create_room_config_request_iq(xmpp_ctx_t *ctx, const char * const room_jid) +xmpp_stanza_t* +stanza_create_room_config_request_iq(xmpp_ctx_t *ctx, const char *const room_jid) { xmpp_stanza_t *iq = xmpp_stanza_new(ctx); xmpp_stanza_set_name(iq, STANZA_NAME_IQ); @@ -666,8 +668,8 @@ stanza_create_room_config_request_iq(xmpp_ctx_t *ctx, const char * const room_ji return iq; } -xmpp_stanza_t * -stanza_create_room_config_cancel_iq(xmpp_ctx_t *ctx, const char * const room_jid) +xmpp_stanza_t* +stanza_create_room_config_cancel_iq(xmpp_ctx_t *ctx, const char *const room_jid) { xmpp_stanza_t *iq = xmpp_stanza_new(ctx); xmpp_stanza_set_name(iq, STANZA_NAME_IQ); @@ -695,8 +697,8 @@ stanza_create_room_config_cancel_iq(xmpp_ctx_t *ctx, const char * const room_jid return iq; } -xmpp_stanza_t * -stanza_create_room_affiliation_list_iq(xmpp_ctx_t *ctx, const char * const room, const char * const affiliation) +xmpp_stanza_t* +stanza_create_room_affiliation_list_iq(xmpp_ctx_t *ctx, const char *const room, const char *const affiliation) { xmpp_stanza_t *iq = xmpp_stanza_new(ctx); xmpp_stanza_set_name(iq, STANZA_NAME_IQ); @@ -722,8 +724,8 @@ stanza_create_room_affiliation_list_iq(xmpp_ctx_t *ctx, const char * const room, return iq; } -xmpp_stanza_t * -stanza_create_room_role_list_iq(xmpp_ctx_t *ctx, const char * const room, const char * const role) +xmpp_stanza_t* +stanza_create_room_role_list_iq(xmpp_ctx_t *ctx, const char *const room, const char *const role) { xmpp_stanza_t *iq = xmpp_stanza_new(ctx); xmpp_stanza_set_name(iq, STANZA_NAME_IQ); @@ -749,9 +751,9 @@ stanza_create_room_role_list_iq(xmpp_ctx_t *ctx, const char * const room, const return iq; } -xmpp_stanza_t * -stanza_create_room_affiliation_set_iq(xmpp_ctx_t *ctx, const char * const room, const char * const jid, - const char * const affiliation, const char * const reason) +xmpp_stanza_t* +stanza_create_room_affiliation_set_iq(xmpp_ctx_t *ctx, const char *const room, const char *const jid, + const char *const affiliation, const char *const reason) { xmpp_stanza_t *iq = xmpp_stanza_new(ctx); xmpp_stanza_set_name(iq, STANZA_NAME_IQ); @@ -790,9 +792,9 @@ stanza_create_room_affiliation_set_iq(xmpp_ctx_t *ctx, const char * const room, return iq; } -xmpp_stanza_t * -stanza_create_room_role_set_iq(xmpp_ctx_t * const ctx, const char * const room, const char * const nick, - const char * const role, const char * const reason) +xmpp_stanza_t* +stanza_create_room_role_set_iq(xmpp_ctx_t *const ctx, const char *const room, const char *const nick, + const char *const role, const char *const reason) { xmpp_stanza_t *iq = xmpp_stanza_new(ctx); xmpp_stanza_set_name(iq, STANZA_NAME_IQ); @@ -831,9 +833,9 @@ stanza_create_room_role_set_iq(xmpp_ctx_t * const ctx, const char * const room, return iq; } -xmpp_stanza_t * -stanza_create_room_kick_iq(xmpp_ctx_t * const ctx, const char * const room, const char * const nick, - const char * const reason) +xmpp_stanza_t* +stanza_create_room_kick_iq(xmpp_ctx_t *const ctx, const char *const room, const char *const nick, + const char *const reason) { xmpp_stanza_t *iq = xmpp_stanza_new(ctx); xmpp_stanza_set_name(iq, STANZA_NAME_IQ); @@ -872,8 +874,8 @@ stanza_create_room_kick_iq(xmpp_ctx_t * const ctx, const char * const room, cons return iq; } -xmpp_stanza_t * -stanza_create_presence(xmpp_ctx_t * const ctx) +xmpp_stanza_t* +stanza_create_presence(xmpp_ctx_t *const ctx) { xmpp_stanza_t *presence = xmpp_stanza_new(ctx); xmpp_stanza_set_name(presence, STANZA_NAME_PRESENCE); @@ -881,8 +883,8 @@ stanza_create_presence(xmpp_ctx_t * const ctx) return presence; } -xmpp_stanza_t * -stanza_create_software_version_iq(xmpp_ctx_t *ctx, const char * const fulljid) +xmpp_stanza_t* +stanza_create_software_version_iq(xmpp_ctx_t *ctx, const char *const fulljid) { xmpp_stanza_t *iq = xmpp_stanza_new(ctx); xmpp_stanza_set_name(iq, STANZA_NAME_IQ); @@ -904,7 +906,7 @@ stanza_create_software_version_iq(xmpp_ctx_t *ctx, const char * const fulljid) return iq; } -xmpp_stanza_t * +xmpp_stanza_t* stanza_create_roster_iq(xmpp_ctx_t *ctx) { xmpp_stanza_t *iq = xmpp_stanza_new(ctx); @@ -922,9 +924,9 @@ stanza_create_roster_iq(xmpp_ctx_t *ctx) return iq; } -xmpp_stanza_t * -stanza_create_disco_info_iq(xmpp_ctx_t *ctx, const char * const id, const char * const to, - const char * const node) +xmpp_stanza_t* +stanza_create_disco_info_iq(xmpp_ctx_t *ctx, const char *const id, const char *const to, + const char *const node) { xmpp_stanza_t *iq = xmpp_stanza_new(ctx); xmpp_stanza_set_name(iq, STANZA_NAME_IQ); @@ -945,9 +947,9 @@ stanza_create_disco_info_iq(xmpp_ctx_t *ctx, const char * const id, const char * return iq; } -xmpp_stanza_t * -stanza_create_disco_items_iq(xmpp_ctx_t *ctx, const char * const id, - const char * const jid) +xmpp_stanza_t* +stanza_create_disco_items_iq(xmpp_ctx_t *ctx, const char *const id, + const char *const jid) { xmpp_stanza_t *iq = xmpp_stanza_new(ctx); xmpp_stanza_set_name(iq, STANZA_NAME_IQ); @@ -965,8 +967,8 @@ stanza_create_disco_items_iq(xmpp_ctx_t *ctx, const char * const id, return iq; } -xmpp_stanza_t * -stanza_create_last_activity_iq(xmpp_ctx_t *ctx, const char * const id, const char * const to) +xmpp_stanza_t* +stanza_create_last_activity_iq(xmpp_ctx_t *ctx, const char *const id, const char *const to) { xmpp_stanza_t *iq = xmpp_stanza_new(ctx); xmpp_stanza_set_name(iq, STANZA_NAME_IQ); @@ -984,8 +986,8 @@ stanza_create_last_activity_iq(xmpp_ctx_t *ctx, const char * const id, const cha return iq; } -xmpp_stanza_t * -stanza_create_room_config_submit_iq(xmpp_ctx_t *ctx, const char * const room, DataForm *form) +xmpp_stanza_t* +stanza_create_room_config_submit_iq(xmpp_ctx_t *ctx, const char *const room, DataForm *form) { xmpp_stanza_t *iq = xmpp_stanza_new(ctx); xmpp_stanza_set_name(iq, STANZA_NAME_IQ); @@ -1019,8 +1021,8 @@ stanza_contains_chat_state(xmpp_stanza_t *stanza) (xmpp_stanza_get_child_by_name(stanza, STANZA_NAME_INACTIVE) != NULL)); } -xmpp_stanza_t * -stanza_create_ping_iq(xmpp_ctx_t *ctx, const char * const target) +xmpp_stanza_t* +stanza_create_ping_iq(xmpp_ctx_t *ctx, const char *const target) { xmpp_stanza_t *iq = xmpp_stanza_new(ctx); xmpp_stanza_set_name(iq, STANZA_NAME_IQ); @@ -1044,7 +1046,7 @@ stanza_create_ping_iq(xmpp_ctx_t *ctx, const char * const target) } GDateTime* -stanza_get_delay(xmpp_stanza_t * const stanza) +stanza_get_delay(xmpp_stanza_t *const stanza) { GTimeVal utc_stamp; // first check for XEP-0203 delayed delivery @@ -1081,7 +1083,7 @@ stanza_get_delay(xmpp_stanza_t * const stanza) return NULL; } -char * +char* stanza_get_status(xmpp_stanza_t *stanza, char *def) { xmpp_ctx_t *ctx = connection_get_ctx(); @@ -1105,7 +1107,7 @@ stanza_get_status(xmpp_stanza_t *stanza, char *def) } } -char * +char* stanza_get_show(xmpp_stanza_t *stanza, char *def) { xmpp_ctx_t *ctx = connection_get_ctx(); @@ -1130,7 +1132,7 @@ stanza_get_show(xmpp_stanza_t *stanza, char *def) } gboolean -stanza_is_muc_presence(xmpp_stanza_t * const stanza) +stanza_is_muc_presence(xmpp_stanza_t *const stanza) { if (stanza == NULL) { return FALSE; @@ -1149,7 +1151,7 @@ stanza_is_muc_presence(xmpp_stanza_t * const stanza) } gboolean -stanza_muc_requires_config(xmpp_stanza_t * const stanza) +stanza_muc_requires_config(xmpp_stanza_t *const stanza) { // no stanza, or not presence stanza if ((stanza == NULL) || (g_strcmp0(xmpp_stanza_get_name(stanza), STANZA_NAME_PRESENCE) != 0)) { @@ -1186,8 +1188,8 @@ stanza_muc_requires_config(xmpp_stanza_t * const stanza) } gboolean -stanza_is_muc_self_presence(xmpp_stanza_t * const stanza, - const char * const self_jid) +stanza_is_muc_self_presence(xmpp_stanza_t *const stanza, + const char *const self_jid) { // no stanza, or not presence stanza if ((stanza == NULL) || (g_strcmp0(xmpp_stanza_get_name(stanza), STANZA_NAME_PRESENCE) != 0)) { @@ -1254,8 +1256,8 @@ stanza_is_muc_self_presence(xmpp_stanza_t * const stanza, return FALSE; } -GSList * -stanza_get_status_codes_by_ns(xmpp_stanza_t * const stanza, char *ns) +GSList* +stanza_get_status_codes_by_ns(xmpp_stanza_t *const stanza, char *ns) { GSList *codes = NULL; xmpp_stanza_t *ns_child = xmpp_stanza_get_child_by_ns(stanza, ns); @@ -1292,7 +1294,7 @@ stanza_room_destroyed(xmpp_stanza_t *stanza) return FALSE; } -char * +char* stanza_get_muc_destroy_alternative_room(xmpp_stanza_t *stanza) { char *stanza_name = xmpp_stanza_get_name(stanza); @@ -1312,7 +1314,7 @@ stanza_get_muc_destroy_alternative_room(xmpp_stanza_t *stanza) return NULL; } -char * +char* stanza_get_muc_destroy_alternative_password(xmpp_stanza_t *stanza) { char *stanza_name = xmpp_stanza_get_name(stanza); @@ -1334,7 +1336,7 @@ stanza_get_muc_destroy_alternative_password(xmpp_stanza_t *stanza) return NULL; } -char * +char* stanza_get_muc_destroy_reason(xmpp_stanza_t *stanza) { char *stanza_name = xmpp_stanza_get_name(stanza); @@ -1356,7 +1358,7 @@ stanza_get_muc_destroy_reason(xmpp_stanza_t *stanza) return NULL; } -char * +char* stanza_get_actor(xmpp_stanza_t *stanza) { char *stanza_name = xmpp_stanza_get_name(stanza); @@ -1382,7 +1384,7 @@ stanza_get_actor(xmpp_stanza_t *stanza) return NULL; } -char * +char* stanza_get_reason(xmpp_stanza_t *stanza) { char *stanza_name = xmpp_stanza_get_name(stanza); @@ -1405,7 +1407,7 @@ stanza_get_reason(xmpp_stanza_t *stanza) } gboolean -stanza_is_room_nick_change(xmpp_stanza_t * const stanza) +stanza_is_room_nick_change(xmpp_stanza_t *const stanza) { // no stanza, or not presence stanza if ((stanza == NULL) || (g_strcmp0(xmpp_stanza_get_name(stanza), STANZA_NAME_PRESENCE) != 0)) { @@ -1432,8 +1434,8 @@ stanza_is_room_nick_change(xmpp_stanza_t * const stanza) return FALSE; } -char * -stanza_get_new_nick(xmpp_stanza_t * const stanza) +char* +stanza_get_new_nick(xmpp_stanza_t *const stanza) { if (!stanza_is_room_nick_change(stanza)) { return NULL; @@ -1456,7 +1458,7 @@ stanza_get_new_nick(xmpp_stanza_t * const stanza) } int -stanza_get_idle_time(xmpp_stanza_t * const stanza) +stanza_get_idle_time(xmpp_stanza_t *const stanza) { xmpp_stanza_t *query = xmpp_stanza_get_child_by_name(stanza, STANZA_NAME_QUERY); @@ -1487,7 +1489,7 @@ stanza_get_idle_time(xmpp_stanza_t * const stanza) } XMPPCaps* -stanza_parse_caps(xmpp_stanza_t * const stanza) +stanza_parse_caps(xmpp_stanza_t *const stanza) { xmpp_stanza_t *caps_st = xmpp_stanza_get_child_by_name(stanza, STANZA_NAME_C); @@ -1512,8 +1514,8 @@ stanza_parse_caps(xmpp_stanza_t * const stanza) return caps; } -char * -stanza_get_caps_str(xmpp_stanza_t * const stanza) +char* +stanza_get_caps_str(xmpp_stanza_t *const stanza) { xmpp_stanza_t *caps = xmpp_stanza_get_child_by_name(stanza, STANZA_NAME_C); @@ -1541,7 +1543,7 @@ stanza_get_caps_str(xmpp_stanza_t * const stanza) return caps_str; } -char * +char* stanza_get_error_message(xmpp_stanza_t *stanza) { xmpp_ctx_t *ctx = connection_get_ctx(); @@ -1607,7 +1609,7 @@ stanza_get_error_message(xmpp_stanza_t *stanza) } void -stanza_attach_priority(xmpp_ctx_t * const ctx, xmpp_stanza_t * const presence, +stanza_attach_priority(xmpp_ctx_t *const ctx, xmpp_stanza_t *const presence, const int pri) { if (pri != 0) { @@ -1627,8 +1629,8 @@ stanza_attach_priority(xmpp_ctx_t * const ctx, xmpp_stanza_t * const presence, } void -stanza_attach_show(xmpp_ctx_t * const ctx, xmpp_stanza_t * const presence, - const char * const show) +stanza_attach_show(xmpp_ctx_t *const ctx, xmpp_stanza_t *const presence, + const char *const show) { if (show) { xmpp_stanza_t *show_stanza = xmpp_stanza_new(ctx); @@ -1643,8 +1645,8 @@ stanza_attach_show(xmpp_ctx_t * const ctx, xmpp_stanza_t * const presence, } void -stanza_attach_status(xmpp_ctx_t * const ctx, xmpp_stanza_t * const presence, - const char * const status) +stanza_attach_status(xmpp_ctx_t *const ctx, xmpp_stanza_t *const presence, + const char *const status) { if (status) { xmpp_stanza_t *status_stanza = xmpp_stanza_new(ctx); @@ -1659,8 +1661,8 @@ stanza_attach_status(xmpp_ctx_t * const ctx, xmpp_stanza_t * const presence, } void -stanza_attach_last_activity(xmpp_ctx_t * const ctx, - xmpp_stanza_t * const presence, const int idle) +stanza_attach_last_activity(xmpp_ctx_t *const ctx, + xmpp_stanza_t *const presence, const int idle) { xmpp_stanza_t *query = xmpp_stanza_new(ctx); xmpp_stanza_set_name(query, STANZA_NAME_QUERY); @@ -1673,7 +1675,7 @@ stanza_attach_last_activity(xmpp_ctx_t * const ctx, } void -stanza_attach_caps(xmpp_ctx_t * const ctx, xmpp_stanza_t * const presence) +stanza_attach_caps(xmpp_ctx_t *const ctx, xmpp_stanza_t *const presence) { xmpp_stanza_t *caps = xmpp_stanza_new(ctx); xmpp_stanza_set_name(caps, STANZA_NAME_C); @@ -1689,7 +1691,7 @@ stanza_attach_caps(xmpp_ctx_t * const ctx, xmpp_stanza_t * const presence) xmpp_stanza_release(query); } -const char * +const char* stanza_get_presence_string_from_type(resource_presence_t presence_type) { switch(presence_type) @@ -1759,7 +1761,7 @@ stanza_free_presence(XMPPPresence *presence) } } -XMPPPresence * +XMPPPresence* stanza_parse_presence(xmpp_stanza_t *stanza, int *err) { char *from = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_FROM); diff --git a/src/xmpp/stanza.h b/src/xmpp/stanza.h index 80a4fd93..7170e204 100644 --- a/src/xmpp/stanza.h +++ b/src/xmpp/stanza.h @@ -195,111 +195,100 @@ typedef enum { xmpp_stanza_t* stanza_create_bookmarks_storage_request(xmpp_ctx_t *ctx); -xmpp_stanza_t * stanza_enable_carbons(xmpp_ctx_t *ctx); +xmpp_stanza_t* stanza_enable_carbons(xmpp_ctx_t *ctx); -xmpp_stanza_t * stanza_disable_carbons(xmpp_ctx_t *ctx); +xmpp_stanza_t* stanza_disable_carbons(xmpp_ctx_t *ctx); xmpp_stanza_t* stanza_create_chat_state(xmpp_ctx_t *ctx, - const char * const fulljid, const char * const state); + const char *const fulljid, const char *const state); -xmpp_stanza_t * stanza_attach_state(xmpp_ctx_t *ctx, xmpp_stanza_t *stanza, const char * const state); -xmpp_stanza_t * stanza_attach_carbons_private(xmpp_ctx_t *ctx, xmpp_stanza_t *stanza); -xmpp_stanza_t * stanza_attach_hints_no_copy(xmpp_ctx_t *ctx, xmpp_stanza_t *stanza); -xmpp_stanza_t * stanza_attach_hints_no_store(xmpp_ctx_t *ctx, xmpp_stanza_t *stanza); -xmpp_stanza_t * stanza_attach_receipt_request(xmpp_ctx_t *ctx, xmpp_stanza_t *stanza); +xmpp_stanza_t* stanza_attach_state(xmpp_ctx_t *ctx, xmpp_stanza_t *stanza, const char *const state); +xmpp_stanza_t* stanza_attach_carbons_private(xmpp_ctx_t *ctx, xmpp_stanza_t *stanza); +xmpp_stanza_t* stanza_attach_hints_no_copy(xmpp_ctx_t *ctx, xmpp_stanza_t *stanza); +xmpp_stanza_t* stanza_attach_hints_no_store(xmpp_ctx_t *ctx, xmpp_stanza_t *stanza); +xmpp_stanza_t* stanza_attach_receipt_request(xmpp_ctx_t *ctx, xmpp_stanza_t *stanza); xmpp_stanza_t* stanza_create_message(xmpp_ctx_t *ctx, char *id, - const char * const recipient, const char * const type, const char * const message); + const char *const recipient, const char *const type, const char *const message); -xmpp_stanza_t* stanza_create_room_join_presence(xmpp_ctx_t * const ctx, - const char * const full_room_jid, const char * const passwd); +xmpp_stanza_t* stanza_create_room_join_presence(xmpp_ctx_t *const ctx, + const char *const full_room_jid, const char *const passwd); xmpp_stanza_t* stanza_create_room_newnick_presence(xmpp_ctx_t *ctx, - const char * const full_room_jid); + const char *const full_room_jid); xmpp_stanza_t* stanza_create_room_leave_presence(xmpp_ctx_t *ctx, - const char * const room, const char * const nick); + const char *const room, const char *const nick); -xmpp_stanza_t* stanza_create_presence(xmpp_ctx_t * const ctx); +xmpp_stanza_t* stanza_create_presence(xmpp_ctx_t *const ctx); xmpp_stanza_t* stanza_create_roster_iq(xmpp_ctx_t *ctx); -xmpp_stanza_t* stanza_create_ping_iq(xmpp_ctx_t *ctx, const char * const target); -xmpp_stanza_t* stanza_create_disco_info_iq(xmpp_ctx_t *ctx, const char * const id, - const char * const to, const char * const node); +xmpp_stanza_t* stanza_create_ping_iq(xmpp_ctx_t *ctx, const char *const target); +xmpp_stanza_t* stanza_create_disco_info_iq(xmpp_ctx_t *ctx, const char *const id, + const char *const to, const char *const node); -xmpp_stanza_t* stanza_create_last_activity_iq(xmpp_ctx_t *ctx, const char * const id, - const char * const to); +xmpp_stanza_t* stanza_create_last_activity_iq(xmpp_ctx_t *ctx, const char *const id, + const char *const to); -xmpp_stanza_t* stanza_create_invite(xmpp_ctx_t *ctx, const char * const room, - const char * const contact, const char * const reason, const char * const password); -xmpp_stanza_t* stanza_create_mediated_invite(xmpp_ctx_t *ctx, const char * const room, - const char * const contact, const char * const reason); +xmpp_stanza_t* stanza_create_invite(xmpp_ctx_t *ctx, const char *const room, + const char *const contact, const char *const reason, const char *const password); +xmpp_stanza_t* stanza_create_mediated_invite(xmpp_ctx_t *ctx, const char *const room, + const char *const contact, const char *const reason); gboolean stanza_contains_chat_state(xmpp_stanza_t *stanza); -GDateTime* stanza_get_delay(xmpp_stanza_t * const stanza); +GDateTime* stanza_get_delay(xmpp_stanza_t *const stanza); -gboolean stanza_is_muc_presence(xmpp_stanza_t * const stanza); -gboolean stanza_is_muc_self_presence(xmpp_stanza_t * const stanza, - const char * const self_jid); -gboolean stanza_is_room_nick_change(xmpp_stanza_t * const stanza); -gboolean stanza_muc_requires_config(xmpp_stanza_t * const stanza); +gboolean stanza_is_muc_presence(xmpp_stanza_t *const stanza); +gboolean stanza_is_muc_self_presence(xmpp_stanza_t *const stanza, + const char *const self_jid); +gboolean stanza_is_room_nick_change(xmpp_stanza_t *const stanza); +gboolean stanza_muc_requires_config(xmpp_stanza_t *const stanza); -char * stanza_get_new_nick(xmpp_stanza_t * const stanza); -xmpp_stanza_t* stanza_create_instant_room_request_iq(xmpp_ctx_t *ctx, - const char * const room_jid); -xmpp_stanza_t* stanza_create_instant_room_destroy_iq(xmpp_ctx_t *ctx, - const char * const room_jid); -xmpp_stanza_t* stanza_create_room_config_request_iq(xmpp_ctx_t *ctx, - const char * const room_jid); -xmpp_stanza_t* stanza_create_room_config_cancel_iq(xmpp_ctx_t *ctx, - const char * const room_jid); -xmpp_stanza_t* stanza_create_room_config_submit_iq(xmpp_ctx_t *ctx, - const char * const room, DataForm *form); -xmpp_stanza_t* stanza_create_room_affiliation_list_iq(xmpp_ctx_t *ctx, const char * const room, - const char * const affiliation); -xmpp_stanza_t* stanza_create_room_affiliation_set_iq(xmpp_ctx_t *ctx, const char * const room, const char * const jid, - const char * const affiliation, const char * const reason); -xmpp_stanza_t* stanza_create_room_role_set_iq(xmpp_ctx_t * const ctx, const char * const room, const char * const jid, - const char * const role, const char * const reason); -xmpp_stanza_t* stanza_create_room_role_list_iq(xmpp_ctx_t *ctx, const char * const room, const char * const role); +char* stanza_get_new_nick(xmpp_stanza_t *const stanza); +xmpp_stanza_t* stanza_create_instant_room_request_iq(xmpp_ctx_t *ctx, const char *const room_jid); +xmpp_stanza_t* stanza_create_instant_room_destroy_iq(xmpp_ctx_t *ctx, const char *const room_jid); +xmpp_stanza_t* stanza_create_room_config_request_iq(xmpp_ctx_t *ctx, const char *const room_jid); +xmpp_stanza_t* stanza_create_room_config_cancel_iq(xmpp_ctx_t *ctx, const char *const room_jid); +xmpp_stanza_t* stanza_create_room_config_submit_iq(xmpp_ctx_t *ctx, const char *const room, DataForm *form); +xmpp_stanza_t* stanza_create_room_affiliation_list_iq(xmpp_ctx_t *ctx, const char *const room, + const char *const affiliation); +xmpp_stanza_t* stanza_create_room_affiliation_set_iq(xmpp_ctx_t *ctx, const char *const room, const char *const jid, + const char *const affiliation, const char *const reason); +xmpp_stanza_t* stanza_create_room_role_set_iq(xmpp_ctx_t *const ctx, const char *const room, const char *const jid, + const char *const role, const char *const reason); +xmpp_stanza_t* stanza_create_room_role_list_iq(xmpp_ctx_t *ctx, const char *const room, const char *const role); -xmpp_stanza_t* stanza_create_room_subject_message(xmpp_ctx_t *ctx, const char * const room, const char * const subject); -xmpp_stanza_t* stanza_create_room_kick_iq(xmpp_ctx_t * const ctx, const char * const room, const char * const nick, - const char * const reason); +xmpp_stanza_t* stanza_create_room_subject_message(xmpp_ctx_t *ctx, const char *const room, const char *const subject); +xmpp_stanza_t* stanza_create_room_kick_iq(xmpp_ctx_t *const ctx, const char *const room, const char *const nick, + const char *const reason); -int stanza_get_idle_time(xmpp_stanza_t * const stanza); -char * stanza_get_caps_str(xmpp_stanza_t * const stanza); +int stanza_get_idle_time(xmpp_stanza_t *const stanza); +char* stanza_get_caps_str(xmpp_stanza_t *const stanza); -DataForm * stanza_create_form(xmpp_stanza_t * const stanza); +DataForm* stanza_create_form(xmpp_stanza_t *const stanza); void stanza_destroy_form(DataForm *form); -void stanza_attach_priority(xmpp_ctx_t * const ctx, - xmpp_stanza_t * const presence, const int pri); -void stanza_attach_last_activity(xmpp_ctx_t * const ctx, - xmpp_stanza_t * const presence, const int idle); -void stanza_attach_caps(xmpp_ctx_t * const ctx, xmpp_stanza_t * const presence); -void stanza_attach_show(xmpp_ctx_t * const ctx, xmpp_stanza_t * const presence, - const char * const show); -void stanza_attach_status(xmpp_ctx_t * const ctx, xmpp_stanza_t * const presence, - const char * const status); +void stanza_attach_priority(xmpp_ctx_t *const ctx, xmpp_stanza_t *const presence, const int pri); +void stanza_attach_last_activity(xmpp_ctx_t *const ctx, xmpp_stanza_t *const presence, const int idle); +void stanza_attach_caps(xmpp_ctx_t *const ctx, xmpp_stanza_t *const presence); +void stanza_attach_show(xmpp_ctx_t *const ctx, xmpp_stanza_t *const presence, const char *const show); +void stanza_attach_status(xmpp_ctx_t *const ctx, xmpp_stanza_t *const presence, const char *const status); -const char * stanza_get_presence_string_from_type(resource_presence_t presence_type); -xmpp_stanza_t * stanza_create_software_version_iq(xmpp_ctx_t *ctx, const char * const fulljid); -xmpp_stanza_t * stanza_create_disco_items_iq(xmpp_ctx_t *ctx, const char * const id, - const char * const jid); +const char* stanza_get_presence_string_from_type(resource_presence_t presence_type); +xmpp_stanza_t* stanza_create_software_version_iq(xmpp_ctx_t *ctx, const char *const fulljid); +xmpp_stanza_t* stanza_create_disco_items_iq(xmpp_ctx_t *ctx, const char *const id, const char *const jid); -char * stanza_get_status(xmpp_stanza_t *stanza, char *def); -char * stanza_get_show(xmpp_stanza_t *stanza, char *def); +char* stanza_get_status(xmpp_stanza_t *stanza, char *def); +char* stanza_get_show(xmpp_stanza_t *stanza, char *def); -xmpp_stanza_t * stanza_create_roster_set(xmpp_ctx_t *ctx, const char * const id, - const char * const jid, const char * const handle, GSList *groups); -xmpp_stanza_t * stanza_create_roster_remove_set(xmpp_ctx_t *ctx, - const char * const barejid); +xmpp_stanza_t* stanza_create_roster_set(xmpp_ctx_t *ctx, const char *const id, const char *const jid, + const char *const handle, GSList *groups); +xmpp_stanza_t* stanza_create_roster_remove_set(xmpp_ctx_t *ctx, const char *const barejid); -char * stanza_get_error_message(xmpp_stanza_t * const stanza); +char* stanza_get_error_message(xmpp_stanza_t *const stanza); -GSList* stanza_get_status_codes_by_ns(xmpp_stanza_t * const stanza, char *ns); +GSList* stanza_get_status_codes_by_ns(xmpp_stanza_t *const stanza, char *ns); gboolean stanza_room_destroyed(xmpp_stanza_t *stanza); char* stanza_get_muc_destroy_alternative_room(xmpp_stanza_t *stanza); char* stanza_get_muc_destroy_alternative_password(xmpp_stanza_t *stanza); @@ -311,7 +300,7 @@ Resource* stanza_resource_from_presence(XMPPPresence *presence); XMPPPresence* stanza_parse_presence(xmpp_stanza_t *stanza, int *err); void stanza_free_presence(XMPPPresence *presence); -XMPPCaps* stanza_parse_caps(xmpp_stanza_t * const stanza); +XMPPCaps* stanza_parse_caps(xmpp_stanza_t *const stanza); void stanza_free_caps(XMPPCaps *caps); #endif diff --git a/src/xmpp/xmpp.h b/src/xmpp/xmpp.h index 43106fa6..d49b106d 100644 --- a/src/xmpp/xmpp.h +++ b/src/xmpp/xmpp.h @@ -138,81 +138,78 @@ typedef struct data_form_t { // connection functions void jabber_init(void); -jabber_conn_status_t jabber_connect_with_details(const char * const jid, - const char * const passwd, const char * const altdomain, const int port, const char *const tls_policy); -jabber_conn_status_t jabber_connect_with_account(const ProfAccount * const account); +jabber_conn_status_t jabber_connect_with_details(const char *const jid, const char *const passwd, + const char *const altdomain, const int port, const char *const tls_policy); +jabber_conn_status_t jabber_connect_with_account(const ProfAccount *const account); void jabber_disconnect(void); void jabber_shutdown(void); void jabber_process_events(int millis); -const char * jabber_get_fulljid(void); -const char * jabber_get_domain(void); +const char* jabber_get_fulljid(void); +const char* jabber_get_domain(void); jabber_conn_status_t jabber_get_connection_status(void); -char * jabber_get_presence_message(void); +char* jabber_get_presence_message(void); char* jabber_get_account_name(void); -GList * jabber_get_available_resources(void); +GList* jabber_get_available_resources(void); char* jabber_create_uuid(void); void jabber_free_uuid(char *uuid); // message functions -char* message_send_chat(const char * const barejid, const char * const msg); -char* message_send_chat_otr(const char * const barejid, const char * const msg); -char* message_send_chat_pgp(const char * const barejid, const char * const msg); -void message_send_private(const char * const fulljid, const char * const msg); -void message_send_groupchat(const char * const roomjid, const char * const msg); -void message_send_groupchat_subject(const char * const roomjid, const char * const subject); +char* message_send_chat(const char *const barejid, const char *const msg); +char* message_send_chat_otr(const char *const barejid, const char *const msg); +char* message_send_chat_pgp(const char *const barejid, const char *const msg); +void message_send_private(const char *const fulljid, const char *const msg); +void message_send_groupchat(const char *const roomjid, const char *const msg); +void message_send_groupchat_subject(const char *const roomjid, const char *const subject); -void message_send_inactive(const char * const jid); -void message_send_composing(const char * const jid); -void message_send_paused(const char * const jid); -void message_send_gone(const char * const jid); +void message_send_inactive(const char *const jid); +void message_send_composing(const char *const jid); +void message_send_paused(const char *const jid); +void message_send_gone(const char *const jid); -void message_send_invite(const char * const room, const char * const contact, - const char * const reason); +void message_send_invite(const char *const room, const char *const contact, const char *const reason); // presence functions -void presence_subscription(const char * const jid, const jabber_subscr_t action); +void presence_subscription(const char *const jid, const jabber_subscr_t action); GSList* presence_get_subscription_requests(void); gint presence_sub_request_count(void); void presence_reset_sub_request_search(void); -char * presence_sub_request_find(const char * const search_str); +char* presence_sub_request_find(const char *const search_str); void presence_join_room(char *room, char *nick, char * passwd); -void presence_change_room_nick(const char * const room, const char * const nick); -void presence_leave_chat_room(const char * const room_jid); -void presence_send(resource_presence_t status, const char * const msg, int idle, char *signed_status); -gboolean presence_sub_request_exists(const char * const bare_jid); +void presence_change_room_nick(const char *const room, const char *const nick); +void presence_leave_chat_room(const char *const room_jid); +void presence_send(resource_presence_t status, const char *const msg, int idle, char *signed_status); +gboolean presence_sub_request_exists(const char *const bare_jid); // iq functions -void iq_enable_carbons(); -void iq_disable_carbons(); -void iq_send_software_version(const char * const fulljid); +void iq_enable_carbons(void); +void iq_disable_carbons(void); +void iq_send_software_version(const char *const fulljid); void iq_room_list_request(gchar *conferencejid); void iq_disco_info_request(gchar *jid); void iq_disco_items_request(gchar *jid); void iq_last_activity_request(gchar *jid); void iq_set_autoping(int seconds); -void iq_confirm_instant_room(const char * const room_jid); -void iq_destroy_room(const char * const room_jid); -void iq_request_room_config_form(const char * const room_jid); -void iq_submit_room_config(const char * const room, DataForm *form); -void iq_room_config_cancel(const char * const room_jid); -void iq_send_ping(const char * const target); -void iq_send_caps_request(const char * const to, const char * const id, - const char * const node, const char * const ver); -void iq_send_caps_request_for_jid(const char * const to, const char * const id, - const char * const node, const char * const ver); -void iq_send_caps_request_legacy(const char * const to, const char * const id, - const char * const node, const char * const ver); -void iq_room_info_request(const char * const room, gboolean display_result); -void iq_room_affiliation_list(const char * const room, char *affiliation); -void iq_room_affiliation_set(const char * const room, const char * const jid, char *affiliation, - const char * const reason); -void iq_room_kick_occupant(const char * const room, const char * const nick, const char * const reason); -void iq_room_role_set(const char * const room, const char * const nick, char *role, - const char * const reason); +void iq_confirm_instant_room(const char *const room_jid); +void iq_destroy_room(const char *const room_jid); +void iq_request_room_config_form(const char *const room_jid); +void iq_submit_room_config(const char *const room, DataForm *form); +void iq_room_config_cancel(const char *const room_jid); +void iq_send_ping(const char *const target); +void iq_send_caps_request(const char *const to, const char *const id, const char *const node, const char *const ver); +void iq_send_caps_request_for_jid(const char *const to, const char *const id, const char *const node, + const char *const ver); +void iq_send_caps_request_legacy(const char *const to, const char *const id, const char *const node, + const char *const ver); +void iq_room_info_request(const char *const room, gboolean display_result); +void iq_room_affiliation_list(const char *const room, char *affiliation); +void iq_room_affiliation_set(const char *const room, const char *const jid, char *affiliation, + const char *const reason); +void iq_room_kick_occupant(const char *const room, const char *const nick, const char *const reason); +void iq_room_role_set(const char *const room, const char *const nick, char *role, const char *const reason); void iq_room_role_list(const char * const room, char *role); // caps functions -Capabilities* caps_lookup(const char * const jid); +Capabilities* caps_lookup(const char *const jid); void caps_close(void); void caps_destroy(Capabilities *caps); @@ -220,32 +217,32 @@ gboolean bookmark_add(const char *jid, const char *nick, const char *password, c gboolean bookmark_update(const char *jid, const char *nick, const char *password, const char *autojoin_str); gboolean bookmark_remove(const char *jid); gboolean bookmark_join(const char *jid); -const GList * bookmark_get_list(void); -char * bookmark_find(const char * const search_str); +const GList* bookmark_get_list(void); +char* bookmark_find(const char *const search_str); void bookmark_autocomplete_reset(void); -void roster_send_name_change(const char * const barejid, const char * const new_name, GSList *groups); -void roster_send_add_to_group(const char * const group, PContact contact); -void roster_send_remove_from_group(const char * const group, PContact contact); -void roster_send_add_new(const char * const barejid, const char * const name); -void roster_send_remove(const char * const barejid); +void roster_send_name_change(const char *const barejid, const char *const new_name, GSList *groups); +void roster_send_add_to_group(const char *const group, PContact contact); +void roster_send_remove_from_group(const char *const group, PContact contact); +void roster_send_add_new(const char *const barejid, const char *const name); +void roster_send_remove(const char *const barejid); void form_destroy(DataForm *form); -char * form_get_form_type_field(DataForm *form); -void form_set_value(DataForm *form, const char * const tag, char *value); -gboolean form_add_unique_value(DataForm *form, const char * const tag, char *value); -void form_add_value(DataForm *form, const char * const tag, char *value); -gboolean form_remove_value(DataForm *form, const char * const tag, char *value); -gboolean form_remove_text_multi_value(DataForm *form, const char * const tag, int index); -gboolean form_tag_exists(DataForm *form, const char * const tag); -form_field_type_t form_get_field_type(DataForm *form, const char * const tag); -gboolean form_field_contains_option(DataForm *form, const char * const tag, char *value); -int form_get_value_count(DataForm *form, const char * const tag); -FormField* form_get_field_by_tag(DataForm *form, const char * const tag); -Autocomplete form_get_value_ac(DataForm *form, const char * const tag); +char* form_get_form_type_field(DataForm *form); +void form_set_value(DataForm *form, const char *const tag, char *value); +gboolean form_add_unique_value(DataForm *form, const char *const tag, char *value); +void form_add_value(DataForm *form, const char *const tag, char *value); +gboolean form_remove_value(DataForm *form, const char *const tag, char *value); +gboolean form_remove_text_multi_value(DataForm *form, const char *const tag, int index); +gboolean form_tag_exists(DataForm *form, const char *const tag); +form_field_type_t form_get_field_type(DataForm *form, const char *const tag); +gboolean form_field_contains_option(DataForm *form, const char *const tag, char *value); +int form_get_value_count(DataForm *form, const char *const tag); +FormField* form_get_field_by_tag(DataForm *form, const char *const tag); +Autocomplete form_get_value_ac(DataForm *form, const char *const tag); void form_reset_autocompleters(DataForm *form); -GSList * form_get_non_form_type_fields_sorted(DataForm *form); -GSList * form_get_field_values_sorted(FormField *field); +GSList* form_get_non_form_type_fields_sorted(DataForm *form); +GSList* form_get_field_values_sorted(FormField *field); #endif diff --git a/tests/unittests/test_common.c b/tests/unittests/test_common.c index 8df3790a..0e26b704 100644 --- a/tests/unittests/test_common.c +++ b/tests/unittests/test_common.c @@ -605,7 +605,7 @@ void strip_quotes_strips_first(void **state) char *result = strip_arg_quotes(input); assert_string_equal("/cmd test string", result); - + free(result); } diff --git a/tests/unittests/ui/stub_ui.h b/tests/unittests/ui/stub_ui.h index 81357a86..d4488c4b 100644 --- a/tests/unittests/ui/stub_ui.h +++ b/tests/unittests/ui/stub_ui.h @@ -3,4 +3,4 @@ void expect_any_cons_show(void); void expect_cons_show_error(char *expected); void expect_any_cons_show_error(void); void expect_ui_current_print_line(char *message); -void expect_ui_current_print_formatted_line(char show_char, int attrs, char *message); \ No newline at end of file +void expect_ui_current_print_formatted_line(char show_char, int attrs, char *message);