1
1
mirror of https://github.com/profanity-im/profanity.git synced 2025-01-03 14:57:42 -05:00

Applied coding style to commands.c

This commit is contained in:
James Booth 2015-10-25 00:31:42 +01:00
parent fa53e23805
commit 99b2d5fda2

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,7 +2058,7 @@ 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];
@ -2144,7 +2143,7 @@ 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();
Occupant *occupant = NULL; Occupant *occupant = NULL;
@ -2220,7 +2219,7 @@ 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();
@ -2307,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) {
@ -2401,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];
@ -2437,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);
@ -2446,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.");
@ -2677,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();
@ -2754,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();
@ -2787,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();
@ -2815,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();
@ -2862,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();
@ -2932,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();
@ -3000,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();
@ -3063,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();
@ -3148,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();
@ -3169,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();
@ -3280,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();
@ -3310,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);
@ -3340,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();
@ -3362,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];
@ -3434,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];
@ -3486,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;
@ -3565,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();
@ -3588,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);
@ -3598,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);
@ -3620,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) {
@ -3772,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);
@ -3787,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);
@ -3804,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);
@ -3818,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];
@ -3842,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];
@ -3985,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];
@ -4031,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];
@ -4087,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];
@ -4111,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];
@ -4136,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();
@ -4156,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)) {
@ -4259,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();
@ -4287,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 &&
@ -4340,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);
@ -4353,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();
@ -4365,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);
@ -4398,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);
@ -4411,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);
@ -4419,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);
@ -4432,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);
@ -4452,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);
@ -4465,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) {
@ -4735,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) {
@ -5055,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);
} }
@ -5063,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);
@ -5083,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.");