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