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:
parent
fa53e23805
commit
99b2d5fda2
@ -73,17 +73,16 @@
|
||||
#include "event/ui_events.h"
|
||||
|
||||
static void _update_presence(const resource_presence_t presence,
|
||||
const char * const show, gchar **args);
|
||||
static gboolean _cmd_set_boolean_preference(gchar *arg, const char * const command,
|
||||
const char * const display, preference_t pref);
|
||||
//static void _cmd_show_filtered_help(char *heading, gchar *cmd_filter[], int filter_size);
|
||||
static void _who_room(ProfWin *window, const char * const command, gchar **args);
|
||||
static void _who_roster(ProfWin *window, const char * const command, gchar **args);
|
||||
const char *const show, gchar **args);
|
||||
static gboolean _cmd_set_boolean_preference(gchar *arg, const char *const command,
|
||||
const char *const display, preference_t pref);
|
||||
static void _who_room(ProfWin *window, const char *const command, gchar **args);
|
||||
static void _who_roster(ProfWin *window, const char *const command, gchar **args);
|
||||
|
||||
extern GHashTable *commands;
|
||||
|
||||
gboolean
|
||||
cmd_execute_default(ProfWin *window, const char * inp)
|
||||
cmd_execute_default(ProfWin *window, const char *inp)
|
||||
{
|
||||
// handle escaped commands - treat as normal message
|
||||
if (g_str_has_prefix(inp, "//")) {
|
||||
@ -138,7 +137,7 @@ cmd_execute_default(ProfWin *window, const char * inp)
|
||||
}
|
||||
|
||||
gboolean
|
||||
cmd_execute_alias(ProfWin *window, const char * const inp, gboolean *ran)
|
||||
cmd_execute_alias(ProfWin *window, const char *const inp, gboolean *ran)
|
||||
{
|
||||
if (inp[0] != '/') {
|
||||
ran = FALSE;
|
||||
@ -158,7 +157,7 @@ cmd_execute_alias(ProfWin *window, const char * const inp, gboolean *ran)
|
||||
}
|
||||
|
||||
gboolean
|
||||
cmd_tls(ProfWin *window, const char * const command, gchar **args)
|
||||
cmd_tls(ProfWin *window, const char *const command, gchar **args)
|
||||
{
|
||||
if (g_strcmp0(args[0], "certpath") == 0) {
|
||||
if (g_strcmp0(args[1], "set") == 0) {
|
||||
@ -247,7 +246,7 @@ cmd_tls(ProfWin *window, const char * const command, gchar **args)
|
||||
}
|
||||
|
||||
gboolean
|
||||
cmd_connect(ProfWin *window, const char * const command, gchar **args)
|
||||
cmd_connect(ProfWin *window, const char *const command, gchar **args)
|
||||
{
|
||||
jabber_conn_status_t conn_status = jabber_get_connection_status();
|
||||
if ((conn_status != JABBER_DISCONNECTED) && (conn_status != JABBER_STARTED)) {
|
||||
@ -361,7 +360,7 @@ cmd_connect(ProfWin *window, const char * const command, gchar **args)
|
||||
}
|
||||
|
||||
gboolean
|
||||
cmd_account(ProfWin *window, const char * const command, gchar **args)
|
||||
cmd_account(ProfWin *window, const char *const command, gchar **args)
|
||||
{
|
||||
char *subcmd = args[0];
|
||||
|
||||
@ -711,7 +710,7 @@ cmd_account(ProfWin *window, const char * const command, gchar **args)
|
||||
}
|
||||
|
||||
gboolean
|
||||
cmd_script(ProfWin *window, const char * const command, gchar **args)
|
||||
cmd_script(ProfWin *window, const char *const command, gchar **args)
|
||||
{
|
||||
if ((g_strcmp0(args[0], "run") == 0) && args[1]) {
|
||||
gboolean res = scripts_exec(args[1]);
|
||||
@ -734,7 +733,7 @@ cmd_script(ProfWin *window, const char * const command, gchar **args)
|
||||
}
|
||||
|
||||
gboolean
|
||||
cmd_sub(ProfWin *window, const char * const command, gchar **args)
|
||||
cmd_sub(ProfWin *window, const char *const command, gchar **args)
|
||||
{
|
||||
jabber_conn_status_t conn_status = jabber_get_connection_status();
|
||||
|
||||
@ -824,7 +823,7 @@ cmd_sub(ProfWin *window, const char * const command, gchar **args)
|
||||
}
|
||||
|
||||
gboolean
|
||||
cmd_disconnect(ProfWin *window, const char * const command, gchar **args)
|
||||
cmd_disconnect(ProfWin *window, const char *const command, gchar **args)
|
||||
{
|
||||
if (jabber_get_connection_status() == JABBER_CONNECTED) {
|
||||
char *jid = strdup(jabber_get_fulljid());
|
||||
@ -846,7 +845,7 @@ cmd_disconnect(ProfWin *window, const char * const command, gchar **args)
|
||||
}
|
||||
|
||||
gboolean
|
||||
cmd_quit(ProfWin *window, const char * const command, gchar **args)
|
||||
cmd_quit(ProfWin *window, const char *const command, gchar **args)
|
||||
{
|
||||
log_info("Profanity is shutting down...");
|
||||
exit(0);
|
||||
@ -854,7 +853,7 @@ cmd_quit(ProfWin *window, const char * const command, gchar **args)
|
||||
}
|
||||
|
||||
gboolean
|
||||
cmd_wins(ProfWin *window, const char * const command, gchar **args)
|
||||
cmd_wins(ProfWin *window, const char *const command, gchar **args)
|
||||
{
|
||||
if (args[0] == NULL) {
|
||||
cons_show_wins();
|
||||
@ -906,7 +905,7 @@ cmd_wins(ProfWin *window, const char * const command, gchar **args)
|
||||
}
|
||||
|
||||
gboolean
|
||||
cmd_win(ProfWin *window, const char * const command, gchar **args)
|
||||
cmd_win(ProfWin *window, const char *const command, gchar **args)
|
||||
{
|
||||
int num = atoi(args[0]);
|
||||
|
||||
@ -921,7 +920,7 @@ cmd_win(ProfWin *window, const char * const command, gchar **args)
|
||||
}
|
||||
|
||||
static void
|
||||
_cmd_help_cmd_list(const char * const tag)
|
||||
_cmd_help_cmd_list(const char *const tag)
|
||||
{
|
||||
cons_show("");
|
||||
ProfWin *console = wins_get_console();
|
||||
@ -983,7 +982,7 @@ _cmd_help_cmd_list(const char * const tag)
|
||||
}
|
||||
|
||||
gboolean
|
||||
cmd_help(ProfWin *window, const char * const command, gchar **args)
|
||||
cmd_help(ProfWin *window, const char *const command, gchar **args)
|
||||
{
|
||||
int num_args = g_strv_length(args);
|
||||
if (num_args == 0) {
|
||||
@ -1018,14 +1017,14 @@ cmd_help(ProfWin *window, const char * const command, gchar **args)
|
||||
}
|
||||
|
||||
gboolean
|
||||
cmd_about(ProfWin *window, const char * const command, gchar **args)
|
||||
cmd_about(ProfWin *window, const char *const command, gchar **args)
|
||||
{
|
||||
ui_about();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
cmd_prefs(ProfWin *window, const char * const command, gchar **args)
|
||||
cmd_prefs(ProfWin *window, const char *const command, gchar **args)
|
||||
{
|
||||
if (args[0] == NULL) {
|
||||
cons_prefs();
|
||||
@ -1070,7 +1069,7 @@ cmd_prefs(ProfWin *window, const char * const command, gchar **args)
|
||||
}
|
||||
|
||||
gboolean
|
||||
cmd_theme(ProfWin *window, const char * const command, gchar **args)
|
||||
cmd_theme(ProfWin *window, const char *const command, gchar **args)
|
||||
{
|
||||
// list themes
|
||||
if (g_strcmp0(args[0], "list") == 0) {
|
||||
@ -1112,7 +1111,7 @@ cmd_theme(ProfWin *window, const char * const command, gchar **args)
|
||||
}
|
||||
|
||||
static void
|
||||
_who_room(ProfWin *window, const char * const command, gchar **args)
|
||||
_who_room(ProfWin *window, const char *const command, gchar **args)
|
||||
{
|
||||
if ((g_strv_length(args) == 2) && args[1]) {
|
||||
cons_show("Argument group is not applicable to chat rooms.");
|
||||
@ -1242,7 +1241,7 @@ _who_room(ProfWin *window, const char * const command, gchar **args)
|
||||
}
|
||||
|
||||
static void
|
||||
_who_roster(ProfWin *window, const char * const command, gchar **args)
|
||||
_who_roster(ProfWin *window, const char *const command, gchar **args)
|
||||
{
|
||||
char *presence = args[0];
|
||||
|
||||
@ -1455,7 +1454,7 @@ _who_roster(ProfWin *window, const char * const command, gchar **args)
|
||||
}
|
||||
|
||||
gboolean
|
||||
cmd_who(ProfWin *window, const char * const command, gchar **args)
|
||||
cmd_who(ProfWin *window, const char *const command, gchar **args)
|
||||
{
|
||||
jabber_conn_status_t conn_status = jabber_get_connection_status();
|
||||
|
||||
@ -1475,7 +1474,7 @@ cmd_who(ProfWin *window, const char * const command, gchar **args)
|
||||
}
|
||||
|
||||
gboolean
|
||||
cmd_msg(ProfWin *window, const char * const command, gchar **args)
|
||||
cmd_msg(ProfWin *window, const char *const command, gchar **args)
|
||||
{
|
||||
char *usr = args[0];
|
||||
char *msg = args[1];
|
||||
@ -1542,7 +1541,7 @@ cmd_msg(ProfWin *window, const char * const command, gchar **args)
|
||||
}
|
||||
|
||||
gboolean
|
||||
cmd_group(ProfWin *window, const char * const command, gchar **args)
|
||||
cmd_group(ProfWin *window, const char *const command, gchar **args)
|
||||
{
|
||||
jabber_conn_status_t conn_status = jabber_get_connection_status();
|
||||
|
||||
@ -1649,7 +1648,7 @@ cmd_group(ProfWin *window, const char * const command, gchar **args)
|
||||
}
|
||||
|
||||
gboolean
|
||||
cmd_roster(ProfWin *window, const char * const command, gchar **args)
|
||||
cmd_roster(ProfWin *window, const char *const command, gchar **args)
|
||||
{
|
||||
jabber_conn_status_t conn_status = jabber_get_connection_status();
|
||||
|
||||
@ -1911,7 +1910,7 @@ cmd_roster(ProfWin *window, const char * const command, gchar **args)
|
||||
}
|
||||
|
||||
gboolean
|
||||
cmd_resource(ProfWin *window, const char * const command, gchar **args)
|
||||
cmd_resource(ProfWin *window, const char *const command, gchar **args)
|
||||
{
|
||||
char *cmd = args[0];
|
||||
char *setting = NULL;
|
||||
@ -1983,7 +1982,7 @@ cmd_resource(ProfWin *window, const char * const command, gchar **args)
|
||||
}
|
||||
|
||||
gboolean
|
||||
cmd_status(ProfWin *window, const char * const command, gchar **args)
|
||||
cmd_status(ProfWin *window, const char *const command, gchar **args)
|
||||
{
|
||||
char *usr = args[0];
|
||||
|
||||
@ -2059,7 +2058,7 @@ cmd_status(ProfWin *window, const char * const command, gchar **args)
|
||||
}
|
||||
|
||||
gboolean
|
||||
cmd_info(ProfWin *window, const char * const command, gchar **args)
|
||||
cmd_info(ProfWin *window, const char *const command, gchar **args)
|
||||
{
|
||||
char *usr = args[0];
|
||||
|
||||
@ -2144,7 +2143,7 @@ cmd_info(ProfWin *window, const char * const command, gchar **args)
|
||||
}
|
||||
|
||||
gboolean
|
||||
cmd_caps(ProfWin *window, const char * const command, gchar **args)
|
||||
cmd_caps(ProfWin *window, const char *const command, gchar **args)
|
||||
{
|
||||
jabber_conn_status_t conn_status = jabber_get_connection_status();
|
||||
Occupant *occupant = NULL;
|
||||
@ -2220,7 +2219,7 @@ cmd_caps(ProfWin *window, const char * const command, gchar **args)
|
||||
|
||||
|
||||
gboolean
|
||||
cmd_software(ProfWin *window, const char * const command, gchar **args)
|
||||
cmd_software(ProfWin *window, const char *const command, gchar **args)
|
||||
{
|
||||
jabber_conn_status_t conn_status = jabber_get_connection_status();
|
||||
|
||||
@ -2307,7 +2306,7 @@ cmd_software(ProfWin *window, const char * const command, gchar **args)
|
||||
}
|
||||
|
||||
gboolean
|
||||
cmd_join(ProfWin *window, const char * const command, gchar **args)
|
||||
cmd_join(ProfWin *window, const char *const command, gchar **args)
|
||||
{
|
||||
jabber_conn_status_t conn_status = jabber_get_connection_status();
|
||||
if (conn_status != JABBER_CONNECTED) {
|
||||
@ -2401,7 +2400,7 @@ cmd_join(ProfWin *window, const char * const command, gchar **args)
|
||||
}
|
||||
|
||||
gboolean
|
||||
cmd_invite(ProfWin *window, const char * const command, gchar **args)
|
||||
cmd_invite(ProfWin *window, const char *const command, gchar **args)
|
||||
{
|
||||
char *contact = args[0];
|
||||
char *reason = args[1];
|
||||
@ -2437,7 +2436,7 @@ cmd_invite(ProfWin *window, const char * const command, gchar **args)
|
||||
}
|
||||
|
||||
gboolean
|
||||
cmd_invites(ProfWin *window, const char * const command, gchar **args)
|
||||
cmd_invites(ProfWin *window, const char *const command, gchar **args)
|
||||
{
|
||||
GSList *invites = muc_invites();
|
||||
cons_show_room_invites(invites);
|
||||
@ -2446,7 +2445,7 @@ cmd_invites(ProfWin *window, const char * const command, gchar **args)
|
||||
}
|
||||
|
||||
gboolean
|
||||
cmd_decline(ProfWin *window, const char * const command, gchar **args)
|
||||
cmd_decline(ProfWin *window, const char *const command, gchar **args)
|
||||
{
|
||||
if (!muc_invites_contain(args[0])) {
|
||||
cons_show("No such invite exists.");
|
||||
@ -2677,7 +2676,7 @@ cmd_form_field(ProfWin *window, char *tag, gchar **args)
|
||||
}
|
||||
|
||||
gboolean
|
||||
cmd_form(ProfWin *window, const char * const command, gchar **args)
|
||||
cmd_form(ProfWin *window, const char *const command, gchar **args)
|
||||
{
|
||||
jabber_conn_status_t conn_status = jabber_get_connection_status();
|
||||
|
||||
@ -2754,7 +2753,7 @@ cmd_form(ProfWin *window, const char * const command, gchar **args)
|
||||
}
|
||||
|
||||
gboolean
|
||||
cmd_kick(ProfWin *window, const char * const command, gchar **args)
|
||||
cmd_kick(ProfWin *window, const char *const command, gchar **args)
|
||||
{
|
||||
jabber_conn_status_t conn_status = jabber_get_connection_status();
|
||||
|
||||
@ -2787,7 +2786,7 @@ cmd_kick(ProfWin *window, const char * const command, gchar **args)
|
||||
}
|
||||
|
||||
gboolean
|
||||
cmd_ban(ProfWin *window, const char * const command, gchar **args)
|
||||
cmd_ban(ProfWin *window, const char *const command, gchar **args)
|
||||
{
|
||||
jabber_conn_status_t conn_status = jabber_get_connection_status();
|
||||
|
||||
@ -2815,7 +2814,7 @@ cmd_ban(ProfWin *window, const char * const command, gchar **args)
|
||||
}
|
||||
|
||||
gboolean
|
||||
cmd_subject(ProfWin *window, const char * const command, gchar **args)
|
||||
cmd_subject(ProfWin *window, const char *const command, gchar **args)
|
||||
{
|
||||
jabber_conn_status_t conn_status = jabber_get_connection_status();
|
||||
|
||||
@ -2862,7 +2861,7 @@ cmd_subject(ProfWin *window, const char * const command, gchar **args)
|
||||
}
|
||||
|
||||
gboolean
|
||||
cmd_affiliation(ProfWin *window, const char * const command, gchar **args)
|
||||
cmd_affiliation(ProfWin *window, const char *const command, gchar **args)
|
||||
{
|
||||
jabber_conn_status_t conn_status = jabber_get_connection_status();
|
||||
|
||||
@ -2932,7 +2931,7 @@ cmd_affiliation(ProfWin *window, const char * const command, gchar **args)
|
||||
}
|
||||
|
||||
gboolean
|
||||
cmd_role(ProfWin *window, const char * const command, gchar **args)
|
||||
cmd_role(ProfWin *window, const char *const command, gchar **args)
|
||||
{
|
||||
jabber_conn_status_t conn_status = jabber_get_connection_status();
|
||||
|
||||
@ -3000,7 +2999,7 @@ cmd_role(ProfWin *window, const char * const command, gchar **args)
|
||||
}
|
||||
|
||||
gboolean
|
||||
cmd_room(ProfWin *window, const char * const command, gchar **args)
|
||||
cmd_room(ProfWin *window, const char *const command, gchar **args)
|
||||
{
|
||||
jabber_conn_status_t conn_status = jabber_get_connection_status();
|
||||
|
||||
@ -3063,7 +3062,7 @@ cmd_room(ProfWin *window, const char * const command, gchar **args)
|
||||
}
|
||||
|
||||
gboolean
|
||||
cmd_occupants(ProfWin *window, const char * const command, gchar **args)
|
||||
cmd_occupants(ProfWin *window, const char *const command, gchar **args)
|
||||
{
|
||||
jabber_conn_status_t conn_status = jabber_get_connection_status();
|
||||
|
||||
@ -3148,7 +3147,7 @@ cmd_occupants(ProfWin *window, const char * const command, gchar **args)
|
||||
}
|
||||
|
||||
gboolean
|
||||
cmd_rooms(ProfWin *window, const char * const command, gchar **args)
|
||||
cmd_rooms(ProfWin *window, const char *const command, gchar **args)
|
||||
{
|
||||
jabber_conn_status_t conn_status = jabber_get_connection_status();
|
||||
|
||||
@ -3169,7 +3168,7 @@ cmd_rooms(ProfWin *window, const char * const command, gchar **args)
|
||||
}
|
||||
|
||||
gboolean
|
||||
cmd_bookmark(ProfWin *window, const char * const command, gchar **args)
|
||||
cmd_bookmark(ProfWin *window, const char *const command, gchar **args)
|
||||
{
|
||||
jabber_conn_status_t conn_status = jabber_get_connection_status();
|
||||
|
||||
@ -3280,7 +3279,7 @@ cmd_bookmark(ProfWin *window, const char * const command, gchar **args)
|
||||
}
|
||||
|
||||
gboolean
|
||||
cmd_disco(ProfWin *window, const char * const command, gchar **args)
|
||||
cmd_disco(ProfWin *window, const char *const command, gchar **args)
|
||||
{
|
||||
jabber_conn_status_t conn_status = jabber_get_connection_status();
|
||||
|
||||
@ -3310,7 +3309,7 @@ cmd_disco(ProfWin *window, const char * const command, gchar **args)
|
||||
}
|
||||
|
||||
gboolean
|
||||
cmd_lastactivity(ProfWin *window, const char * const command, gchar **args)
|
||||
cmd_lastactivity(ProfWin *window, const char *const command, gchar **args)
|
||||
{
|
||||
if ((g_strcmp0(args[0], "on") == 0) || (g_strcmp0(args[0], "off") == 0)) {
|
||||
return _cmd_set_boolean_preference(args[0], command, "Last activity", PREF_LASTACTIVITY);
|
||||
@ -3340,7 +3339,7 @@ cmd_lastactivity(ProfWin *window, const char * const command, gchar **args)
|
||||
}
|
||||
|
||||
gboolean
|
||||
cmd_nick(ProfWin *window, const char * const command, gchar **args)
|
||||
cmd_nick(ProfWin *window, const char *const command, gchar **args)
|
||||
{
|
||||
jabber_conn_status_t conn_status = jabber_get_connection_status();
|
||||
|
||||
@ -3362,7 +3361,7 @@ cmd_nick(ProfWin *window, const char * const command, gchar **args)
|
||||
}
|
||||
|
||||
gboolean
|
||||
cmd_alias(ProfWin *window, const char * const command, gchar **args)
|
||||
cmd_alias(ProfWin *window, const char *const command, gchar **args)
|
||||
{
|
||||
char *subcmd = args[0];
|
||||
|
||||
@ -3434,7 +3433,7 @@ cmd_alias(ProfWin *window, const char * const command, gchar **args)
|
||||
}
|
||||
|
||||
gboolean
|
||||
cmd_tiny(ProfWin *window, const char * const command, gchar **args)
|
||||
cmd_tiny(ProfWin *window, const char *const command, gchar **args)
|
||||
{
|
||||
char *url = args[0];
|
||||
|
||||
@ -3486,14 +3485,14 @@ cmd_tiny(ProfWin *window, const char * const command, gchar **args)
|
||||
}
|
||||
|
||||
gboolean
|
||||
cmd_clear(ProfWin *window, const char * const command, gchar **args)
|
||||
cmd_clear(ProfWin *window, const char *const command, gchar **args)
|
||||
{
|
||||
ui_clear_win(window);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
cmd_close(ProfWin *window, const char * const command, gchar **args)
|
||||
cmd_close(ProfWin *window, const char *const command, gchar **args)
|
||||
{
|
||||
jabber_conn_status_t conn_status = jabber_get_connection_status();
|
||||
int index = 0;
|
||||
@ -3565,7 +3564,7 @@ cmd_close(ProfWin *window, const char * const command, gchar **args)
|
||||
}
|
||||
|
||||
gboolean
|
||||
cmd_leave(ProfWin *window, const char * const command, gchar **args)
|
||||
cmd_leave(ProfWin *window, const char *const command, gchar **args)
|
||||
{
|
||||
jabber_conn_status_t conn_status = jabber_get_connection_status();
|
||||
int index = wins_get_current_num();
|
||||
@ -3588,7 +3587,7 @@ cmd_leave(ProfWin *window, const char * const command, gchar **args)
|
||||
}
|
||||
|
||||
gboolean
|
||||
cmd_privileges(ProfWin *window, const char * const command, gchar **args)
|
||||
cmd_privileges(ProfWin *window, const char *const command, gchar **args)
|
||||
{
|
||||
gboolean result = _cmd_set_boolean_preference(args[0], command, "MUC privileges", PREF_MUC_PRIVILEGES);
|
||||
|
||||
@ -3598,19 +3597,19 @@ cmd_privileges(ProfWin *window, const char * const command, gchar **args)
|
||||
}
|
||||
|
||||
gboolean
|
||||
cmd_beep(ProfWin *window, const char * const command, gchar **args)
|
||||
cmd_beep(ProfWin *window, const char *const command, gchar **args)
|
||||
{
|
||||
return _cmd_set_boolean_preference(args[0], command, "Sound", PREF_BEEP);
|
||||
}
|
||||
|
||||
gboolean
|
||||
cmd_presence(ProfWin *window, const char * const command, gchar **args)
|
||||
cmd_presence(ProfWin *window, const char *const command, gchar **args)
|
||||
{
|
||||
return _cmd_set_boolean_preference(args[0], command, "Contact presence", PREF_PRESENCE);
|
||||
}
|
||||
|
||||
gboolean
|
||||
cmd_wrap(ProfWin *window, const char * const command, gchar **args)
|
||||
cmd_wrap(ProfWin *window, const char *const command, gchar **args)
|
||||
{
|
||||
gboolean result = _cmd_set_boolean_preference(args[0], command, "Word wrap", PREF_WRAP);
|
||||
|
||||
@ -3620,7 +3619,7 @@ cmd_wrap(ProfWin *window, const char * const command, gchar **args)
|
||||
}
|
||||
|
||||
gboolean
|
||||
cmd_time(ProfWin *window, const char * const command, gchar **args)
|
||||
cmd_time(ProfWin *window, const char *const command, gchar **args)
|
||||
{
|
||||
if (g_strcmp0(args[0], "lastactivity") == 0) {
|
||||
if (args[1] == NULL) {
|
||||
@ -3772,7 +3771,7 @@ cmd_time(ProfWin *window, const char * const command, gchar **args)
|
||||
}
|
||||
|
||||
gboolean
|
||||
cmd_states(ProfWin *window, const char * const command, gchar **args)
|
||||
cmd_states(ProfWin *window, const char *const command, gchar **args)
|
||||
{
|
||||
gboolean result = _cmd_set_boolean_preference(args[0], command, "Sending chat states",
|
||||
PREF_STATES);
|
||||
@ -3787,7 +3786,7 @@ cmd_states(ProfWin *window, const char * const command, gchar **args)
|
||||
}
|
||||
|
||||
gboolean
|
||||
cmd_titlebar(ProfWin *window, const char * const command, gchar **args)
|
||||
cmd_titlebar(ProfWin *window, const char *const command, gchar **args)
|
||||
{
|
||||
if (g_strcmp0(args[0], "show") != 0 && g_strcmp0(args[0], "goodbye") != 0) {
|
||||
cons_bad_cmd_usage(command);
|
||||
@ -3804,7 +3803,7 @@ cmd_titlebar(ProfWin *window, const char * const command, gchar **args)
|
||||
}
|
||||
|
||||
gboolean
|
||||
cmd_outtype(ProfWin *window, const char * const command, gchar **args)
|
||||
cmd_outtype(ProfWin *window, const char *const command, gchar **args)
|
||||
{
|
||||
gboolean result = _cmd_set_boolean_preference(args[0], command,
|
||||
"Sending typing notifications", PREF_OUTTYPE);
|
||||
@ -3818,7 +3817,7 @@ cmd_outtype(ProfWin *window, const char * const command, gchar **args)
|
||||
}
|
||||
|
||||
gboolean
|
||||
cmd_gone(ProfWin *window, const char * const command, gchar **args)
|
||||
cmd_gone(ProfWin *window, const char *const command, gchar **args)
|
||||
{
|
||||
char *value = args[0];
|
||||
|
||||
@ -3842,7 +3841,7 @@ cmd_gone(ProfWin *window, const char * const command, gchar **args)
|
||||
|
||||
|
||||
gboolean
|
||||
cmd_notify(ProfWin *window, const char * const command, gchar **args)
|
||||
cmd_notify(ProfWin *window, const char *const command, gchar **args)
|
||||
{
|
||||
char *kind = args[0];
|
||||
|
||||
@ -3985,7 +3984,7 @@ cmd_notify(ProfWin *window, const char * const command, gchar **args)
|
||||
}
|
||||
|
||||
gboolean
|
||||
cmd_inpblock(ProfWin *window, const char * const command, gchar **args)
|
||||
cmd_inpblock(ProfWin *window, const char *const command, gchar **args)
|
||||
{
|
||||
char *subcmd = args[0];
|
||||
char *value = args[1];
|
||||
@ -4031,7 +4030,7 @@ cmd_inpblock(ProfWin *window, const char * const command, gchar **args)
|
||||
}
|
||||
|
||||
gboolean
|
||||
cmd_log(ProfWin *window, const char * const command, gchar **args)
|
||||
cmd_log(ProfWin *window, const char *const command, gchar **args)
|
||||
{
|
||||
char *subcmd = args[0];
|
||||
char *value = args[1];
|
||||
@ -4087,7 +4086,7 @@ cmd_log(ProfWin *window, const char * const command, gchar **args)
|
||||
}
|
||||
|
||||
gboolean
|
||||
cmd_reconnect(ProfWin *window, const char * const command, gchar **args)
|
||||
cmd_reconnect(ProfWin *window, const char *const command, gchar **args)
|
||||
{
|
||||
char *value = args[0];
|
||||
|
||||
@ -4111,7 +4110,7 @@ cmd_reconnect(ProfWin *window, const char * const command, gchar **args)
|
||||
}
|
||||
|
||||
gboolean
|
||||
cmd_autoping(ProfWin *window, const char * const command, gchar **args)
|
||||
cmd_autoping(ProfWin *window, const char *const command, gchar **args)
|
||||
{
|
||||
char *value = args[0];
|
||||
|
||||
@ -4136,7 +4135,7 @@ cmd_autoping(ProfWin *window, const char * const command, gchar **args)
|
||||
}
|
||||
|
||||
gboolean
|
||||
cmd_ping(ProfWin *window, const char * const command, gchar **args)
|
||||
cmd_ping(ProfWin *window, const char *const command, gchar **args)
|
||||
{
|
||||
jabber_conn_status_t conn_status = jabber_get_connection_status();
|
||||
|
||||
@ -4156,7 +4155,7 @@ cmd_ping(ProfWin *window, const char * const command, gchar **args)
|
||||
}
|
||||
|
||||
gboolean
|
||||
cmd_autoaway(ProfWin *window, const char * const command, gchar **args)
|
||||
cmd_autoaway(ProfWin *window, const char *const command, gchar **args)
|
||||
{
|
||||
if ((strcmp(args[0], "mode") != 0) && (strcmp(args[0], "time") != 0) &&
|
||||
(strcmp(args[0], "message") != 0) && (strcmp(args[0], "check") != 0)) {
|
||||
@ -4259,7 +4258,7 @@ cmd_autoaway(ProfWin *window, const char * const command, gchar **args)
|
||||
}
|
||||
|
||||
gboolean
|
||||
cmd_priority(ProfWin *window, const char * const command, gchar **args)
|
||||
cmd_priority(ProfWin *window, const char *const command, gchar **args)
|
||||
{
|
||||
jabber_conn_status_t conn_status = jabber_get_connection_status();
|
||||
|
||||
@ -4287,7 +4286,7 @@ cmd_priority(ProfWin *window, const char * const command, gchar **args)
|
||||
}
|
||||
|
||||
gboolean
|
||||
cmd_statuses(ProfWin *window, const char * const command, gchar **args)
|
||||
cmd_statuses(ProfWin *window, const char *const command, gchar **args)
|
||||
{
|
||||
if (strcmp(args[0], "console") != 0 &&
|
||||
strcmp(args[0], "chat") != 0 &&
|
||||
@ -4340,7 +4339,7 @@ cmd_statuses(ProfWin *window, const char * const command, gchar **args)
|
||||
}
|
||||
|
||||
gboolean
|
||||
cmd_vercheck(ProfWin *window, const char * const command, gchar **args)
|
||||
cmd_vercheck(ProfWin *window, const char *const command, gchar **args)
|
||||
{
|
||||
int num_args = g_strv_length(args);
|
||||
|
||||
@ -4353,7 +4352,7 @@ cmd_vercheck(ProfWin *window, const char * const command, gchar **args)
|
||||
}
|
||||
|
||||
gboolean
|
||||
cmd_xmlconsole(ProfWin *window, const char * const command, gchar **args)
|
||||
cmd_xmlconsole(ProfWin *window, const char *const command, gchar **args)
|
||||
{
|
||||
if (!ui_xmlconsole_exists()) {
|
||||
ui_create_xmlconsole_win();
|
||||
@ -4365,25 +4364,25 @@ cmd_xmlconsole(ProfWin *window, const char * const command, gchar **args)
|
||||
}
|
||||
|
||||
gboolean
|
||||
cmd_flash(ProfWin *window, const char * const command, gchar **args)
|
||||
cmd_flash(ProfWin *window, const char *const command, gchar **args)
|
||||
{
|
||||
return _cmd_set_boolean_preference(args[0], command, "Screen flash", PREF_FLASH);
|
||||
}
|
||||
|
||||
gboolean
|
||||
cmd_intype(ProfWin *window, const char * const command, gchar **args)
|
||||
cmd_intype(ProfWin *window, const char *const command, gchar **args)
|
||||
{
|
||||
return _cmd_set_boolean_preference(args[0], command, "Show contact typing", PREF_INTYPE);
|
||||
}
|
||||
|
||||
gboolean
|
||||
cmd_splash(ProfWin *window, const char * const command, gchar **args)
|
||||
cmd_splash(ProfWin *window, const char *const command, gchar **args)
|
||||
{
|
||||
return _cmd_set_boolean_preference(args[0], command, "Splash screen", PREF_SPLASH);
|
||||
}
|
||||
|
||||
gboolean
|
||||
cmd_autoconnect(ProfWin *window, const char * const command, gchar **args)
|
||||
cmd_autoconnect(ProfWin *window, const char *const command, gchar **args)
|
||||
{
|
||||
if (strcmp(args[0], "off") == 0) {
|
||||
prefs_set_string(PREF_CONNECT_ACCOUNT, NULL);
|
||||
@ -4398,7 +4397,7 @@ cmd_autoconnect(ProfWin *window, const char * const command, gchar **args)
|
||||
}
|
||||
|
||||
gboolean
|
||||
cmd_chlog(ProfWin *window, const char * const command, gchar **args)
|
||||
cmd_chlog(ProfWin *window, const char *const command, gchar **args)
|
||||
{
|
||||
gboolean result = _cmd_set_boolean_preference(args[0], command, "Chat logging", PREF_CHLOG);
|
||||
|
||||
@ -4411,7 +4410,7 @@ cmd_chlog(ProfWin *window, const char * const command, gchar **args)
|
||||
}
|
||||
|
||||
gboolean
|
||||
cmd_grlog(ProfWin *window, const char * const command, gchar **args)
|
||||
cmd_grlog(ProfWin *window, const char *const command, gchar **args)
|
||||
{
|
||||
gboolean result = _cmd_set_boolean_preference(args[0], command, "Groupchat logging", PREF_GRLOG);
|
||||
|
||||
@ -4419,7 +4418,7 @@ cmd_grlog(ProfWin *window, const char * const command, gchar **args)
|
||||
}
|
||||
|
||||
gboolean
|
||||
cmd_history(ProfWin *window, const char * const command, gchar **args)
|
||||
cmd_history(ProfWin *window, const char *const command, gchar **args)
|
||||
{
|
||||
gboolean result = _cmd_set_boolean_preference(args[0], command, "Chat history", PREF_HISTORY);
|
||||
|
||||
@ -4432,7 +4431,7 @@ cmd_history(ProfWin *window, const char * const command, gchar **args)
|
||||
}
|
||||
|
||||
gboolean
|
||||
cmd_carbons(ProfWin *window, const char * const command, gchar **args)
|
||||
cmd_carbons(ProfWin *window, const char *const command, gchar **args)
|
||||
{
|
||||
gboolean result = _cmd_set_boolean_preference(args[0], command, "Message carbons preference", PREF_CARBONS);
|
||||
|
||||
@ -4452,7 +4451,7 @@ cmd_carbons(ProfWin *window, const char * const command, gchar **args)
|
||||
}
|
||||
|
||||
gboolean
|
||||
cmd_receipts(ProfWin *window, const char * const command, gchar **args)
|
||||
cmd_receipts(ProfWin *window, const char *const command, gchar **args)
|
||||
{
|
||||
if (g_strcmp0(args[0], "send") == 0) {
|
||||
return _cmd_set_boolean_preference(args[1], command, "Send delivery receipts", PREF_RECEIPTS_SEND);
|
||||
@ -4465,42 +4464,42 @@ cmd_receipts(ProfWin *window, const char * const command, gchar **args)
|
||||
}
|
||||
|
||||
gboolean
|
||||
cmd_away(ProfWin *window, const char * const command, gchar **args)
|
||||
cmd_away(ProfWin *window, const char *const command, gchar **args)
|
||||
{
|
||||
_update_presence(RESOURCE_AWAY, "away", args);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
cmd_online(ProfWin *window, const char * const command, gchar **args)
|
||||
cmd_online(ProfWin *window, const char *const command, gchar **args)
|
||||
{
|
||||
_update_presence(RESOURCE_ONLINE, "online", args);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
cmd_dnd(ProfWin *window, const char * const command, gchar **args)
|
||||
cmd_dnd(ProfWin *window, const char *const command, gchar **args)
|
||||
{
|
||||
_update_presence(RESOURCE_DND, "dnd", args);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
cmd_chat(ProfWin *window, const char * const command, gchar **args)
|
||||
cmd_chat(ProfWin *window, const char *const command, gchar **args)
|
||||
{
|
||||
_update_presence(RESOURCE_CHAT, "chat", args);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
cmd_xa(ProfWin *window, const char * const command, gchar **args)
|
||||
cmd_xa(ProfWin *window, const char *const command, gchar **args)
|
||||
{
|
||||
_update_presence(RESOURCE_XA, "xa", args);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
cmd_pgp(ProfWin *window, const char * const command, gchar **args)
|
||||
cmd_pgp(ProfWin *window, const char *const command, gchar **args)
|
||||
{
|
||||
#ifdef HAVE_LIBGPGME
|
||||
if (args[0] == NULL) {
|
||||
@ -4735,7 +4734,7 @@ cmd_pgp(ProfWin *window, const char * const command, gchar **args)
|
||||
}
|
||||
|
||||
gboolean
|
||||
cmd_otr(ProfWin *window, const char * const command, gchar **args)
|
||||
cmd_otr(ProfWin *window, const char *const command, gchar **args)
|
||||
{
|
||||
#ifdef HAVE_LIBOTR
|
||||
if (args[0] == NULL) {
|
||||
@ -5055,7 +5054,7 @@ cmd_otr(ProfWin *window, const char * const command, gchar **args)
|
||||
}
|
||||
|
||||
gboolean
|
||||
cmd_encwarn(ProfWin *window, const char * const command, gchar **args)
|
||||
cmd_encwarn(ProfWin *window, const char *const command, gchar **args)
|
||||
{
|
||||
return _cmd_set_boolean_preference(args[0], command, "Encryption warning message", PREF_ENC_WARN);
|
||||
}
|
||||
@ -5063,7 +5062,7 @@ cmd_encwarn(ProfWin *window, const char * const command, gchar **args)
|
||||
// helper function for status change commands
|
||||
static void
|
||||
_update_presence(const resource_presence_t resource_presence,
|
||||
const char * const show, gchar **args)
|
||||
const char *const show, gchar **args)
|
||||
{
|
||||
char *msg = NULL;
|
||||
int num_args = g_strv_length(args);
|
||||
@ -5083,8 +5082,8 @@ _update_presence(const resource_presence_t resource_presence,
|
||||
|
||||
// helper function for boolean preference commands
|
||||
static gboolean
|
||||
_cmd_set_boolean_preference(gchar *arg, const char * const command,
|
||||
const char * const display, preference_t pref)
|
||||
_cmd_set_boolean_preference(gchar *arg, const char *const command,
|
||||
const char *const display, preference_t pref)
|
||||
{
|
||||
GString *enabled = g_string_new(display);
|
||||
g_string_append(enabled, " enabled.");
|
||||
|
Loading…
Reference in New Issue
Block a user