1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-12-04 14:46:46 -05:00

Merge branch 'master' into osx-functional

This commit is contained in:
James Booth 2015-10-26 01:05:31 +00:00
commit 67d57ba908
85 changed files with 1948 additions and 2006 deletions

View File

@ -46,8 +46,8 @@
static GHashTable *sessions; static GHashTable *sessions;
static void static void
_chat_session_new(const char * const barejid, const char * const resource, _chat_session_new(const char *const barejid, const char *const resource, gboolean resource_override,
gboolean resource_override, gboolean send_states) gboolean send_states)
{ {
assert(barejid != NULL); assert(barejid != NULL);
assert(resource != NULL); assert(resource != NULL);
@ -86,19 +86,19 @@ chat_sessions_clear(void)
} }
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); _chat_session_new(barejid, resource, TRUE, TRUE);
} }
ChatSession* ChatSession*
chat_session_get(const char * const barejid) chat_session_get(const char *const barejid)
{ {
return g_hash_table_lookup(sessions, barejid); return g_hash_table_lookup(sessions, barejid);
} }
void 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(barejid != NULL);
assert(resource != NULL); assert(resource != NULL);
@ -112,25 +112,25 @@ chat_session_recipient_gone(const char * const barejid, const char * const resou
} }
void 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); chat_session_recipient_active(barejid, resource, TRUE);
} }
void 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); chat_session_recipient_active(barejid, resource, TRUE);
} }
void 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); chat_session_recipient_active(barejid, resource, TRUE);
} }
void 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) gboolean send_states)
{ {
assert(barejid != NULL); assert(barejid != NULL);
@ -153,7 +153,7 @@ chat_session_recipient_active(const char * const barejid, const char * const res
} }
void void
chat_session_remove(const char * const barejid) chat_session_remove(const char *const barejid)
{ {
g_hash_table_remove(sessions, barejid); g_hash_table_remove(sessions, barejid);
} }

View File

@ -48,16 +48,15 @@ typedef struct chat_session_t {
void chat_sessions_init(void); void chat_sessions_init(void);
void chat_sessions_clear(void); void chat_sessions_clear(void);
void chat_session_resource_override(const char * const barejid, const char * const resource); void chat_session_resource_override(const char *const barejid, const char *const resource);
ChatSession* chat_session_get(const char * const barejid); ChatSession* chat_session_get(const char *const barejid);
void chat_session_recipient_active(const char * const barejid, const char * const resource, void chat_session_recipient_active(const char *const barejid, const char *const resource, gboolean send_states);
gboolean send_states); void chat_session_recipient_typing(const char *const barejid, const char *const resource);
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_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_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_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 #endif

View File

@ -44,7 +44,7 @@
#define PAUSED_TIMEOUT 10.0 #define PAUSED_TIMEOUT 10.0
#define INACTIVE_TIMEOUT 30.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* ChatState*
chat_state_new(void) chat_state_new(void)
@ -66,7 +66,7 @@ chat_state_free(ChatState *state)
} }
void 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); gdouble elapsed = g_timer_elapsed(state->timer, NULL);
@ -118,7 +118,7 @@ chat_state_handle_idle(const char * const barejid, ChatState *state)
} }
void 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 // ACTIVE|INACTIVE|PAUSED|GONE -> COMPOSING
if (state->type != CHAT_STATE_COMPOSING) { if (state->type != CHAT_STATE_COMPOSING) {
@ -138,7 +138,7 @@ chat_state_active(ChatState *state)
} }
void 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 (state->type != CHAT_STATE_GONE) {
if (prefs_get_boolean(PREF_STATES)) { if (prefs_get_boolean(PREF_STATES)) {
@ -150,7 +150,7 @@ chat_state_gone(const char * const barejid, ChatState *state)
} }
static void 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; gboolean send = TRUE;
GString *jid = g_string_new(barejid); GString *jid = g_string_new(barejid);

View File

@ -53,9 +53,9 @@ typedef struct prof_chat_state_t {
ChatState* chat_state_new(void); ChatState* chat_state_new(void);
void chat_state_free(ChatState *state); void chat_state_free(ChatState *state);
void chat_state_handle_idle(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_handle_typing(const char *const barejid, ChatState *state);
void chat_state_active(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 #endif

View File

@ -73,43 +73,43 @@
#include "ui/ui.h" #include "ui/ui.h"
#include "window_list.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* _sub_autocomplete(ProfWin *window, const char *const input);
static char * _notify_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* _theme_autocomplete(ProfWin *window, const char *const input);
static char * _autoaway_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* _autoconnect_autocomplete(ProfWin *window, const char *const input);
static char * _account_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* _who_autocomplete(ProfWin *window, const char *const input);
static char * _roster_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* _group_autocomplete(ProfWin *window, const char *const input);
static char * _bookmark_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* _otr_autocomplete(ProfWin *window, const char *const input);
static char * _pgp_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* _connect_autocomplete(ProfWin *window, const char *const input);
static char * _statuses_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* _alias_autocomplete(ProfWin *window, const char *const input);
static char * _join_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* _log_autocomplete(ProfWin *window, const char *const input);
static char * _form_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* _form_field_autocomplete(ProfWin *window, const char *const input);
static char * _occupants_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* _kick_autocomplete(ProfWin *window, const char *const input);
static char * _ban_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* _affiliation_autocomplete(ProfWin *window, const char *const input);
static char * _role_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* _resource_autocomplete(ProfWin *window, const char *const input);
static char * _titlebar_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* _inpblock_autocomplete(ProfWin *window, const char *const input);
static char * _time_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* _receipts_autocomplete(ProfWin *window, const char *const input);
static char * _help_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* _wins_autocomplete(ProfWin *window, const char *const input);
static char * _tls_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* _script_autocomplete(ProfWin *window, const char *const input);
GHashTable *commands = NULL; GHashTable *commands = NULL;
@ -2376,7 +2376,7 @@ cmd_alias_remove(char *value)
// Command autocompletion functions // Command autocompletion functions
char* char*
cmd_autocomplete(ProfWin *window, const char * const input) cmd_autocomplete(ProfWin *window, const char *const input)
{ {
// autocomplete command // autocomplete command
if ((strncmp(input, "/", 1) == 0) && (!str_contains(input, strlen(input), ' '))) { if ((strncmp(input, "/", 1) == 0) && (!str_contains(input, strlen(input), ' '))) {
@ -2511,7 +2511,7 @@ cmd_reset_autocomplete(ProfWin *window)
} }
gboolean gboolean
cmd_valid_tag(const char * const str) cmd_valid_tag(const char *const str)
{ {
return ((g_strcmp0(str, CMD_TAG_CHAT) == 0) || return ((g_strcmp0(str, CMD_TAG_CHAT) == 0) ||
(g_strcmp0(str, CMD_TAG_GROUPCHAT) == 0) || (g_strcmp0(str, CMD_TAG_GROUPCHAT) == 0) ||
@ -2523,7 +2523,7 @@ cmd_valid_tag(const char * const str)
} }
gboolean gboolean
cmd_has_tag(Command *pcmd, const char * const tag) cmd_has_tag(Command *pcmd, const char *const tag)
{ {
int i = 0; int i = 0;
for (i = 0; pcmd->help.tags[i] != NULL; i++) { for (i = 0; pcmd->help.tags[i] != NULL; i++) {
@ -2568,7 +2568,7 @@ cmd_process_input(ProfWin *window, char *inp)
// Command execution // Command execution
void 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 "); GString *command = g_string_new("/connect ");
g_string_append(command, account); g_string_append(command, account);
@ -2577,7 +2577,7 @@ cmd_execute_connect(ProfWin *window, const char * const account)
} }
static gboolean 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) { if (g_str_has_prefix(command, "/field") && window->type == WIN_MUC_CONFIG) {
gboolean result = FALSE; gboolean result = FALSE;
@ -2620,8 +2620,8 @@ _cmd_execute(ProfWin *window, const char * const command, const char * const inp
} }
} }
static char * static char*
_cmd_complete_parameters(ProfWin *window, const char * const input) _cmd_complete_parameters(ProfWin *window, const char *const input)
{ {
int i; int i;
char *result = NULL; char *result = NULL;
@ -2771,8 +2771,8 @@ _cmd_complete_parameters(ProfWin *window, const char * const input)
return NULL; return NULL;
} }
static char * static char*
_sub_autocomplete(ProfWin *window, const char * const input) _sub_autocomplete(ProfWin *window, const char *const input)
{ {
char *result = NULL; char *result = NULL;
result = autocomplete_param_with_func(input, "/sub allow", presence_sub_request_find); 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; return NULL;
} }
static char * static char*
_who_autocomplete(ProfWin *window, const char * const input) _who_autocomplete(ProfWin *window, const char *const input)
{ {
char *result = NULL; char *result = NULL;
@ -2823,8 +2823,8 @@ _who_autocomplete(ProfWin *window, const char * const input)
return NULL; return NULL;
} }
static char * static char*
_roster_autocomplete(ProfWin *window, const char * const input) _roster_autocomplete(ProfWin *window, const char *const input)
{ {
char *result = NULL; char *result = NULL;
result = autocomplete_param_with_func(input, "/roster nick", roster_barejid_autocomplete); 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; return NULL;
} }
static char * static char*
_group_autocomplete(ProfWin *window, const char * const input) _group_autocomplete(ProfWin *window, const char *const input)
{ {
char *result = NULL; char *result = NULL;
result = autocomplete_param_with_func(input, "/group show", roster_group_autocomplete); 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; return NULL;
} }
static char * static char*
_bookmark_autocomplete(ProfWin *window, const char * const input) _bookmark_autocomplete(ProfWin *window, const char *const input)
{ {
char *found = NULL; char *found = NULL;
@ -2975,8 +2975,8 @@ _bookmark_autocomplete(ProfWin *window, const char * const input)
return found; return found;
} }
static char * static char*
_notify_autocomplete(ProfWin *window, const char * const input) _notify_autocomplete(ProfWin *window, const char *const input)
{ {
int i = 0; int i = 0;
char *result = NULL; char *result = NULL;
@ -3038,8 +3038,8 @@ _notify_autocomplete(ProfWin *window, const char * const input)
return NULL; return NULL;
} }
static char * static char*
_autoaway_autocomplete(ProfWin *window, const char * const input) _autoaway_autocomplete(ProfWin *window, const char *const input)
{ {
char *result = NULL; char *result = NULL;
@ -3070,8 +3070,8 @@ _autoaway_autocomplete(ProfWin *window, const char * const input)
return NULL; return NULL;
} }
static char * static char*
_log_autocomplete(ProfWin *window, const char * const input) _log_autocomplete(ProfWin *window, const char *const input)
{ {
char *result = NULL; char *result = NULL;
@ -3093,8 +3093,8 @@ _log_autocomplete(ProfWin *window, const char * const input)
return NULL; return NULL;
} }
static char * static char*
_autoconnect_autocomplete(ProfWin *window, const char * const input) _autoconnect_autocomplete(ProfWin *window, const char *const input)
{ {
char *result = NULL; char *result = NULL;
@ -3111,8 +3111,8 @@ _autoconnect_autocomplete(ProfWin *window, const char * const input)
return NULL; return NULL;
} }
static char * static char*
_otr_autocomplete(ProfWin *window, const char * const input) _otr_autocomplete(ProfWin *window, const char *const input)
{ {
char *found = NULL; char *found = NULL;
@ -3158,8 +3158,8 @@ _otr_autocomplete(ProfWin *window, const char * const input)
return NULL; return NULL;
} }
static char * static char*
_pgp_autocomplete(ProfWin *window, const char * const input) _pgp_autocomplete(ProfWin *window, const char *const input)
{ {
char *found = NULL; char *found = NULL;
@ -3206,8 +3206,8 @@ _pgp_autocomplete(ProfWin *window, const char * const input)
return NULL; return NULL;
} }
static char * static char*
_theme_autocomplete(ProfWin *window, const char * const input) _theme_autocomplete(ProfWin *window, const char *const input)
{ {
char *result = NULL; char *result = NULL;
if ((strncmp(input, "/theme load ", 12) == 0) && (strlen(input) > 12)) { if ((strncmp(input, "/theme load ", 12) == 0) && (strlen(input) > 12)) {
@ -3235,8 +3235,8 @@ _theme_autocomplete(ProfWin *window, const char * const input)
return NULL; return NULL;
} }
static char * static char*
_script_autocomplete(ProfWin *window, const char * const input) _script_autocomplete(ProfWin *window, const char *const input)
{ {
char *result = NULL; char *result = NULL;
if ((strncmp(input, "/script show ", 13) == 0) && (strlen(input) > 13)) { if ((strncmp(input, "/script show ", 13) == 0) && (strlen(input) > 13)) {
@ -3281,8 +3281,8 @@ _script_autocomplete(ProfWin *window, const char * const input)
return NULL; return NULL;
} }
static char * static char*
_resource_autocomplete(ProfWin *window, const char * const input) _resource_autocomplete(ProfWin *window, const char *const input)
{ {
char *found = NULL; char *found = NULL;
@ -3317,8 +3317,8 @@ _resource_autocomplete(ProfWin *window, const char * const input)
return NULL; return NULL;
} }
static char * static char*
_titlebar_autocomplete(ProfWin *window, const char * const input) _titlebar_autocomplete(ProfWin *window, const char *const input)
{ {
char *found = NULL; char *found = NULL;
@ -3340,8 +3340,8 @@ _titlebar_autocomplete(ProfWin *window, const char * const input)
return NULL; return NULL;
} }
static char * static char*
_inpblock_autocomplete(ProfWin *window, const char * const input) _inpblock_autocomplete(ProfWin *window, const char *const input)
{ {
char *found = NULL; char *found = NULL;
@ -3358,8 +3358,8 @@ _inpblock_autocomplete(ProfWin *window, const char * const input)
return NULL; return NULL;
} }
static char * static char*
_form_autocomplete(ProfWin *window, const char * const input) _form_autocomplete(ProfWin *window, const char *const input)
{ {
if (window->type != WIN_MUC_CONFIG) { if (window->type != WIN_MUC_CONFIG) {
return NULL; return NULL;
@ -3384,8 +3384,8 @@ _form_autocomplete(ProfWin *window, const char * const input)
return NULL; return NULL;
} }
static char * static char*
_form_field_autocomplete(ProfWin *window, const char * const input) _form_field_autocomplete(ProfWin *window, const char *const input)
{ {
if (window->type != WIN_MUC_CONFIG) { if (window->type != WIN_MUC_CONFIG) {
return NULL; return NULL;
@ -3454,8 +3454,8 @@ _form_field_autocomplete(ProfWin *window, const char * const input)
return found; return found;
} }
static char * static char*
_occupants_autocomplete(ProfWin *window, const char * const input) _occupants_autocomplete(ProfWin *window, const char *const input)
{ {
char *found = NULL; char *found = NULL;
@ -3492,8 +3492,8 @@ _occupants_autocomplete(ProfWin *window, const char * const input)
return NULL; return NULL;
} }
static char * static char*
_time_autocomplete(ProfWin *window, const char * const input) _time_autocomplete(ProfWin *window, const char *const input)
{ {
char *found = NULL; char *found = NULL;
@ -3545,8 +3545,8 @@ _time_autocomplete(ProfWin *window, const char * const input)
return NULL; return NULL;
} }
static char * static char*
_kick_autocomplete(ProfWin *window, const char * const input) _kick_autocomplete(ProfWin *window, const char *const input)
{ {
char *result = NULL; char *result = NULL;
@ -3566,8 +3566,8 @@ _kick_autocomplete(ProfWin *window, const char * const input)
return result; return result;
} }
static char * static char*
_ban_autocomplete(ProfWin *window, const char * const input) _ban_autocomplete(ProfWin *window, const char *const input)
{ {
char *result = NULL; char *result = NULL;
@ -3587,8 +3587,8 @@ _ban_autocomplete(ProfWin *window, const char * const input)
return result; return result;
} }
static char * static char*
_affiliation_autocomplete(ProfWin *window, const char * const input) _affiliation_autocomplete(ProfWin *window, const char *const input)
{ {
char *result = NULL; char *result = NULL;
@ -3635,8 +3635,8 @@ _affiliation_autocomplete(ProfWin *window, const char * const input)
return result; return result;
} }
static char * static char*
_role_autocomplete(ProfWin *window, const char * const input) _role_autocomplete(ProfWin *window, const char *const input)
{ {
char *result = NULL; char *result = NULL;
@ -3683,8 +3683,8 @@ _role_autocomplete(ProfWin *window, const char * const input)
return result; return result;
} }
static char * static char*
_statuses_autocomplete(ProfWin *window, const char * const input) _statuses_autocomplete(ProfWin *window, const char *const input)
{ {
char *result = NULL; char *result = NULL;
@ -3711,8 +3711,8 @@ _statuses_autocomplete(ProfWin *window, const char * const input)
return NULL; return NULL;
} }
static char * static char*
_wins_autocomplete(ProfWin *window, const char * const input) _wins_autocomplete(ProfWin *window, const char *const input)
{ {
char *result = NULL; char *result = NULL;
@ -3729,8 +3729,8 @@ _wins_autocomplete(ProfWin *window, const char * const input)
return NULL; return NULL;
} }
static char * static char*
_tls_autocomplete(ProfWin *window, const char * const input) _tls_autocomplete(ProfWin *window, const char *const input)
{ {
char *result = NULL; char *result = NULL;
@ -3757,8 +3757,8 @@ _tls_autocomplete(ProfWin *window, const char * const input)
return result; return result;
} }
static char * static char*
_receipts_autocomplete(ProfWin *window, const char * const input) _receipts_autocomplete(ProfWin *window, const char *const input)
{ {
char *result = NULL; char *result = NULL;
@ -3780,8 +3780,8 @@ _receipts_autocomplete(ProfWin *window, const char * const input)
return NULL; return NULL;
} }
static char * static char*
_alias_autocomplete(ProfWin *window, const char * const input) _alias_autocomplete(ProfWin *window, const char *const input)
{ {
char *result = NULL; char *result = NULL;
@ -3798,8 +3798,8 @@ _alias_autocomplete(ProfWin *window, const char * const input)
return NULL; return NULL;
} }
static char * static char*
_connect_autocomplete(ProfWin *window, const char * const input) _connect_autocomplete(ProfWin *window, const char *const input)
{ {
char *found = NULL; char *found = NULL;
gboolean result = FALSE; gboolean result = FALSE;
@ -3879,8 +3879,8 @@ _connect_autocomplete(ProfWin *window, const char * const input)
return NULL; return NULL;
} }
static char * static char*
_help_autocomplete(ProfWin *window, const char * const input) _help_autocomplete(ProfWin *window, const char *const input)
{ {
char *result = NULL; char *result = NULL;
@ -3897,8 +3897,8 @@ _help_autocomplete(ProfWin *window, const char * const input)
return NULL; return NULL;
} }
static char * static char*
_join_autocomplete(ProfWin *window, const char * const input) _join_autocomplete(ProfWin *window, const char *const input)
{ {
char *found = NULL; char *found = NULL;
gboolean result = FALSE; gboolean result = FALSE;
@ -3932,8 +3932,8 @@ _join_autocomplete(ProfWin *window, const char * const input)
return NULL; return NULL;
} }
static char * static char*
_account_autocomplete(ProfWin *window, const char * const input) _account_autocomplete(ProfWin *window, const char *const input)
{ {
char *found = NULL; char *found = NULL;
gboolean result = FALSE; gboolean result = FALSE;

View File

@ -45,7 +45,7 @@ GHashTable *commands;
void cmd_init(void); void cmd_init(void);
void cmd_uninit(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_reset_autocomplete(ProfWin *window);
void cmd_autocomplete_add(char *value); void cmd_autocomplete_add(char *value);
void cmd_autocomplete_remove(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_add(char *value);
void cmd_alias_remove(char *value); void cmd_alias_remove(char *value);
gboolean cmd_valid_tag(const char * const str); gboolean cmd_valid_tag(const char *const str);
gboolean cmd_has_tag(Command *pcmd, const char * const tag); gboolean cmd_has_tag(Command *pcmd, const char *const tag);
gboolean cmd_process_input(ProfWin *window, char *inp); 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); gboolean cmd_exists(char *cmd);
GSList * cmd_get_basic_help(void); GSList* cmd_get_basic_help(void);
GSList * cmd_get_settings_help(void); GSList* cmd_get_settings_help(void);
GSList * cmd_get_presence_help(void); GSList* cmd_get_presence_help(void);
void cmd_history_append(char *inp); void cmd_history_append(char *inp);
char *cmd_history_previous(char *inp); char* cmd_history_previous(char *inp);
char *cmd_history_next(char *inp); char* cmd_history_next(char *inp);
void command_docgen(void); void command_docgen(void);

View File

@ -73,17 +73,16 @@
#include "event/ui_events.h" #include "event/ui_events.h"
static void _update_presence(const resource_presence_t presence, static void _update_presence(const resource_presence_t presence,
const char * const show, gchar **args); const char *const show, gchar **args);
static gboolean _cmd_set_boolean_preference(gchar *arg, const char * const command, static gboolean _cmd_set_boolean_preference(gchar *arg, const char *const command,
const char * const display, preference_t pref); 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_room(ProfWin *window, const char * const command, gchar **args); static void _who_roster(ProfWin *window, const char *const command, gchar **args);
static void _who_roster(ProfWin *window, const char * const command, gchar **args);
extern GHashTable *commands; extern GHashTable *commands;
gboolean gboolean
cmd_execute_default(ProfWin *window, const char * inp) cmd_execute_default(ProfWin *window, const char *inp)
{ {
// handle escaped commands - treat as normal message // handle escaped commands - treat as normal message
if (g_str_has_prefix(inp, "//")) { if (g_str_has_prefix(inp, "//")) {
@ -138,7 +137,7 @@ cmd_execute_default(ProfWin *window, const char * inp)
} }
gboolean 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] != '/') { if (inp[0] != '/') {
ran = FALSE; ran = FALSE;
@ -158,7 +157,7 @@ cmd_execute_alias(ProfWin *window, const char * const inp, gboolean *ran)
} }
gboolean 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[0], "certpath") == 0) {
if (g_strcmp0(args[1], "set") == 0) { if (g_strcmp0(args[1], "set") == 0) {
@ -247,7 +246,7 @@ cmd_tls(ProfWin *window, const char * const command, gchar **args)
} }
gboolean 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(); jabber_conn_status_t conn_status = jabber_get_connection_status();
if ((conn_status != JABBER_DISCONNECTED) && (conn_status != JABBER_STARTED)) { if ((conn_status != JABBER_DISCONNECTED) && (conn_status != JABBER_STARTED)) {
@ -361,7 +360,7 @@ cmd_connect(ProfWin *window, const char * const command, gchar **args)
} }
gboolean 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]; char *subcmd = args[0];
@ -711,7 +710,7 @@ cmd_account(ProfWin *window, const char * const command, gchar **args)
} }
gboolean 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]) { if ((g_strcmp0(args[0], "run") == 0) && args[1]) {
gboolean res = scripts_exec(args[1]); gboolean res = scripts_exec(args[1]);
@ -734,7 +733,7 @@ cmd_script(ProfWin *window, const char * const command, gchar **args)
} }
gboolean 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(); 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 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) { if (jabber_get_connection_status() == JABBER_CONNECTED) {
char *jid = strdup(jabber_get_fulljid()); char *jid = strdup(jabber_get_fulljid());
@ -846,7 +845,7 @@ cmd_disconnect(ProfWin *window, const char * const command, gchar **args)
} }
gboolean 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..."); log_info("Profanity is shutting down...");
exit(0); exit(0);
@ -854,7 +853,7 @@ cmd_quit(ProfWin *window, const char * const command, gchar **args)
} }
gboolean 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) { if (args[0] == NULL) {
cons_show_wins(); cons_show_wins();
@ -906,7 +905,7 @@ cmd_wins(ProfWin *window, const char * const command, gchar **args)
} }
gboolean 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]); int num = atoi(args[0]);
@ -921,7 +920,7 @@ cmd_win(ProfWin *window, const char * const command, gchar **args)
} }
static void static void
_cmd_help_cmd_list(const char * const tag) _cmd_help_cmd_list(const char *const tag)
{ {
cons_show(""); cons_show("");
ProfWin *console = wins_get_console(); ProfWin *console = wins_get_console();
@ -983,7 +982,7 @@ _cmd_help_cmd_list(const char * const tag)
} }
gboolean 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); int num_args = g_strv_length(args);
if (num_args == 0) { if (num_args == 0) {
@ -1018,14 +1017,14 @@ cmd_help(ProfWin *window, const char * const command, gchar **args)
} }
gboolean gboolean
cmd_about(ProfWin *window, const char * const command, gchar **args) cmd_about(ProfWin *window, const char *const command, gchar **args)
{ {
ui_about(); ui_about();
return TRUE; return TRUE;
} }
gboolean 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) { if (args[0] == NULL) {
cons_prefs(); cons_prefs();
@ -1070,7 +1069,7 @@ cmd_prefs(ProfWin *window, const char * const command, gchar **args)
} }
gboolean gboolean
cmd_theme(ProfWin *window, const char * const command, gchar **args) cmd_theme(ProfWin *window, const char *const command, gchar **args)
{ {
// list themes // list themes
if (g_strcmp0(args[0], "list") == 0) { if (g_strcmp0(args[0], "list") == 0) {
@ -1112,7 +1111,7 @@ cmd_theme(ProfWin *window, const char * const command, gchar **args)
} }
static void 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]) { if ((g_strv_length(args) == 2) && args[1]) {
cons_show("Argument group is not applicable to chat rooms."); 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 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]; char *presence = args[0];
@ -1455,7 +1454,7 @@ _who_roster(ProfWin *window, const char * const command, gchar **args)
} }
gboolean 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(); 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 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 *usr = args[0];
char *msg = args[1]; char *msg = args[1];
@ -1542,7 +1541,7 @@ cmd_msg(ProfWin *window, const char * const command, gchar **args)
} }
gboolean 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(); 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 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(); 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 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 *cmd = args[0];
char *setting = NULL; char *setting = NULL;
@ -1983,7 +1982,7 @@ cmd_resource(ProfWin *window, const char * const command, gchar **args)
} }
gboolean 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]; char *usr = args[0];
@ -2059,12 +2058,11 @@ cmd_status(ProfWin *window, const char * const command, gchar **args)
} }
gboolean 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]; char *usr = args[0];
jabber_conn_status_t conn_status = jabber_get_connection_status(); jabber_conn_status_t conn_status = jabber_get_connection_status();
PContact pcontact = NULL;
if (conn_status != JABBER_CONNECTED) { if (conn_status != JABBER_CONNECTED) {
cons_show("You are not currently 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) { if (usr_jid == NULL) {
usr_jid = usr; usr_jid = usr;
} }
pcontact = roster_get_contact(usr_jid); PContact pcontact = roster_get_contact(usr_jid);
if (pcontact) { if (pcontact) {
cons_show_info(pcontact); cons_show_info(pcontact);
} else { } else {
@ -2145,10 +2143,9 @@ cmd_info(ProfWin *window, const char * const command, gchar **args)
} }
gboolean 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(); jabber_conn_status_t conn_status = jabber_get_connection_status();
PContact pcontact = NULL;
Occupant *occupant = NULL; Occupant *occupant = NULL;
if (conn_status != JABBER_CONNECTED) { if (conn_status != JABBER_CONNECTED) {
@ -2182,7 +2179,7 @@ cmd_caps(ProfWin *window, const char * const command, gchar **args)
if (jid->fulljid == NULL) { if (jid->fulljid == NULL) {
cons_show("You must provide a full jid to the /caps command."); cons_show("You must provide a full jid to the /caps command.");
} else { } else {
pcontact = roster_get_contact(jid->barejid); PContact pcontact = roster_get_contact(jid->barejid);
if (pcontact == NULL) { if (pcontact == NULL) {
cons_show("Contact not found in roster: %s", jid->barejid); cons_show("Contact not found in roster: %s", jid->barejid);
} else { } else {
@ -2222,10 +2219,9 @@ cmd_caps(ProfWin *window, const char * const command, gchar **args)
gboolean 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(); jabber_conn_status_t conn_status = jabber_get_connection_status();
Occupant *occupant = NULL;
if (conn_status != JABBER_CONNECTED) { if (conn_status != JABBER_CONNECTED) {
cons_show("You are not currently 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]) { if (args[0]) {
ProfMucWin *mucwin = (ProfMucWin*)window; ProfMucWin *mucwin = (ProfMucWin*)window;
assert(mucwin->memcheck == PROFMUCWIN_MEMCHECK); assert(mucwin->memcheck == PROFMUCWIN_MEMCHECK);
occupant = muc_roster_item(mucwin->roomjid, args[0]); Occupant *occupant = muc_roster_item(mucwin->roomjid, args[0]);
if (occupant) { if (occupant) {
Jid *jid = jid_create_from_bare_and_resource(mucwin->roomjid, args[0]); Jid *jid = jid_create_from_bare_and_resource(mucwin->roomjid, args[0]);
iq_send_software_version(jid->fulljid); iq_send_software_version(jid->fulljid);
@ -2310,7 +2306,7 @@ cmd_software(ProfWin *window, const char * const command, gchar **args)
} }
gboolean 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(); jabber_conn_status_t conn_status = jabber_get_connection_status();
if (conn_status != JABBER_CONNECTED) { if (conn_status != JABBER_CONNECTED) {
@ -2404,7 +2400,7 @@ cmd_join(ProfWin *window, const char * const command, gchar **args)
} }
gboolean 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 *contact = args[0];
char *reason = args[1]; char *reason = args[1];
@ -2440,7 +2436,7 @@ cmd_invite(ProfWin *window, const char * const command, gchar **args)
} }
gboolean 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(); GSList *invites = muc_invites();
cons_show_room_invites(invites); cons_show_room_invites(invites);
@ -2449,7 +2445,7 @@ cmd_invites(ProfWin *window, const char * const command, gchar **args)
} }
gboolean 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])) { if (!muc_invites_contain(args[0])) {
cons_show("No such invite exists."); cons_show("No such invite exists.");
@ -2680,7 +2676,7 @@ cmd_form_field(ProfWin *window, char *tag, gchar **args)
} }
gboolean 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(); 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 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(); 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 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(); 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 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(); 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 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(); 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 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(); 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 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(); 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 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(); 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 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(); 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 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(); 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 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(); 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 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)) { 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); 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 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(); 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 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]; char *subcmd = args[0];
@ -3437,7 +3433,7 @@ cmd_alias(ProfWin *window, const char * const command, gchar **args)
} }
gboolean 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]; char *url = args[0];
@ -3489,14 +3485,14 @@ cmd_tiny(ProfWin *window, const char * const command, gchar **args)
} }
gboolean 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); ui_clear_win(window);
return TRUE; return TRUE;
} }
gboolean 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(); jabber_conn_status_t conn_status = jabber_get_connection_status();
int index = 0; int index = 0;
@ -3568,7 +3564,7 @@ cmd_close(ProfWin *window, const char * const command, gchar **args)
} }
gboolean 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(); jabber_conn_status_t conn_status = jabber_get_connection_status();
int index = wins_get_current_num(); int index = wins_get_current_num();
@ -3591,7 +3587,7 @@ cmd_leave(ProfWin *window, const char * const command, gchar **args)
} }
gboolean 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); 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 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); return _cmd_set_boolean_preference(args[0], command, "Sound", PREF_BEEP);
} }
gboolean 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); return _cmd_set_boolean_preference(args[0], command, "Contact presence", PREF_PRESENCE);
} }
gboolean 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); 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 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 (g_strcmp0(args[0], "lastactivity") == 0) {
if (args[1] == NULL) { if (args[1] == NULL) {
@ -3775,7 +3771,7 @@ cmd_time(ProfWin *window, const char * const command, gchar **args)
} }
gboolean 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", gboolean result = _cmd_set_boolean_preference(args[0], command, "Sending chat states",
PREF_STATES); PREF_STATES);
@ -3790,7 +3786,7 @@ cmd_states(ProfWin *window, const char * const command, gchar **args)
} }
gboolean 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) { if (g_strcmp0(args[0], "show") != 0 && g_strcmp0(args[0], "goodbye") != 0) {
cons_bad_cmd_usage(command); cons_bad_cmd_usage(command);
@ -3807,7 +3803,7 @@ cmd_titlebar(ProfWin *window, const char * const command, gchar **args)
} }
gboolean 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, gboolean result = _cmd_set_boolean_preference(args[0], command,
"Sending typing notifications", PREF_OUTTYPE); "Sending typing notifications", PREF_OUTTYPE);
@ -3821,7 +3817,7 @@ cmd_outtype(ProfWin *window, const char * const command, gchar **args)
} }
gboolean 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]; char *value = args[0];
@ -3845,7 +3841,7 @@ cmd_gone(ProfWin *window, const char * const command, gchar **args)
gboolean 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]; char *kind = args[0];
@ -3988,7 +3984,7 @@ cmd_notify(ProfWin *window, const char * const command, gchar **args)
} }
gboolean 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 *subcmd = args[0];
char *value = args[1]; char *value = args[1];
@ -4034,7 +4030,7 @@ cmd_inpblock(ProfWin *window, const char * const command, gchar **args)
} }
gboolean 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 *subcmd = args[0];
char *value = args[1]; char *value = args[1];
@ -4090,7 +4086,7 @@ cmd_log(ProfWin *window, const char * const command, gchar **args)
} }
gboolean 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]; char *value = args[0];
@ -4114,7 +4110,7 @@ cmd_reconnect(ProfWin *window, const char * const command, gchar **args)
} }
gboolean 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]; char *value = args[0];
@ -4139,7 +4135,7 @@ cmd_autoping(ProfWin *window, const char * const command, gchar **args)
} }
gboolean 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(); 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 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) && if ((strcmp(args[0], "mode") != 0) && (strcmp(args[0], "time") != 0) &&
(strcmp(args[0], "message") != 0) && (strcmp(args[0], "check") != 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 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(); 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 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 && if (strcmp(args[0], "console") != 0 &&
strcmp(args[0], "chat") != 0 && strcmp(args[0], "chat") != 0 &&
@ -4343,7 +4339,7 @@ cmd_statuses(ProfWin *window, const char * const command, gchar **args)
} }
gboolean 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); int num_args = g_strv_length(args);
@ -4356,7 +4352,7 @@ cmd_vercheck(ProfWin *window, const char * const command, gchar **args)
} }
gboolean 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()) { if (!ui_xmlconsole_exists()) {
ui_create_xmlconsole_win(); ui_create_xmlconsole_win();
@ -4368,25 +4364,25 @@ cmd_xmlconsole(ProfWin *window, const char * const command, gchar **args)
} }
gboolean 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); return _cmd_set_boolean_preference(args[0], command, "Screen flash", PREF_FLASH);
} }
gboolean 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); return _cmd_set_boolean_preference(args[0], command, "Show contact typing", PREF_INTYPE);
} }
gboolean 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); return _cmd_set_boolean_preference(args[0], command, "Splash screen", PREF_SPLASH);
} }
gboolean 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) { if (strcmp(args[0], "off") == 0) {
prefs_set_string(PREF_CONNECT_ACCOUNT, NULL); prefs_set_string(PREF_CONNECT_ACCOUNT, NULL);
@ -4401,7 +4397,7 @@ cmd_autoconnect(ProfWin *window, const char * const command, gchar **args)
} }
gboolean 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); 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 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); 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 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); 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 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); 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 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) { if (g_strcmp0(args[0], "send") == 0) {
return _cmd_set_boolean_preference(args[1], command, "Send delivery receipts", PREF_RECEIPTS_SEND); 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 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); _update_presence(RESOURCE_AWAY, "away", args);
return TRUE; return TRUE;
} }
gboolean 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); _update_presence(RESOURCE_ONLINE, "online", args);
return TRUE; return TRUE;
} }
gboolean 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); _update_presence(RESOURCE_DND, "dnd", args);
return TRUE; return TRUE;
} }
gboolean 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); _update_presence(RESOURCE_CHAT, "chat", args);
return TRUE; return TRUE;
} }
gboolean 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); _update_presence(RESOURCE_XA, "xa", args);
return TRUE; return TRUE;
} }
gboolean gboolean
cmd_pgp(ProfWin *window, const char * const command, gchar **args) cmd_pgp(ProfWin *window, const char *const command, gchar **args)
{ {
#ifdef HAVE_LIBGPGME #ifdef HAVE_LIBGPGME
if (args[0] == NULL) { if (args[0] == NULL) {
@ -4738,7 +4734,7 @@ cmd_pgp(ProfWin *window, const char * const command, gchar **args)
} }
gboolean gboolean
cmd_otr(ProfWin *window, const char * const command, gchar **args) cmd_otr(ProfWin *window, const char *const command, gchar **args)
{ {
#ifdef HAVE_LIBOTR #ifdef HAVE_LIBOTR
if (args[0] == NULL) { if (args[0] == NULL) {
@ -5058,7 +5054,7 @@ cmd_otr(ProfWin *window, const char * const command, gchar **args)
} }
gboolean 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); 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 // helper function for status change commands
static void static void
_update_presence(const resource_presence_t resource_presence, _update_presence(const resource_presence_t resource_presence,
const char * const show, gchar **args) const char *const show, gchar **args)
{ {
char *msg = NULL; char *msg = NULL;
int num_args = g_strv_length(args); 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 // helper function for boolean preference commands
static gboolean static gboolean
_cmd_set_boolean_preference(gchar *arg, const char * const command, _cmd_set_boolean_preference(gchar *arg, const char *const command,
const char * const display, preference_t pref) const char *const display, preference_t pref)
{ {
GString *enabled = g_string_new(display); GString *enabled = g_string_new(display);
g_string_append(enabled, " enabled."); g_string_append(enabled, " enabled.");

View File

@ -58,98 +58,98 @@ typedef struct cmd_help_t {
*/ */
typedef struct cmd_t { typedef struct cmd_t {
gchar *cmd; gchar *cmd;
gboolean (*func)(ProfWin *window, const char * const command, gchar **args); gboolean (*func)(ProfWin *window, const char *const command, gchar **args);
gchar** (*parser)(const char * const inp, int min, int max, gboolean *result); gchar** (*parser)(const char *const inp, int min, int max, gboolean *result);
int min_args; int min_args;
int max_args; int max_args;
void (*setting_func)(void); void (*setting_func)(void);
CommandHelp help; CommandHelp help;
} Command; } Command;
gboolean cmd_execute_alias(ProfWin *window, const char * const inp, gboolean *ran); gboolean cmd_execute_alias(ProfWin *window, const char *const inp, gboolean *ran);
gboolean cmd_execute_default(ProfWin *window, const char * inp); gboolean cmd_execute_default(ProfWin *window, const char *inp);
gboolean cmd_about(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_account(ProfWin *window, const char *const command, gchar **args);
gboolean cmd_autoaway(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_autoconnect(ProfWin *window, const char *const command, gchar **args);
gboolean cmd_autoping(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_away(ProfWin *window, const char *const command, gchar **args);
gboolean cmd_beep(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_caps(ProfWin *window, const char *const command, gchar **args);
gboolean cmd_chat(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_chlog(ProfWin *window, const char *const command, gchar **args);
gboolean cmd_clear(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_close(ProfWin *window, const char *const command, gchar **args);
gboolean cmd_connect(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_tls(ProfWin *window, const char *const command, gchar **args);
gboolean cmd_decline(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_disco(ProfWin *window, const char *const command, gchar **args);
gboolean cmd_lastactivity(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_disconnect(ProfWin *window, const char *const command, gchar **args);
gboolean cmd_dnd(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_flash(ProfWin *window, const char *const command, gchar **args);
gboolean cmd_gone(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_grlog(ProfWin *window, const char *const command, gchar **args);
gboolean cmd_group(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_help(ProfWin *window, const char *const command, gchar **args);
gboolean cmd_history(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_carbons(ProfWin *window, const char *const command, gchar **args);
gboolean cmd_receipts(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_info(ProfWin *window, const char *const command, gchar **args);
gboolean cmd_intype(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_invite(ProfWin *window, const char *const command, gchar **args);
gboolean cmd_invites(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_join(ProfWin *window, const char *const command, gchar **args);
gboolean cmd_leave(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_log(ProfWin *window, const char *const command, gchar **args);
gboolean cmd_msg(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_nick(ProfWin *window, const char *const command, gchar **args);
gboolean cmd_notify(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_online(ProfWin *window, const char *const command, gchar **args);
gboolean cmd_otr(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_pgp(ProfWin *window, const char *const command, gchar **args);
gboolean cmd_outtype(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_prefs(ProfWin *window, const char *const command, gchar **args);
gboolean cmd_priority(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_quit(ProfWin *window, const char *const command, gchar **args);
gboolean cmd_reconnect(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_room(ProfWin *window, const char *const command, gchar **args);
gboolean cmd_rooms(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_bookmark(ProfWin *window, const char *const command, gchar **args);
gboolean cmd_roster(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_software(ProfWin *window, const char *const command, gchar **args);
gboolean cmd_splash(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_states(ProfWin *window, const char *const command, gchar **args);
gboolean cmd_status(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_statuses(ProfWin *window, const char *const command, gchar **args);
gboolean cmd_sub(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_theme(ProfWin *window, const char *const command, gchar **args);
gboolean cmd_tiny(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_titlebar(ProfWin *window, const char *const command, gchar **args);
gboolean cmd_vercheck(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_who(ProfWin *window, const char *const command, gchar **args);
gboolean cmd_win(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_wins(ProfWin *window, const char *const command, gchar **args);
gboolean cmd_xa(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_alias(ProfWin *window, const char *const command, gchar **args);
gboolean cmd_xmlconsole(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_ping(ProfWin *window, const char *const command, gchar **args);
gboolean cmd_form(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_occupants(ProfWin *window, const char *const command, gchar **args);
gboolean cmd_kick(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_ban(ProfWin *window, const char *const command, gchar **args);
gboolean cmd_subject(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_affiliation(ProfWin *window, const char *const command, gchar **args);
gboolean cmd_role(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_privileges(ProfWin *window, const char *const command, gchar **args);
gboolean cmd_presence(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_wrap(ProfWin *window, const char *const command, gchar **args);
gboolean cmd_time(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_resource(ProfWin *window, const char *const command, gchar **args);
gboolean cmd_inpblock(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_encwarn(ProfWin *window, const char *const command, gchar **args);
gboolean cmd_script(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); gboolean cmd_form_field(ProfWin *window, char *tag, gchar **args);

View File

@ -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); static size_t _data_callback(void *ptr, size_t size, size_t nmemb, void *data);
// taken from glib 2.30.3 // taken from glib 2.30.3
gchar * gchar*
p_utf8_substring(const gchar *str, glong start_pos, glong end_pos) p_utf8_substring(const gchar *str, glong start_pos, glong end_pos)
{ {
gchar *start, *end, *out; gchar *start, *end, *out;
@ -148,7 +148,7 @@ mkdir_recursive(const char *dir)
return result; return result;
} }
char * char*
str_replace(const char *string, const char *substr, str_replace(const char *string, const char *substr,
const char *replacement) const char *replacement)
{ {
@ -193,7 +193,7 @@ str_replace(const char *string, const char *substr,
} }
gboolean 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) { if (!searchstr) {
return FALSE; return FALSE;
@ -244,7 +244,7 @@ strtoi_range(char *str, int *saveptr, int min, int max, char **err_msg)
} }
int int
utf8_display_len(const char * const str) utf8_display_len(const char *const str)
{ {
if (!str) { if (!str) {
return 0; return 0;
@ -265,7 +265,7 @@ utf8_display_len(const char * const str)
return len; return len;
} }
char * char*
prof_getline(FILE *stream) prof_getline(FILE *stream)
{ {
char *buf; char *buf;
@ -309,8 +309,8 @@ prof_getline(FILE *stream)
return s; return s;
} }
char * char*
release_get_latest() release_get_latest(void)
{ {
char *url = "http://www.profanity.im/profanity_version.txt"; char *url = "http://www.profanity.im/profanity_version.txt";
@ -362,7 +362,7 @@ release_is_new(char *found_version)
} }
gboolean gboolean
valid_resource_presence_string(const char * const str) valid_resource_presence_string(const char *const str)
{ {
assert(str != NULL); assert(str != NULL);
if ((strcmp(str, "online") == 0) || (strcmp(str, "chat") == 0) || 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) string_from_resource_presence(resource_presence_t presence)
{ {
switch(presence) switch(presence)
@ -393,7 +393,7 @@ string_from_resource_presence(resource_presence_t presence)
} }
resource_presence_t resource_presence_t
resource_presence_from_string(const char * const str) resource_presence_from_string(const char *const str)
{ {
if (str == NULL) { if (str == NULL) {
return RESOURCE_ONLINE; return RESOURCE_ONLINE;
@ -430,7 +430,7 @@ contact_presence_from_resource_presence(resource_presence_t resource_presence)
} }
} }
gchar * gchar*
xdg_get_config_home(void) xdg_get_config_home(void)
{ {
gchar *xdg_config_home = getenv("XDG_CONFIG_HOME"); gchar *xdg_config_home = getenv("XDG_CONFIG_HOME");
@ -449,7 +449,7 @@ xdg_get_config_home(void)
} }
} }
gchar * gchar*
xdg_get_data_home(void) xdg_get_data_home(void)
{ {
gchar *xdg_data_home = getenv("XDG_DATA_HOME"); gchar *xdg_data_home = getenv("XDG_DATA_HOME");
@ -468,7 +468,7 @@ xdg_get_data_home(void)
} }
} }
char * char*
create_unique_id(char *prefix) create_unique_id(char *prefix)
{ {
char *result = NULL; char *result = NULL;
@ -492,7 +492,7 @@ reset_unique_id(void)
unique_id = 0; unique_id = 0;
} }
char * char*
p_sha1_hash(char *str) p_sha1_hash(char *str)
{ {
P_SHA1_CTX ctx; P_SHA1_CTX ctx;
@ -623,8 +623,8 @@ get_file_or_linked(char *loc, char *basedir)
return true_loc; return true_loc;
} }
char * char*
strip_arg_quotes(const char * const input) strip_arg_quotes(const char *const input)
{ {
char *unquoted = strdup(input); char *unquoted = strdup(input);
@ -644,3 +644,21 @@ strip_arg_quotes(const char * const input)
return unquoted; 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;
}

View File

@ -102,31 +102,31 @@ gboolean p_hash_table_contains(GHashTable *hash_table, gconstpointer key);
gboolean create_dir(char *name); gboolean create_dir(char *name);
gboolean mkdir_recursive(const char *dir); gboolean mkdir_recursive(const char *dir);
char * str_replace(const char *string, const char *substr, char* str_replace(const char *string, const char *substr, const char *replacement);
const char *replacement); gboolean str_contains_str(const char *const searchstr, const char *const substr);
gboolean str_contains_str(const char * const searchstr, const char * const substr);
int str_contains(const char str[], int size, char ch); int str_contains(const char str[], int size, char ch);
gboolean strtoi_range(char *str, int *saveptr, int min, int max, char **err_msg); gboolean strtoi_range(char *str, int *saveptr, int min, int max, char **err_msg);
int utf8_display_len(const char * const str); int utf8_display_len(const char *const str);
char * prof_getline(FILE *stream); char* prof_getline(FILE *stream);
char* release_get_latest(void); char* release_get_latest(void);
gboolean release_is_new(char *found_version); gboolean release_is_new(char *found_version);
gchar * xdg_get_config_home(void); gchar* xdg_get_config_home(void);
gchar * xdg_get_data_home(void); gchar* xdg_get_data_home(void);
gboolean valid_resource_presence_string(const char * const str); gboolean valid_resource_presence_string(const char *const str);
const char * string_from_resource_presence(resource_presence_t presence); const char* string_from_resource_presence(resource_presence_t presence);
resource_presence_t resource_presence_from_string(const char * const str); resource_presence_t resource_presence_from_string(const char *const str);
contact_presence_t contact_presence_from_resource_presence(resource_presence_t resource_presence); contact_presence_t contact_presence_from_resource_presence(resource_presence_t resource_presence);
char * p_sha1_hash(char *str); char* p_sha1_hash(char *str);
char * create_unique_id(char *prefix); char* create_unique_id(char *prefix);
void reset_unique_id(void); void reset_unique_id(void);
int cmp_win_num(gconstpointer a, gconstpointer b); int cmp_win_num(gconstpointer a, gconstpointer b);
int get_next_available_win_num(GList *used); int get_next_available_win_num(GList *used);
char* get_file_or_linked(char *loc, char *basedir); 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 #endif

View File

@ -44,14 +44,14 @@
#include "log.h" #include "log.h"
ProfAccount* ProfAccount*
account_new(const gchar * const name, const gchar * const jid, account_new(const gchar *const name, const gchar *const jid,
const gchar * const password, const gchar * eval_password, gboolean enabled, const gchar * const server, 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, int port, const gchar *const resource, const gchar *const last_presence,
const gchar * const login_presence, int priority_online, int priority_chat, const gchar *const login_presence, int priority_online, int priority_chat,
int priority_away, int priority_xa, int priority_dnd, int priority_away, int priority_xa, int priority_dnd,
const gchar * const muc_service, const gchar * const muc_nick, const gchar *const muc_service, const gchar *const muc_nick,
const gchar * const otr_policy, GList *otr_manual, GList *otr_opportunistic, const gchar *const otr_policy, GList *otr_manual, GList *otr_opportunistic,
GList *otr_always, const gchar * const pgp_keyid, const char *const startscript, GList *otr_always, const gchar *const pgp_keyid, const char *const startscript,
gchar *tls_policy) gchar *tls_policy)
{ {
ProfAccount *new_account = malloc(sizeof(ProfAccount)); ProfAccount *new_account = malloc(sizeof(ProfAccount));
@ -166,7 +166,7 @@ account_new(const gchar * const name, const gchar * const jid,
return new_account; return new_account;
} }
char * char*
account_create_full_jid(ProfAccount *account) account_create_full_jid(ProfAccount *account)
{ {
if (account->resource) { if (account->resource) {

View File

@ -64,14 +64,14 @@ typedef struct prof_account_t {
gchar *tls_policy; gchar *tls_policy;
} ProfAccount; } ProfAccount;
ProfAccount* account_new(const gchar * const name, const gchar * const jid, 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, 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, int port, const gchar *const resource, const gchar *const last_presence,
const gchar * const login_presence, int priority_online, int priority_chat, const gchar *const login_presence, int priority_online, int priority_chat,
int priority_away, int priority_xa, int priority_dnd, int priority_away, int priority_xa, int priority_dnd,
const gchar * const muc_service, const gchar * const muc_nick, const gchar *const muc_service, const gchar *const muc_nick,
const gchar * const otr_policy, GList *otr_manual, GList *otr_opportunistic, const gchar *const otr_policy, GList *otr_manual, GList *otr_opportunistic,
GList *otr_always, const gchar * const pgp_keyid, const char *const startscript, GList *otr_always, const gchar *const pgp_keyid, const char *const startscript,
gchar *tls_policy); gchar *tls_policy);
char* account_create_full_jid(ProfAccount *account); char* account_create_full_jid(ProfAccount *account);
gboolean account_eval_password(ProfAccount *account); gboolean account_eval_password(ProfAccount *account);

View File

@ -54,8 +54,8 @@ static Autocomplete all_ac;
static Autocomplete enabled_ac; static Autocomplete enabled_ac;
static void _save_accounts(void); static void _save_accounts(void);
static gchar * _get_accounts_file(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 void _remove_from_list(GKeyFile *accounts, const char *const account_name, const char *const key, const char *const contact_jid);
void void
accounts_load(void) accounts_load(void)
@ -95,14 +95,14 @@ accounts_close(void)
g_key_file_free(accounts); g_key_file_free(accounts);
} }
char * char*
accounts_find_enabled(const char * const prefix) accounts_find_enabled(const char *const prefix)
{ {
return autocomplete_complete(enabled_ac, prefix, TRUE); return autocomplete_complete(enabled_ac, prefix, TRUE);
} }
char * char*
accounts_find_all(const char * const prefix) accounts_find_all(const char *const prefix)
{ {
return autocomplete_complete(all_ac, prefix, TRUE); return autocomplete_complete(all_ac, prefix, TRUE);
} }
@ -193,7 +193,7 @@ accounts_get_list(void)
} }
ProfAccount* ProfAccount*
accounts_get_account(const char * const name) accounts_get_account(const char *const name)
{ {
if (!g_key_file_has_group(accounts, name)) { if (!g_key_file_has_group(accounts, name)) {
return NULL; return NULL;
@ -305,7 +305,7 @@ accounts_get_account(const char * const name)
} }
gboolean gboolean
accounts_enable(const char * const name) accounts_enable(const char *const name)
{ {
if (g_key_file_has_group(accounts, name)) { if (g_key_file_has_group(accounts, name)) {
g_key_file_set_boolean(accounts, name, "enabled", TRUE); g_key_file_set_boolean(accounts, name, "enabled", TRUE);
@ -318,7 +318,7 @@ accounts_enable(const char * const name)
} }
gboolean gboolean
accounts_disable(const char * const name) accounts_disable(const char *const name)
{ {
if (g_key_file_has_group(accounts, name)) { if (g_key_file_has_group(accounts, name)) {
g_key_file_set_boolean(accounts, name, "enabled", FALSE); g_key_file_set_boolean(accounts, name, "enabled", FALSE);
@ -331,7 +331,7 @@ accounts_disable(const char * const name)
} }
gboolean 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)) { if (g_key_file_has_group(accounts, new_name)) {
return FALSE; return FALSE;
@ -393,14 +393,14 @@ accounts_rename(const char * const account_name, const char * const new_name)
} }
gboolean 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); return g_key_file_has_group(accounts, account_name);
} }
void 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); Jid *jid = jid_create(value);
if (jid) { if (jid) {
@ -428,7 +428,7 @@ accounts_set_jid(const char * const account_name, const char * const value)
} }
void 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)) { if (accounts_account_exists(account_name)) {
g_key_file_set_string(accounts, account_name, "server", value); 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 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) { if (value != 0) {
g_key_file_set_integer(accounts, account_name, "port", value); 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 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)) { if (accounts_account_exists(account_name)) {
g_key_file_set_string(accounts, account_name, "resource", value); 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 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)) { if (accounts_account_exists(account_name)) {
g_key_file_set_string(accounts, account_name, "password", value); 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 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)) { if (accounts_account_exists(account_name)) {
g_key_file_set_string(accounts, account_name, "eval_password", value); 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 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)) { if (accounts_account_exists(account_name)) {
g_key_file_set_string(accounts, account_name, "pgp.keyid", value); 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 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)) { if (accounts_account_exists(account_name)) {
g_key_file_set_string(accounts, account_name, "script.start", value); 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 void
accounts_clear_password(const char * const account_name) accounts_clear_password(const char *const account_name)
{ {
if (accounts_account_exists(account_name)) { if (accounts_account_exists(account_name)) {
g_key_file_remove_key(accounts, account_name, "password", NULL); g_key_file_remove_key(accounts, account_name, "password", NULL);
@ -500,7 +500,7 @@ accounts_clear_password(const char * const account_name)
} }
void 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)) { if (accounts_account_exists(account_name)) {
g_key_file_remove_key(accounts, account_name, "eval_password", NULL); 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 void
accounts_clear_server(const char * const account_name) accounts_clear_server(const char *const account_name)
{ {
if (accounts_account_exists(account_name)) { if (accounts_account_exists(account_name)) {
g_key_file_remove_key(accounts, account_name, "server", NULL); g_key_file_remove_key(accounts, account_name, "server", NULL);
@ -518,7 +518,7 @@ accounts_clear_server(const char * const account_name)
} }
void void
accounts_clear_port(const char * const account_name) accounts_clear_port(const char *const account_name)
{ {
if (accounts_account_exists(account_name)) { if (accounts_account_exists(account_name)) {
g_key_file_remove_key(accounts, account_name, "port", NULL); g_key_file_remove_key(accounts, account_name, "port", NULL);
@ -527,7 +527,7 @@ accounts_clear_port(const char * const account_name)
} }
void 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)) { if (accounts_account_exists(account_name)) {
g_key_file_remove_key(accounts, account_name, "pgp.keyid", NULL); 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 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)) { if (accounts_account_exists(account_name)) {
g_key_file_remove_key(accounts, account_name, "script.start", NULL); 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 void
accounts_clear_otr(const char * const account_name) accounts_clear_otr(const char *const account_name)
{ {
if (accounts_account_exists(account_name)) { if (accounts_account_exists(account_name)) {
g_key_file_remove_key(accounts, account_name, "otr.policy", NULL); g_key_file_remove_key(accounts, account_name, "otr.policy", NULL);
@ -553,7 +553,7 @@ accounts_clear_otr(const char * const account_name)
} }
void 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)) { if (accounts_account_exists(account_name)) {
GString *key = g_string_new("otr."); 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 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; gsize length;
gchar **list = g_key_file_get_string_list(accounts, account_name, key, &length, NULL); 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 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)) { if (accounts_account_exists(account_name)) {
g_key_file_set_string(accounts, account_name, "muc.service", value); 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 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)) { if (accounts_account_exists(account_name)) {
g_key_file_set_string(accounts, account_name, "muc.nick", value); 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 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)) { if (accounts_account_exists(account_name)) {
g_key_file_set_string(accounts, account_name, "otr.policy", value); 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 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)) { if (accounts_account_exists(account_name)) {
g_key_file_set_string(accounts, account_name, "tls.policy", value); 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 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)) { if (accounts_account_exists(account_name)) {
g_key_file_set_integer(accounts, account_name, "priority.online", value); 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 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)) { if (accounts_account_exists(account_name)) {
g_key_file_set_integer(accounts, account_name, "priority.chat", value); 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 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)) { if (accounts_account_exists(account_name)) {
g_key_file_set_integer(accounts, account_name, "priority.away", value); 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 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)) { if (accounts_account_exists(account_name)) {
g_key_file_set_integer(accounts, account_name, "priority.xa", value); 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 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)) { if (accounts_account_exists(account_name)) {
g_key_file_set_integer(accounts, account_name, "priority.dnd", value); 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 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)) { if (accounts_account_exists(account_name)) {
accounts_set_priority_online(account_name, value); accounts_set_priority_online(account_name, value);
@ -759,7 +759,7 @@ accounts_set_priority_all(const char * const account_name, const gint value)
} }
gint 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) resource_presence_t presence_type)
{ {
gint result; gint result;
@ -790,7 +790,7 @@ accounts_get_priority_for_presence_type(const char * const account_name,
} }
void 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)) { if (accounts_account_exists(account_name)) {
g_key_file_set_string(accounts, account_name, "presence.last", value); 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 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 (accounts_account_exists(account_name)) {
if (value) { if (value) {
@ -812,7 +812,7 @@ accounts_set_last_status(const char * const account_name, const char * const val
} }
void 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)) { if (accounts_account_exists(account_name)) {
GDateTime *nowdt = g_date_time_new_now_utc(); GDateTime *nowdt = g_date_time_new_now_utc();
@ -829,8 +829,8 @@ accounts_set_last_activity(const char * const account_name)
} }
} }
char * char*
accounts_get_last_activity(const char * const account_name) accounts_get_last_activity(const char *const account_name)
{ {
if (accounts_account_exists(account_name)) { if (accounts_account_exists(account_name)) {
return g_key_file_get_string(accounts, account_name, "last.activity", NULL); 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 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)) { if (accounts_account_exists(account_name)) {
g_key_file_set_string(accounts, account_name, "presence.login", value); 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 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; resource_presence_t result;
gchar *setting = g_key_file_get_string(accounts, account_name, "presence.last", NULL); 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; return result;
} }
char * char*
accounts_get_last_status(const char * const account_name) accounts_get_last_status(const char *const account_name)
{ {
return g_key_file_get_string(accounts, account_name, "presence.laststatus", NULL); return g_key_file_get_string(accounts, account_name, "presence.laststatus", NULL);
} }
resource_presence_t 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; resource_presence_t result;
gchar *setting = g_key_file_get_string(accounts, account_name, "presence.login", NULL); 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); g_string_free(base_str, TRUE);
} }
static gchar * static gchar*
_get_accounts_file(void) _get_accounts_file(void)
{ {
gchar *xdg_data = xdg_get_data_home(); gchar *xdg_data = xdg_get_data_home();

View File

@ -43,54 +43,54 @@
void accounts_load(void); void accounts_load(void);
void accounts_close(void); void accounts_close(void);
char * accounts_find_all(const char * const prefix); char* accounts_find_all(const char *const prefix);
char * accounts_find_enabled(const char * const prefix); char* accounts_find_enabled(const char *const prefix);
void accounts_reset_all_search(void); void accounts_reset_all_search(void);
void accounts_reset_enabled_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); void accounts_add(const char *jid, const char *altdomain, const int port, const char *const tls_policy);
int accounts_remove(const char *jid); int accounts_remove(const char *jid);
gchar** accounts_get_list(void); gchar** accounts_get_list(void);
ProfAccount* accounts_get_account(const char * const name); ProfAccount* accounts_get_account(const char *const name);
gboolean accounts_enable(const char * const name); gboolean accounts_enable(const char *const name);
gboolean accounts_disable(const char * const name); gboolean accounts_disable(const char *const name);
gboolean accounts_rename(const char * const account_name, gboolean accounts_rename(const char *const account_name,
const char * const new_name); const char *const new_name);
gboolean accounts_account_exists(const char * const account_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_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_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_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_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_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_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_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_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_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_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_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_status(const char *const account_name, const char *const value);
void accounts_set_last_activity(const char * const account_name); void 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);
void accounts_set_login_presence(const char * const account_name, const char * const value); 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); resource_presence_t accounts_get_login_presence(const char *const account_name);
char * accounts_get_last_status(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); 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_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_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_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_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_dnd(const char *const account_name, const gint value);
void accounts_set_priority_all(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, gint accounts_get_priority_for_presence_type(const char *const account_name,
resource_presence_t presence_type); resource_presence_t presence_type);
void accounts_set_pgp_keyid(const char * const account_name, const char * const value); 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_set_script_start(const char *const account_name, const char *const value);
void accounts_clear_password(const char * const account_name); void accounts_clear_password(const char *const account_name);
void accounts_clear_eval_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_server(const char *const account_name);
void accounts_clear_port(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_otr(const char *const account_name);
void accounts_clear_pgp_keyid(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_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_add_otr_policy(const char *const account_name, const char *const contact_jid, const char *const policy);
#endif #endif

View File

@ -66,11 +66,11 @@ gint log_maxsize = 0;
static Autocomplete boolean_choice_ac; static Autocomplete boolean_choice_ac;
static void _save_prefs(void); static void _save_prefs(void);
static gchar * _get_preferences_file(void); static gchar* _get_preferences_file(void);
static const char * _get_group(preference_t pref); static const char* _get_group(preference_t pref);
static const char * _get_key(preference_t pref); static const char* _get_key(preference_t pref);
static gboolean _get_default_boolean(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 void
prefs_load(void) prefs_load(void)
@ -142,8 +142,8 @@ prefs_close(void)
prefs = NULL; prefs = NULL;
} }
char * char*
prefs_autocomplete_boolean_choice(const char * const prefix) prefs_autocomplete_boolean_choice(const char *const prefix)
{ {
return autocomplete_complete(boolean_choice_ac, prefix, TRUE); return autocomplete_complete(boolean_choice_ac, prefix, TRUE);
} }
@ -177,7 +177,7 @@ prefs_set_boolean(preference_t pref, gboolean value)
_save_prefs(); _save_prefs();
} }
char * char*
prefs_get_string(preference_t pref) prefs_get_string(preference_t pref)
{ {
const char *group = _get_group(pref); const char *group = _get_group(pref);
@ -263,7 +263,8 @@ prefs_set_max_log_size(gint value)
_save_prefs(); _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); int val = g_key_file_get_integer(prefs, PREF_GROUP_UI, "inpblock", NULL);
if (val == 0) { 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); g_key_file_set_integer(prefs, PREF_GROUP_UI, "inpblock", value);
_save_prefs(); _save_prefs();
@ -444,7 +446,7 @@ prefs_set_pgp_char(char ch)
} }
gboolean 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)) { if (g_key_file_has_key(prefs, PREF_GROUP_ALIAS, name, NULL)) {
return FALSE; return FALSE;
@ -455,15 +457,15 @@ prefs_add_alias(const char * const name, const char * const value)
} }
} }
char * char*
prefs_get_alias(const char * const name) prefs_get_alias(const char *const name)
{ {
return g_key_file_get_string(prefs, PREF_GROUP_ALIAS, name, NULL); return g_key_file_get_string(prefs, PREF_GROUP_ALIAS, name, NULL);
} }
gboolean 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)) { if (!g_key_file_has_key(prefs, PREF_GROUP_ALIAS, name, NULL)) {
return FALSE; return FALSE;
@ -483,7 +485,7 @@ _alias_cmp(gconstpointer *p1, gconstpointer *p2)
return strcmp(alias1->name, alias2->name); return strcmp(alias1->name, alias2->name);
} }
GList * GList*
prefs_get_aliases(void) prefs_get_aliases(void)
{ {
if (!g_key_file_has_group(prefs, PREF_GROUP_ALIAS)) { if (!g_key_file_has_group(prefs, PREF_GROUP_ALIAS)) {
@ -545,7 +547,7 @@ _save_prefs(void)
g_string_free(base_str, TRUE); g_string_free(base_str, TRUE);
} }
static gchar * static gchar*
_get_preferences_file(void) _get_preferences_file(void)
{ {
gchar *xdg_config = xdg_get_config_home(); gchar *xdg_config = xdg_get_config_home();
@ -561,7 +563,7 @@ _get_preferences_file(void)
// get the preference group for a specific preference // get the preference group for a specific preference
// for example the PREF_BEEP setting ("beep" in .profrc, see _get_key) belongs // for example the PREF_BEEP setting ("beep" in .profrc, see _get_key) belongs
// to the [ui] section. // to the [ui] section.
static const char * static const char*
_get_group(preference_t pref) _get_group(preference_t pref)
{ {
switch (pref) switch (pref)
@ -648,7 +650,7 @@ _get_group(preference_t pref)
// get the key used in .profrc for the preference // get the key used in .profrc for the preference
// for example the PREF_AUTOAWAY_MODE maps to "autoaway.mode" in .profrc // for example the PREF_AUTOAWAY_MODE maps to "autoaway.mode" in .profrc
static const char * static const char*
_get_key(preference_t pref) _get_key(preference_t pref)
{ {
switch (pref) switch (pref)
@ -833,7 +835,7 @@ _get_default_boolean(preference_t pref)
// the default setting for a string type preference // the default setting for a string type preference
// if it is not specified in .profrc // if it is not specified in .profrc
static char * static char*
_get_default_string(preference_t pref) _get_default_string(preference_t pref)
{ {
switch (pref) switch (pref)

View File

@ -124,9 +124,9 @@ typedef struct prof_alias_t {
void prefs_load(void); void prefs_load(void);
void prefs_close(void); void prefs_close(void);
char * prefs_find_login(char *prefix); char* prefs_find_login(char *prefix);
void prefs_reset_login_search(void); 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); void prefs_reset_boolean_choice(void);
gint prefs_get_gone(void); gint prefs_get_gone(void);
@ -162,15 +162,15 @@ void prefs_set_pgp_char(char ch);
void prefs_add_login(const char *jid); void prefs_add_login(const char *jid);
gboolean prefs_add_alias(const char * const name, const char * const value); gboolean prefs_add_alias(const char *const name, const char *const value);
gboolean prefs_remove_alias(const char * const name); gboolean prefs_remove_alias(const char *const name);
char* prefs_get_alias(const char * const name); char* prefs_get_alias(const char *const name);
GList* prefs_get_aliases(void); GList* prefs_get_aliases(void);
void prefs_free_aliases(GList *aliases); void prefs_free_aliases(GList *aliases);
gboolean prefs_get_boolean(preference_t pref); gboolean prefs_get_boolean(preference_t pref);
void prefs_set_boolean(preference_t pref, gboolean value); 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_free_string(char *pref);
void prefs_set_string(preference_t pref, char *value); void prefs_set_string(preference_t pref, char *value);

View File

@ -124,17 +124,17 @@ static struct colours_t {
NCURSES_COLOR_T receiptsent; NCURSES_COLOR_T receiptsent;
} colour_prefs; } 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 _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_colours(void);
static void _load_preferences(void); static void _load_preferences(void);
static gchar * _get_themes_dir(void); static gchar* _get_themes_dir(void);
void _theme_list_dir(const gchar * const dir, GSList **result); void _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);
static gboolean _theme_load_file(const char * const theme_name); static gboolean _theme_load_file(const char *const theme_name);
void 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")) { if (!_theme_load_file(theme_name) && !_theme_load_file("default")) {
log_error("Theme initialisation failed"); log_error("Theme initialisation failed");
@ -144,7 +144,7 @@ theme_init(const char * const theme_name)
} }
gboolean gboolean
theme_load(const char * const theme_name) theme_load(const char *const theme_name)
{ {
if (_theme_load_file(theme_name)) { if (_theme_load_file(theme_name)) {
_load_colours(); _load_colours();
@ -156,7 +156,7 @@ theme_load(const char * const theme_name)
} }
static gboolean static gboolean
_theme_load_file(const char * const theme_name) _theme_load_file(const char *const theme_name)
{ {
// use default theme // use default theme
if (theme_name == NULL || strcmp(theme_name, "default") == 0) { if (theme_name == NULL || strcmp(theme_name, "default") == 0) {
@ -189,7 +189,7 @@ _theme_load_file(const char * const theme_name)
return TRUE; return TRUE;
} }
GSList * GSList*
theme_list(void) theme_list(void)
{ {
GSList *result = NULL; GSList *result = NULL;
@ -300,7 +300,7 @@ theme_init_colours(void)
} }
static NCURSES_COLOR_T static NCURSES_COLOR_T
_lookup_colour(const char * const colour) _lookup_colour(const char *const colour)
{ {
int i; int i;
for (i = 0; i < num_colours; i++) { for (i = 0; i < num_colours; i++) {
@ -489,7 +489,7 @@ _load_preferences(void)
} }
} }
static gchar * static gchar*
_get_themes_dir(void) _get_themes_dir(void)
{ {
gchar *xdg_config = xdg_get_config_home(); gchar *xdg_config = xdg_get_config_home();
@ -500,7 +500,7 @@ _get_themes_dir(void)
} }
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); GDir *themes = g_dir_open(dir, 0, NULL);
if (themes) { if (themes) {
@ -513,8 +513,8 @@ _theme_list_dir(const gchar * const dir, GSList **result)
} }
} }
static GString * static GString*
_theme_find(const char * const theme_name) _theme_find(const char *const theme_name)
{ {
GString *path = NULL; GString *path = NULL;
gchar *themes_dir = _get_themes_dir(); gchar *themes_dir = _get_themes_dir();
@ -546,7 +546,7 @@ _theme_find(const char * const theme_name)
} }
theme_item_t 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) { if (g_strcmp0(presence, "online") == 0) {
return THEME_ONLINE; return THEME_ONLINE;

View File

@ -105,12 +105,12 @@ typedef enum {
THEME_MAGENTA_BOLD THEME_MAGENTA_BOLD
} theme_item_t; } theme_item_t;
void theme_init(const char * const theme_name); void theme_init(const char *const theme_name);
void theme_init_colours(void); 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); GSList* theme_list(void);
void theme_close(void); void theme_close(void);
int theme_attrs(theme_item_t attrs); 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 #endif

View File

@ -76,7 +76,7 @@ tlscerts_init(void)
} }
gboolean gboolean
tlscerts_exists(const char * const fingerprint) tlscerts_exists(const char *const fingerprint)
{ {
return g_key_file_has_group(tlscerts, fingerprint); return g_key_file_has_group(tlscerts, fingerprint);
} }
@ -110,8 +110,8 @@ tlscerts_list(void)
} }
TLSCertificate* TLSCertificate*
tlscerts_new(const char * const fingerprint, const char * const domain, const char * const organisation, 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) const char *const email, const char *const notbefore, const char *const notafter)
{ {
TLSCertificate *cert = malloc(sizeof(TLSCertificate)); TLSCertificate *cert = malloc(sizeof(TLSCertificate));
if (fingerprint) { if (fingerprint) {
@ -181,7 +181,7 @@ tlscerts_add(TLSCertificate *cert)
} }
gboolean gboolean
tlscerts_revoke(const char * const fingerprint) tlscerts_revoke(const char *const fingerprint)
{ {
gboolean result = g_key_file_remove_group(tlscerts, fingerprint, NULL); gboolean result = g_key_file_remove_group(tlscerts, fingerprint, NULL);
if (result) { if (result) {
@ -193,8 +193,8 @@ tlscerts_revoke(const char * const fingerprint)
return result; return result;
} }
char * char*
tlscerts_complete(const char * const prefix) tlscerts_complete(const char *const prefix)
{ {
return autocomplete_complete(certs_ac, prefix, TRUE); return autocomplete_complete(certs_ac, prefix, TRUE);
} }
@ -226,7 +226,7 @@ tlscerts_close(void)
autocomplete_free(certs_ac); autocomplete_free(certs_ac);
} }
static gchar * static gchar*
_get_tlscerts_file(void) _get_tlscerts_file(void)
{ {
gchar *xdg_data = xdg_get_data_home(); gchar *xdg_data = xdg_get_data_home();

View File

@ -46,21 +46,21 @@ typedef struct tls_cert_t {
void tlscerts_init(void); void tlscerts_init(void);
TLSCertificate *tlscerts_new(const char * const fingerprint, const char * const domain, TLSCertificate* tlscerts_new(const char *const fingerprint, const char *const domain,
const char * const organisation, const char * const email, const char *const organisation, const char *const email,
const char * const notbefore, const char * const notafter); 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); void tlscerts_add(TLSCertificate *cert);
gboolean tlscerts_revoke(const char * const fingerprint); gboolean tlscerts_revoke(const char *const fingerprint);
void tlscerts_free(TLSCertificate *cert); void tlscerts_free(TLSCertificate *cert);
GList* tlscerts_list(void); GList* tlscerts_list(void);
char* tlscerts_complete(const char * const prefix); char* tlscerts_complete(const char *const prefix);
void tlscerts_reset_ac(void); void tlscerts_reset_ac(void);

View File

@ -58,9 +58,9 @@ struct p_contact_t {
}; };
PContact PContact
p_contact_new(const char * const barejid, const char * const name, p_contact_new(const char *const barejid, const char *const name,
GSList *groups, const char * const subscription, GSList *groups, const char *const subscription,
const char * const offline_message, gboolean pending_out) const char *const offline_message, gboolean pending_out)
{ {
PContact contact = malloc(sizeof(struct p_contact_t)); PContact contact = malloc(sizeof(struct p_contact_t));
contact->barejid = strdup(barejid); contact->barejid = strdup(barejid);
@ -98,7 +98,7 @@ p_contact_new(const char * const barejid, const char * const name,
} }
void 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);
FREE_SET_NULL(contact->name_collate_key); FREE_SET_NULL(contact->name_collate_key);
@ -120,7 +120,7 @@ p_contact_set_groups(const PContact contact, GSList *groups)
} }
gboolean 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; GSList *groups = contact->groups;
while (groups) { while (groups) {
@ -133,14 +133,14 @@ p_contact_in_group(const PContact contact, const char * const group)
return FALSE; return FALSE;
} }
GSList * GSList*
p_contact_groups(const PContact contact) p_contact_groups(const PContact contact)
{ {
return contact->groups; return contact->groups;
} }
gboolean 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); gboolean result = g_hash_table_remove(contact->available_resources, resource);
autocomplete_remove(contact->resource_ac, 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) p_contact_barejid(const PContact contact)
{ {
return contact->barejid; return contact->barejid;
} }
const char * const char*
p_contact_barejid_collate_key(const PContact contact) p_contact_barejid_collate_key(const PContact contact)
{ {
return contact->barejid_collate_key; return contact->barejid_collate_key;
} }
const char * const char*
p_contact_name(const PContact contact) p_contact_name(const PContact contact)
{ {
return contact->name; return contact->name;
} }
const char * const char*
p_contact_name_collate_key(const PContact contact) p_contact_name_collate_key(const PContact contact)
{ {
return contact->name_collate_key; return contact->name_collate_key;
} }
const char * const char*
p_contact_name_or_jid(const PContact contact) p_contact_name_or_jid(const PContact contact)
{ {
if (contact->name) { if (contact->name) {
@ -207,8 +207,8 @@ p_contact_name_or_jid(const PContact contact)
} }
} }
char * char*
p_contact_create_display_string(const PContact contact, const char * const resource) p_contact_create_display_string(const PContact contact, const char *const resource)
{ {
GString *result_str = g_string_new(""); GString *result_str = g_string_new("");
@ -229,7 +229,7 @@ p_contact_create_display_string(const PContact contact, const char * const resou
return result; return result;
} }
static Resource * static Resource*
_highest_presence(Resource *first, Resource *second) _highest_presence(Resource *first, Resource *second)
{ {
if (first->presence == RESOURCE_CHAT) { if (first->presence == RESOURCE_CHAT) {
@ -253,7 +253,7 @@ _highest_presence(Resource *first, Resource *second)
} }
} }
Resource * Resource*
_get_most_available_resource(PContact contact) _get_most_available_resource(PContact contact)
{ {
// find resource with highest priority, if more than one, // find resource with highest priority, if more than one,
@ -287,7 +287,7 @@ _get_most_available_resource(PContact contact)
return highest; return highest;
} }
const char * const char*
p_contact_presence(const PContact contact) p_contact_presence(const PContact contact)
{ {
assert(contact != NULL); assert(contact != NULL);
@ -302,7 +302,7 @@ p_contact_presence(const PContact contact)
return string_from_resource_presence(resource->presence); return string_from_resource_presence(resource->presence);
} }
const char * const char*
p_contact_status(const PContact contact) p_contact_status(const PContact contact)
{ {
assert(contact != NULL); assert(contact != NULL);
@ -317,7 +317,7 @@ p_contact_status(const PContact contact)
return resource->status; return resource->status;
} }
const char * const char*
p_contact_subscription(const PContact contact) p_contact_subscription(const PContact contact)
{ {
return contact->subscription; return contact->subscription;
@ -337,8 +337,8 @@ p_contact_subscribed(const PContact contact)
} }
} }
Resource * Resource*
p_contact_get_resource(const PContact contact, const char * const resource) p_contact_get_resource(const PContact contact, const char *const resource)
{ {
return g_hash_table_lookup(contact->available_resources, 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; return contact->pending_out;
} }
GDateTime * GDateTime*
p_contact_last_activity(const PContact contact) p_contact_last_activity(const PContact contact)
{ {
return contact->last_activity; return contact->last_activity;
} }
GList * GList*
p_contact_get_available_resources(const PContact contact) p_contact_get_available_resources(const PContact contact)
{ {
assert(contact != NULL); assert(contact != NULL);
@ -406,7 +406,7 @@ p_contact_set_presence(const PContact contact, Resource *resource)
} }
void 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); FREE_SET_NULL(contact->subscription);
if (subscription) { if (subscription) {

View File

@ -40,11 +40,10 @@
typedef struct p_contact_t *PContact; typedef struct p_contact_t *PContact;
PContact p_contact_new(const char * const barejid, const char * const name, PContact p_contact_new(const char *const barejid, const char *const name, GSList *groups,
GSList *groups, const char * const subscription, const char *const subscription, const char *const offline_message, gboolean pending_out);
const char * const offline_message, gboolean pending_out);
void p_contact_add_resource(PContact contact, Resource *resource); 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); void p_contact_free(PContact contact);
const char* p_contact_barejid(PContact contact); const char* p_contact_barejid(PContact contact);
const char* p_contact_barejid_collate_key(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_presence(PContact contact);
const char* p_contact_status(PContact contact); const char* p_contact_status(PContact contact);
const char* p_contact_subscription(const 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); GDateTime* p_contact_last_activity(const PContact contact);
gboolean p_contact_pending_out(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_presence(const PContact contact, Resource *resource);
void p_contact_set_status(const PContact contact, const char * const status); 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_name(const PContact contact, const char *const name);
void p_contact_set_subscription(const PContact contact, const char * const subscription); 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_pending_out(const PContact contact, gboolean pending_out);
void p_contact_set_last_activity(const PContact contact, GDateTime *last_activity); void p_contact_set_last_activity(const PContact contact, GDateTime *last_activity);
gboolean p_contact_is_available(const PContact contact); gboolean p_contact_is_available(const PContact contact);
gboolean p_contact_has_available_resource(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); void p_contact_set_groups(const PContact contact, GSList *groups);
GSList * p_contact_groups(const PContact contact); GSList* p_contact_groups(const PContact contact);
gboolean p_contact_in_group(const PContact contact, const char * const group); gboolean p_contact_in_group(const PContact contact, const char *const group);
gboolean p_contact_subscribed(const PContact contact); 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); Autocomplete p_contact_resource_ac(const PContact contact);
void p_contact_resource_ac_reset(const PContact contact); void p_contact_resource_ac_reset(const PContact contact);

View File

@ -48,7 +48,7 @@
#endif #endif
jabber_conn_status_t 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); cons_show("Connecting as %s", jid);
return jabber_connect_with_details(jid, passwd, altdomain, port, tls_policy); return jabber_connect_with_details(jid, passwd, altdomain, port, tls_policy);
@ -65,7 +65,7 @@ cl_ev_connect_account(ProfAccount *account)
} }
void 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; char *signed_status = NULL;
@ -84,7 +84,7 @@ cl_ev_presence_send(const resource_presence_t presence_type, const char * const
} }
void 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); chat_state_active(chatwin->state);
@ -154,13 +154,13 @@ cl_ev_send_msg(ProfChatWin *chatwin, const char * const msg)
} }
void 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); message_send_groupchat(mucwin->roomjid, msg);
} }
void 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); message_send_private(privwin->fulljid, msg);
ui_outgoing_private_msg(privwin, msg); ui_outgoing_private_msg(privwin, msg);

View File

@ -35,13 +35,13 @@
#ifndef CLIENT_EVENTS_H #ifndef CLIENT_EVENTS_H
#define 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); 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_msg(ProfChatWin *chatwin, const char *const msg);
void cl_ev_send_muc_msg(ProfMucWin *mucwin, 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_priv_msg(ProfPrivateWin *privwin, const char *const msg);
#endif #endif

View File

@ -123,8 +123,8 @@ sv_ev_failed_login(void)
void void
sv_ev_room_invite(jabber_invite_t invite_type, sv_ev_room_invite(jabber_invite_t invite_type,
const char * const invitor, const char * const room, const char *const invitor, const char *const room,
const char * const reason, const char * const password) const char *const reason, const char *const password)
{ {
if (!muc_active(room) && !muc_invites_contain(room)) { if (!muc_active(room) && !muc_invites_contain(room)) {
cons_show_room_invite(invitor, room, reason); cons_show_room_invite(invitor, room, reason);
@ -133,8 +133,7 @@ sv_ev_room_invite(jabber_invite_t invite_type,
} }
void void
sv_ev_room_broadcast(const char *const room_jid, sv_ev_room_broadcast(const char *const room_jid, const char *const message)
const char * const message)
{ {
if (muc_roster_complete(room_jid)) { if (muc_roster_complete(room_jid)) {
ui_room_broadcast(room_jid, message); ui_room_broadcast(room_jid, message);
@ -144,7 +143,7 @@ sv_ev_room_broadcast(const char *const room_jid,
} }
void 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); muc_set_subject(room, subject);
if (muc_roster_complete(room)) { if (muc_roster_complete(room)) {
@ -153,15 +152,15 @@ sv_ev_room_subject(const char * const room, const char * const nick, const char
} }
void void
sv_ev_room_history(const char * const room_jid, const char * const nick, sv_ev_room_history(const char *const room_jid, const char *const nick,
GDateTime *timestamp, const char * const message) GDateTime *timestamp, const char *const message)
{ {
ui_room_history(room_jid, nick, timestamp, message); ui_room_history(room_jid, nick, timestamp, message);
} }
void void
sv_ev_room_message(const char * const room_jid, const char * const nick, sv_ev_room_message(const char *const room_jid, const char *const nick,
const char * const message) const char *const message)
{ {
ui_room_message(room_jid, nick, 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 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); 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 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); ui_incoming_private_msg(fulljid, message, timestamp);
} }
@ -341,7 +340,7 @@ sv_ev_inactive(char *barejid, char *resource)
} }
void 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); ui_recipient_gone(barejid, resource);
if (ui_chat_win_exists(barejid)) { if (ui_chat_win_exists(barejid)) {
@ -350,7 +349,7 @@ sv_ev_gone(const char * const barejid, const char * const resource)
} }
void 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)) { if (ui_chat_win_exists(barejid)) {
chat_session_recipient_active(barejid, resource, send_states); chat_session_recipient_active(barejid, resource, send_states);
@ -419,44 +418,44 @@ sv_ev_contact_online(char *barejid, Resource *resource, GDateTime *last_activity
} }
void void
sv_ev_leave_room(const char * const room) sv_ev_leave_room(const char *const room)
{ {
muc_leave(room); muc_leave(room);
ui_leave_room(room); ui_leave_room(room);
} }
void void
sv_ev_room_destroy(const char * const room) sv_ev_room_destroy(const char *const room)
{ {
muc_leave(room); muc_leave(room);
ui_room_destroy(room); ui_room_destroy(room);
} }
void void
sv_ev_room_destroyed(const char * const room, const char * const new_jid, const char * const password, sv_ev_room_destroyed(const char *const room, const char *const new_jid, const char *const password,
const char * const reason) const char *const reason)
{ {
muc_leave(room); muc_leave(room);
ui_room_destroyed(room, reason, new_jid, password); ui_room_destroyed(room, reason, new_jid, password);
} }
void 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); muc_leave(room);
ui_room_kicked(room, actor, reason); ui_room_kicked(room, actor, reason);
} }
void 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); muc_leave(room);
ui_room_banned(room, actor, reason); ui_room_banned(room, actor, reason);
} }
void void
sv_ev_room_occupant_offline(const char * const room, const char * const nick, sv_ev_room_occupant_offline(const char *const room, const char *const nick,
const char * const show, const char * const status) const char *const show, const char *const status)
{ {
muc_roster_remove(room, nick); muc_roster_remove(room, nick);
@ -469,8 +468,8 @@ sv_ev_room_occupant_offline(const char * const room, const char * const nick,
} }
void void
sv_ev_room_occupent_kicked(const char * const room, const char * const nick, const char * const actor, sv_ev_room_occupent_kicked(const char *const room, const char *const nick, const char *const actor,
const char * const reason) const char *const reason)
{ {
muc_roster_remove(room, nick); muc_roster_remove(room, nick);
ui_room_member_kicked(room, nick, actor, reason); 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 void
sv_ev_room_occupent_banned(const char * const room, const char * const nick, const char * const actor, sv_ev_room_occupent_banned(const char *const room, const char *const nick, const char *const actor,
const char * const reason) const char *const reason)
{ {
muc_roster_remove(room, nick); muc_roster_remove(room, nick);
ui_room_member_banned(room, nick, actor, reason); 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 void
sv_ev_roster_update(const char * const barejid, const char * const name, sv_ev_roster_update(const char *const barejid, const char *const name,
GSList *groups, const char * const subscription, gboolean pending_out) GSList *groups, const char *const subscription, gboolean pending_out)
{ {
roster_update(barejid, name, groups, subscription, pending_out); roster_update(barejid, name, groups, subscription, pending_out);
rosterwin_roster(); rosterwin_roster();
} }
void void
sv_ev_xmpp_stanza(const char * const msg) sv_ev_xmpp_stanza(const char *const msg)
{ {
ui_handle_stanza(msg); ui_handle_stanza(msg);
} }
void void
sv_ev_muc_self_online(const char * const room, const char * const nick, gboolean config_required, 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 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) const char *const jid, const char *const show, const char *const status)
{ {
muc_roster_add(room, nick, jid, role, affiliation, show, status); muc_roster_add(room, nick, jid, role, affiliation, show, status);
char *old_role = muc_role_str(room); 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 void
sv_ev_muc_occupant_online(const char * const room, const char * const nick, const char * const jid, 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 role, const char *const affiliation, const char *const actor, const char *const reason,
const char * const show, const char * const status) const char *const show, const char *const status)
{ {
Occupant *occupant = muc_roster_item(room, nick); 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 int
sv_ev_certfail(const char * const errormsg, const char * const certname, const char * const certfp, sv_ev_certfail(const char *const errormsg, const char *const certname, const char *const certfp,
const char * const notbefore, const char * const notafter) const char *const notbefore, const char *const notafter)
{ {
if (tlscerts_exists(certfp)) { if (tlscerts_exists(certfp)) {
return 1; return 1;
@ -739,7 +738,7 @@ sv_ev_certfail(const char * const errormsg, const char * const certname, const c
} }
void 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); Jid *jidp = jid_create(from);

View File

@ -41,53 +41,52 @@ void sv_ev_login_account_success(char *account_name, int secured);
void sv_ev_lost_connection(void); void sv_ev_lost_connection(void);
void sv_ev_failed_login(void); void sv_ev_failed_login(void);
void sv_ev_room_invite(jabber_invite_t invite_type, void sv_ev_room_invite(jabber_invite_t invite_type,
const char * const invitor, const char * const room, const char *const invitor, const char *const room,
const char * const reason, const char * const password); const char *const reason, const char *const password);
void sv_ev_room_broadcast(const char *const room_jid, void sv_ev_room_broadcast(const char *const room_jid, const char *const message);
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_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,
void sv_ev_room_history(const char * const room_jid, const char * const nick, GDateTime *timestamp, const char *const message);
GDateTime *timestamp, const char * const message); void sv_ev_room_message(const char *const room_jid, const char *const nick,
void sv_ev_room_message(const char * const room_jid, const char * const nick, const char *const message);
const char * const message);
void sv_ev_incoming_message(char *barejid, char *resource, char *message, char *pgp_message, GDateTime *timestamp); 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_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_delayed_private_message(const char *const fulljid, char *message, GDateTime *timestamp);
void sv_ev_typing(char *barejid, char *resource); void sv_ev_typing(char *barejid, char *resource);
void sv_ev_paused(char *barejid, char *resource); void sv_ev_paused(char *barejid, char *resource);
void sv_ev_inactive(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_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_subscription(const char *from, jabber_subscr_t type);
void sv_ev_message_receipt(char *barejid, char *id); void sv_ev_message_receipt(char *barejid, char *id);
void sv_ev_contact_offline(char *contact, char *resource, char *status); 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_contact_online(char *contact, Resource *resource, GDateTime *last_activity, char *pgpkey);
void sv_ev_leave_room(const char * const room); void sv_ev_leave_room(const char *const room);
void sv_ev_room_destroy(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, void sv_ev_room_occupant_offline(const char *const room, const char *const nick,
const char * const show, const char * const status); 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, void sv_ev_room_destroyed(const char *const room, const char *const new_jid, const char *const password,
const char * const reason); 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_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, void sv_ev_room_occupent_kicked(const char *const room, const char *const nick, const char *const actor,
const char * const reason); 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_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, void sv_ev_room_occupent_banned(const char *const room, const char *const nick, const char *const actor,
const char * const reason); const char *const reason);
void sv_ev_outgoing_carbon(char *barejid, char *message); void sv_ev_outgoing_carbon(char *barejid, char *message);
void sv_ev_incoming_carbon(char *barejid, char *resource, 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_xmpp_stanza(const char *const msg);
void sv_ev_muc_self_online(const char * const room, const char * const nick, gboolean config_required, 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 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); 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, 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 role, const char *const affiliation, const char *const actor, const char *const reason,
const char * const show_str, const char * const status_str); const char *const show_str, const char *const status_str);
void sv_ev_roster_update(const char * const barejid, const char * const name, void sv_ev_roster_update(const char *const barejid, const char *const name,
GSList *groups, const char * const subscription, gboolean pending_out); GSList *groups, const char *const subscription, gboolean pending_out);
void sv_ev_roster_received(void); void sv_ev_roster_received(void);
int sv_ev_certfail(const char * const errormsg, const char * const certname, const char * const certfp, int sv_ev_certfail(const char *const errormsg, const char *const certname, const char *const certfp,
const char * const notbefore, const char * const notafter); const char *const notbefore, const char *const notafter);
void sv_ev_lastactivity_response(const char * const from, const int seconds, const char * const msg); void sv_ev_lastactivity_response(const char *const from, const int seconds, const char *const msg);
#endif #endif

View File

@ -44,13 +44,13 @@ ui_ev_focus_win(ProfWin *win)
} }
ProfChatWin* 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); return ui_new_chat_win(barejid);
} }
ProfPrivateWin* 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); return ui_new_private_win(fulljid);
} }

View File

@ -36,7 +36,7 @@
#define UI_EVENTS_H #define UI_EVENTS_H
void ui_ev_focus_win(ProfWin *win); void ui_ev_focus_win(ProfWin *win);
ProfChatWin* ui_ev_new_chat_win(const char * const barejid); ProfChatWin* ui_ev_new_chat_win(const char *const barejid);
ProfPrivateWin* ui_ev_new_private_win(const char * const fulljid); ProfPrivateWin* ui_ev_new_private_win(const char *const fulljid);
#endif #endif

View File

@ -41,8 +41,8 @@
#include "common.h" #include "common.h"
Jid * Jid*
jid_create(const gchar * const str) jid_create(const gchar *const str)
{ {
Jid *result = NULL; Jid *result = NULL;
@ -106,8 +106,8 @@ jid_create(const gchar * const str)
return result; return result;
} }
Jid * Jid*
jid_create_from_bare_and_resource(const char * const room, const char * const nick) jid_create_from_bare_and_resource(const char *const room, const char *const nick)
{ {
Jid *result; Jid *result;
char *jid = create_fulljid(room, nick); char *jid = create_fulljid(room, nick);
@ -142,8 +142,8 @@ jid_is_valid_room_form(Jid *jid)
* barejid/resourcepart * barejid/resourcepart
* Will return a newly created string that must be freed by the caller * Will return a newly created string that must be freed by the caller
*/ */
char * char*
create_fulljid(const char * const barejid, const char * const resource) create_fulljid(const char *const barejid, const char *const resource)
{ {
gchar *barejidlower = g_utf8_strdown(barejid, -1); gchar *barejidlower = g_utf8_strdown(barejid, -1);
GString *full_jid = g_string_new(barejidlower); 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" * Full JID = "test@conference.server/person"
* returns "person" * returns "person"
*/ */
char * char*
get_nick_from_full_jid(const char * const full_room_jid) get_nick_from_full_jid(const char *const full_room_jid)
{ {
char **tokens = g_strsplit(full_room_jid, "/", 0); char **tokens = g_strsplit(full_room_jid, "/", 0);
char *nick_part = NULL; 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 * get the fulljid, fall back to the barejid
*/ */
char * char*
jid_fulljid_or_barejid(Jid *jid) jid_fulljid_or_barejid(Jid *jid)
{ {
if (jid->fulljid) { if (jid->fulljid) {

View File

@ -48,14 +48,14 @@ struct jid_t {
typedef struct jid_t Jid; typedef struct jid_t Jid;
Jid * jid_create(const gchar * const str); 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_from_bare_and_resource(const char *const room, const char *const nick);
void jid_destroy(Jid *jid); void jid_destroy(Jid *jid);
gboolean jid_is_valid_room_form(Jid *jid); gboolean jid_is_valid_room_form(Jid *jid);
char * create_fulljid(const char * const barejid, const char * const resource); char* create_fulljid(const char *const barejid, const char *const resource);
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 * jid_fulljid_or_barejid(Jid *jid); char* jid_fulljid_or_barejid(Jid *jid);
#endif #endif

View File

@ -78,23 +78,22 @@ struct dated_chat_log {
}; };
static gboolean _log_roll_needed(struct dated_chat_log *dated_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_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_groupchat_log(char *room, const char *const login);
static void _free_chat_log(struct dated_chat_log *dated_log); static void _free_chat_log(struct dated_chat_log *dated_log);
static gboolean _key_equals(void *key1, void *key2); static gboolean _key_equals(void *key1, void *key2);
static char * _get_log_filename(const char * const other, const char * const login, static char* _get_log_filename(const char *const other, const char *const login, GDateTime *dt, gboolean create);
GDateTime *dt, gboolean create); static char* _get_groupchat_log_filename(const char *const room, const char *const login, GDateTime *dt,
static char * _get_groupchat_log_filename(const char * const room, gboolean create);
const char * const login, GDateTime *dt, gboolean create); static gchar* _get_chatlog_dir(void);
static gchar * _get_chatlog_dir(void); static gchar* _get_main_log_file(void);
static gchar * _get_main_log_file(void);
static void _rotate_log_file(void); static void _rotate_log_file(void);
static char* _log_string_from_level(log_level_t level); static char* _log_string_from_level(log_level_t level);
static void _chat_log_chat(const char * const login, const char * const other, static void _chat_log_chat(const char *const login, const char *const other, const gchar *const msg,
const gchar * const msg, chat_log_direction_t direction, GDateTime *timestamp); chat_log_direction_t direction, GDateTime *timestamp);
void void
log_debug(const char * const msg, ...) log_debug(const char *const msg, ...)
{ {
va_list arg; va_list arg;
va_start(arg, msg); va_start(arg, msg);
@ -106,7 +105,7 @@ log_debug(const char * const msg, ...)
} }
void void
log_info(const char * const msg, ...) log_info(const char *const msg, ...)
{ {
va_list arg; va_list arg;
va_start(arg, msg); va_start(arg, msg);
@ -118,7 +117,7 @@ log_info(const char * const msg, ...)
} }
void void
log_warning(const char * const msg, ...) log_warning(const char *const msg, ...)
{ {
va_list arg; va_list arg;
va_start(arg, msg); va_start(arg, msg);
@ -130,7 +129,7 @@ log_warning(const char * const msg, ...)
} }
void void
log_error(const char * const msg, ...) log_error(const char *const msg, ...)
{ {
va_list arg; va_list arg;
va_start(arg, msg); va_start(arg, msg);
@ -160,7 +159,7 @@ log_reinit(void)
log_init(level_filter); log_init(level_filter);
} }
char * char*
get_log_file_location(void) get_log_file_location(void)
{ {
return mainlogfile->str; return mainlogfile->str;
@ -183,7 +182,7 @@ log_close(void)
} }
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) { if (level >= level_filter && logp) {
dt = g_date_time_new_now(tz); dt = g_date_time_new_now(tz);
@ -263,7 +262,7 @@ groupchat_log_init(void)
} }
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)) { if (prefs_get_boolean(PREF_CHLOG)) {
const char *jid = jabber_get_fulljid(); const char *jid = jabber_get_fulljid();
@ -274,7 +273,7 @@ chat_log_msg_out(const char * const barejid, const char * const msg)
} }
void 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)) { if (prefs_get_boolean(PREF_CHLOG)) {
const char *jid = jabber_get_fulljid(); const char *jid = jabber_get_fulljid();
@ -291,7 +290,7 @@ chat_log_otr_msg_out(const char * const barejid, const char * const msg)
} }
void 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)) { if (prefs_get_boolean(PREF_CHLOG)) {
const char *jid = jabber_get_fulljid(); const char *jid = jabber_get_fulljid();
@ -308,7 +307,7 @@ chat_log_pgp_msg_out(const char * const barejid, const char * const msg)
} }
void 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)) { if (prefs_get_boolean(PREF_CHLOG)) {
const char *jid = jabber_get_fulljid(); 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 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)) { if (prefs_get_boolean(PREF_CHLOG)) {
const char *jid = jabber_get_fulljid(); 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 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)) { if (prefs_get_boolean(PREF_CHLOG)) {
const char *jid = jabber_get_fulljid(); 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 static void
_chat_log_chat(const char * const login, const char * const other, _chat_log_chat(const char *const login, const char *const other, const char *const msg,
const char * const msg, chat_log_direction_t direction, GDateTime *timestamp) chat_log_direction_t direction, GDateTime *timestamp)
{ {
struct dated_chat_log *dated_log = g_hash_table_lookup(logs, other); 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 void
groupchat_log_chat(const gchar * const login, const gchar * const room, groupchat_log_chat(const gchar *const login, const gchar *const room, const gchar *const nick, const gchar *const msg)
const gchar * const nick, const gchar * const msg)
{ {
gchar *room_copy = strdup(room); gchar *room_copy = strdup(room);
struct dated_chat_log *dated_log = g_hash_table_lookup(groupchat_logs, room_copy); 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 * GSList*
chat_log_get_previous(const gchar * const login, const gchar * const recipient) chat_log_get_previous(const gchar *const login, const gchar *const recipient)
{ {
GSList *history = NULL; GSList *history = NULL;
GDateTime *now = g_date_time_new_now_local(); GDateTime *now = g_date_time_new_now_local();
@ -502,8 +500,8 @@ chat_log_close(void)
g_date_time_unref(session_started); g_date_time_unref(session_started);
} }
static struct dated_chat_log * static struct dated_chat_log*
_create_log(const char * const other, const char * const login) _create_log(const char *const other, const char *const login)
{ {
GDateTime *now = g_date_time_new_now_local(); GDateTime *now = g_date_time_new_now_local();
char *filename = _get_log_filename(other, login, now, TRUE); 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; return new_log;
} }
static struct dated_chat_log * static struct dated_chat_log*
_create_groupchat_log(char *room, const char * const login) _create_groupchat_log(char *room, const char *const login)
{ {
GDateTime *now = g_date_time_new_now_local(); GDateTime *now = g_date_time_new_now_local();
char *filename = _get_groupchat_log_filename(room, login, now, TRUE); 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); return (g_strcmp0(str1, str2) == 0);
} }
static char * static char*
_get_log_filename(const char * const other, const char * const login, _get_log_filename(const char *const other, const char *const login, GDateTime *dt, gboolean create)
GDateTime *dt, gboolean create)
{ {
gchar *chatlogs_dir = _get_chatlog_dir(); gchar *chatlogs_dir = _get_chatlog_dir();
GString *log_file = g_string_new(chatlogs_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; return result;
} }
static char * static char*
_get_groupchat_log_filename(const char * const room, const char * const login, _get_groupchat_log_filename(const char *const room, const char *const login, GDateTime *dt, gboolean create)
GDateTime *dt, gboolean create)
{ {
gchar *chatlogs_dir = _get_chatlog_dir(); gchar *chatlogs_dir = _get_chatlog_dir();
GString *log_file = g_string_new(chatlogs_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; return result;
} }
static gchar * static gchar*
_get_chatlog_dir(void) _get_chatlog_dir(void)
{ {
gchar *xdg_data = xdg_get_data_home(); gchar *xdg_data = xdg_get_data_home();
@ -653,7 +649,7 @@ _get_chatlog_dir(void)
return result; return result;
} }
static gchar * static gchar*
_get_main_log_file(void) _get_main_log_file(void)
{ {
gchar *xdg_data = xdg_get_data_home(); gchar *xdg_data = xdg_get_data_home();

View File

@ -54,13 +54,12 @@ void log_init(log_level_t filter);
log_level_t log_get_filter(void); log_level_t log_get_filter(void);
void log_close(void); void log_close(void);
void log_reinit(void); void log_reinit(void);
char * get_log_file_location(void); char* get_log_file_location(void);
void log_debug(const char * const msg, ...); void log_debug(const char *const msg, ...);
void log_info(const char * const msg, ...); void log_info(const char *const msg, ...);
void log_warning(const char * const msg, ...); void log_warning(const char *const msg, ...);
void log_error(const char * const msg, ...); void log_error(const char *const msg, ...);
void log_msg(log_level_t level, const char * const area, void log_msg(log_level_t level, const char *const area, const char *const msg);
const char * const msg);
log_level_t log_level_from_string(char *log_level); log_level_t log_level_from_string(char *log_level);
void log_stderr_init(log_level_t 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_init(void);
void chat_log_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_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_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_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_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_pgp_msg_in(const char *const barejid, const char *const msg, GDateTime *timestamp);
void chat_log_close(void); void chat_log_close(void);
GSList * chat_log_get_previous(const gchar * const login, GSList* chat_log_get_previous(const gchar *const login, const gchar *const recipient);
const gchar * const recipient);
void groupchat_log_init(void); void groupchat_log_init(void);
void groupchat_log_chat(const gchar * const login, const gchar * const room, void groupchat_log_chat(const gchar *const login, const gchar *const room, const gchar *const nick,
const gchar * const nick, const gchar * const msg); const gchar *const msg);
#endif #endif

View File

@ -40,6 +40,7 @@
#endif #endif
#include "profanity.h" #include "profanity.h"
#include "common.h"
#include "command/command.h" #include "command/command.h"
static gboolean version = FALSE; static gboolean version = FALSE;
@ -103,18 +104,7 @@ main(int argc, char **argv)
g_print("XMPP library: libstrophe\n"); g_print("XMPP library: libstrophe\n");
#endif #endif
gboolean notify_enabled = FALSE; if (is_notify_enabled()) {
#ifdef HAVE_OSXNOTIFY
notify_enabled = TRUE;
#endif
#ifdef HAVE_LIBNOTIFY
notify_enabled = TRUE;
#endif
#ifdef PLATFORM_CYGWIN
notify_enabled = TRUE;
#endif
if (notify_enabled) {
g_print("Desktop notification support: Enabled\n"); g_print("Desktop notification support: Enabled\n");
} else { } else {
g_print("Desktop notification support: Disabled\n"); g_print("Desktop notification support: Disabled\n");

155
src/muc.c
View File

@ -72,12 +72,12 @@ Autocomplete invite_ac;
static void _free_room(ChatRoom *room); static void _free_room(ChatRoom *room);
static gint _compare_occupants(Occupant *a, Occupant *b); static gint _compare_occupants(Occupant *a, Occupant *b);
static muc_role_t _role_from_string(const char * const role); static muc_role_t _role_from_string(const char *const role);
static muc_affiliation_t _affiliation_from_string(const char * const affiliation); static muc_affiliation_t _affiliation_from_string(const char *const affiliation);
static char* _role_to_string(muc_role_t role); static char* _role_to_string(muc_role_t role);
static char* _affiliation_to_string(muc_affiliation_t affiliation); static char* _affiliation_to_string(muc_affiliation_t affiliation);
static Occupant* _muc_occupant_new(const char *const nick, const char * const jid, static Occupant* _muc_occupant_new(const char *const nick, const char *const jid, muc_role_t role,
muc_role_t role, muc_affiliation_t affiliation, resource_presence_t presence, const char * const status); muc_affiliation_t affiliation, resource_presence_t presence, const char *const status);
static void _occupant_free(Occupant *occupant); static void _occupant_free(Occupant *occupant);
void void
@ -99,7 +99,7 @@ muc_close(void)
} }
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); autocomplete_add(invite_ac, room);
if (password) { if (password) {
@ -108,7 +108,7 @@ muc_invites_add(const char * const room, const char * const password)
} }
void void
muc_invites_remove(const char * const room) muc_invites_remove(const char *const room)
{ {
autocomplete_remove(invite_ac, room); autocomplete_remove(invite_ac, room);
g_hash_table_remove(invite_passwords, room); g_hash_table_remove(invite_passwords, room);
@ -120,20 +120,20 @@ muc_invites_count(void)
return autocomplete_length(invite_ac); return autocomplete_length(invite_ac);
} }
GSList * GSList*
muc_invites(void) muc_invites(void)
{ {
return autocomplete_create_list(invite_ac); return autocomplete_create_list(invite_ac);
} }
char * char*
muc_invite_password(const char * const room) muc_invite_password(const char *const room)
{ {
return g_hash_table_lookup(invite_passwords, room); return g_hash_table_lookup(invite_passwords, room);
} }
gboolean gboolean
muc_invites_contain(const char * const room) muc_invites_contain(const char *const room)
{ {
GSList *invites = autocomplete_create_list(invite_ac); GSList *invites = autocomplete_create_list(invite_ac);
GSList *curr = invites; GSList *curr = invites;
@ -156,8 +156,8 @@ muc_invites_reset_ac(void)
autocomplete_reset(invite_ac); autocomplete_reset(invite_ac);
} }
char * char*
muc_invites_find(const char * const search_str) muc_invites_find(const char *const search_str)
{ {
return autocomplete_complete(invite_ac, search_str, TRUE); return autocomplete_complete(invite_ac, search_str, TRUE);
} }
@ -172,8 +172,7 @@ muc_invites_clear(void)
} }
void void
muc_join(const char * const room, const char * const nick, muc_join(const char *const room, const char *const nick, const char *const password, gboolean autojoin)
const char * const password, gboolean autojoin)
{ {
ChatRoom *new_room = malloc(sizeof(ChatRoom)); ChatRoom *new_room = malloc(sizeof(ChatRoom));
new_room->room = strdup(room); new_room->room = strdup(room);
@ -202,13 +201,13 @@ muc_join(const char * const room, const char * const nick,
} }
void void
muc_leave(const char * const room) muc_leave(const char *const room)
{ {
g_hash_table_remove(rooms, room); g_hash_table_remove(rooms, room);
} }
gboolean gboolean
muc_requires_config(const char * const room) muc_requires_config(const char *const room)
{ {
ChatRoom *chat_room = g_hash_table_lookup(rooms, room); ChatRoom *chat_room = g_hash_table_lookup(rooms, room);
if (chat_room) { if (chat_room) {
@ -220,7 +219,7 @@ muc_requires_config(const char * const room)
} }
void 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); ChatRoom *chat_room = g_hash_table_lookup(rooms, room);
if (chat_room) { if (chat_room) {
@ -229,7 +228,7 @@ muc_set_requires_config(const char * const room, gboolean val)
} }
void 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); ChatRoom *chat_room = g_hash_table_lookup(rooms, room);
if (chat_room && features) { 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 * Returns TRUE if the user is currently in the room
*/ */
gboolean gboolean
muc_active(const char * const room) muc_active(const char *const room)
{ {
ChatRoom *chat_room = g_hash_table_lookup(rooms, room); ChatRoom *chat_room = g_hash_table_lookup(rooms, room);
return (chat_room != NULL); return (chat_room != NULL);
} }
gboolean gboolean
muc_autojoin(const char * const room) muc_autojoin(const char *const room)
{ {
ChatRoom *chat_room = g_hash_table_lookup(rooms, room); ChatRoom *chat_room = g_hash_table_lookup(rooms, room);
if (chat_room) { if (chat_room) {
@ -263,7 +262,7 @@ muc_autojoin(const char * const room)
} }
void 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); ChatRoom *chat_room = g_hash_table_lookup(rooms, room);
if (chat_room) { if (chat_room) {
@ -276,8 +275,8 @@ muc_set_subject(const char * const room, const char * const subject)
} }
} }
char * char*
muc_subject(const char * const room) muc_subject(const char *const room)
{ {
ChatRoom *chat_room = g_hash_table_lookup(rooms, room); ChatRoom *chat_room = g_hash_table_lookup(rooms, room);
if (chat_room) { if (chat_room) {
@ -288,7 +287,7 @@ muc_subject(const char * const room)
} }
void 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); ChatRoom *chat_room = g_hash_table_lookup(rooms, room);
if (chat_room) { if (chat_room) {
@ -296,8 +295,8 @@ muc_pending_broadcasts_add(const char * const room, const char * const message)
} }
} }
GList * GList*
muc_pending_broadcasts(const char * const room) muc_pending_broadcasts(const char *const room)
{ {
ChatRoom *chat_room = g_hash_table_lookup(rooms, room); ChatRoom *chat_room = g_hash_table_lookup(rooms, room);
if (chat_room) { if (chat_room) {
@ -307,8 +306,8 @@ muc_pending_broadcasts(const char * const room)
} }
} }
char * char*
muc_old_nick(const char * const room, const char * const new_nick) muc_old_nick(const char *const room, const char *const new_nick)
{ {
ChatRoom *chat_room = g_hash_table_lookup(rooms, room); ChatRoom *chat_room = g_hash_table_lookup(rooms, room);
if (chat_room && chat_room->pending_nick_change) { 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 * and is awaiting the response
*/ */
void 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); ChatRoom *chat_room = g_hash_table_lookup(rooms, room);
if (chat_room) { if (chat_room) {
@ -337,7 +336,7 @@ muc_nick_change_start(const char * const room, const char * const new_nick)
* nick change * nick change
*/ */
gboolean 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); ChatRoom *chat_room = g_hash_table_lookup(rooms, room);
if (chat_room) { if (chat_room) {
@ -352,7 +351,7 @@ muc_nick_change_pending(const char * const room)
* the service has responded * the service has responded
*/ */
void 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); ChatRoom *chat_room = g_hash_table_lookup(rooms, room);
if (chat_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 * The contents of the list are owned by the chat room and should not be
* modified or freed. * modified or freed.
*/ */
GList * GList*
muc_rooms(void) muc_rooms(void)
{ {
return g_hash_table_get_keys(rooms); return g_hash_table_get_keys(rooms);
@ -380,8 +379,8 @@ muc_rooms(void)
* Return current users nickname for the specified room * Return current users nickname for the specified room
* The nickname is owned by the chat room and should not be modified or freed * The nickname is owned by the chat room and should not be modified or freed
*/ */
char * char*
muc_nick(const char * const room) muc_nick(const char *const room)
{ {
ChatRoom *chat_room = g_hash_table_lookup(rooms, room); ChatRoom *chat_room = g_hash_table_lookup(rooms, room);
if (chat_room) { if (chat_room) {
@ -395,8 +394,8 @@ muc_nick(const char * const room)
* Return password for the specified room * Return password for the specified room
* The password is owned by the chat room and should not be modified or freed * The password is owned by the chat room and should not be modified or freed
*/ */
char * char*
muc_password(const char * const room) muc_password(const char *const room)
{ {
ChatRoom *chat_room = g_hash_table_lookup(rooms, room); ChatRoom *chat_room = g_hash_table_lookup(rooms, room);
if (chat_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 * Returns TRUE if the specified nick exists in the room's roster
*/ */
gboolean 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); ChatRoom *chat_room = g_hash_table_lookup(rooms, room);
if (chat_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 * Add a new chat room member to the room's roster
*/ */
gboolean gboolean
muc_roster_add(const char * const room, const char * const nick, const char * const jid, muc_roster_add(const char *const room, const char *const nick, const char *const jid, const char *const role,
const char * const role, const char * const affiliation, const char * const show, const char * const status) const char *const affiliation, const char *const show, const char *const status)
{ {
ChatRoom *chat_room = g_hash_table_lookup(rooms, room); ChatRoom *chat_room = g_hash_table_lookup(rooms, room);
gboolean updated = FALSE; 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 * Remove a room member from the room's roster
*/ */
void 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); ChatRoom *chat_room = g_hash_table_lookup(rooms, room);
if (chat_room) { if (chat_room) {
@ -474,8 +473,8 @@ muc_roster_remove(const char * const room, const char * const nick)
} }
} }
Occupant * Occupant*
muc_roster_item(const char * const room, const char * const nick) muc_roster_item(const char *const room, const char *const nick)
{ {
ChatRoom *chat_room = g_hash_table_lookup(rooms, room); ChatRoom *chat_room = g_hash_table_lookup(rooms, room);
if (chat_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 * Return a list of PContacts representing the room members in the room's roster
*/ */
GList * GList*
muc_roster(const char * const room) muc_roster(const char *const room)
{ {
ChatRoom *chat_room = g_hash_table_lookup(rooms, room); ChatRoom *chat_room = g_hash_table_lookup(rooms, room);
if (chat_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 * Return a Autocomplete representing the room member's in the roster
*/ */
Autocomplete Autocomplete
muc_roster_ac(const char * const room) muc_roster_ac(const char *const room)
{ {
ChatRoom *chat_room = g_hash_table_lookup(rooms, room); ChatRoom *chat_room = g_hash_table_lookup(rooms, room);
if (chat_room) { if (chat_room) {
@ -526,7 +525,7 @@ muc_roster_ac(const char * const room)
} }
Autocomplete 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); ChatRoom *chat_room = g_hash_table_lookup(rooms, room);
if (chat_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 * Set to TRUE when the rooms roster has been fully received
*/ */
void 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); ChatRoom *chat_room = g_hash_table_lookup(rooms, room);
if (chat_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 * Returns TRUE id the rooms roster has been fully received
*/ */
gboolean gboolean
muc_roster_complete(const char * const room) muc_roster_complete(const char *const room)
{ {
ChatRoom *chat_room = g_hash_table_lookup(rooms, room); ChatRoom *chat_room = g_hash_table_lookup(rooms, room);
if (chat_room) { if (chat_room) {
@ -568,20 +567,20 @@ muc_occupant_available(Occupant *occupant)
return (occupant->presence == RESOURCE_ONLINE || occupant->presence == RESOURCE_CHAT); return (occupant->presence == RESOURCE_ONLINE || occupant->presence == RESOURCE_CHAT);
} }
const char * const char*
muc_occupant_affiliation_str(Occupant *occupant) muc_occupant_affiliation_str(Occupant *occupant)
{ {
return _affiliation_to_string(occupant->affiliation); return _affiliation_to_string(occupant->affiliation);
} }
const char * const char*
muc_occupant_role_str(Occupant *occupant) muc_occupant_role_str(Occupant *occupant)
{ {
return _role_to_string(occupant->role); return _role_to_string(occupant->role);
} }
GSList * GSList*
muc_occupants_by_role(const char * const room, muc_role_t role) muc_occupants_by_role(const char *const room, muc_role_t role)
{ {
ChatRoom *chat_room = g_hash_table_lookup(rooms, room); ChatRoom *chat_room = g_hash_table_lookup(rooms, room);
if (chat_room) { if (chat_room) {
@ -603,8 +602,8 @@ muc_occupants_by_role(const char * const room, muc_role_t role)
} }
} }
GSList * GSList*
muc_occupants_by_affiliation(const char * const room, muc_affiliation_t affiliation) muc_occupants_by_affiliation(const char *const room, muc_affiliation_t affiliation)
{ {
ChatRoom *chat_room = g_hash_table_lookup(rooms, room); ChatRoom *chat_room = g_hash_table_lookup(rooms, room);
if (chat_room) { if (chat_room) {
@ -631,8 +630,7 @@ muc_occupants_by_affiliation(const char * const room, muc_affiliation_t affiliat
* is in progress * is in progress
*/ */
void void
muc_occupant_nick_change_start(const char * const room, muc_occupant_nick_change_start(const char *const room, const char *const new_nick, const char *const old_nick)
const char * const new_nick, const char * const old_nick)
{ {
ChatRoom *chat_room = g_hash_table_lookup(rooms, room); ChatRoom *chat_room = g_hash_table_lookup(rooms, room);
if (chat_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 old nick name will be returned in a new string which must be freed by
* the caller * the caller
*/ */
char * char*
muc_roster_nick_change_complete(const char * const room, muc_roster_nick_change_complete(const char *const room, const char *const nick)
const char * const nick)
{ {
ChatRoom *chat_room = g_hash_table_lookup(rooms, room); ChatRoom *chat_room = g_hash_table_lookup(rooms, room);
if (chat_room) { if (chat_room) {
@ -665,8 +662,8 @@ muc_roster_nick_change_complete(const char * const room,
return NULL; return NULL;
} }
char * char*
muc_autocomplete(ProfWin *window, const char * const input) muc_autocomplete(ProfWin *window, const char *const input)
{ {
if (window->type == WIN_MUC) { if (window->type == WIN_MUC) {
ProfMucWin *mucwin = (ProfMucWin*)window; ProfMucWin *mucwin = (ProfMucWin*)window;
@ -708,7 +705,7 @@ muc_autocomplete(ProfWin *window, const char * const input)
} }
void 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); ChatRoom *chat_room = g_hash_table_lookup(rooms, room);
if (chat_room) { if (chat_room) {
@ -719,7 +716,7 @@ muc_jid_autocomplete_reset(const char * const room)
} }
void 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); ChatRoom *chat_room = g_hash_table_lookup(rooms, room);
if (chat_room) { if (chat_room) {
@ -741,7 +738,7 @@ muc_jid_autocomplete_add_all(const char * const room, GSList *jids)
} }
void void
muc_autocomplete_reset(const char * const room) muc_autocomplete_reset(const char *const room)
{ {
ChatRoom *chat_room = g_hash_table_lookup(rooms, room); ChatRoom *chat_room = g_hash_table_lookup(rooms, room);
if (chat_room) { if (chat_room) {
@ -756,8 +753,8 @@ muc_autocomplete_reset(const char * const room)
} }
} }
char * char*
muc_role_str(const char * const room) muc_role_str(const char *const room)
{ {
ChatRoom *chat_room = g_hash_table_lookup(rooms, room); ChatRoom *chat_room = g_hash_table_lookup(rooms, room);
if (chat_room) { if (chat_room) {
@ -768,7 +765,7 @@ muc_role_str(const char * const room)
} }
void 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); ChatRoom *chat_room = g_hash_table_lookup(rooms, room);
if (chat_room) { if (chat_room) {
@ -776,8 +773,8 @@ muc_set_role(const char * const room, const char * const role)
} }
} }
char * char*
muc_affiliation_str(const char * const room) muc_affiliation_str(const char *const room)
{ {
ChatRoom *chat_room = g_hash_table_lookup(rooms, room); ChatRoom *chat_room = g_hash_table_lookup(rooms, room);
if (chat_room) { if (chat_room) {
@ -788,7 +785,7 @@ muc_affiliation_str(const char * const room)
} }
void 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); ChatRoom *chat_room = g_hash_table_lookup(rooms, room);
if (chat_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_t
muc_member_type(const char * const room) muc_member_type(const char *const room)
{ {
ChatRoom *chat_room = g_hash_table_lookup(rooms, room); ChatRoom *chat_room = g_hash_table_lookup(rooms, room);
if (chat_room) { if (chat_room) {
@ -832,8 +829,8 @@ _free_room(ChatRoom *room)
} }
} }
static static gint
gint _compare_occupants(Occupant *a, Occupant *b) _compare_occupants(Occupant *a, Occupant *b)
{ {
const char * utf8_str_a = a->nick_collate_key; const char * utf8_str_a = a->nick_collate_key;
const char * utf8_str_b = b->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 static muc_role_t
_role_from_string(const char * const role) _role_from_string(const char *const role)
{ {
if (role) { if (role) {
if (g_strcmp0(role, "visitor") == 0) { 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) _role_to_string(muc_role_t role)
{ {
char *result = NULL; char *result = NULL;
@ -888,7 +885,7 @@ _role_to_string(muc_role_t role)
} }
static muc_affiliation_t static muc_affiliation_t
_affiliation_from_string(const char * const affiliation) _affiliation_from_string(const char *const affiliation)
{ {
if (affiliation) { if (affiliation) {
if (g_strcmp0(affiliation, "outcast") == 0) { 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) _affiliation_to_string(muc_affiliation_t affiliation)
{ {
char *result = NULL; char *result = NULL;
@ -937,8 +934,8 @@ _affiliation_to_string(muc_affiliation_t affiliation)
} }
static Occupant* 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, _muc_occupant_new(const char *const nick, const char *const jid, muc_role_t role, muc_affiliation_t affiliation,
const char * const status) resource_presence_t presence, const char *const status)
{ {
Occupant *occupant = malloc(sizeof(Occupant)); Occupant *occupant = malloc(sizeof(Occupant));

View File

@ -76,75 +76,74 @@ typedef struct _muc_occupant_t {
void muc_init(void); void muc_init(void);
void muc_close(void); void muc_close(void);
void muc_join(const char * const room, const char * const nick, const char * const password, gboolean autojoin); 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_leave(const char *const room);
gboolean muc_active(const char * const room); gboolean muc_active(const char *const room);
gboolean muc_autojoin(const char * const room); gboolean muc_autojoin(const char *const room);
GList* muc_rooms(void); 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_nick(const char *const room);
char* muc_password(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_start(const char *const room, const char *const new_nick);
void muc_nick_change_complete(const char * const room, const char * const nick); void muc_nick_change_complete(const char *const room, const char *const nick);
gboolean muc_nick_change_pending(const char * const room); gboolean muc_nick_change_pending(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);
gboolean muc_roster_contains_nick(const char * const room, const char * const 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_complete(const char *const room);
gboolean muc_roster_add(const char * const room, const char * const nick, const char * const jid, gboolean muc_roster_add(const char *const room, const char *const nick, const char *const jid, const char *const role,
const char * const role, const char * const affiliation, const char * const show, const char *const affiliation, const char *const show, const char *const status);
const char * const status); void muc_roster_remove(const char *const room, const char *const nick);
void muc_roster_remove(const char * const room, const char * const nick); void muc_roster_set_complete(const char *const room);
void muc_roster_set_complete(const char * const room); GList* muc_roster(const char *const room);
GList * muc_roster(const char * const room); Autocomplete muc_roster_ac(const char *const room);
Autocomplete muc_roster_ac(const char * const room); Autocomplete muc_roster_jid_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_reset(const char * const room); void muc_jid_autocomplete_add_all(const char *const room, GSList *jids);
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); gboolean muc_occupant_available(Occupant *occupant);
const char * muc_occupant_affiliation_str(Occupant *occupant); const char* muc_occupant_affiliation_str(Occupant *occupant);
const char * muc_occupant_role_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_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);
void muc_occupant_nick_change_start(const char * const room, const char * const new_nick, const char * const old_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); 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_add(const char *const room, const char *const password);
void muc_invites_remove(const char * const room); void muc_invites_remove(const char *const room);
gint muc_invites_count(void); gint muc_invites_count(void);
GSList* muc_invites(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); 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); 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); void 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);
void muc_pending_broadcasts_add(const char * const room, const char * const message); void 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);
char* muc_autocomplete(ProfWin *window, const char * const input); char* muc_autocomplete(ProfWin *window, const char *const input);
void muc_autocomplete_reset(const char * const room); void muc_autocomplete_reset(const char *const room);
gboolean muc_requires_config(const char * const room); gboolean muc_requires_config(const char *const room);
void muc_set_requires_config(const char * const room, gboolean val); 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_role(const char *const room, const char *const role);
void muc_set_affiliation(const char * const room, const char * const affiliation); void muc_set_affiliation(const char *const room, const char *const affiliation);
char *muc_role_str(const char * const room); char* muc_role_str(const char *const room);
char *muc_affiliation_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 #endif

View File

@ -63,13 +63,13 @@ otr_userstate(void)
return user_state; return user_state;
} }
OtrlMessageAppOps * OtrlMessageAppOps*
otr_messageops(void) otr_messageops(void)
{ {
return &ops; return &ops;
} }
GHashTable * GHashTable*
otr_smpinitators(void) otr_smpinitators(void)
{ {
return smp_initiators; return smp_initiators;
@ -146,13 +146,13 @@ cb_gone_secure(void *opdata, ConnContext *context)
ui_gone_secure(context->username, otr_is_trusted(context->username)); ui_gone_secure(context->username, otr_is_trusted(context->username));
} }
char * char*
otr_libotr_version(void) otr_libotr_version(void)
{ {
return OTRL_VERSION; return OTRL_VERSION;
} }
char * char*
otr_start_query(void) otr_start_query(void)
{ {
return otrlib_start_query(); return otrlib_start_query();
@ -274,7 +274,7 @@ otr_on_connect(ProfAccount *account)
} }
char* 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); prof_otrpolicy_t policy = otr_get_policy(barejid);
char *whitespace_base = strstr(message, OTRL_MESSAGE_TAG_BASE); char *whitespace_base = strstr(message, OTRL_MESSAGE_TAG_BASE);
@ -314,7 +314,7 @@ otr_on_message_recv(const char * const barejid, const char * const resource, con
} }
gboolean gboolean
otr_on_message_send(ProfChatWin *chatwin, const char * const message) otr_on_message_send(ProfChatWin *chatwin, const char *const message)
{ {
char *id = NULL; char *id = NULL;
prof_otrpolicy_t policy = otr_get_policy(chatwin->barejid); prof_otrpolicy_t policy = otr_get_policy(chatwin->barejid);
@ -451,8 +451,8 @@ otr_key_loaded(void)
return data_loaded; return data_loaded;
} }
char * char*
otr_tag_message(const char * const msg) otr_tag_message(const char *const msg)
{ {
GString *otr_message = g_string_new(msg); GString *otr_message = g_string_new(msg);
g_string_append(otr_message, OTRL_MESSAGE_TAG_BASE); g_string_append(otr_message, OTRL_MESSAGE_TAG_BASE);
@ -464,7 +464,7 @@ otr_tag_message(const char * const msg)
} }
gboolean gboolean
otr_is_secure(const char * const recipient) otr_is_secure(const char *const recipient)
{ {
ConnContext *context = otrlib_context_find(user_state, recipient, jid); ConnContext *context = otrlib_context_find(user_state, recipient, jid);
@ -480,7 +480,7 @@ otr_is_secure(const char * const recipient)
} }
gboolean gboolean
otr_is_trusted(const char * const recipient) otr_is_trusted(const char *const recipient)
{ {
ConnContext *context = otrlib_context_find(user_state, recipient, jid); ConnContext *context = otrlib_context_find(user_state, recipient, jid);
@ -506,7 +506,7 @@ otr_is_trusted(const char * const recipient)
} }
void void
otr_trust(const char * const recipient) otr_trust(const char *const recipient)
{ {
ConnContext *context = otrlib_context_find(user_state, recipient, jid); ConnContext *context = otrlib_context_find(user_state, recipient, jid);
@ -530,7 +530,7 @@ otr_trust(const char * const recipient)
} }
void void
otr_untrust(const char * const recipient) otr_untrust(const char *const recipient)
{ {
ConnContext *context = otrlib_context_find(user_state, recipient, jid); ConnContext *context = otrlib_context_find(user_state, recipient, jid);
@ -554,7 +554,7 @@ otr_untrust(const char * const recipient)
} }
void 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); ConnContext *context = otrlib_context_find(user_state, recipient, jid);
@ -578,7 +578,7 @@ otr_smp_secret(const char * const recipient, const char *secret)
} }
void 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); 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 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); ConnContext *context = otrlib_context_find(user_state, recipient, jid);
@ -612,12 +612,12 @@ otr_smp_answer(const char * const recipient, const char *answer)
} }
void void
otr_end_session(const char * const recipient) otr_end_session(const char *const recipient)
{ {
otrlib_end_session(user_state, recipient, jid, &ops); otrlib_end_session(user_state, recipient, jid, &ops);
} }
char * char*
otr_get_my_fingerprint(void) otr_get_my_fingerprint(void)
{ {
char fingerprint[45]; char fingerprint[45];
@ -627,8 +627,8 @@ otr_get_my_fingerprint(void)
return result; return result;
} }
char * char*
otr_get_their_fingerprint(const char * const recipient) otr_get_their_fingerprint(const char *const recipient)
{ {
ConnContext *context = otrlib_context_find(user_state, recipient, jid); ConnContext *context = otrlib_context_find(user_state, recipient, jid);
@ -643,7 +643,7 @@ otr_get_their_fingerprint(const char * const recipient)
} }
prof_otrpolicy_t prof_otrpolicy_t
otr_get_policy(const char * const recipient) otr_get_policy(const char *const recipient)
{ {
char *account_name = jabber_get_account_name(); char *account_name = jabber_get_account_name();
ProfAccount *account = accounts_get_account(account_name); ProfAccount *account = accounts_get_account(account_name);
@ -695,8 +695,8 @@ otr_get_policy(const char * const recipient)
return result; return result;
} }
char * char*
otr_encrypt_message(const char * const to, const char * const message) otr_encrypt_message(const char *const to, const char *const message)
{ {
char *newmessage = NULL; char *newmessage = NULL;
gcry_error_t err = otrlib_encrypt_message(user_state, &ops, jid, to, message, &newmessage); gcry_error_t err = otrlib_encrypt_message(user_state, &ops, jid, to, message, &newmessage);
@ -716,8 +716,8 @@ _otr_tlv_free(OtrlTLV *tlvs)
} }
} }
char * char*
otr_decrypt_message(const char * const from, const char * const message, gboolean *decrypted) otr_decrypt_message(const char *const from, const char *const message, gboolean *decrypted)
{ {
char *newmessage = NULL; char *newmessage = NULL;
OtrlTLV *tlvs = NULL; OtrlTLV *tlvs = NULL;

View File

@ -58,35 +58,35 @@ char* otr_start_query(void);
void otr_poll(void); void otr_poll(void);
void otr_on_connect(ProfAccount *account); 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); 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); gboolean otr_on_message_send(ProfChatWin *chatwin, const char *const message);
void otr_keygen(ProfAccount *account); 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_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); gboolean otr_is_trusted(const char *const recipient);
void otr_trust(const char * const recipient); void otr_trust(const char *const recipient);
void otr_untrust(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_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_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_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_my_fingerprint(void);
char * otr_get_their_fingerprint(const char * const recipient); char* otr_get_their_fingerprint(const char *const recipient);
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 * otr_decrypt_message(const char * const from, const char * const message, char* otr_decrypt_message(const char *const from, const char *const message,
gboolean *decrypted); gboolean *decrypted);
void otr_free_message(char *message); 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 #endif

View File

@ -44,15 +44,15 @@ void otrlib_init_ops(OtrlMessageAppOps *ops);
void otrlib_init_timer(void); void otrlib_init_timer(void);
void otrlib_poll(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, gcry_error_t otrlib_encrypt_message(OtrlUserState user_state, OtrlMessageAppOps *ops, char *jid, const char *const to,
const char * const message, char **newmessage); const char *const message, char **newmessage);
int otrlib_decrypt_message(OtrlUserState user_state, OtrlMessageAppOps *ops, char *jid, const char * const from, int otrlib_decrypt_message(OtrlUserState user_state, OtrlMessageAppOps *ops, char *jid, const char *const from,
const char * const message, char **decrypted, OtrlTLV **tlvs); const char *const message, char **decrypted, OtrlTLV **tlvs);
void otrlib_handle_tlvs(OtrlUserState user_state, OtrlMessageAppOps *ops, ConnContext *context, OtrlTLV *tlvs, GHashTable *smp_initiators); void otrlib_handle_tlvs(OtrlUserState user_state, OtrlMessageAppOps *ops, ConnContext *context, OtrlTLV *tlvs, GHashTable *smp_initiators);

View File

@ -55,7 +55,7 @@ otrlib_poll(void)
{ {
} }
char * char*
otrlib_start_query(void) 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."; 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; ops->display_otr_message = cb_display_otr_message;
} }
ConnContext * ConnContext*
otrlib_context_find(OtrlUserState user_state, const char * const recipient, char *jid) 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); return otrl_context_find(user_state, recipient, jid, "xmpp", 0, NULL, NULL, NULL);
} }
void 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", ConnContext *context = otrl_context_find(user_state, recipient, jid, "xmpp",
0, NULL, NULL, NULL); 0, NULL, NULL, NULL);
@ -93,8 +93,8 @@ otrlib_end_session(OtrlUserState user_state, const char * const recipient, char
} }
gcry_error_t gcry_error_t
otrlib_encrypt_message(OtrlUserState user_state, OtrlMessageAppOps *ops, char *jid, const char * const to, otrlib_encrypt_message(OtrlUserState user_state, OtrlMessageAppOps *ops, char *jid, const char *const to,
const char * const message, char **newmessage) const char *const message, char **newmessage)
{ {
gcry_error_t err; gcry_error_t err;
err = otrl_message_sending( err = otrl_message_sending(
@ -114,8 +114,8 @@ otrlib_encrypt_message(OtrlUserState user_state, OtrlMessageAppOps *ops, char *j
} }
int int
otrlib_decrypt_message(OtrlUserState user_state, OtrlMessageAppOps *ops, char *jid, const char * const from, otrlib_decrypt_message(OtrlUserState user_state, OtrlMessageAppOps *ops, char *jid, const char *const from,
const char * const message, char **decrypted, OtrlTLV **tlvs) const char *const message, char **decrypted, OtrlTLV **tlvs)
{ {
return otrl_message_receiving( return otrl_message_receiving(
user_state, user_state,

View File

@ -71,15 +71,14 @@ otrlib_poll(void)
} }
} }
char * char*
otrlib_start_query(void) 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."; 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* static const char*
cb_otr_error_message(void *opdata, ConnContext *context, cb_otr_error_message(void *opdata, ConnContext *context, OtrlErrorCode err_code)
OtrlErrorCode err_code)
{ {
switch(err_code) switch(err_code)
{ {
@ -241,14 +240,14 @@ otrlib_init_ops(OtrlMessageAppOps *ops)
ops->timer_control = cb_timer_control; ops->timer_control = cb_timer_control;
} }
ConnContext * ConnContext*
otrlib_context_find(OtrlUserState user_state, const char * const recipient, char *jid) 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); return otrl_context_find(user_state, recipient, jid, "xmpp", OTRL_INSTAG_MASTER, 0, NULL, NULL, NULL);
} }
void 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", ConnContext *context = otrl_context_find(user_state, recipient, jid, "xmpp",
OTRL_INSTAG_MASTER, 0, NULL, NULL, NULL); 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 gcry_error_t
otrlib_encrypt_message(OtrlUserState user_state, OtrlMessageAppOps *ops, char *jid, const char * const to, otrlib_encrypt_message(OtrlUserState user_state, OtrlMessageAppOps *ops, char *jid, const char *const to,
const char * const message, char **newmessage) const char *const message, char **newmessage)
{ {
gcry_error_t err; gcry_error_t err;
@ -284,8 +283,8 @@ otrlib_encrypt_message(OtrlUserState user_state, OtrlMessageAppOps *ops, char *j
} }
int int
otrlib_decrypt_message(OtrlUserState user_state, OtrlMessageAppOps *ops, char *jid, const char * const from, otrlib_decrypt_message(OtrlUserState user_state, OtrlMessageAppOps *ops, char *jid, const char *const from,
const char * const message, char **decrypted, OtrlTLV **tlvs) const char *const message, char **decrypted, OtrlTLV **tlvs)
{ {
return otrl_message_receiving( return otrl_message_receiving(
user_state, user_state,

View File

@ -66,8 +66,8 @@ static char *passphrase_attempt;
static Autocomplete key_ac; static Autocomplete key_ac;
static char* _remove_header_footer(char *str, 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 char* _add_header_footer(const char *const str, const char *const header, const char *const footer);
static void _save_pubkeys(void); static void _save_pubkeys(void);
void void
@ -79,7 +79,7 @@ _p_gpg_free_pubkeyid(ProfPGPPubKeyId *pubkeyid)
free(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) _p_gpg_passphrase_cb(void *hook, const char *uid_hint, const char *passphrase_info, int prev_was_bad, int fd)
{ {
if (passphrase) { if (passphrase) {
@ -154,7 +154,7 @@ p_gpg_close(void)
} }
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(); gchar *data_home = xdg_get_data_home();
GString *pubsfile = g_string_new(data_home); GString *pubsfile = g_string_new(data_home);
@ -262,7 +262,7 @@ p_gpg_on_disconnect(void)
} }
gboolean 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_ctx_t ctx;
gpgme_error_t error = gpgme_new(&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; return TRUE;
} }
static ProfPGPKey * static ProfPGPKey*
_p_gpg_key_new(void) _p_gpg_key_new(void)
{ {
ProfPGPKey *p_pgpkey = malloc(sizeof(ProfPGPKey)); ProfPGPKey *p_pgpkey = malloc(sizeof(ProfPGPKey));
@ -321,7 +321,7 @@ _p_gpg_free_key(ProfPGPKey *key)
} }
} }
GHashTable * GHashTable*
p_gpg_list_keys(void) p_gpg_list_keys(void)
{ {
gpgme_error_t error; gpgme_error_t error;
@ -411,7 +411,7 @@ p_gpg_free_keys(GHashTable *keys)
} }
GHashTable * GHashTable*
p_gpg_pubkeys(void) p_gpg_pubkeys(void)
{ {
return pubkeys; return pubkeys;
@ -424,7 +424,7 @@ p_gpg_libver(void)
} }
gboolean gboolean
p_gpg_valid_key(const char * const keyid) p_gpg_valid_key(const char *const keyid)
{ {
gpgme_ctx_t ctx; gpgme_ctx_t ctx;
gpgme_error_t error = gpgme_new(&ctx); gpgme_error_t error = gpgme_new(&ctx);
@ -453,14 +453,14 @@ p_gpg_valid_key(const char * const keyid)
} }
gboolean gboolean
p_gpg_available(const char * const barejid) p_gpg_available(const char *const barejid)
{ {
char *pubkey = g_hash_table_lookup(pubkeys, barejid); char *pubkey = g_hash_table_lookup(pubkeys, barejid);
return (pubkey != NULL); return (pubkey != NULL);
} }
void 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) { if (!sign) {
return; return;
@ -515,7 +515,7 @@ p_gpg_verify(const char * const barejid, const char *const sign)
} }
char* 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_ctx_t ctx;
gpgme_error_t error = gpgme_new(&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; return result;
} }
char * char*
p_gpg_encrypt(const char * const barejid, const char * const message) p_gpg_encrypt(const char *const barejid, const char *const message)
{ {
ProfPGPPubKeyId *pubkeyid = g_hash_table_lookup(pubkeys, barejid); ProfPGPPubKeyId *pubkeyid = g_hash_table_lookup(pubkeys, barejid);
if (!pubkeyid) { if (!pubkeyid) {
@ -654,8 +654,8 @@ p_gpg_encrypt(const char * const barejid, const char * const message)
return result; return result;
} }
char * char*
p_gpg_decrypt(const char * const cipher) p_gpg_decrypt(const char *const cipher)
{ {
gpgme_ctx_t ctx; gpgme_ctx_t ctx;
gpgme_error_t error = gpgme_new(&ctx); gpgme_error_t error = gpgme_new(&ctx);
@ -725,8 +725,8 @@ p_gpg_free_decrypted(char *decrypted)
g_free(decrypted); g_free(decrypted);
} }
char * char*
p_gpg_autocomplete_key(const char * const search_str) p_gpg_autocomplete_key(const char *const search_str)
{ {
return autocomplete_complete(key_ac, search_str, TRUE); return autocomplete_complete(key_ac, search_str, TRUE);
} }
@ -737,7 +737,7 @@ p_gpg_autocomplete_key_reset(void)
autocomplete_reset(key_ac); autocomplete_reset(key_ac);
} }
char * char*
p_gpg_format_fp_str(char *fp) p_gpg_format_fp_str(char *fp)
{ {
if (!fp) { if (!fp) {
@ -761,7 +761,7 @@ p_gpg_format_fp_str(char *fp)
} }
static char* static char*
_remove_header_footer(char *str, const char * const footer) _remove_header_footer(char *str, const char *const footer)
{ {
int pos = 0; int pos = 0;
int newlines = 0; int newlines = 0;
@ -785,7 +785,7 @@ _remove_header_footer(char *str, const char * const footer)
} }
static char* 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(""); GString *result_str = g_string_new("");

View File

@ -53,23 +53,22 @@ typedef struct pgp_pubkeyid_t {
void p_gpg_init(void); void p_gpg_init(void);
void p_gpg_close(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); void p_gpg_on_disconnect(void);
GHashTable* p_gpg_list_keys(void); GHashTable* p_gpg_list_keys(void);
void p_gpg_free_keys(GHashTable *keys); 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); GHashTable* p_gpg_pubkeys(void);
gboolean p_gpg_valid_key(const char * const keyid); gboolean p_gpg_valid_key(const char *const keyid);
gboolean p_gpg_available(const char * const barejid); gboolean p_gpg_available(const char *const barejid);
const char* p_gpg_libver(void); const char* p_gpg_libver(void);
char* p_gpg_sign(const char * const str, const char * const fp); char* p_gpg_sign(const char *const str, const char *const fp);
void p_gpg_verify(const char * const barejid, const char *const sign); 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_encrypt(const char *const barejid, const char *const message);
char* p_gpg_decrypt(const char * const cipher); char* p_gpg_decrypt(const char *const cipher);
void p_gpg_free_decrypted(char *decrypted); 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); void p_gpg_autocomplete_key_reset(void);
char* p_gpg_format_fp_str(char *fp); char* p_gpg_format_fp_str(char *fp);
#endif #endif

View File

@ -162,7 +162,7 @@ prof_handle_activity(void)
} }
static void static void
_connect_default(const char * const account) _connect_default(const char *const account)
{ {
ProfWin *window = wins_get_current(); ProfWin *window = wins_get_current();
if (account) { if (account) {
@ -177,7 +177,7 @@ _connect_default(const char * const account)
} }
static void static void
_check_autoaway() _check_autoaway(void)
{ {
jabber_conn_status_t conn_status = jabber_get_connection_status(); jabber_conn_status_t conn_status = jabber_get_connection_status();
if (conn_status != JABBER_CONNECTED) { if (conn_status != JABBER_CONNECTED) {

View File

@ -39,8 +39,8 @@
#include <common.h> #include <common.h>
#include <resource.h> #include <resource.h>
Resource * resource_new(const char * const name, resource_presence_t presence, Resource*
const char * const status, const int priority) resource_new(const char *const name, resource_presence_t presence, const char *const status, const int priority)
{ {
assert(name != NULL); assert(name != NULL);
Resource *new_resource = malloc(sizeof(struct resource_t)); 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) { if (resource) {
free(resource->name); free(resource->name);

View File

@ -44,10 +44,9 @@ typedef struct resource_t {
int priority; int priority;
} Resource; } Resource;
Resource * resource_new(const char * const name, resource_presence_t presence, Resource* resource_new(const char *const name, resource_presence_t presence, const char *const status,
const char * const status, const int priority); const int priority);
void resource_destroy(Resource *resource); void resource_destroy(Resource *resource);
int resource_compare_availability(Resource *first, Resource *second); int resource_compare_availability(Resource *first, Resource *second);
#endif #endif

View File

@ -64,10 +64,8 @@ static GHashTable *name_to_barejid;
static gboolean _key_equals(void *key1, void *key2); static gboolean _key_equals(void *key1, void *key2);
static gboolean _datetimes_equal(GDateTime *dt1, GDateTime *dt2); static gboolean _datetimes_equal(GDateTime *dt1, GDateTime *dt2);
static void _replace_name(const char * const current_name, static void _replace_name(const char *const current_name, const char *const new_name, const char *const barejid);
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 _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);
void void
@ -86,8 +84,7 @@ roster_clear(void)
} }
gboolean gboolean
roster_update_presence(const char * const barejid, Resource *resource, roster_update_presence(const char *const barejid, Resource *resource, GDateTime *last_activity)
GDateTime *last_activity)
{ {
assert(barejid != NULL); assert(barejid != NULL);
assert(resource != NULL); assert(resource != NULL);
@ -108,7 +105,7 @@ roster_update_presence(const char * const barejid, Resource *resource,
} }
PContact PContact
roster_get_contact(const char * const barejid) roster_get_contact(const char *const barejid)
{ {
gchar *barejidlower = g_utf8_strdown(barejid, -1); gchar *barejidlower = g_utf8_strdown(barejid, -1);
PContact contact = g_hash_table_lookup(contacts, barejidlower); PContact contact = g_hash_table_lookup(contacts, barejidlower);
@ -117,8 +114,8 @@ roster_get_contact(const char * const barejid)
return contact; return contact;
} }
char * char*
roster_get_msg_display_name(const char * const barejid, const char * const resource) roster_get_msg_display_name(const char *const barejid, const char *const resource)
{ {
GString *result = g_string_new(""); GString *result = g_string_new("");
@ -145,8 +142,7 @@ roster_get_msg_display_name(const char * const barejid, const char * const resou
} }
gboolean gboolean
roster_contact_offline(const char * const barejid, roster_contact_offline(const char *const barejid, const char *const resource, const char *const status)
const char * const resource, const char * const status)
{ {
PContact contact = roster_get_contact(barejid); PContact contact = roster_get_contact(barejid);
@ -199,7 +195,7 @@ roster_free(void)
} }
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); assert(contact != NULL);
@ -215,7 +211,7 @@ roster_change_name(PContact contact, const char * const new_name)
} }
void 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(barejid_ac, barejid);
autocomplete_remove(name_ac, name); autocomplete_remove(name_ac, name);
@ -241,8 +237,8 @@ roster_remove(const char * const name, const char * const barejid)
} }
void void
roster_update(const char * const barejid, const char * const name, roster_update(const char *const barejid, const char *const name, GSList *groups, const char *const subscription,
GSList *groups, const char * const subscription, gboolean pending_out) gboolean pending_out)
{ {
PContact contact = roster_get_contact(barejid); PContact contact = roster_get_contact(barejid);
assert(contact != NULL); assert(contact != NULL);
@ -268,8 +264,8 @@ roster_update(const char * const barejid, const char * const name,
} }
gboolean gboolean
roster_add(const char * const barejid, const char * const name, GSList *groups, roster_add(const char *const barejid, const char *const name, GSList *groups, const char *const subscription,
const char * const subscription, gboolean pending_out) gboolean pending_out)
{ {
PContact contact = roster_get_contact(barejid); PContact contact = roster_get_contact(barejid);
if (contact) { if (contact) {
@ -292,8 +288,8 @@ roster_add(const char * const barejid, const char * const name, GSList *groups,
return TRUE; return TRUE;
} }
char * char*
roster_barejid_from_name(const char * const name) roster_barejid_from_name(const char *const name)
{ {
if (name) { if (name) {
return g_hash_table_lookup(name_to_barejid, name); return g_hash_table_lookup(name_to_barejid, name);
@ -302,8 +298,8 @@ roster_barejid_from_name(const char * const name)
} }
} }
GSList * GSList*
roster_get_contacts_by_presence(const char * const presence) roster_get_contacts_by_presence(const char *const presence)
{ {
GSList *result = NULL; GSList *result = NULL;
GHashTableIter iter; GHashTableIter iter;
@ -322,7 +318,7 @@ roster_get_contacts_by_presence(const char * const presence)
return result; return result;
} }
GSList * GSList*
roster_get_contacts(void) roster_get_contacts(void)
{ {
GSList *result = NULL; GSList *result = NULL;
@ -339,7 +335,7 @@ roster_get_contacts(void)
return result; return result;
} }
GSList * GSList*
roster_get_contacts_online(void) roster_get_contacts_online(void)
{ {
GSList *result = NULL; GSList *result = NULL;
@ -375,19 +371,19 @@ roster_has_pending_subscriptions(void)
return FALSE; return FALSE;
} }
char * char*
roster_contact_autocomplete(const char * const search_str) roster_contact_autocomplete(const char *const search_str)
{ {
return autocomplete_complete(name_ac, search_str, TRUE); return autocomplete_complete(name_ac, search_str, TRUE);
} }
char * char*
roster_fulljid_autocomplete(const char * const search_str) roster_fulljid_autocomplete(const char *const search_str)
{ {
return autocomplete_complete(fulljid_ac, search_str, TRUE); return autocomplete_complete(fulljid_ac, search_str, TRUE);
} }
GSList * GSList*
roster_get_nogroup(void) roster_get_nogroup(void)
{ {
GSList *result = NULL; GSList *result = NULL;
@ -407,8 +403,8 @@ roster_get_nogroup(void)
return result; return result;
} }
GSList * GSList*
roster_get_group(const char * const group) roster_get_group(const char *const group)
{ {
GSList *result = NULL; GSList *result = NULL;
GHashTableIter iter; GHashTableIter iter;
@ -431,26 +427,26 @@ roster_get_group(const char * const group)
return result; return result;
} }
GSList * GSList*
roster_get_groups(void) roster_get_groups(void)
{ {
return autocomplete_create_list(groups_ac); return autocomplete_create_list(groups_ac);
} }
char * char*
roster_group_autocomplete(const char * const search_str) roster_group_autocomplete(const char *const search_str)
{ {
return autocomplete_complete(groups_ac, search_str, TRUE); return autocomplete_complete(groups_ac, search_str, TRUE);
} }
char * char*
roster_barejid_autocomplete(const char * const search_str) roster_barejid_autocomplete(const char *const search_str)
{ {
return autocomplete_complete(barejid_ac, search_str, TRUE); return autocomplete_complete(barejid_ac, search_str, TRUE);
} }
static static gboolean
gboolean _key_equals(void *key1, void *key2) _key_equals(void *key1, void *key2)
{ {
gchar *str1 = (gchar *) key1; gchar *str1 = (gchar *) key1;
gchar *str2 = (gchar *) key2; gchar *str2 = (gchar *) key2;
@ -473,8 +469,7 @@ _datetimes_equal(GDateTime *dt1, GDateTime *dt2)
} }
static void static void
_replace_name(const char * const current_name, const char * const new_name, _replace_name(const char *const current_name, const char *const new_name, const char *const barejid)
const char * const barejid)
{ {
// current handle exists already // current handle exists already
if (current_name) { if (current_name) {
@ -490,7 +485,7 @@ _replace_name(const char * const current_name, const char * const new_name,
} }
static void 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) { if (name) {
autocomplete_add(name_ac, name); autocomplete_add(name_ac, name);
@ -501,8 +496,8 @@ _add_name_and_barejid(const char * const name, const char * const barejid)
} }
} }
static static gint
gint _compare_contacts(PContact a, PContact b) _compare_contacts(PContact a, PContact b)
{ {
const char * utf8_str_a = NULL; const char * utf8_str_a = NULL;
const char * utf8_str_b = NULL; const char * utf8_str_b = NULL;

View File

@ -41,32 +41,30 @@
#include "contact.h" #include "contact.h"
void roster_clear(void); void roster_clear(void);
gboolean roster_update_presence(const char * const barejid, Resource *resource, gboolean roster_update_presence(const char *const barejid, Resource *resource, GDateTime *last_activity);
GDateTime *last_activity); PContact roster_get_contact(const char *const barejid);
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_contact_offline(const char * const barejid,
const char * const resource, const char * const status);
void roster_reset_search_attempts(void); void roster_reset_search_attempts(void);
void roster_init(void); void roster_init(void);
void roster_free(void); void roster_free(void);
void roster_change_name(PContact contact, const char * const new_name); void roster_change_name(PContact contact, const char *const new_name);
void roster_remove(const char * const name, const char * const barejid); void roster_remove(const char *const name, const char *const barejid);
void roster_update(const char * const barejid, const char * const name, void roster_update(const char *const barejid, const char *const name, GSList *groups, const char *const subscription,
GSList *groups, const char * const subscription, gboolean pending_out); gboolean pending_out);
gboolean roster_add(const char * const barejid, const char * const name, GSList *groups, gboolean roster_add(const char *const barejid, const char *const name, GSList *groups, const char *const subscription,
const char * const subscription, gboolean pending_out); gboolean pending_out);
char * roster_barejid_from_name(const char * const name); char* roster_barejid_from_name(const char *const name);
GSList * roster_get_contacts(void); GSList* roster_get_contacts(void);
GSList * roster_get_contacts_online(void); GSList* roster_get_contacts_online(void);
gboolean roster_has_pending_subscriptions(void); gboolean roster_has_pending_subscriptions(void);
char * roster_contact_autocomplete(const char * const search_str); char* roster_contact_autocomplete(const char *const search_str);
char * roster_fulljid_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_group(const char *const group);
GSList * roster_get_groups(void); GSList* roster_get_groups(void);
char * roster_group_autocomplete(const char * const search_str); char* roster_group_autocomplete(const char *const search_str);
char * roster_barejid_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_contacts_by_presence(const char *const presence);
GSList * roster_get_nogroup(void); GSList* roster_get_nogroup(void);
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);
#endif #endif

View File

@ -46,7 +46,7 @@ struct autocomplete_t {
gchar *search_str; 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
autocomplete_new(void) autocomplete_new(void)
@ -118,7 +118,7 @@ autocomplete_add(Autocomplete ac, const char *item)
} }
void void
autocomplete_remove(Autocomplete ac, const char * const item) autocomplete_remove(Autocomplete ac, const char *const item)
{ {
if (ac) { if (ac) {
GSList *curr = g_slist_find_custom(ac->items, item, (GCompareFunc)strcmp); GSList *curr = g_slist_find_custom(ac->items, item, (GCompareFunc)strcmp);
@ -139,7 +139,7 @@ autocomplete_remove(Autocomplete ac, const char * const item)
return; return;
} }
GSList * GSList*
autocomplete_create_list(Autocomplete ac) autocomplete_create_list(Autocomplete ac)
{ {
GSList *copy = NULL; GSList *copy = NULL;
@ -168,7 +168,7 @@ autocomplete_contains(Autocomplete ac, const char *value)
return FALSE; return FALSE;
} }
gchar * gchar*
autocomplete_complete(Autocomplete ac, const gchar *search_str, gboolean quote) autocomplete_complete(Autocomplete ac, const gchar *search_str, gboolean quote)
{ {
gchar *found = NULL; gchar *found = NULL;
@ -215,8 +215,8 @@ autocomplete_complete(Autocomplete ac, const gchar *search_str, gboolean quote)
} }
} }
char * char*
autocomplete_param_with_func(const char * const input, char *command, autocomplete_func func) autocomplete_param_with_func(const char *const input, char *command, autocomplete_func func)
{ {
GString *auto_msg = NULL; GString *auto_msg = NULL;
char *result = NULL; char *result = NULL;
@ -246,8 +246,8 @@ autocomplete_param_with_func(const char * const input, char *command, autocomple
return result; return result;
} }
char * char*
autocomplete_param_with_ac(const char * const input, char *command, Autocomplete ac, gboolean quote) autocomplete_param_with_ac(const char *const input, char *command, Autocomplete ac, gboolean quote)
{ {
GString *auto_msg = NULL; GString *auto_msg = NULL;
char *result = NULL; char *result = NULL;
@ -277,8 +277,8 @@ autocomplete_param_with_ac(const char * const input, char *command, Autocomplete
return result; return result;
} }
char * char*
autocomplete_param_no_with_func(const char * const input, char *command, int arg_number, autocomplete_func func) 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))) { if (strncmp(input, command, strlen(command)) == 0 && (strlen(input) > strlen(command))) {
GString *result_str = NULL; GString *result_str = NULL;
@ -309,7 +309,7 @@ autocomplete_param_no_with_func(const char * const input, char *command, int arg
return NULL; return NULL;
} }
static gchar * static gchar*
_search_from(Autocomplete ac, GSList *curr, gboolean quote) _search_from(Autocomplete ac, GSList *curr, gboolean quote)
{ {
while(curr) { while(curr) {

View File

@ -37,7 +37,7 @@
#include <glib.h> #include <glib.h>
typedef char*(*autocomplete_func)(const char * const); typedef char* (*autocomplete_func)(const char *const);
typedef struct autocomplete_t *Autocomplete; typedef struct autocomplete_t *Autocomplete;
// allocate new autocompleter with no items // allocate new autocompleter with no items
@ -50,21 +50,21 @@ void autocomplete_clear(Autocomplete ac);
void autocomplete_free(Autocomplete ac); void autocomplete_free(Autocomplete ac);
void autocomplete_add(Autocomplete ac, const char *item); 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 // 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); 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); 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); 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); int arg_number, autocomplete_func func);
void autocomplete_reset(Autocomplete ac); void autocomplete_reset(Autocomplete ac);

View File

@ -61,8 +61,8 @@
* { "arg1", "arg2", NULL } * { "arg1", "arg2", NULL }
* *
*/ */
gchar ** gchar**
parse_args(const char * const inp, int min, int max, gboolean *result) parse_args(const char *const inp, int min, int max, gboolean *result)
{ {
if (inp == NULL) { if (inp == NULL) {
*result = FALSE; *result = FALSE;
@ -195,8 +195,8 @@ parse_args(const char * const inp, int min, int max, gboolean *result)
* { "arg1", "arg2", "some free text", NULL } * { "arg1", "arg2", "some free text", NULL }
* *
*/ */
gchar ** gchar**
parse_args_with_freetext(const char * const inp, int min, int max, gboolean *result) parse_args_with_freetext(const char *const inp, int min, int max, gboolean *result)
{ {
if (inp == NULL) { if (inp == NULL) {
*result = FALSE; *result = FALSE;
@ -316,7 +316,7 @@ parse_args_with_freetext(const char * const inp, int min, int max, gboolean *res
} }
int int
count_tokens(const char * const string) count_tokens(const char *const string)
{ {
int length = g_utf8_strlen(string, -1); int length = g_utf8_strlen(string, -1);
gboolean in_quotes = FALSE; gboolean in_quotes = FALSE;
@ -346,8 +346,8 @@ count_tokens(const char * const string)
return num_tokens; return num_tokens;
} }
char * char*
get_start(const char * const string, int tokens) get_start(const char *const string, int tokens)
{ {
GString *result = g_string_new(""); GString *result = g_string_new("");
int length = g_utf8_strlen(string, -1); int length = g_utf8_strlen(string, -1);
@ -388,7 +388,7 @@ get_start(const char * const string, int tokens)
return result_str; return result_str;
} }
GHashTable * GHashTable*
parse_options(gchar **args, gchar **opt_keys, gboolean *res) parse_options(gchar **args, gchar **opt_keys, gboolean *res)
{ {
GList *keys = NULL; GList *keys = NULL;

View File

@ -37,10 +37,10 @@
#include <glib.h> #include <glib.h>
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);
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);
int count_tokens(const char * const string); int count_tokens(const char *const string);
char* get_start(const char * const string, int tokens); char* get_start(const char *const string, int tokens);
GHashTable* parse_options(gchar **args, gchar **keys, gboolean *res); GHashTable* parse_options(gchar **args, gchar **keys, gboolean *res);
void options_destroy(GHashTable *options); void options_destroy(GHashTable *options);

View File

@ -54,7 +54,7 @@ tinyurl_valid(char *url)
g_str_has_prefix(url, "https://")); g_str_has_prefix(url, "https://"));
} }
char * char*
tinyurl_get(char *url) tinyurl_get(char *url)
{ {
GString *full_url = g_string_new("http://tinyurl.com/api-create.php?url="); GString *full_url = g_string_new("http://tinyurl.com/api-create.php?url=");

View File

@ -38,6 +38,6 @@
#include <glib.h> #include <glib.h>
gboolean tinyurl_valid(char *url); gboolean tinyurl_valid(char *url);
char * tinyurl_get(char *url); char* tinyurl_get(char *url);
#endif #endif

View File

@ -58,7 +58,7 @@ struct prof_buff_t {
static void _free_entry(ProfBuffEntry *entry); static void _free_entry(ProfBuffEntry *entry);
ProfBuff ProfBuff
buffer_create() buffer_create(void)
{ {
ProfBuff new_buff = malloc(sizeof(struct prof_buff_t)); ProfBuff new_buff = malloc(sizeof(struct prof_buff_t));
new_buff->entries = NULL; new_buff->entries = NULL;
@ -81,7 +81,7 @@ buffer_free(ProfBuff buffer)
void void
buffer_push(ProfBuff buffer, const char show_char, int pad_indent, GDateTime *time, 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)); ProfBuffEntry *e = malloc(sizeof(struct prof_buff_entry_t));
e->show_char = show_char; e->show_char = show_char;
@ -102,7 +102,7 @@ buffer_push(ProfBuff buffer, const char show_char, int pad_indent, GDateTime *ti
} }
gboolean gboolean
buffer_mark_received(ProfBuff buffer, const char * const id) buffer_mark_received(ProfBuff buffer, const char *const id)
{ {
GSList *entries = buffer->entries; GSList *entries = buffer->entries;
while (entries) { while (entries) {

View File

@ -61,10 +61,9 @@ typedef struct prof_buff_t *ProfBuff;
ProfBuff buffer_create(); ProfBuff buffer_create();
void buffer_free(ProfBuff buffer); 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, 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); int buffer_size(ProfBuff buffer);
ProfBuffEntry* buffer_yield_entry(ProfBuff buffer, int entry); 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 #endif

View File

@ -71,14 +71,14 @@ cons_show_time(void)
} }
void void
cons_show_word(const char * const word) cons_show_word(const char *const word)
{ {
ProfWin *console = wins_get_console(); ProfWin *console = wins_get_console();
win_print(console, '-', 0, NULL, NO_DATE | NO_EOL, 0, "", word); win_print(console, '-', 0, NULL, NO_DATE | NO_EOL, 0, "", word);
} }
void void
cons_debug(const char * const msg, ...) cons_debug(const char *const msg, ...)
{ {
ProfWin *console = wins_get_console(); ProfWin *console = wins_get_console();
if (strcmp(PACKAGE_STATUS, "development") == 0) { if (strcmp(PACKAGE_STATUS, "development") == 0) {
@ -93,7 +93,7 @@ cons_debug(const char * const msg, ...)
} }
void void
cons_show(const char * const msg, ...) cons_show(const char *const msg, ...)
{ {
ProfWin *console = wins_get_console(); ProfWin *console = wins_get_console();
va_list arg; va_list arg;
@ -106,7 +106,7 @@ cons_show(const char * const msg, ...)
} }
void void
cons_show_padded(int pad, const char * const msg, ...) cons_show_padded(int pad, const char *const msg, ...)
{ {
ProfWin *console = wins_get_console(); ProfWin *console = wins_get_console();
va_list arg; va_list arg;
@ -162,7 +162,7 @@ cons_show_help(Command *command)
} }
void void
cons_bad_cmd_usage(const char * const cmd) cons_bad_cmd_usage(const char *const cmd)
{ {
GString *msg = g_string_new(""); GString *msg = g_string_new("");
g_string_printf(msg, "Invalid usage, see '/help %s' for details.", &cmd[1]); 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 void
cons_show_error(const char * const msg, ...) cons_show_error(const char *const msg, ...)
{ {
ProfWin *console = wins_get_console(); ProfWin *console = wins_get_console();
va_list arg; va_list arg;
@ -189,7 +189,7 @@ cons_show_error(const char * const msg, ...)
} }
void void
cons_show_typing(const char * const barejid) cons_show_typing(const char *const barejid)
{ {
ProfWin *console = wins_get_console(); ProfWin *console = wins_get_console();
const char * display_usr = NULL; const char * display_usr = NULL;
@ -209,7 +209,7 @@ cons_show_typing(const char * const barejid)
} }
void 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(); ProfWin *console = wins_get_console();
@ -355,7 +355,7 @@ cons_show_info(PContact pcontact)
} }
void 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(); ProfWin *console = wins_get_console();
cons_show(""); cons_show("");
@ -466,7 +466,7 @@ cons_show_sent_subs(void)
} }
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(); ProfWin *console = wins_get_console();
if (rooms && (g_slist_length(rooms) > 0)) { if (rooms && (g_slist_length(rooms) > 0)) {
@ -574,7 +574,7 @@ cons_show_disco_info(const char *jid, GSList *identities, GSList *features)
} }
void 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(); ProfWin *console = wins_get_console();
if (items && (g_slist_length(items) > 0)) { if (items && (g_slist_length(items) > 0)) {
@ -598,7 +598,7 @@ cons_show_disco_items(GSList *items, const char * const jid)
} }
void void
cons_show_status(const char * const barejid) cons_show_status(const char *const barejid)
{ {
ProfWin *console = wins_get_console(); ProfWin *console = wins_get_console();
PContact pcontact = roster_get_contact(barejid); PContact pcontact = roster_get_contact(barejid);
@ -613,8 +613,8 @@ cons_show_status(const char * const barejid)
} }
void void
cons_show_room_invite(const char * const invitor, const char * const room, cons_show_room_invite(const char *const invitor, const char * const room,
const char * const reason) const char *const reason)
{ {
char *display_from = NULL; char *display_from = NULL;
PContact contact = roster_get_contact(invitor); PContact contact = roster_get_contact(invitor);
@ -1170,18 +1170,7 @@ cons_show_ui_prefs(void)
void void
cons_notify_setting(void) cons_notify_setting(void)
{ {
gboolean notify_enabled = FALSE; if (is_notify_enabled()) {
#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 (prefs_get_boolean(PREF_NOTIFY_MESSAGE)) if (prefs_get_boolean(PREF_NOTIFY_MESSAGE))
cons_show("Messages (/notify message) : ON"); cons_show("Messages (/notify message) : ON");
else else
@ -1684,7 +1673,7 @@ cons_navigation_help(void)
} }
void void
cons_show_roster_group(const char * const group, GSList *list) cons_show_roster_group(const char *const group, GSList *list)
{ {
cons_show(""); cons_show("");

View File

@ -89,7 +89,7 @@ static Display *display;
static GTimer *ui_idle_time; static GTimer *ui_idle_time;
//static void _win_handle_switch(const wint_t ch); //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); static void _ui_draw_term_title(void);
void void
@ -195,7 +195,7 @@ ui_close(void)
endwin(); endwin();
} }
char * char*
ui_readline(void) ui_readline(void)
{ {
return inp_readline(); return inp_readline();
@ -290,7 +290,7 @@ ui_xmlconsole_exists(void)
} }
void void
ui_handle_stanza(const char * const msg) ui_handle_stanza(const char *const msg)
{ {
if (ui_xmlconsole_exists()) { if (ui_xmlconsole_exists()) {
ProfXMLWin *xmlconsole = wins_get_xmlconsole(); ProfXMLWin *xmlconsole = wins_get_xmlconsole();
@ -309,7 +309,7 @@ ui_handle_stanza(const char * const msg)
} }
gboolean gboolean
ui_chat_win_exists(const char * const barejid) ui_chat_win_exists(const char *const barejid)
{ {
ProfChatWin *chatwin = wins_get_chat(barejid); ProfChatWin *chatwin = wins_get_chat(barejid);
return (chatwin != NULL); return (chatwin != NULL);
@ -352,7 +352,7 @@ ui_contact_online(char *barejid, Resource *resource, GDateTime *last_activity)
} }
void 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); ProfChatWin *chatwin = wins_get_chat(barejid);
ProfWin *window = (ProfWin*) chatwin; 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) ui_get_chat_recipients(void)
{ {
GSList *recipients = wins_get_chat_recipients(); GSList *recipients = wins_get_chat_recipients();
@ -402,7 +402,7 @@ ui_get_chat_recipients(void)
} }
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); ProfChatWin *chatwin = wins_get_chat(barejid);
if (chatwin) { if (chatwin) {
@ -412,7 +412,7 @@ ui_message_receipt(const char * const barejid, const char * const id)
} }
void 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; ProfWin *window = (ProfWin*)chatwin;
int num = wins_get_num(window); int num = wins_get_num(window);
@ -462,7 +462,7 @@ ui_incoming_msg(ProfChatWin *chatwin, const char * const resource, const char *
} }
void 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; char *display_from = NULL;
display_from = get_nick_from_full_jid(fulljid); 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 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) { if (name) {
cons_show("Roster item added: %s (%s)", barejid, 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 void
ui_roster_remove(const char * const barejid) ui_roster_remove(const char *const barejid)
{ {
cons_show("Roster item removed: %s", barejid); cons_show("Roster item removed: %s", barejid);
rosterwin_roster(); rosterwin_roster();
} }
void 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); cons_show("%s already in group %s", contact, group);
rosterwin_roster(); rosterwin_roster();
} }
void 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); cons_show("%s is not currently in group %s", contact, group);
rosterwin_roster(); rosterwin_roster();
} }
void 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); cons_show("%s added to group %s", contact, group);
rosterwin_roster(); rosterwin_roster();
} }
void 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); cons_show("%s removed from group %s", contact, group);
rosterwin_roster(); rosterwin_roster();
@ -577,7 +577,7 @@ ui_handle_login_account_success(ProfAccount *account, int secured)
void void
ui_update_presence(const resource_presence_t resource_presence, 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); contact_presence_t contact_presence = contact_presence_from_resource_presence(resource_presence);
title_bar_set_presence(contact_presence); title_bar_set_presence(contact_presence);
@ -590,7 +590,7 @@ ui_update_presence(const resource_presence_t resource_presence,
} }
void 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 // intended recipient was invalid chat room
ProfMucWin *mucwin = wins_get_muc(recipient); ProfMucWin *mucwin = wins_get_muc(recipient);
@ -602,7 +602,7 @@ ui_handle_recipient_not_found(const char * const recipient, const char * const e
} }
void 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 // always show in console
cons_show_error("Error from %s: %s", recipient, err_msg); 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 void
ui_handle_error(const char * const err_msg) ui_handle_error(const char *const err_msg)
{ {
GString *msg = g_string_new(""); GString *msg = g_string_new("");
g_string_printf(msg, "Error %s", err_msg); g_string_printf(msg, "Error %s", err_msg);
@ -638,7 +638,7 @@ ui_handle_error(const char * const err_msg)
} }
void 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(""); GString *msg = g_string_new("");
g_string_printf(msg, "Invalid usage, see '/help %s' for details.", &cmd[1]); g_string_printf(msg, "Invalid usage, see '/help %s' for details.", &cmd[1]);
@ -856,7 +856,7 @@ ui_switch_win(ProfWin *window)
} }
void void
ui_gone_secure(const char * const barejid, gboolean trusted) ui_gone_secure(const char *const barejid, gboolean trusted)
{ {
ProfWin *window = NULL; ProfWin *window = NULL;
@ -892,7 +892,7 @@ ui_gone_secure(const char * const barejid, gboolean trusted)
} }
void void
ui_gone_insecure(const char * const barejid) ui_gone_insecure(const char *const barejid)
{ {
ProfChatWin *chatwin = wins_get_chat(barejid); ProfChatWin *chatwin = wins_get_chat(barejid);
if (chatwin) { if (chatwin) {
@ -908,7 +908,7 @@ ui_gone_insecure(const char * const barejid)
} }
void void
ui_smp_recipient_initiated(const char * const barejid) ui_smp_recipient_initiated(const char *const barejid)
{ {
ProfChatWin *chatwin = wins_get_chat(barejid); ProfChatWin *chatwin = wins_get_chat(barejid);
if (chatwin) { if (chatwin) {
@ -917,7 +917,7 @@ ui_smp_recipient_initiated(const char * const barejid)
} }
void 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); ProfChatWin *chatwin = wins_get_chat(barejid);
if (chatwin) { if (chatwin) {
@ -928,7 +928,7 @@ ui_smp_recipient_initiated_q(const char * const barejid, const char *question)
} }
void void
ui_smp_unsuccessful_sender(const char * const barejid) ui_smp_unsuccessful_sender(const char *const barejid)
{ {
ProfChatWin *chatwin = wins_get_chat(barejid); ProfChatWin *chatwin = wins_get_chat(barejid);
if (chatwin) { if (chatwin) {
@ -937,7 +937,7 @@ ui_smp_unsuccessful_sender(const char * const barejid)
} }
void void
ui_smp_unsuccessful_receiver(const char * const barejid) ui_smp_unsuccessful_receiver(const char *const barejid)
{ {
ProfChatWin *chatwin = wins_get_chat(barejid); ProfChatWin *chatwin = wins_get_chat(barejid);
if (chatwin) { if (chatwin) {
@ -946,7 +946,7 @@ ui_smp_unsuccessful_receiver(const char * const barejid)
} }
void void
ui_smp_aborted(const char * const barejid) ui_smp_aborted(const char *const barejid)
{ {
ProfChatWin *chatwin = wins_get_chat(barejid); ProfChatWin *chatwin = wins_get_chat(barejid);
if (chatwin) { if (chatwin) {
@ -955,7 +955,7 @@ ui_smp_aborted(const char * const barejid)
} }
void void
ui_smp_successful(const char * const barejid) ui_smp_successful(const char *const barejid)
{ {
ProfChatWin *chatwin = wins_get_chat(barejid); ProfChatWin *chatwin = wins_get_chat(barejid);
if (chatwin) { if (chatwin) {
@ -964,7 +964,7 @@ ui_smp_successful(const char * const barejid)
} }
void void
ui_smp_answer_success(const char * const barejid) ui_smp_answer_success(const char *const barejid)
{ {
ProfChatWin *chatwin = wins_get_chat(barejid); ProfChatWin *chatwin = wins_get_chat(barejid);
if (chatwin) { if (chatwin) {
@ -973,7 +973,7 @@ ui_smp_answer_success(const char * const barejid)
} }
void void
ui_smp_answer_failure(const char * const barejid) ui_smp_answer_failure(const char *const barejid)
{ {
ProfChatWin *chatwin = wins_get_chat(barejid); ProfChatWin *chatwin = wins_get_chat(barejid);
if (chatwin) { if (chatwin) {
@ -982,7 +982,7 @@ ui_smp_answer_failure(const char * const barejid)
} }
void void
ui_otr_authenticating(const char * const barejid) ui_otr_authenticating(const char *const barejid)
{ {
ProfChatWin *chatwin = wins_get_chat(barejid); ProfChatWin *chatwin = wins_get_chat(barejid);
if (chatwin) { if (chatwin) {
@ -991,7 +991,7 @@ ui_otr_authenticating(const char * const barejid)
} }
void void
ui_otr_authetication_waiting(const char * const barejid) ui_otr_authetication_waiting(const char *const barejid)
{ {
ProfChatWin *chatwin = wins_get_chat(barejid); ProfChatWin *chatwin = wins_get_chat(barejid);
if (chatwin) { if (chatwin) {
@ -1000,7 +1000,7 @@ ui_otr_authetication_waiting(const char * const barejid)
} }
void 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); ProfChatWin *chatwin = wins_get_chat(barejid);
if (chatwin) { if (chatwin) {
@ -1011,7 +1011,7 @@ ui_handle_otr_error(const char * const barejid, const char * const message)
} }
void void
ui_trust(const char * const barejid) ui_trust(const char *const barejid)
{ {
ProfChatWin *chatwin = wins_get_chat(barejid); ProfChatWin *chatwin = wins_get_chat(barejid);
if (chatwin) { if (chatwin) {
@ -1027,7 +1027,7 @@ ui_trust(const char * const barejid)
} }
void void
ui_untrust(const char * const barejid) ui_untrust(const char *const barejid)
{ {
ProfChatWin *chatwin = wins_get_chat(barejid); ProfChatWin *chatwin = wins_get_chat(barejid);
if (chatwin) { if (chatwin) {
@ -1118,7 +1118,7 @@ ui_win_type(int index)
} }
void void
ui_current_print_line(const char * const msg, ...) ui_current_print_line(const char *const msg, ...)
{ {
ProfWin *window = wins_get_current(); ProfWin *window = wins_get_current();
va_list arg; va_list arg;
@ -1131,7 +1131,7 @@ ui_current_print_line(const char * const msg, ...)
} }
void 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(); ProfWin *current = wins_get_current();
va_list arg; va_list arg;
@ -1144,20 +1144,20 @@ ui_current_print_formatted_line(const char show_char, int attrs, const char * co
} }
void 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); win_print(window, '-', 0, NULL, 0, THEME_ERROR, "", msg);
} }
void void
ui_current_error_line(const char * const msg) ui_current_error_line(const char *const msg)
{ {
ProfWin *current = wins_get_current(); ProfWin *current = wins_get_current();
win_print(current, '-', 0, NULL, 0, THEME_ERROR, "", msg); win_print(current, '-', 0, NULL, 0, THEME_ERROR, "", msg);
} }
void 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) if (barejid == NULL || message == NULL)
return; return;
@ -1180,7 +1180,7 @@ ui_print_system_msg_from_recipient(const char * const barejid, const char *messa
} }
void 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) if (barejid == NULL)
return; return;
@ -1214,7 +1214,7 @@ ui_recipient_gone(const char * const barejid, const char * const resource)
} }
ProfPrivateWin* ProfPrivateWin*
ui_new_private_win(const char * const fulljid) ui_new_private_win(const char *const fulljid)
{ {
ProfWin *window = wins_new_private(fulljid); ProfWin *window = wins_new_private(fulljid);
return (ProfPrivateWin*)window; return (ProfPrivateWin*)window;
@ -1237,7 +1237,7 @@ ui_open_xmlconsole_win(void)
} }
ProfChatWin* ProfChatWin*
ui_new_chat_win(const char * const barejid) ui_new_chat_win(const char *const barejid)
{ {
ProfWin *window = wins_new_chat(barejid); ProfWin *window = wins_new_chat(barejid);
ProfChatWin *chatwin = (ProfChatWin *)window; ProfChatWin *chatwin = (ProfChatWin *)window;
@ -1260,7 +1260,7 @@ ui_new_chat_win(const char * const barejid)
} }
void 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 = '-'; char enc_char = '-';
if (enc_mode == PROF_MSG_OTR) { if (enc_mode == PROF_MSG_OTR) {
@ -1277,7 +1277,7 @@ ui_outgoing_chat_msg(ProfChatWin *chatwin, const char * const message, char *id,
} }
void 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); ProfChatWin *chatwin = wins_get_chat(barejid);
@ -1295,13 +1295,13 @@ ui_outgoing_chat_msg_carbon(const char * const barejid, const char * const messa
} }
void 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); win_print((ProfWin*)privwin, '-', 0, NULL, 0, THEME_TEXT_ME, "me", message);
} }
void 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); ProfWin *window = (ProfWin*)wins_get_muc(roomjid);
if (!window) { if (!window) {
@ -1335,15 +1335,15 @@ ui_room_join(const char * const roomjid, gboolean focus)
} }
void void
ui_switch_to_room(const char * const roomjid) ui_switch_to_room(const char *const roomjid)
{ {
ProfWin *window = (ProfWin*)wins_get_muc(roomjid); ProfWin *window = (ProfWin*)wins_get_muc(roomjid);
ui_ev_focus_win(window); ui_ev_focus_win(window);
} }
void void
ui_room_role_change(const char * const roomjid, const char * const role, const char * const actor, ui_room_role_change(const char *const roomjid, const char *const role, const char *const actor,
const char * const reason) const char *const reason)
{ {
ProfWin *window = (ProfWin*)wins_get_muc(roomjid); ProfWin *window = (ProfWin*)wins_get_muc(roomjid);
win_vprint(window, '!', 0, NULL, NO_EOL, THEME_ROOMINFO, "", "Your role has been changed to: %s", role); 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 void
ui_room_affiliation_change(const char * const roomjid, const char * const affiliation, const char * const actor, ui_room_affiliation_change(const char *const roomjid, const char *const affiliation, const char *const actor,
const char * const reason) const char *const reason)
{ {
ProfWin *window = (ProfWin*)wins_get_muc(roomjid); ProfWin *window = (ProfWin*)wins_get_muc(roomjid);
win_vprint(window, '!', 0, NULL, NO_EOL, THEME_ROOMINFO, "", "Your affiliation has been changed to: %s", affiliation); 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 void
ui_room_role_and_affiliation_change(const char * const roomjid, const char * const role, const char * const affiliation, 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) const char *const actor, const char *const reason)
{ {
ProfWin *window = (ProfWin*)wins_get_muc(roomjid); 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); 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 void
ui_room_occupant_role_change(const char * const roomjid, const char * const nick, const char * const role, 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) const char *const actor, const char *const reason)
{ {
ProfWin *window = (ProfWin*)wins_get_muc(roomjid); 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); 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 void
ui_room_occupant_affiliation_change(const char * const roomjid, const char * const nick, const char * const affiliation, 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) const char *const actor, const char *const reason)
{ {
ProfWin *window = (ProfWin*)wins_get_muc(roomjid); 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); 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 void
ui_room_occupant_role_and_affiliation_change(const char * const roomjid, const char * const nick, const char * const role, 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) const char *const affiliation, const char *const actor, const char *const reason)
{ {
ProfWin *window = (ProfWin*)wins_get_muc(roomjid); 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); 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 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); ProfWin *window = (ProfWin*)wins_get_muc(roomjid);
if (window) { if (window) {
@ -1443,7 +1443,7 @@ ui_handle_room_info_error(const char * const roomjid, const char * const error)
} }
void 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); ProfWin *window = (ProfWin*)wins_get_muc(roomjid);
if (window) { if (window) {
@ -1484,7 +1484,7 @@ ui_show_room_disco_info(const char * const roomjid, GSList *identities, GSList *
} }
void 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); ProfWin *window = (ProfWin*)wins_get_muc(roomjid);
if (window == NULL) { if (window == NULL) {
@ -1524,13 +1524,13 @@ ui_room_roster(const char * const roomjid, GList *roster, const char * const pre
} }
void 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); cons_show_error("Error joining room %s, reason: %s", roomjid, err);
} }
void 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); ProfWin *window = (ProfWin*)wins_get_muc(roomjid);
if (window == NULL) { if (window == NULL) {
@ -1541,8 +1541,8 @@ ui_room_member_offline(const char * const roomjid, const char * const nick)
} }
void void
ui_room_member_kicked(const char * const roomjid, const char * const nick, const char * const actor, ui_room_member_kicked(const char *const roomjid, const char *const nick, const char *const actor,
const char * const reason) const char *const reason)
{ {
ProfWin *window = (ProfWin*)wins_get_muc(roomjid); ProfWin *window = (ProfWin*)wins_get_muc(roomjid);
if (window == NULL) { if (window == NULL) {
@ -1565,8 +1565,8 @@ ui_room_member_kicked(const char * const roomjid, const char * const nick, const
} }
void void
ui_room_member_banned(const char * const roomjid, const char * const nick, const char * const actor, ui_room_member_banned(const char *const roomjid, const char *const nick, const char *const actor,
const char * const reason) const char *const reason)
{ {
ProfWin *window = (ProfWin*)wins_get_muc(roomjid); ProfWin *window = (ProfWin*)wins_get_muc(roomjid);
if (window == NULL) { if (window == NULL) {
@ -1589,8 +1589,8 @@ ui_room_member_banned(const char * const roomjid, const char * const nick, const
} }
void void
ui_room_member_online(const char * const roomjid, const char * const nick, const char * const role, 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) const char *const affiliation, const char *const show, const char *const status)
{ {
ProfWin *window = (ProfWin*)wins_get_muc(roomjid); ProfWin *window = (ProfWin*)wins_get_muc(roomjid);
if (window == NULL) { if (window == NULL) {
@ -1610,8 +1610,8 @@ ui_room_member_online(const char * const roomjid, const char * const nick, const
} }
void void
ui_room_member_presence(const char * const roomjid, const char * const nick, ui_room_member_presence(const char *const roomjid, const char *const nick,
const char * const show, const char * const status) const char *const show, const char *const status)
{ {
ProfWin *window = (ProfWin*)wins_get_muc(roomjid); ProfWin *window = (ProfWin*)wins_get_muc(roomjid);
if (window == NULL) { if (window == NULL) {
@ -1622,8 +1622,8 @@ ui_room_member_presence(const char * const roomjid, const char * const nick,
} }
void void
ui_room_member_nick_change(const char * const roomjid, ui_room_member_nick_change(const char *const roomjid,
const char * const old_nick, const char * const nick) const char *const old_nick, const char *const nick)
{ {
ProfWin *window = (ProfWin*)wins_get_muc(roomjid); ProfWin *window = (ProfWin*)wins_get_muc(roomjid);
if (window == NULL) { if (window == NULL) {
@ -1634,7 +1634,7 @@ ui_room_member_nick_change(const char * const roomjid,
} }
void 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); ProfWin *window = (ProfWin*)wins_get_muc(roomjid);
if (window == NULL) { if (window == NULL) {
@ -1645,8 +1645,8 @@ ui_room_nick_change(const char * const roomjid, const char * const nick)
} }
void void
ui_room_history(const char * const roomjid, const char * const nick, ui_room_history(const char *const roomjid, const char *const nick,
GDateTime *timestamp, const char * const message) GDateTime *timestamp, const char *const message)
{ {
ProfWin *window = (ProfWin*)wins_get_muc(roomjid); ProfWin *window = (ProfWin*)wins_get_muc(roomjid);
if (window == NULL) { if (window == NULL) {
@ -1671,8 +1671,8 @@ ui_room_history(const char * const roomjid, const char * const nick,
} }
void void
ui_room_message(const char * const roomjid, const char * const nick, ui_room_message(const char *const roomjid, const char *const nick,
const char * const message) const char *const message)
{ {
ProfMucWin *mucwin = wins_get_muc(roomjid); ProfMucWin *mucwin = wins_get_muc(roomjid);
if (mucwin == NULL) { if (mucwin == NULL) {
@ -1755,7 +1755,7 @@ ui_room_message(const char * const roomjid, const char * const nick,
} }
void void
ui_room_requires_config(const char * const roomjid) ui_room_requires_config(const char *const roomjid)
{ {
ProfWin *window = (ProfWin*)wins_get_muc(roomjid); ProfWin *window = (ProfWin*)wins_get_muc(roomjid);
if (window == NULL) { if (window == NULL) {
@ -1790,7 +1790,7 @@ ui_room_requires_config(const char * const roomjid)
} }
void void
ui_room_destroy(const char * const roomjid) ui_room_destroy(const char *const roomjid)
{ {
ProfWin *window = (ProfWin*)wins_get_muc(roomjid); ProfWin *window = (ProfWin*)wins_get_muc(roomjid);
if (window == NULL) { if (window == NULL) {
@ -1803,7 +1803,7 @@ ui_room_destroy(const char * const roomjid)
} }
void void
ui_leave_room(const char * const roomjid) ui_leave_room(const char *const roomjid)
{ {
ProfWin *window = (ProfWin*)wins_get_muc(roomjid); ProfWin *window = (ProfWin*)wins_get_muc(roomjid);
if (window) { if (window) {
@ -1813,8 +1813,8 @@ ui_leave_room(const char * const roomjid)
} }
void void
ui_room_destroyed(const char * const roomjid, const char * const reason, const char * const new_jid, ui_room_destroyed(const char *const roomjid, const char *const reason, const char *const new_jid,
const char * const password) const char *const password)
{ {
ProfWin *window = (ProfWin*)wins_get_muc(roomjid); ProfWin *window = (ProfWin*)wins_get_muc(roomjid);
if (window == NULL) { if (window == NULL) {
@ -1841,7 +1841,7 @@ ui_room_destroyed(const char * const roomjid, const char * const reason, const c
} }
void 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); ProfWin *window = (ProfWin*)wins_get_muc(roomjid);
if (window == NULL) { if (window == NULL) {
@ -1868,7 +1868,7 @@ ui_room_kicked(const char * const roomjid, const char * const actor, const char
} }
void 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); ProfWin *window = (ProfWin*)wins_get_muc(roomjid);
if (window == NULL) { if (window == NULL) {
@ -1895,7 +1895,7 @@ ui_room_banned(const char * const roomjid, const char * const actor, const char
} }
void 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); ProfWin *window = (ProfWin*)wins_get_muc(roomjid);
if (window == NULL) { if (window == NULL) {
@ -1931,7 +1931,7 @@ ui_room_subject(const char * const roomjid, const char * const nick, const char
} }
void 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); ProfWin *window = (ProfWin*)wins_get_muc(roomjid);
if (window == NULL) { if (window == NULL) {
@ -1942,7 +1942,7 @@ ui_handle_room_kick_error(const char * const roomjid, const char * const nick, c
} }
void 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); ProfWin *window = (ProfWin*)wins_get_muc(roomjid);
if (window == NULL) { if (window == NULL) {
@ -1965,8 +1965,8 @@ ui_room_broadcast(const char * const roomjid, const char * const message)
} }
void void
ui_handle_room_affiliation_list_error(const char * const roomjid, const char * const affiliation, ui_handle_room_affiliation_list_error(const char *const roomjid, const char *const affiliation,
const char * const error) const char *const error)
{ {
ProfWin *window = (ProfWin*)wins_get_muc(roomjid); ProfWin *window = (ProfWin*)wins_get_muc(roomjid);
if (window) { if (window) {
@ -1975,7 +1975,7 @@ ui_handle_room_affiliation_list_error(const char * const roomjid, const char * c
} }
void 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); ProfWin *window = (ProfWin*)wins_get_muc(roomjid);
if (window) { if (window) {
@ -1996,7 +1996,7 @@ ui_handle_room_affiliation_list(const char * const roomjid, const char * const a
} }
void 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); ProfWin *window = (ProfWin*)wins_get_muc(roomjid);
if (window) { if (window) {
@ -2005,7 +2005,7 @@ ui_handle_room_role_list_error(const char * const roomjid, const char * const ro
} }
void 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); ProfWin *window = (ProfWin*)wins_get_muc(roomjid);
if (window) { if (window) {
@ -2035,8 +2035,8 @@ ui_handle_room_role_list(const char * const roomjid, const char * const role, GS
} }
void void
ui_handle_room_affiliation_set_error(const char * const roomjid, const char * const jid, const char * const affiliation, ui_handle_room_affiliation_set_error(const char *const roomjid, const char *const jid, const char *const affiliation,
const char * const error) const char *const error)
{ {
ProfWin *window = (ProfWin*)wins_get_muc(roomjid); ProfWin *window = (ProfWin*)wins_get_muc(roomjid);
if (window) { if (window) {
@ -2045,8 +2045,8 @@ ui_handle_room_affiliation_set_error(const char * const roomjid, const char * co
} }
void void
ui_handle_room_role_set_error(const char * const roomjid, const char * const nick, const char * const role, ui_handle_room_role_set_error(const char *const roomjid, const char *const nick, const char *const role,
const char * const error) const char *const error)
{ {
ProfWin *window = (ProfWin*)wins_get_muc(roomjid); ProfWin *window = (ProfWin*)wins_get_muc(roomjid);
if (window) { if (window) {
@ -2071,7 +2071,7 @@ ui_win_unread(int index)
} }
} }
char * char*
ui_ask_password(void) ui_ask_password(void)
{ {
status_bar_get_password(); status_bar_get_password();
@ -2079,14 +2079,14 @@ ui_ask_password(void)
return inp_get_password(); return inp_get_password();
} }
char * char*
ui_get_line(void) ui_get_line(void)
{ {
status_bar_update_virtual(); status_bar_update_virtual();
return inp_get_line(); return inp_get_line();
} }
char * char*
ui_ask_pgp_passphrase(const char *hint, int prev_fail) ui_ask_pgp_passphrase(const char *hint, int prev_fail)
{ {
ProfWin *current = wins_get_current(); ProfWin *current = wins_get_current();
@ -2543,7 +2543,7 @@ ui_show_form_field(ProfWin *window, DataForm *form, char *tag)
} }
void 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); ProfWin *window = wins_new_muc_config(roomjid, form);
ProfMucConfWin *confwin = (ProfMucConfWin*)window; ProfMucConfWin *confwin = (ProfMucConfWin*)window;
@ -2560,7 +2560,7 @@ ui_handle_room_configuration(const char * const roomjid, DataForm *form)
} }
void 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; ProfWin *window = NULL;
GString *message_str = g_string_new(""); GString *message_str = g_string_new("");
@ -2584,14 +2584,11 @@ ui_handle_room_configuration_form_error(const char * const roomjid, const char *
} }
void 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) { 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); GString *form_recipient = g_string_new(roomjid);
g_string_append(form_recipient, " config"); 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); g_string_free(form_recipient, TRUE);
if (form_window) { if (form_window) {
num = wins_get_num(form_window); int num = wins_get_num(form_window);
wins_close_by_num(num); wins_close_by_num(num);
} }
@ -2617,13 +2614,12 @@ ui_handle_room_config_submit_result(const char * const roomjid)
} }
void 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 *console = wins_get_console();
if (roomjid) {
ProfWin *muc_window = NULL; ProfWin *muc_window = NULL;
ProfWin *form_window = NULL; ProfWin *form_window = NULL;
if (roomjid) {
muc_window = (ProfWin*)wins_get_muc(roomjid); muc_window = (ProfWin*)wins_get_muc(roomjid);
GString *form_recipient = g_string_new(roomjid); GString *form_recipient = g_string_new(roomjid);
@ -2759,7 +2755,7 @@ ui_show_lines(ProfWin *window, const gchar** lines)
} }
void void
ui_room_update_occupants(const char * const roomjid) ui_room_update_occupants(const char *const roomjid)
{ {
ProfWin *window = (ProfWin*)wins_get_muc(roomjid); ProfWin *window = (ProfWin*)wins_get_muc(roomjid);
if (window && win_has_active_subwin(window)) { if (window && win_has_active_subwin(window)) {
@ -2768,7 +2764,7 @@ ui_room_update_occupants(const char * const roomjid)
} }
void void
ui_room_show_occupants(const char * const roomjid) ui_room_show_occupants(const char *const roomjid)
{ {
ProfWin *window = (ProfWin*)wins_get_muc(roomjid); ProfWin *window = (ProfWin*)wins_get_muc(roomjid);
if (window && !win_has_active_subwin(window)) { if (window && !win_has_active_subwin(window)) {
@ -2778,7 +2774,7 @@ ui_room_show_occupants(const char * const roomjid)
} }
void void
ui_room_hide_occupants(const char * const roomjid) ui_room_hide_occupants(const char *const roomjid)
{ {
ProfWin *window = (ProfWin*)wins_get_muc(roomjid); ProfWin *window = (ProfWin*)wins_get_muc(roomjid);
if (window && win_has_active_subwin(window)) { if (window && win_has_active_subwin(window)) {
@ -2806,7 +2802,7 @@ ui_hide_roster(void)
} }
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(""); GString *message_str = g_string_new("");
@ -2824,8 +2820,8 @@ ui_handle_software_version_error(const char * const roomjid, const char * const
} }
void void
ui_show_software_version(const char * const jid, const char * const presence, ui_show_software_version(const char *const jid, const char *const presence,
const char * const name, const char * const version, const char * const os) const char *const name, const char *const version, const char *const os)
{ {
Jid *jidp = jid_create(jid); Jid *jidp = jid_create(jid);
ProfWin *window = NULL; ProfWin *window = NULL;
@ -2875,7 +2871,7 @@ ui_show_software_version(const char * const jid, const char * const presence,
} }
static void static void
_win_show_history(ProfChatWin *chatwin, const char * const contact) _win_show_history(ProfChatWin *chatwin, const char *const contact)
{ {
if (!chatwin->history_shown) { if (!chatwin->history_shown) {
Jid *jid = jid_create(jabber_get_fulljid()); 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); g_slist_free_full(history, free);
} }
} }

View File

@ -129,7 +129,7 @@ create_input_window(void)
_inp_win_update_virtual(); _inp_win_update_virtual();
} }
char * char*
inp_readline(void) inp_readline(void)
{ {
free(inp_line); free(inp_line);
@ -225,7 +225,7 @@ inp_close(void)
rl_callback_handler_remove(); rl_callback_handler_remove();
} }
char * char*
inp_get_line(void) inp_get_line(void)
{ {
werase(inp_win); werase(inp_win);

View File

@ -47,6 +47,6 @@ void inp_win_clear(void);
void inp_win_resize(void); void inp_win_resize(void);
void inp_put_back(void); void inp_put_back(void);
char* inp_get_password(void); char* inp_get_password(void);
char * inp_get_line(void); char* inp_get_line(void);
#endif #endif

View File

@ -51,7 +51,7 @@
#include "window_list.h" #include "window_list.h"
#include "config/preferences.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; static GTimer *remind_timer;
@ -73,7 +73,7 @@ notifier_uninit(void)
} }
void void
notify_typing(const char * const handle) notify_typing(const char *const handle)
{ {
char message[strlen(handle) + 1 + 11]; char message[strlen(handle) + 1 + 11];
sprintf(message, "%s: typing...", handle); sprintf(message, "%s: typing...", handle);
@ -82,8 +82,8 @@ notify_typing(const char * const handle)
} }
void void
notify_invite(const char * const from, const char * const room, notify_invite(const char *const from, const char *const room,
const char * const reason) const char *const reason)
{ {
GString *message = g_string_new("Room invite\nfrom: "); GString *message = g_string_new("Room invite\nfrom: ");
g_string_append(message, from); g_string_append(message, from);
@ -99,7 +99,7 @@ notify_invite(const char * const from, const char * const room,
} }
void 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); int num = wins_get_num(window);
if (num == 10) { if (num == 10) {
@ -121,7 +121,7 @@ notify_message(ProfWin *window, const char * const name, const char * const text
} }
void 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(""); GString *message = g_string_new("");
g_string_append_printf(message, "%s in %s (win %d)", handle, room, win); 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 void
notify_subscription(const char * const from) notify_subscription(const char *const from)
{ {
GString *message = g_string_new("Subscription request: \n"); GString *message = g_string_new("Subscription request: \n");
g_string_append(message, from); g_string_append(message, from);
@ -195,8 +195,7 @@ notify_remind(void)
} }
static void static void
_notify(const char * const message, int timeout, _notify(const char *const message, int timeout, const char *const category)
const char * const category)
{ {
#ifdef HAVE_LIBNOTIFY #ifdef HAVE_LIBNOTIFY
log_debug("Attempting notification: %s", message); log_debug("Attempting notification: %s", message);

View File

@ -62,7 +62,7 @@ _occuptantswin_occupant(ProfLayoutSplit *layout, Occupant *occupant, gboolean sh
} }
void void
occupantswin_occupants(const char * const roomjid) occupantswin_occupants(const char *const roomjid)
{ {
ProfMucWin *mucwin = wins_get_muc(roomjid); ProfMucWin *mucwin = wins_get_muc(roomjid);
if (mucwin) { if (mucwin) {

View File

@ -82,7 +82,7 @@ _rosterwin_contact(ProfLayoutSplit *layout, PContact contact)
} }
static void 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); GSList *contacts = roster_get_contacts_by_presence(presence);

View File

@ -304,7 +304,7 @@ status_bar_get_password(void)
} }
void void
status_bar_print_message(const char * const msg) status_bar_print_message(const char *const msg)
{ {
werase(status_bar); werase(status_bar);

View File

@ -41,7 +41,7 @@ void status_bar_resize(void);
void status_bar_clear(void); void status_bar_clear(void);
void status_bar_clear_message(void); void status_bar_clear_message(void);
void status_bar_get_password(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); void status_bar_current(int i);
#endif #endif

View File

@ -62,146 +62,146 @@ GSList* ui_get_chat_recipients(void);
void ui_switch_win(ProfWin *window); void ui_switch_win(ProfWin *window);
void ui_sigwinch_handler(int sig); void ui_sigwinch_handler(int sig);
void ui_gone_secure(const char * const barejid, gboolean trusted); void ui_gone_secure(const char *const barejid, gboolean trusted);
void ui_gone_insecure(const char * const barejid); void ui_gone_insecure(const char *const barejid);
void ui_trust(const char * const barejid); void ui_trust(const char *const barejid);
void ui_untrust(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(const char *const barejid);
void ui_smp_recipient_initiated_q(const char * const barejid, const char *question); void ui_smp_recipient_initiated_q(const char *const barejid, const char *question);
void ui_smp_successful(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_sender(const char *const barejid);
void ui_smp_unsuccessful_receiver(const char * const barejid); void ui_smp_unsuccessful_receiver(const char *const barejid);
void ui_smp_aborted(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_success(const char *const barejid);
void ui_smp_answer_failure(const char * const barejid); void ui_smp_answer_failure(const char *const barejid);
void ui_otr_authenticating(const char * const barejid); void ui_otr_authenticating(const char *const barejid);
void ui_otr_authetication_waiting(const char * const recipient); 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); unsigned long ui_get_idle_time(void);
void ui_reset_idle_time(void); void ui_reset_idle_time(void);
ProfPrivateWin* ui_new_private_win(const char * const fulljid); ProfPrivateWin* ui_new_private_win(const char *const fulljid);
ProfChatWin* ui_new_chat_win(const char * const barejid); ProfChatWin* ui_new_chat_win(const char *const barejid);
void ui_print_system_msg_from_recipient(const char * const barejid, const char *message); void ui_print_system_msg_from_recipient(const char *const barejid, const char *message);
gint ui_unread(void); gint ui_unread(void);
void ui_close_connected_win(int index); void ui_close_connected_win(int index);
int ui_close_all_wins(void); int ui_close_all_wins(void);
int ui_close_read_wins(void); int ui_close_read_wins(void);
// current window actions // current window actions
void ui_current_print_line(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_print_formatted_line(const char show_char, int attrs, const char *const msg, ...);
void ui_current_error_line(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_win_error_line(ProfWin *window, const char *const msg);
win_type_t ui_win_type(int index); win_type_t ui_win_type(int index);
void ui_close_win(int index); void ui_close_win(int index);
int ui_win_unread(int index); int ui_win_unread(int index);
char * ui_ask_password(void); char* ui_ask_password(void);
char * ui_get_line(void); char* ui_get_line(void);
char * ui_ask_pgp_passphrase(const char *hint, int prev_fail); 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 // ui events
void ui_contact_online(char *barejid, Resource *resource, GDateTime *last_activity); 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_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_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_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_message_receipt(const char *const barejid, const char *const id);
void ui_disconnected(void); 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(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_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_private_msg(ProfPrivateWin *privwin, const char *const message);
void ui_room_join(const char * const roomjid, gboolean focus); void ui_room_join(const char *const roomjid, gboolean focus);
void ui_switch_to_room(const char * const roomjid); 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, void ui_room_role_change(const char *const roomjid, const char *const role, const char *const actor,
const char * const reason); const char *const reason);
void ui_room_affiliation_change(const char * const roomjid, const char * const affiliation, const char * const actor, void ui_room_affiliation_change(const char *const roomjid, const char *const affiliation, const char *const actor,
const char * const reason); const char *const reason);
void ui_room_role_and_affiliation_change(const char * const roomjid, const char * const role, 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); 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, 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); 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, 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); 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, 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); 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_roster(const char *const roomjid, GList *occupants, const char *const presence);
void ui_room_history(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); GDateTime *timestamp, const char *const message);
void ui_room_message(const char * const roomjid, const char * const nick, void ui_room_message(const char *const roomjid, const char *const nick,
const char * const message); const char *const message);
void ui_room_subject(const char * const roomjid, const char * const nick, const char * const subject); 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_requires_config(const char *const roomjid);
void ui_room_destroy(const char * const roomjid); void ui_room_destroy(const char *const roomjid);
void ui_show_room_info(ProfMucWin *mucwin); void ui_show_room_info(ProfMucWin *mucwin);
void ui_show_room_role_list(ProfMucWin *mucwin, muc_role_t role); 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_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_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_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, void ui_room_destroyed(const char *const roomjid, const char *const reason, const char *const new_jid,
const char * const password); const char *const password);
void ui_room_kicked(const char * const roomjid, const char * const actor, const char * const reason); 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, void ui_room_member_kicked(const char *const roomjid, const char *const nick, const char *const actor,
const char * const reason); const char *const reason);
void ui_room_banned(const char * const roomjid, 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, void ui_room_member_banned(const char *const roomjid, const char *const nick, const char *const actor,
const char * const reason); const char *const reason);
void ui_leave_room(const char * const roomjid); void ui_leave_room(const char *const roomjid);
void ui_room_broadcast(const char * const roomjid, void ui_room_broadcast(const char *const roomjid,
const char * const message); const char *const message);
void ui_room_member_offline(const char * const roomjid, const char * const nick); 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, 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); const char *const affiliation, const char *const show, const char *const status);
void ui_room_member_nick_change(const char * const roomjid, void ui_room_member_nick_change(const char *const roomjid,
const char * const old_nick, const char * const nick); 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_nick_change(const char *const roomjid, const char *const nick);
void ui_room_member_presence(const char * const roomjid, void ui_room_member_presence(const char *const roomjid,
const char * const nick, const char * const show, const char * const status); const char *const nick, const char *const show, const char *const status);
void ui_room_update_occupants(const char * const roomjid); void ui_room_update_occupants(const char *const roomjid);
void ui_room_show_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_room_hide_occupants(const char *const roomjid);
void ui_show_roster(void); void ui_show_roster(void);
void ui_hide_roster(void); void ui_hide_roster(void);
void ui_roster_add(const char * const barejid, const char * const name); void ui_roster_add(const char *const barejid, const char *const name);
void ui_roster_remove(const char * const barejid); 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_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_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_added(const char *const contact, const char *const group);
void ui_group_removed(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_online(PContact contact, Resource *resource, GDateTime *last_activity);
void ui_chat_win_contact_offline(PContact contact, char *resource, char *status); void ui_chat_win_contact_offline(PContact contact, char *resource, char *status);
void ui_contact_offline(char *barejid, 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_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_recipient_error(const char *const recipient, const char *const err_msg);
void ui_handle_error(const char * const err_msg); void ui_handle_error(const char *const err_msg);
void ui_clear_win_title(void); void ui_clear_win_title(void);
void ui_goodbye_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_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(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_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(const char *const roomjid);
void ui_handle_room_config_submit_result_error(const char * const roomjid, const char * const message); 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, void ui_handle_room_affiliation_list_error(const char *const roomjid, const char *const affiliation,
const char * const error); 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_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, void ui_handle_room_affiliation_set_error(const char *const roomjid, const char *const jid,
const char * const affiliation, const char * const error); 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, void ui_handle_room_role_set_error(const char *const roomjid, const char *const nick, const char *const role,
const char * const error); 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_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_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_kick_error(const char *const roomjid, const char *const nick, const char *const error);
void ui_show_form(ProfMucConfWin *confwin); void ui_show_form(ProfMucConfWin *confwin);
void ui_show_form_field(ProfWin *window, DataForm *form, char *tag); void ui_show_form_field(ProfWin *window, DataForm *form, char *tag);
void ui_show_form_help(ProfMucConfWin *confwin); 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_redraw_all_room_rosters(void);
void ui_show_all_room_rosters(void); void ui_show_all_room_rosters(void);
void ui_hide_all_room_rosters(void); void ui_hide_all_room_rosters(void);
gboolean ui_chat_win_exists(const char * const barejid); 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_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, 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); const char *const name, const char *const version, const char *const os);
gboolean ui_tidy_wins(void); gboolean ui_tidy_wins(void);
void ui_prune_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_titlebar_presence(contact_presence_t presence);
void ui_handle_login_account_success(ProfAccount *account, int secured); void ui_handle_login_account_success(ProfAccount *account, int secured);
void ui_update_presence(const resource_presence_t resource_presence, 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_about(void);
void ui_statusbar_new(const int win); void ui_statusbar_new(const int win);
@ -238,7 +238,7 @@ void ui_input_clear(void);
void ui_input_nonblocking(gboolean); void ui_input_nonblocking(gboolean);
void ui_write(char *line, int offset); 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); void ui_create_xmlconsole_win(void);
gboolean ui_xmlconsole_exists(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); void ui_inp_history_append(char *inp);
// console window actions // console window actions
void cons_show(const char * const msg, ...); void cons_show(const char *const msg, ...);
void cons_show_padded(int pad, const char * const msg, ...); void cons_show_padded(int pad, const char *const msg, ...);
void cons_about(void); void cons_about(void);
void cons_help(void); void cons_help(void);
void cons_show_help(Command *command); 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_navigation_help(void);
void cons_prefs(void); void cons_prefs(void);
void cons_show_ui_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_otr_prefs(void);
void cons_show_pgp_prefs(void); void cons_show_pgp_prefs(void);
void cons_show_account(ProfAccount *account); 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_time(void);
void cons_show_word(const char * const word); void cons_show_word(const char *const word);
void cons_show_error(const char * const cmd, ...); void cons_show_error(const char *const cmd, ...);
void cons_show_contacts(GSList * list); void cons_show_contacts(GSList *list);
void cons_show_roster(GSList * list); void cons_show_roster(GSList *list);
void cons_show_roster_group(const char * const group, GSList * list); void cons_show_roster_group(const char *const group, GSList *list);
void cons_show_wins(void); 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_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_themes(GSList *themes);
void cons_show_scripts(GSList *scripts); void cons_show_scripts(GSList *scripts);
void cons_show_script(const char *const script, GSList *commands); void cons_show_script(const char *const script, GSList *commands);
void cons_show_aliases(GList *aliases); void cons_show_aliases(GList *aliases);
void cons_show_login_success(ProfAccount *account, int secured); void cons_show_login_success(ProfAccount *account, int secured);
void cons_show_software_version(const char * const jid, void cons_show_software_version(const char *const jid,
const char * const presence, const char * const name, const char *const presence, const char *const name,
const char * const version, const char * const os); const char *const version, const char *const os);
void cons_show_account_list(gchar **accounts); 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_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_disco_info(const char *from, GSList *identities, GSList *features);
void cons_show_room_invite(const char * const invitor, const char * const room, void cons_show_room_invite(const char *const invitor, const char *const room,
const char * const reason); const char *const reason);
void cons_check_version(gboolean not_available_msg); void cons_check_version(gboolean not_available_msg);
void cons_show_typing(const char * const barejid); 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_incoming_message(const char *const short_from, const int win_index);
void cons_show_room_invites(GSList *invites); void cons_show_room_invites(GSList *invites);
void cons_show_received_subs(void); void cons_show_received_subs(void);
void cons_show_sent_subs(void); void cons_show_sent_subs(void);
@ -348,15 +348,15 @@ void status_bar_set_all_inactive(void);
void rosterwin_roster(void); void rosterwin_roster(void);
// occupants window // occupants window
void occupantswin_occupants(const char * const room); void occupantswin_occupants(const char *const room);
// window interface // window interface
ProfWin* win_create_console(void); ProfWin* win_create_console(void);
ProfWin* win_create_xmlconsole(void); ProfWin* win_create_xmlconsole(void);
ProfWin* win_create_chat(const char * const barejid); ProfWin* win_create_chat(const char *const barejid);
ProfWin* win_create_muc(const char * const roomjid); ProfWin* win_create_muc(const char *const roomjid);
ProfWin* win_create_muc_config(const char * const title, DataForm *form); ProfWin* win_create_muc_config(const char *const title, DataForm *form);
ProfWin* win_create_private(const char * const fulljid); ProfWin* win_create_private(const char *const fulljid);
void win_update_virtual(ProfWin *window); void win_update_virtual(ProfWin *window);
void win_free(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_show_subwin(ProfWin *window);
void win_refresh_without_subwin(ProfWin *window); void win_refresh_without_subwin(ProfWin *window);
void win_refresh_with_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_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_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); char* win_get_title(ProfWin *window);
void win_show_occupant(ProfWin *window, Occupant *occupant); 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_contact(ProfWin *window, PContact contact);
void win_show_info(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 // desktop notifier actions
void notifier_initialise(void); void notifier_initialise(void);
void notifier_uninit(void); void notifier_uninit(void);
void notify_typing(const char * const handle); void notify_typing(const char *const handle);
void notify_message(ProfWin *window, const char * const name, const char * const text); 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, void notify_room_message(const char *const handle, const char *const room,
int win, const char * const text); int win, const char *const text);
void notify_remind(void); void notify_remind(void);
void notify_invite(const char * const from, const char * const room, void notify_invite(const char *const from, const char *const room,
const char * const reason); const char *const reason);
void notify_subscription(const char * const from); void notify_subscription(const char *const from);
#endif #endif

View File

@ -60,8 +60,8 @@
#define CEILING(X) (X-(int)(X) > 0 ? (int)(X+1) : (int)(X)) #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, 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);
static void _win_print_wrapped(WINDOW *win, const char * const message, size_t indent, int pad_indent); static void _win_print_wrapped(WINDOW *win, const char *const message, size_t indent, int pad_indent);
int int
win_roster_cols(void) win_roster_cols(void)
@ -127,7 +127,7 @@ win_create_console(void)
} }
ProfWin* ProfWin*
win_create_chat(const char * const barejid) win_create_chat(const char *const barejid)
{ {
ProfChatWin *new_win = malloc(sizeof(ProfChatWin)); ProfChatWin *new_win = malloc(sizeof(ProfChatWin));
new_win->window.type = WIN_CHAT; new_win->window.type = WIN_CHAT;
@ -149,7 +149,7 @@ win_create_chat(const char * const barejid)
} }
ProfWin* ProfWin*
win_create_muc(const char * const roomjid) win_create_muc(const char *const roomjid)
{ {
ProfMucWin *new_win = malloc(sizeof(ProfMucWin)); ProfMucWin *new_win = malloc(sizeof(ProfMucWin));
int cols = getmaxx(stdscr); int cols = getmaxx(stdscr);
@ -192,7 +192,7 @@ win_create_muc(const char * const roomjid)
} }
ProfWin* 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)); ProfMucConfWin *new_win = malloc(sizeof(ProfMucConfWin));
new_win->window.type = WIN_MUC_CONFIG; new_win->window.type = WIN_MUC_CONFIG;
@ -207,7 +207,7 @@ win_create_muc_config(const char * const roomjid, DataForm *form)
} }
ProfWin* ProfWin*
win_create_private(const char * const fulljid) win_create_private(const char *const fulljid)
{ {
ProfPrivateWin *new_win = malloc(sizeof(ProfPrivateWin)); ProfPrivateWin *new_win = malloc(sizeof(ProfPrivateWin));
new_win->window.type = WIN_PRIVATE; new_win->window.type = WIN_PRIVATE;
@ -233,7 +233,7 @@ win_create_xmlconsole(void)
return &new_win->window; return &new_win->window;
} }
char * char*
win_get_title(ProfWin *window) win_get_title(ProfWin *window)
{ {
if (window == NULL) { if (window == NULL) {
@ -471,12 +471,12 @@ win_clear(ProfWin *window)
void void
win_resize(ProfWin *window) win_resize(ProfWin *window)
{ {
int subwin_cols = 0;
int cols = getmaxx(stdscr); int cols = getmaxx(stdscr);
if (window->layout->type == LAYOUT_SPLIT) { if (window->layout->type == LAYOUT_SPLIT) {
ProfLayoutSplit *layout = (ProfLayoutSplit*)window->layout; ProfLayoutSplit *layout = (ProfLayoutSplit*)window->layout;
if (layout->subwin) { if (layout->subwin) {
int subwin_cols = 0;
if (window->type == WIN_CONSOLE) { if (window->type == WIN_CONSOLE) {
subwin_cols = win_roster_cols(); subwin_cols = win_roster_cols();
} else if (window->type == WIN_MUC) { } else if (window->type == WIN_MUC) {
@ -506,11 +506,11 @@ win_update_virtual(ProfWin *window)
{ {
int rows, cols; int rows, cols;
getmaxyx(stdscr, rows, cols); getmaxyx(stdscr, rows, cols);
int subwin_cols = 0;
if (window->layout->type == LAYOUT_SPLIT) { if (window->layout->type == LAYOUT_SPLIT) {
ProfLayoutSplit *layout = (ProfLayoutSplit*)window->layout; ProfLayoutSplit *layout = (ProfLayoutSplit*)window->layout;
if (layout->subwin) { if (layout->subwin) {
int subwin_cols = 0;
if (window->type == WIN_MUC) { if (window->type == WIN_MUC) {
subwin_cols = win_occpuants_cols(); subwin_cols = win_occpuants_cols();
} else { } else {
@ -634,7 +634,7 @@ win_show_contact(ProfWin *window, PContact contact)
} }
void 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 *presence_str = string_from_resource_presence(occupant->presence);
const char *occupant_affiliation = muc_occupant_affiliation_str(occupant); const char *occupant_affiliation = muc_occupant_affiliation_str(occupant);
@ -828,10 +828,10 @@ win_show_info(ProfWin *window, PContact contact)
} }
void void
win_show_status_string(ProfWin *window, const char * const from, win_show_status_string(ProfWin *window, const char *const from,
const char * const show, const char * const status, const char *const show, const char *const status,
GDateTime *last_activity, const char * const pre, GDateTime *last_activity, const char *const pre,
const char * const default_show) const char *const default_show)
{ {
theme_item_t presence_colour; theme_item_t presence_colour;
@ -872,7 +872,7 @@ win_show_status_string(ProfWin *window, const char * const from,
void void
win_print_incoming_message(ProfWin *window, GDateTime *timestamp, 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 = '-'; char enc_char = '-';
@ -897,7 +897,7 @@ win_print_incoming_message(ProfWin *window, GDateTime *timestamp,
void void
win_vprint(ProfWin *window, const char show_char, int pad_indent, GDateTime *timestamp, 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_list arg;
va_start(arg, message); 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); g_string_vprintf(fmt_msg, message, arg);
win_print(window, show_char, pad_indent, timestamp, flags, theme_item, from, fmt_msg->str); win_print(window, show_char, pad_indent, timestamp, flags, theme_item, from, fmt_msg->str);
g_string_free(fmt_msg, TRUE); g_string_free(fmt_msg, TRUE);
va_end(arg);
} }
void void
win_print(ProfWin *window, const char show_char, int pad_indent, GDateTime *timestamp, 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) { if (timestamp == NULL) {
timestamp = g_date_time_new_now_local(); 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 void
win_print_with_receipt(ProfWin *window, const char show_char, int pad_indent, GTimeVal *tstamp, 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; GDateTime *time;
@ -948,7 +949,7 @@ win_print_with_receipt(ProfWin *window, const char show_char, int pad_indent, GT
} }
void 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); gboolean received = buffer_mark_received(window->layout->buffer, id);
if (received) { if (received) {
@ -957,7 +958,7 @@ win_mark_received(ProfWin *window, const char * const id)
} }
void 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); win_print(window, '-', pad, NULL, 0, 0, "", message);
} }
@ -970,7 +971,7 @@ win_newline(ProfWin *window)
static void static void
_win_print(ProfWin *window, const char show_char, int pad_indent, GDateTime *time, _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 // flags : 1st bit = 0/1 - me/not me
// 2nd bit = 0/1 - date/no date // 2nd bit = 0/1 - date/no date
@ -1097,7 +1098,7 @@ _win_indent(WINDOW *win, int size)
} }
static void 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 starty = getcury(win);
int wordi = 0; int wordi = 0;

View File

@ -55,20 +55,20 @@
#define PAD_SIZE 1000 #define PAD_SIZE 1000
void win_move_to_end(ProfWin *window); void win_move_to_end(ProfWin *window);
void win_show_status_string(ProfWin *window, const char * const from, void win_show_status_string(ProfWin *window, const char *const from,
const char * const show, const char * const status, const char *const show, const char *const status,
GDateTime *last_activity, const char * const pre, GDateTime *last_activity, const char *const pre,
const char * const default_show); const char *const default_show);
void win_print_incoming_message(ProfWin *window, GDateTime *timestamp, 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, 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_newline(ProfWin *window);
void win_redraw(ProfWin *window); void win_redraw(ProfWin *window);
int win_roster_cols(void); int win_roster_cols(void);
int win_occpuants_cols(void); int win_occpuants_cols(void);
void win_printline_nowrap(WINDOW *win, char *msg); 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); gboolean win_has_active_subwin(ProfWin *window);

View File

@ -63,14 +63,14 @@ wins_init(void)
current = 1; current = 1;
} }
ProfWin * ProfWin*
wins_get_console(void) wins_get_console(void)
{ {
return g_hash_table_lookup(windows, GINT_TO_POINTER(1)); return g_hash_table_lookup(windows, GINT_TO_POINTER(1));
} }
ProfChatWin * ProfChatWin*
wins_get_chat(const char * const barejid) wins_get_chat(const char *const barejid)
{ {
GList *values = g_hash_table_get_values(windows); GList *values = g_hash_table_get_values(windows);
GList *curr = values; GList *curr = values;
@ -91,8 +91,8 @@ wins_get_chat(const char * const barejid)
return NULL; return NULL;
} }
ProfMucConfWin * ProfMucConfWin*
wins_get_muc_conf(const char * const roomjid) wins_get_muc_conf(const char *const roomjid)
{ {
GList *values = g_hash_table_get_values(windows); GList *values = g_hash_table_get_values(windows);
GList *curr = values; GList *curr = values;
@ -113,8 +113,8 @@ wins_get_muc_conf(const char * const roomjid)
return NULL; return NULL;
} }
ProfMucWin * ProfMucWin*
wins_get_muc(const char * const roomjid) wins_get_muc(const char *const roomjid)
{ {
GList *values = g_hash_table_get_values(windows); GList *values = g_hash_table_get_values(windows);
GList *curr = values; GList *curr = values;
@ -135,8 +135,8 @@ wins_get_muc(const char * const roomjid)
return NULL; return NULL;
} }
ProfPrivateWin * ProfPrivateWin*
wins_get_private(const char * const fulljid) wins_get_private(const char *const fulljid)
{ {
GList *values = g_hash_table_get_values(windows); GList *values = g_hash_table_get_values(windows);
GList *curr = values; GList *curr = values;
@ -157,7 +157,7 @@ wins_get_private(const char * const fulljid)
return NULL; return NULL;
} }
ProfWin * ProfWin*
wins_get_current(void) wins_get_current(void)
{ {
if (windows) { if (windows) {
@ -167,7 +167,7 @@ wins_get_current(void)
} }
} }
GList * GList*
wins_get_nums(void) wins_get_nums(void)
{ {
return g_hash_table_get_keys(windows); 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) wins_get_by_num(int i)
{ {
return g_hash_table_lookup(windows, GINT_TO_POINTER(i)); return g_hash_table_lookup(windows, GINT_TO_POINTER(i));
} }
ProfWin * ProfWin*
wins_get_next(void) wins_get_next(void)
{ {
// get and sort win nums // get and sort win nums
@ -229,7 +229,7 @@ wins_get_next(void)
} }
} }
ProfWin * ProfWin*
wins_get_previous(void) wins_get_previous(void)
{ {
// get and sort win nums // get and sort win nums
@ -321,7 +321,7 @@ wins_is_current(ProfWin *window)
} }
} }
ProfWin * ProfWin*
wins_new_xmlconsole(void) wins_new_xmlconsole(void)
{ {
GList *keys = g_hash_table_get_keys(windows); GList *keys = g_hash_table_get_keys(windows);
@ -332,8 +332,8 @@ wins_new_xmlconsole(void)
return newwin; return newwin;
} }
ProfWin * ProfWin*
wins_new_chat(const char * const barejid) wins_new_chat(const char *const barejid)
{ {
GList *keys = g_hash_table_get_keys(windows); GList *keys = g_hash_table_get_keys(windows);
int result = get_next_available_win_num(keys); int result = get_next_available_win_num(keys);
@ -343,8 +343,8 @@ wins_new_chat(const char * const barejid)
return newwin; return newwin;
} }
ProfWin * ProfWin*
wins_new_muc(const char * const roomjid) wins_new_muc(const char *const roomjid)
{ {
GList *keys = g_hash_table_get_keys(windows); GList *keys = g_hash_table_get_keys(windows);
int result = get_next_available_win_num(keys); int result = get_next_available_win_num(keys);
@ -354,8 +354,8 @@ wins_new_muc(const char * const roomjid)
return newwin; return newwin;
} }
ProfWin * ProfWin*
wins_new_muc_config(const char * const roomjid, DataForm *form) wins_new_muc_config(const char *const roomjid, DataForm *form)
{ {
GList *keys = g_hash_table_get_keys(windows); GList *keys = g_hash_table_get_keys(windows);
int result = get_next_available_win_num(keys); int result = get_next_available_win_num(keys);
@ -365,8 +365,8 @@ wins_new_muc_config(const char * const roomjid, DataForm *form)
return newwin; return newwin;
} }
ProfWin * ProfWin*
wins_new_private(const char * const fulljid) wins_new_private(const char *const fulljid)
{ {
GList *keys = g_hash_table_get_keys(windows); GList *keys = g_hash_table_get_keys(windows);
int result = get_next_available_win_num(keys); int result = get_next_available_win_num(keys);
@ -426,7 +426,7 @@ wins_show_subwin(ProfWin *window)
win_refresh_with_subwin(current_win); win_refresh_with_subwin(current_win);
} }
ProfXMLWin * ProfXMLWin*
wins_get_xmlconsole(void) wins_get_xmlconsole(void)
{ {
GList *values = g_hash_table_get_values(windows); GList *values = g_hash_table_get_values(windows);
@ -447,7 +447,7 @@ wins_get_xmlconsole(void)
return NULL; return NULL;
} }
GSList * GSList*
wins_get_chat_recipients(void) wins_get_chat_recipients(void)
{ {
GSList *result = NULL; GSList *result = NULL;
@ -466,7 +466,7 @@ wins_get_chat_recipients(void)
return result; return result;
} }
GSList * GSList*
wins_get_prune_wins(void) wins_get_prune_wins(void)
{ {
GSList *result = NULL; GSList *result = NULL;
@ -620,7 +620,7 @@ wins_tidy(void)
} }
} }
GSList * GSList*
wins_create_summary(void) wins_create_summary(void)
{ {
GSList *result = NULL; GSList *result = NULL;

View File

@ -39,27 +39,27 @@
void wins_init(void); void wins_init(void);
ProfWin * wins_new_xmlconsole(void); ProfWin* wins_new_xmlconsole(void);
ProfWin * wins_new_chat(const char * const barejid); ProfWin* wins_new_chat(const char *const barejid);
ProfWin * wins_new_muc(const char * const roomjid); ProfWin* wins_new_muc(const char *const roomjid);
ProfWin * wins_new_muc_config(const char * const roomjid, DataForm *form); ProfWin* wins_new_muc_config(const char *const roomjid, DataForm *form);
ProfWin * wins_new_private(const char * const fulljid); ProfWin* wins_new_private(const char *const fulljid);
ProfWin * wins_get_console(void); ProfWin* wins_get_console(void);
ProfChatWin *wins_get_chat(const char * const barejid); ProfChatWin* wins_get_chat(const char *const barejid);
ProfMucWin * wins_get_muc(const char * const roomjid); ProfMucWin* wins_get_muc(const char *const roomjid);
ProfMucConfWin * wins_get_muc_conf(const char * const roomjid); ProfMucConfWin* wins_get_muc_conf(const char *const roomjid);
ProfPrivateWin *wins_get_private(const char * const fulljid); ProfPrivateWin* wins_get_private(const char *const fulljid);
ProfXMLWin * wins_get_xmlconsole(void); ProfXMLWin* wins_get_xmlconsole(void);
ProfWin * wins_get_current(void); ProfWin* wins_get_current(void);
void wins_set_current_by_num(int i); 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_next(void);
ProfWin * wins_get_previous(void); ProfWin* wins_get_previous(void);
int wins_get_num(ProfWin *window); int wins_get_num(ProfWin *window);
int wins_get_current_num(void); int wins_get_current_num(void);
void wins_close_current(void); void wins_close_current(void);
@ -67,13 +67,13 @@ void wins_close_by_num(int i);
gboolean wins_is_current(ProfWin *window); gboolean wins_is_current(ProfWin *window);
int wins_get_total_unread(void); int wins_get_total_unread(void);
void wins_resize_all(void); void wins_resize_all(void);
GSList * wins_get_chat_recipients(void); GSList* wins_get_chat_recipients(void);
GSList * wins_get_prune_wins(void); GSList* wins_get_prune_wins(void);
void wins_lost_connection(void); void wins_lost_connection(void);
gboolean wins_tidy(void); gboolean wins_tidy(void);
GSList * wins_create_summary(void); GSList* wins_create_summary(void);
void wins_destroy(void); void wins_destroy(void);
GList * wins_get_nums(void); GList* wins_get_nums(void);
gboolean wins_swap(int source_win, int target_win); gboolean wins_swap(int source_win, int target_win);
void wins_hide_subwin(ProfWin *window); void wins_hide_subwin(ProfWin *window);
void wins_show_subwin(ProfWin *window); void wins_show_subwin(ProfWin *window);

View File

@ -62,10 +62,10 @@
static Autocomplete bookmark_ac; static Autocomplete bookmark_ac;
static GList *bookmark_list; static GList *bookmark_list;
static int _bookmark_handle_result(xmpp_conn_t * const conn, static int _bookmark_handle_result(xmpp_conn_t *const conn,
xmpp_stanza_t * const stanza, void * const userdata); xmpp_stanza_t *const stanza, void *const userdata);
static int _bookmark_handle_delete(xmpp_conn_t * const conn, static int _bookmark_handle_delete(xmpp_conn_t *const conn,
void * const userdata); void *const userdata);
static void _bookmark_item_destroy(gpointer item); static void _bookmark_item_destroy(gpointer item);
static int _match_bookmark_by_jid(gconstpointer a, gconstpointer b); static int _match_bookmark_by_jid(gconstpointer a, gconstpointer b);
static void _send_bookmarks(void); static void _send_bookmarks(void);
@ -221,14 +221,14 @@ bookmark_remove(const char *jid)
} }
} }
const GList * const GList*
bookmark_get_list(void) bookmark_get_list(void)
{ {
return bookmark_list; return bookmark_list;
} }
char * char*
bookmark_find(const char * const search_str) bookmark_find(const char *const search_str)
{ {
return autocomplete_complete(bookmark_ac, search_str, TRUE); return autocomplete_complete(bookmark_ac, search_str, TRUE);
} }
@ -242,8 +242,8 @@ bookmark_autocomplete_reset(void)
} }
static int static int
_bookmark_handle_result(xmpp_conn_t * const conn, _bookmark_handle_result(xmpp_conn_t *const conn,
xmpp_stanza_t * const stanza, void * const userdata) xmpp_stanza_t *const stanza, void *const userdata)
{ {
xmpp_ctx_t *ctx = connection_get_ctx(); xmpp_ctx_t *ctx = connection_get_ctx();
char *id = (char *)userdata; char *id = (char *)userdata;
@ -360,8 +360,8 @@ _bookmark_handle_result(xmpp_conn_t * const conn,
} }
static int static int
_bookmark_handle_delete(xmpp_conn_t * const conn, _bookmark_handle_delete(xmpp_conn_t *const conn,
void * const userdata) void *const userdata)
{ {
char *id = (char *)userdata; char *id = (char *)userdata;

View File

@ -68,9 +68,9 @@ static char *my_sha1;
static gchar* _get_cache_file(void); static gchar* _get_cache_file(void);
static void _save_cache(void); static void _save_cache(void);
static Capabilities * _caps_by_ver(const char * const ver); static Capabilities* _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);
Capabilities * _caps_copy(Capabilities *caps); Capabilities* _caps_copy(Capabilities *caps);
void void
caps_init(void) caps_init(void)
@ -93,7 +93,7 @@ caps_init(void)
} }
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); gboolean cached = g_key_file_has_group(cache, ver);
if (!cached) { if (!cached) {
@ -135,25 +135,25 @@ caps_add_by_ver(const char * const ver, Capabilities *caps)
} }
void 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); g_hash_table_insert(jid_to_caps, strdup(jid), caps);
} }
void 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)); g_hash_table_insert(jid_to_ver, strdup(jid), strdup(ver));
} }
gboolean gboolean
caps_contains(const char * const ver) caps_contains(const char *const ver)
{ {
return (g_key_file_has_group(cache, ver)); return (g_key_file_has_group(cache, ver));
} }
static Capabilities * static Capabilities*
_caps_by_ver(const char * const ver) _caps_by_ver(const char *const ver)
{ {
if (g_key_file_has_group(cache, ver)) { if (g_key_file_has_group(cache, ver)) {
Capabilities *new_caps = malloc(sizeof(struct capabilities_t)); Capabilities *new_caps = malloc(sizeof(struct capabilities_t));
@ -226,14 +226,14 @@ _caps_by_ver(const char * const ver)
} }
} }
static Capabilities * static Capabilities*
_caps_by_jid(const char * const jid) _caps_by_jid(const char *const jid)
{ {
return g_hash_table_lookup(jid_to_caps, jid); return g_hash_table_lookup(jid_to_caps, jid);
} }
Capabilities * Capabilities*
caps_lookup(const char * const jid) caps_lookup(const char *const jid)
{ {
char *ver = g_hash_table_lookup(jid_to_ver, jid); char *ver = g_hash_table_lookup(jid_to_ver, jid);
if (ver) { if (ver) {
@ -254,7 +254,7 @@ caps_lookup(const char * const jid)
return NULL; return NULL;
} }
Capabilities * Capabilities*
_caps_copy(Capabilities *caps) _caps_copy(Capabilities *caps)
{ {
if (!caps) { if (!caps) {
@ -280,8 +280,8 @@ _caps_copy(Capabilities *caps)
} }
} }
char * char*
caps_create_sha1_str(xmpp_stanza_t * const query) caps_create_sha1_str(xmpp_stanza_t *const query)
{ {
char *category = NULL; char *category = NULL;
char *type = NULL; char *type = NULL;
@ -388,7 +388,7 @@ caps_create_sha1_str(xmpp_stanza_t * const query)
return result; return result;
} }
Capabilities * Capabilities*
caps_create(xmpp_stanza_t *query) caps_create(xmpp_stanza_t *query)
{ {
char *category = NULL; char *category = NULL;
@ -541,7 +541,7 @@ caps_create(xmpp_stanza_t *query)
} }
char* char*
caps_get_my_sha1(xmpp_ctx_t * const ctx) caps_get_my_sha1(xmpp_ctx_t *const ctx)
{ {
if (my_sha1 == NULL) { if (my_sha1 == NULL) {
xmpp_stanza_t *query = caps_create_query_response_stanza(ctx); 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; return my_sha1;
} }
xmpp_stanza_t * xmpp_stanza_t*
caps_create_query_response_stanza(xmpp_ctx_t * const ctx) caps_create_query_response_stanza(xmpp_ctx_t *const ctx)
{ {
xmpp_stanza_t *query = xmpp_stanza_new(ctx); xmpp_stanza_t *query = xmpp_stanza_new(ctx);
xmpp_stanza_set_name(query, STANZA_NAME_QUERY); xmpp_stanza_set_name(query, STANZA_NAME_QUERY);
@ -674,7 +674,7 @@ caps_destroy(Capabilities *caps)
} }
} }
static gchar * static gchar*
_get_cache_file(void) _get_cache_file(void)
{ {
gchar *xdg_data = xdg_get_data_home(); gchar *xdg_data = xdg_get_data_home();

View File

@ -48,14 +48,14 @@
void caps_init(void); void caps_init(void);
void caps_add_by_ver(const char * const ver, Capabilities *caps); void caps_add_by_ver(const char *const ver, Capabilities *caps);
void caps_add_by_jid(const char * const jid, 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); void caps_map_jid_to_ver(const char *const jid, const char *const ver);
gboolean caps_contains(const char * const ver); gboolean caps_contains(const char *const ver);
char* caps_create_sha1_str(xmpp_stanza_t * const query); char* caps_create_sha1_str(xmpp_stanza_t *const query);
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);
Capabilities* caps_create(xmpp_stanza_t *query); 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 #endif

View File

@ -95,20 +95,20 @@ static GTimer *reconnect_timer;
static log_level_t _get_log_level(xmpp_log_level_t xmpp_level); static log_level_t _get_log_level(xmpp_log_level_t xmpp_level);
static xmpp_log_level_t _get_xmpp_log_level(); static xmpp_log_level_t _get_xmpp_log_level();
static void _xmpp_file_logger(void * const userdata, static void _xmpp_file_logger(void *const userdata,
const xmpp_log_level_t level, const char * const area, const xmpp_log_level_t level, const char *const area,
const char * const msg); 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, 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); const char *const passwd, const char *const altdomain, int port, const char *const tls_policy);
static void _jabber_reconnect(void); 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, 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_account(void);
void _connection_free_saved_details(void); void _connection_free_saved_details(void);
@ -131,7 +131,7 @@ jabber_init(void)
} }
jabber_conn_status_t jabber_conn_status_t
jabber_connect_with_account(const ProfAccount * const account) jabber_connect_with_account(const ProfAccount *const account)
{ {
assert(account != NULL); assert(account != NULL);
@ -157,8 +157,8 @@ jabber_connect_with_account(const ProfAccount * const account)
} }
jabber_conn_status_t jabber_conn_status_t
jabber_connect_with_details(const char * const jid, jabber_connect_with_details(const char *const jid,
const char * const passwd, const char * const altdomain, const int port, const char *const tls_policy) const char *const passwd, const char *const altdomain, const int port, const char *const tls_policy)
{ {
assert(jid != NULL); assert(jid != NULL);
assert(passwd != NULL); assert(passwd != NULL);
@ -271,7 +271,7 @@ jabber_process_events(int millis)
} }
} }
GList * GList*
jabber_get_available_resources(void) jabber_get_available_resources(void)
{ {
return g_hash_table_get_values(available_resources); return g_hash_table_get_values(available_resources);
@ -283,37 +283,37 @@ jabber_get_connection_status(void)
return (jabber_conn.conn_status); return (jabber_conn.conn_status);
} }
xmpp_conn_t * xmpp_conn_t*
connection_get_conn(void) connection_get_conn(void)
{ {
return jabber_conn.conn; return jabber_conn.conn;
} }
xmpp_ctx_t * xmpp_ctx_t*
connection_get_ctx(void) connection_get_ctx(void)
{ {
return jabber_conn.ctx; return jabber_conn.ctx;
} }
const char * const char*
jabber_get_fulljid(void) jabber_get_fulljid(void)
{ {
return xmpp_conn_get_jid(jabber_conn.conn); return xmpp_conn_get_jid(jabber_conn.conn);
} }
const char * const char*
jabber_get_domain(void) jabber_get_domain(void)
{ {
return jabber_conn.domain; return jabber_conn.domain;
} }
char * char*
jabber_get_presence_message(void) jabber_get_presence_message(void)
{ {
return jabber_conn.presence_message; return jabber_conn.presence_message;
} }
char * char*
jabber_get_account_name(void) jabber_get_account_name(void)
{ {
return saved_account.name; return saved_account.name;
@ -334,7 +334,7 @@ jabber_free_uuid(char *uuid)
} }
void void
connection_set_presence_message(const char * const message) connection_set_presence_message(const char *const message)
{ {
FREE_SET_NULL(jabber_conn.presence_message); FREE_SET_NULL(jabber_conn.presence_message);
if (message) { if (message) {
@ -355,7 +355,7 @@ connection_add_available_resource(Resource *resource)
} }
void void
connection_remove_available_resource(const char * const resource) connection_remove_available_resource(const char *const resource)
{ {
g_hash_table_remove(available_resources, resource); g_hash_table_remove(available_resources, resource);
} }
@ -387,16 +387,16 @@ _connection_free_session_data(void)
#ifdef HAVE_LIBMESODE #ifdef HAVE_LIBMESODE
static int static int
_connection_certfail_cb(const char * const certname, const char * const certfp, _connection_certfail_cb(const char *const certname, const char *const certfp,
char * const notbefore, const char * const notafter, const char * const errormsg) char *const notbefore, const char *const notafter, const char *const errormsg)
{ {
return sv_ev_certfail(errormsg, certname, certfp, notbefore, notafter); return sv_ev_certfail(errormsg, certname, certfp, notbefore, notafter);
} }
#endif #endif
static jabber_conn_status_t static jabber_conn_status_t
_jabber_connect(const char * const fulljid, const char * const passwd, _jabber_connect(const char *const fulljid, const char *const passwd,
const char * const altdomain, int port, const char *const tls_policy) const char *const altdomain, int port, const char *const tls_policy)
{ {
assert(fulljid != NULL); assert(fulljid != NULL);
assert(passwd != NULL); assert(passwd != NULL);
@ -488,9 +488,9 @@ _jabber_reconnect(void)
} }
static 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, 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 // login success
if (status == XMPP_CONN_CONNECT) { if (status == XMPP_CONN_CONNECT) {
@ -619,8 +619,8 @@ _get_xmpp_log_level()
} }
static void static void
_xmpp_file_logger(void * const userdata, const xmpp_log_level_t level, _xmpp_file_logger(void *const userdata, const xmpp_log_level_t level,
const char * const area, const char * const msg) const char *const area, const char *const msg)
{ {
log_level_t prof_level = _get_log_level(level); log_level_t prof_level = _get_log_level(level);
log_msg(prof_level, area, msg); 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_get_file_logger()
{ {
xmpp_log_level_t level = _get_xmpp_log_level(); xmpp_log_level_t level = _get_xmpp_log_level();

View File

@ -46,11 +46,11 @@
#include "resource.h" #include "resource.h"
xmpp_conn_t *connection_get_conn(void); xmpp_conn_t* connection_get_conn(void);
xmpp_ctx_t *connection_get_ctx(void); xmpp_ctx_t* connection_get_ctx(void);
void connection_set_priority(int priority); 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_add_available_resource(Resource *resource);
void connection_remove_available_resource(const char * const resource); void connection_remove_available_resource(const char *const resource);
#endif #endif

View File

@ -78,7 +78,7 @@ _is_valid_form_element(xmpp_stanza_t *stanza)
return TRUE; return TRUE;
} }
static DataForm * static DataForm*
_form_new(void) _form_new(void)
{ {
DataForm *form = malloc(sizeof(DataForm)); DataForm *form = malloc(sizeof(DataForm));
@ -93,7 +93,7 @@ _form_new(void)
return form; return form;
} }
static FormField * static FormField*
_field_new(void) _field_new(void)
{ {
FormField *field = malloc(sizeof(FormField)); FormField *field = malloc(sizeof(FormField));
@ -108,8 +108,8 @@ _field_new(void)
return field; return field;
} }
static char * static char*
_get_property(xmpp_stanza_t * const stanza, const char * const property) _get_property(xmpp_stanza_t *const stanza, const char *const property)
{ {
char *result = NULL; char *result = NULL;
xmpp_ctx_t *ctx = connection_get_ctx(); xmpp_ctx_t *ctx = connection_get_ctx();
@ -126,8 +126,8 @@ _get_property(xmpp_stanza_t * const stanza, const char * const property)
return result; return result;
} }
static char * static char*
_get_attr(xmpp_stanza_t * const stanza, const char * const attr) _get_attr(xmpp_stanza_t *const stanza, const char *const attr)
{ {
char *result = xmpp_stanza_get_attribute(stanza, attr); char *result = xmpp_stanza_get_attribute(stanza, attr);
if (result) { if (result) {
@ -138,7 +138,7 @@ _get_attr(xmpp_stanza_t * const stanza, const char * const attr)
} }
static gboolean 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"); xmpp_stanza_t *child = xmpp_stanza_get_child_by_name(stanza, "required");
if (child) { if (child) {
@ -149,7 +149,7 @@ _is_required(xmpp_stanza_t * const stanza)
} }
static form_field_type_t 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) { if (g_strcmp0(type, "hidden") == 0) {
return FIELD_HIDDEN; return FIELD_HIDDEN;
@ -184,8 +184,8 @@ _get_field_type(const char * const type)
return FIELD_UNKNOWN; return FIELD_UNKNOWN;
} }
DataForm * DataForm*
form_create(xmpp_stanza_t * const form_stanza) form_create(xmpp_stanza_t *const form_stanza)
{ {
xmpp_ctx_t *ctx = connection_get_ctx(); xmpp_ctx_t *ctx = connection_get_ctx();
@ -281,7 +281,7 @@ form_create(xmpp_stanza_t * const form_stanza)
return form; return form;
} }
xmpp_stanza_t * xmpp_stanza_t*
form_create_submission(DataForm *form) form_create_submission(DataForm *form)
{ {
xmpp_ctx_t *ctx = connection_get_ctx(); 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); return g_strcmp0(a->var, b->var);
} }
GSList * GSList*
form_get_non_form_type_fields_sorted(DataForm *form) form_get_non_form_type_fields_sorted(DataForm *form)
{ {
GSList *sorted = NULL; GSList *sorted = NULL;
@ -424,7 +424,7 @@ form_get_non_form_type_fields_sorted(DataForm *form)
return sorted; return sorted;
} }
GSList * GSList*
form_get_field_values_sorted(FormField *field) form_get_field_values_sorted(FormField *field)
{ {
GSList *sorted = NULL; GSList *sorted = NULL;
@ -440,7 +440,7 @@ form_get_field_values_sorted(FormField *field)
return sorted; return sorted;
} }
char * char*
form_get_form_type_field(DataForm *form) form_get_form_type_field(DataForm *form)
{ {
GSList *curr = form->fields; GSList *curr = form->fields;
@ -456,7 +456,7 @@ form_get_form_type_field(DataForm *form)
} }
gboolean 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 *tags = g_hash_table_get_keys(form->tag_to_var);
GList *curr = tags; GList *curr = tags;
@ -472,7 +472,7 @@ form_tag_exists(DataForm *form, const char * const tag)
} }
form_field_type_t 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); char *var = g_hash_table_lookup(form->tag_to_var, tag);
if (var) { if (var) {
@ -489,7 +489,7 @@ form_get_field_type(DataForm *form, const char * const tag)
} }
void 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); char *var = g_hash_table_lookup(form->tag_to_var, tag);
if (var) { if (var) {
@ -514,7 +514,7 @@ form_set_value(DataForm *form, const char * const tag, char *value)
} }
void 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); char *var = g_hash_table_lookup(form->tag_to_var, tag);
if (var) { if (var) {
@ -539,7 +539,7 @@ form_add_value(DataForm *form, const char * const tag, char *value)
} }
gboolean 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); char *var = g_hash_table_lookup(form->tag_to_var, tag);
if (var) { if (var) {
@ -570,7 +570,7 @@ form_add_unique_value(DataForm *form, const char * const tag, char *value)
} }
gboolean 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); char *var = g_hash_table_lookup(form->tag_to_var, tag);
if (var) { if (var) {
@ -600,7 +600,7 @@ form_remove_value(DataForm *form, const char * const tag, char *value)
} }
gboolean 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--; index--;
char *var = g_hash_table_lookup(form->tag_to_var, tag); 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 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); char *var = g_hash_table_lookup(form->tag_to_var, tag);
if (var) { if (var) {
@ -654,7 +654,7 @@ form_get_value_count(DataForm *form, const char * const tag)
} }
gboolean 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); char *var = g_hash_table_lookup(form->tag_to_var, tag);
if (var) { if (var) {
@ -678,8 +678,8 @@ form_field_contains_option(DataForm *form, const char * const tag, char *value)
return FALSE; return FALSE;
} }
FormField * FormField*
form_get_field_by_tag(DataForm *form, const char * const tag) form_get_field_by_tag(DataForm *form, const char *const tag)
{ {
char *var = g_hash_table_lookup(form->tag_to_var, tag); char *var = g_hash_table_lookup(form->tag_to_var, tag);
if (var) { if (var) {
@ -696,7 +696,7 @@ form_get_field_by_tag(DataForm *form, const char * const tag)
} }
Autocomplete 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); char *var = g_hash_table_lookup(form->tag_to_var, tag);
if (var) { if (var) {

View File

@ -37,7 +37,7 @@
#include "xmpp/xmpp.h" #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); xmpp_stanza_t* form_create_submission(DataForm *form);
#endif #endif

View File

@ -70,32 +70,32 @@ typedef struct p_room_info_data_t {
gboolean display; gboolean display;
} ProfRoomInfoData; } ProfRoomInfoData;
static int _error_handler(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 _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_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 _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_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 _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_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 _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 _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_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 _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 _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_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_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_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_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_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_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 _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 _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 _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 _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 _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(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_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 _caps_response_handler_legacy(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, void *const userdata);
void void
iq_add_handlers(void) iq_add_handlers(void)
@ -150,7 +150,7 @@ iq_room_list_request(gchar *conferencejid)
} }
void void
iq_enable_carbons() iq_enable_carbons(void)
{ {
xmpp_conn_t * const conn = connection_get_conn(); xmpp_conn_t * const conn = connection_get_conn();
xmpp_ctx_t * const ctx = connection_get_ctx(); xmpp_ctx_t * const ctx = connection_get_ctx();
@ -164,7 +164,7 @@ iq_enable_carbons()
} }
void void
iq_disable_carbons() iq_disable_carbons(void)
{ {
xmpp_conn_t * const conn = connection_get_conn(); xmpp_conn_t * const conn = connection_get_conn();
xmpp_ctx_t * const ctx = connection_get_ctx(); xmpp_ctx_t * const ctx = connection_get_ctx();
@ -210,7 +210,7 @@ iq_last_activity_request(gchar *jid)
} }
void 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_conn_t * const conn = connection_get_conn();
xmpp_ctx_t * const ctx = connection_get_ctx(); xmpp_ctx_t * const ctx = connection_get_ctx();
@ -232,8 +232,8 @@ iq_room_info_request(const char * const room, gboolean display_result)
void void
iq_send_caps_request_for_jid(const char * const to, const char * const id, iq_send_caps_request_for_jid(const char *const to, const char *const id,
const char * const node, const char * const ver) const char *const node, const char *const ver)
{ {
xmpp_conn_t * const conn = connection_get_conn(); xmpp_conn_t * const conn = connection_get_conn();
xmpp_ctx_t * const ctx = connection_get_ctx(); 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 void
iq_send_caps_request(const char * const to, const char * const id, iq_send_caps_request(const char *const to, const char *const id,
const char * const node, const char * const ver) const char *const node, const char *const ver)
{ {
xmpp_conn_t * const conn = connection_get_conn(); xmpp_conn_t * const conn = connection_get_conn();
xmpp_ctx_t * const ctx = connection_get_ctx(); 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 void
iq_send_caps_request_legacy(const char * const to, const char * const id, iq_send_caps_request_legacy(const char *const to, const char *const id,
const char * const node, const char * const ver) const char *const node, const char *const ver)
{ {
xmpp_conn_t * const conn = connection_get_conn(); xmpp_conn_t * const conn = connection_get_conn();
xmpp_ctx_t * const ctx = connection_get_ctx(); xmpp_ctx_t * const ctx = connection_get_ctx();
@ -323,7 +323,7 @@ iq_disco_items_request(gchar *jid)
} }
void 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_conn_t * const conn = connection_get_conn();
xmpp_ctx_t * const ctx = connection_get_ctx(); xmpp_ctx_t * const ctx = connection_get_ctx();
@ -337,7 +337,7 @@ iq_send_software_version(const char * const fulljid)
} }
void 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_conn_t * const conn = connection_get_conn();
xmpp_ctx_t * const ctx = connection_get_ctx(); xmpp_ctx_t * const ctx = connection_get_ctx();
@ -347,7 +347,7 @@ iq_confirm_instant_room(const char * const room_jid)
} }
void 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_conn_t * const conn = connection_get_conn();
xmpp_ctx_t * const ctx = connection_get_ctx(); xmpp_ctx_t * const ctx = connection_get_ctx();
@ -361,7 +361,7 @@ iq_destroy_room(const char * const room_jid)
} }
void 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_conn_t * const conn = connection_get_conn();
xmpp_ctx_t * const ctx = connection_get_ctx(); xmpp_ctx_t * const ctx = connection_get_ctx();
@ -375,7 +375,7 @@ iq_request_room_config_form(const char * const room_jid)
} }
void 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_conn_t * const conn = connection_get_conn();
xmpp_ctx_t * const ctx = connection_get_ctx(); xmpp_ctx_t * const ctx = connection_get_ctx();
@ -389,7 +389,7 @@ iq_submit_room_config(const char * const room, DataForm *form)
} }
void 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_conn_t * const conn = connection_get_conn();
xmpp_ctx_t * const ctx = connection_get_ctx(); xmpp_ctx_t * const ctx = connection_get_ctx();
@ -399,7 +399,7 @@ iq_room_config_cancel(const char * const room_jid)
} }
void 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_conn_t * const conn = connection_get_conn();
xmpp_ctx_t * const ctx = connection_get_ctx(); xmpp_ctx_t * const ctx = connection_get_ctx();
@ -413,7 +413,7 @@ iq_room_affiliation_list(const char * const room, char *affiliation)
} }
void 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_conn_t * const conn = connection_get_conn();
xmpp_ctx_t * const ctx = connection_get_ctx(); xmpp_ctx_t * const ctx = connection_get_ctx();
@ -432,8 +432,8 @@ struct privilege_set_t {
}; };
void void
iq_room_affiliation_set(const char * const room, const char * const jid, char *affiliation, iq_room_affiliation_set(const char *const room, const char *const jid, char *affiliation,
const char * const reason) const char *const reason)
{ {
xmpp_conn_t * const conn = connection_get_conn(); xmpp_conn_t * const conn = connection_get_conn();
xmpp_ctx_t * const ctx = connection_get_ctx(); 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 void
iq_room_role_set(const char * const room, const char * const nick, char *role, iq_room_role_set(const char *const room, const char *const nick, char *role,
const char * const reason) const char *const reason)
{ {
xmpp_conn_t * const conn = connection_get_conn(); xmpp_conn_t * const conn = connection_get_conn();
xmpp_ctx_t * const ctx = connection_get_ctx(); 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 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_conn_t * const conn = connection_get_conn();
xmpp_ctx_t * const ctx = connection_get_ctx(); xmpp_ctx_t * const ctx = connection_get_ctx();
@ -486,7 +486,7 @@ iq_room_role_list(const char * const room, char *role)
} }
void void
iq_send_ping(const char * const target) iq_send_ping(const char *const target)
{ {
xmpp_conn_t * const conn = connection_get_conn(); xmpp_conn_t * const conn = connection_get_conn();
xmpp_ctx_t * const ctx = connection_get_ctx(); xmpp_ctx_t * const ctx = connection_get_ctx();
@ -501,8 +501,8 @@ iq_send_ping(const char * const target)
} }
static int static int
_error_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, _error_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza,
void * const userdata) void *const userdata)
{ {
const char *id = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_ID); const char *id = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_ID);
char *error_msg = stanza_get_error_message(stanza); 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 static int
_pong_handler(xmpp_conn_t *const conn, xmpp_stanza_t * const stanza, _pong_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza,
void * const userdata) void *const userdata)
{ {
char *id = xmpp_stanza_get_id(stanza); char *id = xmpp_stanza_get_id(stanza);
char *type = xmpp_stanza_get_type(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 static int
_caps_response_handler(xmpp_conn_t *const conn, xmpp_stanza_t * const stanza, _caps_response_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza,
void * const userdata) void *const userdata)
{ {
const char *id = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_ID); 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); 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 static int
_caps_response_handler_for_jid(xmpp_conn_t *const conn, xmpp_stanza_t * const stanza, _caps_response_handler_for_jid(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza,
void * const userdata) void *const userdata)
{ {
char *jid = (char *)userdata; char *jid = (char *)userdata;
const char *id = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_ID); 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 static int
_caps_response_handler_legacy(xmpp_conn_t *const conn, xmpp_stanza_t * const stanza, _caps_response_handler_legacy(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza,
void * const userdata) void *const userdata)
{ {
const char *id = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_ID); 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); 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 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); char *type = xmpp_stanza_get_type(stanza);
if (g_strcmp0(type, "error") == 0) { 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 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); char *type = xmpp_stanza_get_type(stanza);
if (g_strcmp0(type, "error") == 0) { 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 static int
_manual_pong_handler(xmpp_conn_t *const conn, xmpp_stanza_t * const stanza, _manual_pong_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza,
void * const userdata) void *const userdata)
{ {
char *from = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_FROM); char *from = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_FROM);
char *type = xmpp_stanza_get_type(stanza); 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 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; 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 static int
_version_result_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, _version_result_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza,
void * const userdata) void *const userdata)
{ {
char *id = xmpp_stanza_get_id(stanza); 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 static int
_ping_get_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, _ping_get_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza,
void * const userdata) void *const userdata)
{ {
xmpp_ctx_t *ctx = (xmpp_ctx_t *)userdata; xmpp_ctx_t *ctx = (xmpp_ctx_t *)userdata;
const char *id = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_ID); 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 static int
_version_get_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, _version_get_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza,
void * const userdata) void *const userdata)
{ {
xmpp_ctx_t *ctx = (xmpp_ctx_t *)userdata; xmpp_ctx_t *ctx = (xmpp_ctx_t *)userdata;
const char *id = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_ID); 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 static int
_disco_items_get_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, _disco_items_get_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza,
void * const userdata) void *const userdata)
{ {
xmpp_ctx_t *ctx = (xmpp_ctx_t *)userdata; xmpp_ctx_t *ctx = (xmpp_ctx_t *)userdata;
const char *id = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_ID); 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 static int
_last_activity_get_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, _last_activity_get_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza,
void * const userdata) void *const userdata)
{ {
xmpp_ctx_t *ctx = connection_get_ctx(); xmpp_ctx_t *ctx = connection_get_ctx();
const char *from = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_FROM); 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 static int
_disco_info_get_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, _disco_info_get_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza,
void * const userdata) void *const userdata)
{ {
xmpp_ctx_t *ctx = (xmpp_ctx_t *)userdata; xmpp_ctx_t *ctx = (xmpp_ctx_t *)userdata;
const char *from = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_FROM); 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 static int
_destroy_room_result_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, _destroy_room_result_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza,
void * const userdata) void *const userdata)
{ {
const char *id = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_ID); 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 static int
_room_config_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, _room_config_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza,
void * const userdata) void *const userdata)
{ {
const char *id = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_ID); const char *id = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_ID);
const char *type = xmpp_stanza_get_type(stanza); 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; return 0;
} }
static int _room_affiliation_set_result_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, static int
void * const userdata) _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 *id = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_ID);
const char *type = xmpp_stanza_get_type(stanza); 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; return 0;
} }
static int _room_role_set_result_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, static int
void * const userdata) _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 *id = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_ID);
const char *type = xmpp_stanza_get_type(stanza); 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 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 *id = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_ID);
const char *type = xmpp_stanza_get_type(stanza); 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 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 *id = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_ID);
const char *type = xmpp_stanza_get_type(stanza); 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 static int
_room_config_submit_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, _room_config_submit_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza,
void * const userdata) void *const userdata)
{ {
const char *id = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_ID); const char *id = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_ID);
const char *type = xmpp_stanza_get_type(stanza); 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 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 *id = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_ID);
const char *type = xmpp_stanza_get_type(stanza); const char *type = xmpp_stanza_get_type(stanza);
@ -1494,8 +1496,8 @@ _item_destroy(DiscoItem *item)
} }
static int static int
_room_info_response_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, _room_info_response_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza,
void * const userdata) void *const userdata)
{ {
const char *type = xmpp_stanza_get_type(stanza); const char *type = xmpp_stanza_get_type(stanza);
ProfRoomInfoData *cb_data = (ProfRoomInfoData *)userdata; 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 static int
_last_activity_response_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, _last_activity_response_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza,
void * const userdata) void *const userdata)
{ {
const char *from = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_FROM); const char *from = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_FROM);
if (!from) { if (!from) {
@ -1628,8 +1630,8 @@ _last_activity_response_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const
} }
static int static int
_disco_info_response_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, _disco_info_response_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza,
void * const userdata) void *const userdata)
{ {
const char *from = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_FROM); const char *from = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_FROM);
const char *type = xmpp_stanza_get_type(stanza); 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 static int
_disco_items_result_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, _disco_items_result_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza,
void * const userdata) void *const userdata)
{ {
log_debug("Received diso#items response"); log_debug("Received diso#items response");

View File

@ -61,13 +61,13 @@
#define HANDLE(ns, type, func) xmpp_handler_add(conn, func, ns, STANZA_NAME_MESSAGE, type, ctx) #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 _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 _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 _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 _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 _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 _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 _receipt_received_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, void *const userdata);
void void
message_add_handlers(void) message_add_handlers(void)
@ -85,7 +85,7 @@ message_add_handlers(void)
} }
static char* static char*
_session_jid(const char * const barejid) _session_jid(const char *const barejid)
{ {
ChatSession *session = chat_session_get(barejid); ChatSession *session = chat_session_get(barejid);
char *jid = NULL; char *jid = NULL;
@ -101,7 +101,7 @@ _session_jid(const char * const barejid)
} }
static char* static char*
_session_state(const char * const barejid) _session_state(const char *const barejid)
{ {
ChatSession *session = chat_session_get(barejid); ChatSession *session = chat_session_get(barejid);
char *state = NULL; char *state = NULL;
@ -118,8 +118,8 @@ _session_state(const char * const barejid)
return state; return state;
} }
char * char*
message_send_chat(const char * const barejid, const char * const msg) message_send_chat(const char *const barejid, const char *const msg)
{ {
xmpp_conn_t * const conn = connection_get_conn(); xmpp_conn_t * const conn = connection_get_conn();
xmpp_ctx_t * const ctx = connection_get_ctx(); 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; return id;
} }
char * char*
message_send_chat_pgp(const char * const barejid, const char * const msg) message_send_chat_pgp(const char *const barejid, const char *const msg)
{ {
xmpp_conn_t * const conn = connection_get_conn(); xmpp_conn_t * const conn = connection_get_conn();
xmpp_ctx_t * const ctx = connection_get_ctx(); 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; return id;
} }
char * char*
message_send_chat_otr(const char * const barejid, const char * const msg) message_send_chat_otr(const char *const barejid, const char *const msg)
{ {
xmpp_conn_t * const conn = connection_get_conn(); xmpp_conn_t * const conn = connection_get_conn();
xmpp_ctx_t * const ctx = connection_get_ctx(); 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 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_conn_t * const conn = connection_get_conn();
xmpp_ctx_t * const ctx = connection_get_ctx(); xmpp_ctx_t * const ctx = connection_get_ctx();
@ -248,7 +248,7 @@ message_send_private(const char * const fulljid, const char * const msg)
} }
void 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_conn_t * const conn = connection_get_conn();
xmpp_ctx_t * const ctx = connection_get_ctx(); xmpp_ctx_t * const ctx = connection_get_ctx();
@ -261,7 +261,7 @@ message_send_groupchat(const char * const roomjid, const char * const msg)
} }
void 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_conn_t * const conn = connection_get_conn();
xmpp_ctx_t * const ctx = connection_get_ctx(); 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 void
message_send_invite(const char * const roomjid, const char * const contact, message_send_invite(const char *const roomjid, const char *const contact,
const char * const reason) const char *const reason)
{ {
xmpp_conn_t * const conn = connection_get_conn(); xmpp_conn_t * const conn = connection_get_conn();
xmpp_ctx_t * const ctx = connection_get_ctx(); xmpp_ctx_t * const ctx = connection_get_ctx();
@ -295,7 +295,7 @@ message_send_invite(const char * const roomjid, const char * const contact,
} }
void void
message_send_composing(const char * const jid) message_send_composing(const char *const jid)
{ {
xmpp_conn_t * const conn = connection_get_conn(); xmpp_conn_t * const conn = connection_get_conn();
xmpp_ctx_t * const ctx = connection_get_ctx(); xmpp_ctx_t * const ctx = connection_get_ctx();
@ -307,7 +307,7 @@ message_send_composing(const char * const jid)
} }
void void
message_send_paused(const char * const jid) message_send_paused(const char *const jid)
{ {
xmpp_conn_t * const conn = connection_get_conn(); xmpp_conn_t * const conn = connection_get_conn();
xmpp_ctx_t * const ctx = connection_get_ctx(); xmpp_ctx_t * const ctx = connection_get_ctx();
@ -317,7 +317,7 @@ message_send_paused(const char * const jid)
} }
void void
message_send_inactive(const char * const jid) message_send_inactive(const char *const jid)
{ {
xmpp_conn_t * const conn = connection_get_conn(); xmpp_conn_t * const conn = connection_get_conn();
xmpp_ctx_t * const ctx = connection_get_ctx(); xmpp_ctx_t * const ctx = connection_get_ctx();
@ -328,7 +328,7 @@ message_send_inactive(const char * const jid)
} }
void void
message_send_gone(const char * const jid) message_send_gone(const char *const jid)
{ {
xmpp_conn_t * const conn = connection_get_conn(); xmpp_conn_t * const conn = connection_get_conn();
xmpp_ctx_t * const ctx = connection_get_ctx(); xmpp_ctx_t * const ctx = connection_get_ctx();
@ -338,7 +338,7 @@ message_send_gone(const char * const jid)
} }
static int 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 *id = xmpp_stanza_get_id(stanza);
char *jid = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_FROM); 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 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_ctx_t *ctx = connection_get_ctx();
xmpp_stanza_t *xns_muc_user = xmpp_stanza_get_child_by_ns(stanza, STANZA_NS_MUC_USER); 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 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); 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 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(); xmpp_ctx_t *ctx = connection_get_ctx();
char *from = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_FROM); 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 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(); xmpp_ctx_t *ctx = connection_get_ctx();
char *message = NULL; char *message = NULL;
@ -584,7 +584,7 @@ _groupchat_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, void
} }
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_conn_t * const conn = connection_get_conn();
xmpp_ctx_t * const ctx = connection_get_ctx(); 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 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); xmpp_stanza_t *receipt = xmpp_stanza_get_child_by_ns(stanza, STANZA_NS_RECEIPTS);
char *name = xmpp_stanza_get_name(receipt); 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 void
_receipt_request_handler(xmpp_stanza_t * const stanza) _receipt_request_handler(xmpp_stanza_t *const stanza)
{ {
if (!prefs_get_boolean(PREF_RECEIPTS_SEND)) { if (!prefs_get_boolean(PREF_RECEIPTS_SEND)) {
return; return;
@ -662,7 +662,7 @@ _receipt_request_handler(xmpp_stanza_t * const stanza)
} }
void 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); xmpp_stanza_t *body = xmpp_stanza_get_child_by_name(stanza, STANZA_NAME_BODY);
if (!body) { if (!body) {
@ -687,7 +687,7 @@ _private_chat_handler(xmpp_stanza_t * const stanza, const char * const fulljid)
} }
static gboolean 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); xmpp_stanza_t *carbons = xmpp_stanza_get_child_by_ns(stanza, STANZA_NS_CARBONS);
if (!carbons) { if (!carbons) {
@ -739,7 +739,7 @@ _handle_carbons(xmpp_stanza_t * const stanza)
} }
static int 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 // ignore if type not chat or absent
char *type = xmpp_stanza_get_type(stanza); char *type = xmpp_stanza_get_type(stanza);

View File

@ -62,23 +62,15 @@
static Autocomplete sub_requests_ac; static Autocomplete sub_requests_ac;
#define HANDLE(ns, type, func) xmpp_handler_add(conn, func, ns, \ #define HANDLE(ns, type, func) xmpp_handler_add(conn, func, ns, STANZA_NAME_PRESENCE, type, ctx)
STANZA_NAME_PRESENCE, type, ctx)
static int _unavailable_handler(xmpp_conn_t * const conn, static int _unavailable_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, void *const userdata);
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 _subscribe_handler(xmpp_conn_t * const conn, static int _subscribed_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, void *const userdata);
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 _subscribed_handler(xmpp_conn_t * const conn, static int _available_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, void *const userdata);
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 _unsubscribed_handler(xmpp_conn_t * const conn, static int _presence_error_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, void *const userdata);
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); 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); static void _send_room_presence(xmpp_conn_t *conn, xmpp_stanza_t *presence);
@ -105,7 +97,7 @@ presence_add_handlers(void)
} }
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); assert(jid != NULL);
@ -149,7 +141,7 @@ presence_subscription(const char * const jid, const jabber_subscr_t action)
free(id); free(id);
} }
GSList * GSList*
presence_get_subscription_requests(void) presence_get_subscription_requests(void)
{ {
return autocomplete_create_list(sub_requests_ac); return autocomplete_create_list(sub_requests_ac);
@ -167,14 +159,14 @@ presence_clear_sub_requests(void)
autocomplete_clear(sub_requests_ac); autocomplete_clear(sub_requests_ac);
} }
char * char*
presence_sub_request_find(const char * const search_str) presence_sub_request_find(const char *const search_str)
{ {
return autocomplete_complete(sub_requests_ac, search_str, TRUE); return autocomplete_complete(sub_requests_ac, search_str, TRUE);
} }
gboolean gboolean
presence_sub_request_exists(const char * const bare_jid) presence_sub_request_exists(const char *const bare_jid)
{ {
gboolean result = FALSE; gboolean result = FALSE;
GSList *requests_p = autocomplete_create_list(sub_requests_ac); GSList *requests_p = autocomplete_create_list(sub_requests_ac);
@ -202,7 +194,7 @@ presence_reset_sub_request_search(void)
} }
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) { if (jabber_get_connection_status() != JABBER_CONNECTED) {
log_warning("Error setting presence, not connected."); log_warning("Error setting presence, not connected.");
@ -317,7 +309,7 @@ presence_join_room(char *room, char *nick, char * passwd)
} }
void 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(room != NULL);
assert(nick != NULL); assert(nick != NULL);
@ -347,7 +339,7 @@ presence_change_room_nick(const char * const room, const char * const nick)
} }
void void
presence_leave_chat_room(const char * const room_jid) presence_leave_chat_room(const char *const room_jid)
{ {
assert(room_jid != NULL); assert(room_jid != NULL);
@ -365,8 +357,8 @@ presence_leave_chat_room(const char * const room_jid)
} }
static int static int
_presence_error_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, _presence_error_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza,
void * const userdata) void *const userdata)
{ {
char *id = xmpp_stanza_get_id(stanza); char *id = xmpp_stanza_get_id(stanza);
char *from = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_FROM); 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 static int
_unsubscribed_handler(xmpp_conn_t * const conn, _unsubscribed_handler(xmpp_conn_t *const conn,
xmpp_stanza_t * const stanza, void * const userdata) xmpp_stanza_t *const stanza, void *const userdata)
{ {
char *from = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_FROM); char *from = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_FROM);
Jid *from_jid = jid_create(from); Jid *from_jid = jid_create(from);
@ -455,8 +447,8 @@ _unsubscribed_handler(xmpp_conn_t * const conn,
} }
static int static int
_subscribed_handler(xmpp_conn_t * const conn, _subscribed_handler(xmpp_conn_t *const conn,
xmpp_stanza_t * const stanza, void * const userdata) xmpp_stanza_t *const stanza, void *const userdata)
{ {
char *from = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_FROM); char *from = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_FROM);
Jid *from_jid = jid_create(from); Jid *from_jid = jid_create(from);
@ -471,8 +463,8 @@ _subscribed_handler(xmpp_conn_t * const conn,
} }
static int static int
_subscribe_handler(xmpp_conn_t * const conn, _subscribe_handler(xmpp_conn_t *const conn,
xmpp_stanza_t * const stanza, void * const userdata) xmpp_stanza_t *const stanza, void *const userdata)
{ {
char *from = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_FROM); char *from = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_FROM);
log_debug("Subscribe presence handler fired for %s", from); log_debug("Subscribe presence handler fired for %s", from);
@ -491,8 +483,8 @@ _subscribe_handler(xmpp_conn_t * const conn,
} }
static int static int
_unavailable_handler(xmpp_conn_t * const conn, _unavailable_handler(xmpp_conn_t *const conn,
xmpp_stanza_t * const stanza, void * const userdata) xmpp_stanza_t *const stanza, void *const userdata)
{ {
ui_input_nonblocking(TRUE); ui_input_nonblocking(TRUE);
@ -568,8 +560,8 @@ _handle_caps(char *jid, XMPPCaps *caps)
} }
static int static int
_available_handler(xmpp_conn_t * const conn, _available_handler(xmpp_conn_t *const conn,
xmpp_stanza_t * const stanza, void * const userdata) xmpp_stanza_t *const stanza, void *const userdata)
{ {
ui_input_nonblocking(TRUE); ui_input_nonblocking(TRUE);
@ -668,7 +660,7 @@ _send_caps_request(char *node, char *caps_key, char *id, char *from)
} }
static int 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); ui_input_nonblocking(TRUE);

View File

@ -60,8 +60,7 @@
#include "xmpp/stanza.h" #include "xmpp/stanza.h"
#include "xmpp/xmpp.h" #include "xmpp/xmpp.h"
#define HANDLE(type, func) xmpp_handler_add(conn, func, XMPP_NS_ROSTER, \ #define HANDLE(type, func) xmpp_handler_add(conn, func, XMPP_NS_ROSTER, STANZA_NAME_IQ, type, ctx)
STANZA_NAME_IQ, type, ctx)
// callback data for group commands // callback data for group commands
typedef struct _group_data { typedef struct _group_data {
@ -70,21 +69,15 @@ typedef struct _group_data {
} GroupData; } GroupData;
// event handlers // event handlers
static int _roster_set_handler(xmpp_conn_t * const conn, static int _roster_set_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, void *const userdata);
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_result_handler(xmpp_conn_t * const conn,
xmpp_stanza_t * const stanza, void * const userdata);
// id handlers // id handlers
static int 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, static int _group_remove_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, void *const userdata);
void * const userdata);
static int
_group_remove_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza,
void * const userdata);
// helper functions // helper functions
GSList * _get_groups_from_item(xmpp_stanza_t *item); GSList* _get_groups_from_item(xmpp_stanza_t *item);
void void
roster_add_handlers(void) roster_add_handlers(void)
@ -107,7 +100,7 @@ roster_request(void)
} }
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_conn_t * const conn = connection_get_conn();
xmpp_ctx_t * const ctx = connection_get_ctx(); 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 void
roster_send_remove(const char * const barejid) roster_send_remove(const char *const barejid)
{ {
xmpp_conn_t * const conn = connection_get_conn(); xmpp_conn_t * const conn = connection_get_conn();
xmpp_ctx_t * const ctx = connection_get_ctx(); xmpp_ctx_t * const ctx = connection_get_ctx();
@ -129,7 +122,7 @@ roster_send_remove(const char * const barejid)
} }
void 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_conn_t * const conn = connection_get_conn();
xmpp_ctx_t * const ctx = connection_get_ctx(); 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 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 *groups = p_contact_groups(contact);
GSList *new_groups = NULL; GSList *new_groups = NULL;
@ -172,8 +165,8 @@ roster_send_add_to_group(const char * const group, PContact contact)
} }
static int static int
_group_add_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, _group_add_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza,
void * const userdata) void *const userdata)
{ {
if (userdata) { if (userdata) {
GroupData *data = userdata; GroupData *data = userdata;
@ -186,7 +179,7 @@ _group_add_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza,
} }
void 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 *groups = p_contact_groups(contact);
GSList *new_groups = NULL; GSList *new_groups = NULL;
@ -219,8 +212,8 @@ roster_send_remove_from_group(const char * const group, PContact contact)
} }
static int static int
_group_remove_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, _group_remove_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza,
void * const userdata) void *const userdata)
{ {
if (userdata) { if (userdata) {
GroupData *data = userdata; GroupData *data = userdata;
@ -233,8 +226,8 @@ _group_remove_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza,
} }
static int static int
_roster_set_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, _roster_set_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza,
void * const userdata) void *const userdata)
{ {
xmpp_stanza_t *query = xmpp_stanza_t *query =
xmpp_stanza_get_child_by_name(stanza, STANZA_NAME_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 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); 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; return 1;
} }
GSList * GSList*
_get_groups_from_item(xmpp_stanza_t *item) _get_groups_from_item(xmpp_stanza_t *item)
{ {
GSList *groups = NULL; GSList *groups = NULL;

View File

@ -56,7 +56,7 @@
#include "muc.h" #include "muc.h"
#if 0 #if 0
xmpp_stanza_t * xmpp_stanza_t*
stanza_create_bookmarks_pubsub_request(xmpp_ctx_t *ctx) stanza_create_bookmarks_pubsub_request(xmpp_ctx_t *ctx)
{ {
xmpp_stanza_t *iq, *pubsub, *items; xmpp_stanza_t *iq, *pubsub, *items;
@ -84,7 +84,7 @@ stanza_create_bookmarks_pubsub_request(xmpp_ctx_t *ctx)
} }
#endif #endif
xmpp_stanza_t * xmpp_stanza_t*
stanza_create_bookmarks_storage_request(xmpp_ctx_t *ctx) stanza_create_bookmarks_storage_request(xmpp_ctx_t *ctx)
{ {
xmpp_stanza_t *iq, *query, *storage; xmpp_stanza_t *iq, *query, *storage;
@ -113,9 +113,9 @@ stanza_create_bookmarks_storage_request(xmpp_ctx_t *ctx)
} }
#if 0 #if 0
xmpp_stanza_t * xmpp_stanza_t*
stanza_create_bookmarks_pubsub_add(xmpp_ctx_t *ctx, const char * const jid, stanza_create_bookmarks_pubsub_add(xmpp_ctx_t *ctx, const char *const jid,
const gboolean autojoin, const char * const nick) const gboolean autojoin, const char *const nick)
{ {
xmpp_stanza_t *stanza = xmpp_stanza_new(ctx); xmpp_stanza_t *stanza = xmpp_stanza_new(ctx);
xmpp_stanza_set_name(stanza, STANZA_NAME_IQ); 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 #endif
xmpp_stanza_t * xmpp_stanza_t*
stanza_enable_carbons(xmpp_ctx_t *ctx){ stanza_enable_carbons(xmpp_ctx_t *ctx)
{
xmpp_stanza_t *iq = xmpp_stanza_new(ctx); xmpp_stanza_t *iq = xmpp_stanza_new(ctx);
char *id = create_unique_id("carbons"); char *id = create_unique_id("carbons");
@ -226,8 +227,9 @@ stanza_enable_carbons(xmpp_ctx_t *ctx){
return iq; return iq;
} }
xmpp_stanza_t * xmpp_stanza_t*
stanza_disable_carbons(xmpp_ctx_t *ctx){ stanza_disable_carbons(xmpp_ctx_t *ctx)
{
xmpp_stanza_t *iq = xmpp_stanza_new(ctx); xmpp_stanza_t *iq = xmpp_stanza_new(ctx);
char *id = create_unique_id("carbons"); char *id = create_unique_id("carbons");
@ -246,8 +248,8 @@ stanza_disable_carbons(xmpp_ctx_t *ctx){
return iq; return iq;
} }
xmpp_stanza_t * xmpp_stanza_t*
stanza_create_chat_state(xmpp_ctx_t *ctx, const char * const fulljid, const char * const state) stanza_create_chat_state(xmpp_ctx_t *ctx, const char *const fulljid, const char *const state)
{ {
xmpp_stanza_t *msg, *chat_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; return msg;
} }
xmpp_stanza_t * xmpp_stanza_t*
stanza_create_room_subject_message(xmpp_ctx_t *ctx, const char * const room, const char * const subject) 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_t *msg = xmpp_stanza_new(ctx);
xmpp_stanza_set_name(msg, STANZA_NAME_MESSAGE); 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; return msg;
} }
xmpp_stanza_t * xmpp_stanza_t*
stanza_attach_state(xmpp_ctx_t *ctx, xmpp_stanza_t *stanza, const char * const state) 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_t *chat_state = xmpp_stanza_new(ctx);
xmpp_stanza_set_name(chat_state, state); 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; return stanza;
} }
xmpp_stanza_t * xmpp_stanza_t*
stanza_attach_carbons_private(xmpp_ctx_t *ctx, xmpp_stanza_t *stanza) stanza_attach_carbons_private(xmpp_ctx_t *ctx, xmpp_stanza_t *stanza)
{ {
xmpp_stanza_t *private_carbon = xmpp_stanza_new(ctx); 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; return stanza;
} }
xmpp_stanza_t * xmpp_stanza_t*
stanza_attach_hints_no_copy(xmpp_ctx_t *ctx, xmpp_stanza_t *stanza) stanza_attach_hints_no_copy(xmpp_ctx_t *ctx, xmpp_stanza_t *stanza)
{ {
xmpp_stanza_t *no_copy = xmpp_stanza_new(ctx); 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; return stanza;
} }
xmpp_stanza_t * xmpp_stanza_t*
stanza_attach_hints_no_store(xmpp_ctx_t *ctx, xmpp_stanza_t *stanza) stanza_attach_hints_no_store(xmpp_ctx_t *ctx, xmpp_stanza_t *stanza)
{ {
xmpp_stanza_t *no_store = xmpp_stanza_new(ctx); 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; return stanza;
} }
xmpp_stanza_t * xmpp_stanza_t*
stanza_attach_receipt_request(xmpp_ctx_t *ctx, xmpp_stanza_t *stanza) stanza_attach_receipt_request(xmpp_ctx_t *ctx, xmpp_stanza_t *stanza)
{ {
xmpp_stanza_t *receipet_request = xmpp_stanza_new(ctx); 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; return stanza;
} }
xmpp_stanza_t * xmpp_stanza_t*
stanza_create_message(xmpp_ctx_t *ctx, char *id, const char * const recipient, stanza_create_message(xmpp_ctx_t *ctx, char *id, const char *const recipient,
const char * const type, const char * const message) const char *const type, const char *const message)
{ {
xmpp_stanza_t *msg, *body, *text; 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; return msg;
} }
xmpp_stanza_t * xmpp_stanza_t*
stanza_create_roster_remove_set(xmpp_ctx_t *ctx, const char * const barejid) stanza_create_roster_remove_set(xmpp_ctx_t *ctx, const char *const barejid)
{ {
xmpp_stanza_t *iq = xmpp_stanza_new(ctx); xmpp_stanza_t *iq = xmpp_stanza_new(ctx);
xmpp_stanza_set_name(iq, STANZA_NAME_IQ); 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 * xmpp_stanza_t*
stanza_create_roster_set(xmpp_ctx_t *ctx, const char * const id, stanza_create_roster_set(xmpp_ctx_t *ctx, const char *const id,
const char * const jid, const char * const handle, GSList *groups) const char *const jid, const char *const handle, GSList *groups)
{ {
xmpp_stanza_t *iq = xmpp_stanza_new(ctx); xmpp_stanza_t *iq = xmpp_stanza_new(ctx);
xmpp_stanza_set_name(iq, STANZA_NAME_IQ); 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; return iq;
} }
xmpp_stanza_t * xmpp_stanza_t*
stanza_create_invite(xmpp_ctx_t *ctx, const char * const room, stanza_create_invite(xmpp_ctx_t *ctx, const char *const room,
const char * const contact, const char * const reason, const char * const password) const char *const contact, const char *const reason, const char *const password)
{ {
xmpp_stanza_t *message, *x; xmpp_stanza_t *message, *x;
@ -481,9 +483,9 @@ stanza_create_invite(xmpp_ctx_t *ctx, const char * const room,
return message; return message;
} }
xmpp_stanza_t * xmpp_stanza_t*
stanza_create_mediated_invite(xmpp_ctx_t *ctx, const char * const room, stanza_create_mediated_invite(xmpp_ctx_t *ctx, const char *const room,
const char * const contact, const char * const reason) const char *const contact, const char *const reason)
{ {
xmpp_stanza_t *message, *x, *invite; xmpp_stanza_t *message, *x, *invite;
@ -521,9 +523,9 @@ stanza_create_mediated_invite(xmpp_ctx_t *ctx, const char * const room,
return message; return message;
} }
xmpp_stanza_t * xmpp_stanza_t*
stanza_create_room_join_presence(xmpp_ctx_t * const ctx, stanza_create_room_join_presence(xmpp_ctx_t *const ctx,
const char * const full_room_jid, const char * const passwd) const char *const full_room_jid, const char *const passwd)
{ {
xmpp_stanza_t *presence = xmpp_stanza_new(ctx); xmpp_stanza_t *presence = xmpp_stanza_new(ctx);
xmpp_stanza_set_name(presence, STANZA_NAME_PRESENCE); xmpp_stanza_set_name(presence, STANZA_NAME_PRESENCE);
@ -554,9 +556,9 @@ stanza_create_room_join_presence(xmpp_ctx_t * const ctx,
return presence; return presence;
} }
xmpp_stanza_t * xmpp_stanza_t*
stanza_create_room_newnick_presence(xmpp_ctx_t *ctx, 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); xmpp_stanza_t *presence = xmpp_stanza_new(ctx);
char *id = create_unique_id("sub"); char *id = create_unique_id("sub");
@ -568,9 +570,9 @@ stanza_create_room_newnick_presence(xmpp_ctx_t *ctx,
return presence; return presence;
} }
xmpp_stanza_t * xmpp_stanza_t*
stanza_create_room_leave_presence(xmpp_ctx_t *ctx, const char * const room, stanza_create_room_leave_presence(xmpp_ctx_t *ctx, const char *const room,
const char * const nick) const char *const nick)
{ {
GString *full_jid = g_string_new(room); GString *full_jid = g_string_new(room);
g_string_append(full_jid, "/"); g_string_append(full_jid, "/");
@ -589,8 +591,8 @@ stanza_create_room_leave_presence(xmpp_ctx_t *ctx, const char * const room,
return presence; return presence;
} }
xmpp_stanza_t * xmpp_stanza_t*
stanza_create_instant_room_request_iq(xmpp_ctx_t *ctx, const char * const room_jid) 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_t *iq = xmpp_stanza_new(ctx);
xmpp_stanza_set_name(iq, STANZA_NAME_IQ); 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; return iq;
} }
xmpp_stanza_t * xmpp_stanza_t*
stanza_create_instant_room_destroy_iq(xmpp_ctx_t *ctx, const char * const room_jid) 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_t *iq = xmpp_stanza_new(ctx);
xmpp_stanza_set_name(iq, STANZA_NAME_IQ); 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; return iq;
} }
xmpp_stanza_t * xmpp_stanza_t*
stanza_create_room_config_request_iq(xmpp_ctx_t *ctx, const char * const room_jid) 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_t *iq = xmpp_stanza_new(ctx);
xmpp_stanza_set_name(iq, STANZA_NAME_IQ); 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; return iq;
} }
xmpp_stanza_t * xmpp_stanza_t*
stanza_create_room_config_cancel_iq(xmpp_ctx_t *ctx, const char * const room_jid) 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_t *iq = xmpp_stanza_new(ctx);
xmpp_stanza_set_name(iq, STANZA_NAME_IQ); 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; return iq;
} }
xmpp_stanza_t * xmpp_stanza_t*
stanza_create_room_affiliation_list_iq(xmpp_ctx_t *ctx, const char * const room, const char * const affiliation) 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_t *iq = xmpp_stanza_new(ctx);
xmpp_stanza_set_name(iq, STANZA_NAME_IQ); 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; return iq;
} }
xmpp_stanza_t * xmpp_stanza_t*
stanza_create_room_role_list_iq(xmpp_ctx_t *ctx, const char * const room, const char * const role) 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_t *iq = xmpp_stanza_new(ctx);
xmpp_stanza_set_name(iq, STANZA_NAME_IQ); 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; return iq;
} }
xmpp_stanza_t * xmpp_stanza_t*
stanza_create_room_affiliation_set_iq(xmpp_ctx_t *ctx, const char * const room, const char * const jid, 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) const char *const affiliation, const char *const reason)
{ {
xmpp_stanza_t *iq = xmpp_stanza_new(ctx); xmpp_stanza_t *iq = xmpp_stanza_new(ctx);
xmpp_stanza_set_name(iq, STANZA_NAME_IQ); 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; return iq;
} }
xmpp_stanza_t * xmpp_stanza_t*
stanza_create_room_role_set_iq(xmpp_ctx_t * const ctx, const char * const room, const char * const nick, 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) const char *const role, const char *const reason)
{ {
xmpp_stanza_t *iq = xmpp_stanza_new(ctx); xmpp_stanza_t *iq = xmpp_stanza_new(ctx);
xmpp_stanza_set_name(iq, STANZA_NAME_IQ); 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; return iq;
} }
xmpp_stanza_t * xmpp_stanza_t*
stanza_create_room_kick_iq(xmpp_ctx_t * const ctx, const char * const room, const char * const nick, stanza_create_room_kick_iq(xmpp_ctx_t *const ctx, const char *const room, const char *const nick,
const char * const reason) const char *const reason)
{ {
xmpp_stanza_t *iq = xmpp_stanza_new(ctx); xmpp_stanza_t *iq = xmpp_stanza_new(ctx);
xmpp_stanza_set_name(iq, STANZA_NAME_IQ); 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; return iq;
} }
xmpp_stanza_t * xmpp_stanza_t*
stanza_create_presence(xmpp_ctx_t * const ctx) stanza_create_presence(xmpp_ctx_t *const ctx)
{ {
xmpp_stanza_t *presence = xmpp_stanza_new(ctx); xmpp_stanza_t *presence = xmpp_stanza_new(ctx);
xmpp_stanza_set_name(presence, STANZA_NAME_PRESENCE); xmpp_stanza_set_name(presence, STANZA_NAME_PRESENCE);
@ -881,8 +883,8 @@ stanza_create_presence(xmpp_ctx_t * const ctx)
return presence; return presence;
} }
xmpp_stanza_t * xmpp_stanza_t*
stanza_create_software_version_iq(xmpp_ctx_t *ctx, const char * const fulljid) stanza_create_software_version_iq(xmpp_ctx_t *ctx, const char *const fulljid)
{ {
xmpp_stanza_t *iq = xmpp_stanza_new(ctx); xmpp_stanza_t *iq = xmpp_stanza_new(ctx);
xmpp_stanza_set_name(iq, STANZA_NAME_IQ); 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; return iq;
} }
xmpp_stanza_t * xmpp_stanza_t*
stanza_create_roster_iq(xmpp_ctx_t *ctx) stanza_create_roster_iq(xmpp_ctx_t *ctx)
{ {
xmpp_stanza_t *iq = xmpp_stanza_new(ctx); xmpp_stanza_t *iq = xmpp_stanza_new(ctx);
@ -922,9 +924,9 @@ stanza_create_roster_iq(xmpp_ctx_t *ctx)
return iq; return iq;
} }
xmpp_stanza_t * xmpp_stanza_t*
stanza_create_disco_info_iq(xmpp_ctx_t *ctx, const char * const id, const char * const to, stanza_create_disco_info_iq(xmpp_ctx_t *ctx, const char *const id, const char *const to,
const char * const node) const char *const node)
{ {
xmpp_stanza_t *iq = xmpp_stanza_new(ctx); xmpp_stanza_t *iq = xmpp_stanza_new(ctx);
xmpp_stanza_set_name(iq, STANZA_NAME_IQ); 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; return iq;
} }
xmpp_stanza_t * xmpp_stanza_t*
stanza_create_disco_items_iq(xmpp_ctx_t *ctx, const char * const id, stanza_create_disco_items_iq(xmpp_ctx_t *ctx, const char *const id,
const char * const jid) const char *const jid)
{ {
xmpp_stanza_t *iq = xmpp_stanza_new(ctx); xmpp_stanza_t *iq = xmpp_stanza_new(ctx);
xmpp_stanza_set_name(iq, STANZA_NAME_IQ); 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; return iq;
} }
xmpp_stanza_t * xmpp_stanza_t*
stanza_create_last_activity_iq(xmpp_ctx_t *ctx, const char * const id, const char * const to) 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_t *iq = xmpp_stanza_new(ctx);
xmpp_stanza_set_name(iq, STANZA_NAME_IQ); 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; return iq;
} }
xmpp_stanza_t * xmpp_stanza_t*
stanza_create_room_config_submit_iq(xmpp_ctx_t *ctx, const char * const room, DataForm *form) 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_t *iq = xmpp_stanza_new(ctx);
xmpp_stanza_set_name(iq, STANZA_NAME_IQ); 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_get_child_by_name(stanza, STANZA_NAME_INACTIVE) != NULL));
} }
xmpp_stanza_t * xmpp_stanza_t*
stanza_create_ping_iq(xmpp_ctx_t *ctx, const char * const target) stanza_create_ping_iq(xmpp_ctx_t *ctx, const char *const target)
{ {
xmpp_stanza_t *iq = xmpp_stanza_new(ctx); xmpp_stanza_t *iq = xmpp_stanza_new(ctx);
xmpp_stanza_set_name(iq, STANZA_NAME_IQ); 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* GDateTime*
stanza_get_delay(xmpp_stanza_t * const stanza) stanza_get_delay(xmpp_stanza_t *const stanza)
{ {
GTimeVal utc_stamp; GTimeVal utc_stamp;
// first check for XEP-0203 delayed delivery // first check for XEP-0203 delayed delivery
@ -1081,7 +1083,7 @@ stanza_get_delay(xmpp_stanza_t * const stanza)
return NULL; return NULL;
} }
char * char*
stanza_get_status(xmpp_stanza_t *stanza, char *def) stanza_get_status(xmpp_stanza_t *stanza, char *def)
{ {
xmpp_ctx_t *ctx = connection_get_ctx(); 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) stanza_get_show(xmpp_stanza_t *stanza, char *def)
{ {
xmpp_ctx_t *ctx = connection_get_ctx(); xmpp_ctx_t *ctx = connection_get_ctx();
@ -1130,7 +1132,7 @@ stanza_get_show(xmpp_stanza_t *stanza, char *def)
} }
gboolean gboolean
stanza_is_muc_presence(xmpp_stanza_t * const stanza) stanza_is_muc_presence(xmpp_stanza_t *const stanza)
{ {
if (stanza == NULL) { if (stanza == NULL) {
return FALSE; return FALSE;
@ -1149,7 +1151,7 @@ stanza_is_muc_presence(xmpp_stanza_t * const stanza)
} }
gboolean 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 // no stanza, or not presence stanza
if ((stanza == NULL) || (g_strcmp0(xmpp_stanza_get_name(stanza), STANZA_NAME_PRESENCE) != 0)) { 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 gboolean
stanza_is_muc_self_presence(xmpp_stanza_t * const stanza, stanza_is_muc_self_presence(xmpp_stanza_t *const stanza,
const char * const self_jid) const char *const self_jid)
{ {
// no stanza, or not presence stanza // no stanza, or not presence stanza
if ((stanza == NULL) || (g_strcmp0(xmpp_stanza_get_name(stanza), STANZA_NAME_PRESENCE) != 0)) { 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; return FALSE;
} }
GSList * GSList*
stanza_get_status_codes_by_ns(xmpp_stanza_t * const stanza, char *ns) stanza_get_status_codes_by_ns(xmpp_stanza_t *const stanza, char *ns)
{ {
GSList *codes = NULL; GSList *codes = NULL;
xmpp_stanza_t *ns_child = xmpp_stanza_get_child_by_ns(stanza, ns); 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; return FALSE;
} }
char * char*
stanza_get_muc_destroy_alternative_room(xmpp_stanza_t *stanza) stanza_get_muc_destroy_alternative_room(xmpp_stanza_t *stanza)
{ {
char *stanza_name = xmpp_stanza_get_name(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; return NULL;
} }
char * char*
stanza_get_muc_destroy_alternative_password(xmpp_stanza_t *stanza) stanza_get_muc_destroy_alternative_password(xmpp_stanza_t *stanza)
{ {
char *stanza_name = xmpp_stanza_get_name(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; return NULL;
} }
char * char*
stanza_get_muc_destroy_reason(xmpp_stanza_t *stanza) stanza_get_muc_destroy_reason(xmpp_stanza_t *stanza)
{ {
char *stanza_name = xmpp_stanza_get_name(stanza); char *stanza_name = xmpp_stanza_get_name(stanza);
@ -1356,7 +1358,7 @@ stanza_get_muc_destroy_reason(xmpp_stanza_t *stanza)
return NULL; return NULL;
} }
char * char*
stanza_get_actor(xmpp_stanza_t *stanza) stanza_get_actor(xmpp_stanza_t *stanza)
{ {
char *stanza_name = xmpp_stanza_get_name(stanza); char *stanza_name = xmpp_stanza_get_name(stanza);
@ -1382,7 +1384,7 @@ stanza_get_actor(xmpp_stanza_t *stanza)
return NULL; return NULL;
} }
char * char*
stanza_get_reason(xmpp_stanza_t *stanza) stanza_get_reason(xmpp_stanza_t *stanza)
{ {
char *stanza_name = xmpp_stanza_get_name(stanza); char *stanza_name = xmpp_stanza_get_name(stanza);
@ -1405,7 +1407,7 @@ stanza_get_reason(xmpp_stanza_t *stanza)
} }
gboolean 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 // no stanza, or not presence stanza
if ((stanza == NULL) || (g_strcmp0(xmpp_stanza_get_name(stanza), STANZA_NAME_PRESENCE) != 0)) { 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; return FALSE;
} }
char * char*
stanza_get_new_nick(xmpp_stanza_t * const stanza) stanza_get_new_nick(xmpp_stanza_t *const stanza)
{ {
if (!stanza_is_room_nick_change(stanza)) { if (!stanza_is_room_nick_change(stanza)) {
return NULL; return NULL;
@ -1456,7 +1458,7 @@ stanza_get_new_nick(xmpp_stanza_t * const stanza)
} }
int 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); 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* 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); 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; return caps;
} }
char * char*
stanza_get_caps_str(xmpp_stanza_t * const stanza) stanza_get_caps_str(xmpp_stanza_t *const stanza)
{ {
xmpp_stanza_t *caps = xmpp_stanza_get_child_by_name(stanza, STANZA_NAME_C); 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; return caps_str;
} }
char * char*
stanza_get_error_message(xmpp_stanza_t *stanza) stanza_get_error_message(xmpp_stanza_t *stanza)
{ {
xmpp_ctx_t *ctx = connection_get_ctx(); xmpp_ctx_t *ctx = connection_get_ctx();
@ -1607,7 +1609,7 @@ stanza_get_error_message(xmpp_stanza_t *stanza)
} }
void 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) const int pri)
{ {
if (pri != 0) { if (pri != 0) {
@ -1627,8 +1629,8 @@ stanza_attach_priority(xmpp_ctx_t * const ctx, xmpp_stanza_t * const presence,
} }
void void
stanza_attach_show(xmpp_ctx_t * const ctx, xmpp_stanza_t * const presence, stanza_attach_show(xmpp_ctx_t *const ctx, xmpp_stanza_t *const presence,
const char * const show) const char *const show)
{ {
if (show) { if (show) {
xmpp_stanza_t *show_stanza = xmpp_stanza_new(ctx); 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 void
stanza_attach_status(xmpp_ctx_t * const ctx, xmpp_stanza_t * const presence, stanza_attach_status(xmpp_ctx_t *const ctx, xmpp_stanza_t *const presence,
const char * const status) const char *const status)
{ {
if (status) { if (status) {
xmpp_stanza_t *status_stanza = xmpp_stanza_new(ctx); 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 void
stanza_attach_last_activity(xmpp_ctx_t * const ctx, stanza_attach_last_activity(xmpp_ctx_t *const ctx,
xmpp_stanza_t * const presence, const int idle) xmpp_stanza_t *const presence, const int idle)
{ {
xmpp_stanza_t *query = xmpp_stanza_new(ctx); xmpp_stanza_t *query = xmpp_stanza_new(ctx);
xmpp_stanza_set_name(query, STANZA_NAME_QUERY); xmpp_stanza_set_name(query, STANZA_NAME_QUERY);
@ -1673,7 +1675,7 @@ stanza_attach_last_activity(xmpp_ctx_t * const ctx,
} }
void 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_t *caps = xmpp_stanza_new(ctx);
xmpp_stanza_set_name(caps, STANZA_NAME_C); 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); xmpp_stanza_release(query);
} }
const char * const char*
stanza_get_presence_string_from_type(resource_presence_t presence_type) stanza_get_presence_string_from_type(resource_presence_t presence_type)
{ {
switch(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) stanza_parse_presence(xmpp_stanza_t *stanza, int *err)
{ {
char *from = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_FROM); char *from = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_FROM);

View File

@ -195,111 +195,100 @@ typedef enum {
xmpp_stanza_t* stanza_create_bookmarks_storage_request(xmpp_ctx_t *ctx); 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, 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_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_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_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_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_receipt_request(xmpp_ctx_t *ctx, xmpp_stanza_t *stanza);
xmpp_stanza_t* stanza_create_message(xmpp_ctx_t *ctx, char *id, 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, xmpp_stanza_t* stanza_create_room_join_presence(xmpp_ctx_t *const ctx,
const char * const full_room_jid, const char * const passwd); const char *const full_room_jid, const char *const passwd);
xmpp_stanza_t* stanza_create_room_newnick_presence(xmpp_ctx_t *ctx, 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, 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_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_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, xmpp_stanza_t* stanza_create_disco_info_iq(xmpp_ctx_t *ctx, const char *const id,
const char * const to, const char * const node); const char *const to, const char *const node);
xmpp_stanza_t* stanza_create_last_activity_iq(xmpp_ctx_t *ctx, const char * const id, xmpp_stanza_t* stanza_create_last_activity_iq(xmpp_ctx_t *ctx, const char *const id,
const char * const to); const char *const to);
xmpp_stanza_t* stanza_create_invite(xmpp_ctx_t *ctx, const char * const room, 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); 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, xmpp_stanza_t* stanza_create_mediated_invite(xmpp_ctx_t *ctx, const char *const room,
const char * const contact, const char * const reason); const char *const contact, const char *const reason);
gboolean stanza_contains_chat_state(xmpp_stanza_t *stanza); 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_presence(xmpp_stanza_t *const stanza);
gboolean stanza_is_muc_self_presence(xmpp_stanza_t * const stanza, gboolean stanza_is_muc_self_presence(xmpp_stanza_t *const stanza,
const char * const self_jid); const char *const self_jid);
gboolean stanza_is_room_nick_change(xmpp_stanza_t * const stanza); gboolean stanza_is_room_nick_change(xmpp_stanza_t *const stanza);
gboolean stanza_muc_requires_config(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); char* stanza_get_new_nick(xmpp_stanza_t *const stanza);
xmpp_stanza_t* stanza_create_instant_room_request_iq(xmpp_ctx_t *ctx, xmpp_stanza_t* stanza_create_instant_room_request_iq(xmpp_ctx_t *ctx, const char *const room_jid);
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_instant_room_destroy_iq(xmpp_ctx_t *ctx, xmpp_stanza_t* stanza_create_room_config_request_iq(xmpp_ctx_t *ctx, const char *const room_jid);
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_request_iq(xmpp_ctx_t *ctx, xmpp_stanza_t* stanza_create_room_config_submit_iq(xmpp_ctx_t *ctx, const char *const room, DataForm *form);
const char * const room_jid); xmpp_stanza_t* stanza_create_room_affiliation_list_iq(xmpp_ctx_t *ctx, const char *const room,
xmpp_stanza_t* stanza_create_room_config_cancel_iq(xmpp_ctx_t *ctx, const char *const affiliation);
const char * const room_jid); xmpp_stanza_t* stanza_create_room_affiliation_set_iq(xmpp_ctx_t *ctx, const char *const room, const char *const jid,
xmpp_stanza_t* stanza_create_room_config_submit_iq(xmpp_ctx_t *ctx, const char *const affiliation, const char *const reason);
const char * const room, DataForm *form); xmpp_stanza_t* stanza_create_room_role_set_iq(xmpp_ctx_t *const ctx, const char *const room, const char *const jid,
xmpp_stanza_t* stanza_create_room_affiliation_list_iq(xmpp_ctx_t *ctx, const char * const room, const char *const role, const char *const reason);
const char * const affiliation); 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_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_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, 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); const char *const reason);
int stanza_get_idle_time(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); 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_destroy_form(DataForm *form);
void stanza_attach_priority(xmpp_ctx_t * const ctx, void stanza_attach_priority(xmpp_ctx_t *const ctx, xmpp_stanza_t *const presence, const int pri);
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_last_activity(xmpp_ctx_t * const ctx, void stanza_attach_caps(xmpp_ctx_t *const ctx, xmpp_stanza_t *const presence);
xmpp_stanza_t * const presence, const int idle); void stanza_attach_show(xmpp_ctx_t *const ctx, xmpp_stanza_t *const presence, const char *const show);
void stanza_attach_caps(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);
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); 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_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, xmpp_stanza_t* stanza_create_disco_items_iq(xmpp_ctx_t *ctx, const char *const id, const char *const jid);
const char * const jid);
char * stanza_get_status(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); 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, xmpp_stanza_t* stanza_create_roster_set(xmpp_ctx_t *ctx, const char *const id, const char *const jid,
const char * const jid, const char * const handle, GSList *groups); const char *const handle, GSList *groups);
xmpp_stanza_t * stanza_create_roster_remove_set(xmpp_ctx_t *ctx, xmpp_stanza_t* stanza_create_roster_remove_set(xmpp_ctx_t *ctx, const char *const barejid);
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); 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_room(xmpp_stanza_t *stanza);
char* stanza_get_muc_destroy_alternative_password(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); XMPPPresence* stanza_parse_presence(xmpp_stanza_t *stanza, int *err);
void stanza_free_presence(XMPPPresence *presence); 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); void stanza_free_caps(XMPPCaps *caps);
#endif #endif

View File

@ -138,81 +138,78 @@ typedef struct data_form_t {
// connection functions // connection functions
void jabber_init(void); void jabber_init(void);
jabber_conn_status_t jabber_connect_with_details(const char * const jid, jabber_conn_status_t jabber_connect_with_details(const char *const jid, const char *const passwd,
const char * const passwd, const char * const altdomain, const int port, const char *const tls_policy); 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_account(const ProfAccount *const account);
void jabber_disconnect(void); void jabber_disconnect(void);
void jabber_shutdown(void); void jabber_shutdown(void);
void jabber_process_events(int millis); void jabber_process_events(int millis);
const char * jabber_get_fulljid(void); const char* jabber_get_fulljid(void);
const char * jabber_get_domain(void); const char* jabber_get_domain(void);
jabber_conn_status_t jabber_get_connection_status(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); char* jabber_get_account_name(void);
GList * jabber_get_available_resources(void); GList* jabber_get_available_resources(void);
char* jabber_create_uuid(void); char* jabber_create_uuid(void);
void jabber_free_uuid(char *uuid); void jabber_free_uuid(char *uuid);
// message functions // message functions
char* message_send_chat(const char * const barejid, const char * const msg); 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_otr(const char *const barejid, const char *const msg);
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);
void message_send_private(const char * const fulljid, 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(const char *const roomjid, const char *const msg);
void message_send_groupchat_subject(const char * const roomjid, const char * const subject); void message_send_groupchat_subject(const char *const roomjid, const char *const subject);
void message_send_inactive(const char * const jid); void message_send_inactive(const char *const jid);
void message_send_composing(const char * const jid); void message_send_composing(const char *const jid);
void message_send_paused(const char * const jid); void message_send_paused(const char *const jid);
void message_send_gone(const char * const jid); void message_send_gone(const char *const jid);
void message_send_invite(const char * const room, const char * const contact, void message_send_invite(const char *const room, const char *const contact, const char *const reason);
const char * const reason);
// presence functions // 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); GSList* presence_get_subscription_requests(void);
gint presence_sub_request_count(void); gint presence_sub_request_count(void);
void presence_reset_sub_request_search(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_join_room(char *room, char *nick, char * passwd);
void presence_change_room_nick(const char * const room, const char * const nick); 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_leave_chat_room(const char *const room_jid);
void presence_send(resource_presence_t status, const char * const msg, int idle, char *signed_status); 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); gboolean presence_sub_request_exists(const char *const bare_jid);
// iq functions // iq functions
void iq_enable_carbons(); void iq_enable_carbons(void);
void iq_disable_carbons(); void iq_disable_carbons(void);
void iq_send_software_version(const char * const fulljid); void iq_send_software_version(const char *const fulljid);
void iq_room_list_request(gchar *conferencejid); void iq_room_list_request(gchar *conferencejid);
void iq_disco_info_request(gchar *jid); void iq_disco_info_request(gchar *jid);
void iq_disco_items_request(gchar *jid); void iq_disco_items_request(gchar *jid);
void iq_last_activity_request(gchar *jid); void iq_last_activity_request(gchar *jid);
void iq_set_autoping(int seconds); void iq_set_autoping(int seconds);
void iq_confirm_instant_room(const char * const room_jid); void iq_confirm_instant_room(const char *const room_jid);
void iq_destroy_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_request_room_config_form(const char *const room_jid);
void iq_submit_room_config(const char * const room, DataForm *form); void iq_submit_room_config(const char *const room, DataForm *form);
void iq_room_config_cancel(const char * const room_jid); void iq_room_config_cancel(const char *const room_jid);
void iq_send_ping(const char * const target); void iq_send_ping(const char *const target);
void iq_send_caps_request(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);
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,
void iq_send_caps_request_for_jid(const char * const to, const char * const id, const char *const ver);
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,
void iq_send_caps_request_legacy(const char * const to, const char * const id, const char *const ver);
const char * const node, const char * const ver); void iq_room_info_request(const char *const room, gboolean display_result);
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_list(const char * const room, char *affiliation); void iq_room_affiliation_set(const char *const room, const char *const jid, char *affiliation,
void iq_room_affiliation_set(const char * const room, const char * const jid, char *affiliation, const char *const reason);
const char * const reason); void iq_room_kick_occupant(const char *const room, const char *const nick, 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_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); void iq_room_role_list(const char * const room, char *role);
// caps functions // caps functions
Capabilities* caps_lookup(const char * const jid); Capabilities* caps_lookup(const char *const jid);
void caps_close(void); void caps_close(void);
void caps_destroy(Capabilities *caps); 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_update(const char *jid, const char *nick, const char *password, const char *autojoin_str);
gboolean bookmark_remove(const char *jid); gboolean bookmark_remove(const char *jid);
gboolean bookmark_join(const char *jid); gboolean bookmark_join(const char *jid);
const GList * bookmark_get_list(void); const GList* bookmark_get_list(void);
char * bookmark_find(const char * const search_str); char* bookmark_find(const char *const search_str);
void bookmark_autocomplete_reset(void); void bookmark_autocomplete_reset(void);
void roster_send_name_change(const char * const barejid, const char * const new_name, GSList *groups); 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_add_to_group(const char *const group, PContact contact);
void roster_send_remove_from_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_add_new(const char *const barejid, const char *const name);
void roster_send_remove(const char * const barejid); void roster_send_remove(const char *const barejid);
void form_destroy(DataForm *form); void form_destroy(DataForm *form);
char * form_get_form_type_field(DataForm *form); char* form_get_form_type_field(DataForm *form);
void form_set_value(DataForm *form, const char * const tag, char *value); 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); 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); 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_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_remove_text_multi_value(DataForm *form, const char *const tag, int index);
gboolean form_tag_exists(DataForm *form, const char * const tag); gboolean form_tag_exists(DataForm *form, const char *const tag);
form_field_type_t form_get_field_type(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); gboolean form_field_contains_option(DataForm *form, const char *const tag, char *value);
int form_get_value_count(DataForm *form, const char * const tag); int form_get_value_count(DataForm *form, const char *const tag);
FormField* form_get_field_by_tag(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); Autocomplete form_get_value_ac(DataForm *form, const char *const tag);
void form_reset_autocompleters(DataForm *form); void form_reset_autocompleters(DataForm *form);
GSList * form_get_non_form_type_fields_sorted(DataForm *form); GSList* form_get_non_form_type_fields_sorted(DataForm *form);
GSList * form_get_field_values_sorted(FormField *field); GSList* form_get_field_values_sorted(FormField *field);
#endif #endif