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

Applied coding style to command.c

This commit is contained in:
James Booth 2015-10-25 00:25:10 +01:00
parent 1d4d693a53
commit cded90bcd0

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;