mirror of
https://github.com/profanity-im/profanity.git
synced 2024-11-03 19:37:16 -05:00
Merge branch 'master' into plugins
This commit is contained in:
commit
8d707de456
@ -3,6 +3,7 @@
|
||||
|
||||
- Plugins API supporting C and Python plugins
|
||||
- SSL certificate verification (requires libmesode) (/tls)
|
||||
- HTTP file uplaod (xep-0363) (/sendfile)
|
||||
- Allow auto extended away (/autoaway)
|
||||
- Include last acitvity in initial presence (xep-0256) (/lastactivity)
|
||||
- Last Activity (xep-0012) (/lastactivity)
|
||||
|
@ -137,6 +137,11 @@ GHashTable *commands = NULL;
|
||||
#define CMD_TAG_UI "ui"
|
||||
#define CMD_TAG_PLUGINS "plugins"
|
||||
|
||||
#define CMD_MAINFUNC(func) func,
|
||||
#define CMD_NOMAINFUNC NULL,
|
||||
#define CMD_SUBFUNCS(...) { __VA_ARGS__, { NULL, NULL } },
|
||||
#define CMD_NOSUBFUNCS { { NULL, NULL } },
|
||||
|
||||
#define CMD_NOTAGS { { NULL },
|
||||
#define CMD_TAGS(...) { { __VA_ARGS__, NULL },
|
||||
#define CMD_SYN(...) { __VA_ARGS__, NULL },
|
||||
@ -152,7 +157,9 @@ GHashTable *commands = NULL;
|
||||
static struct cmd_t command_defs[] =
|
||||
{
|
||||
{ "/help",
|
||||
cmd_help, parse_args, 0, 2, NULL,
|
||||
parse_args, 0, 2, NULL,
|
||||
CMD_NOSUBFUNCS
|
||||
CMD_MAINFUNC(cmd_help)
|
||||
CMD_NOTAGS
|
||||
CMD_SYN(
|
||||
"/help [<area>|<command>]")
|
||||
@ -173,7 +180,9 @@ static struct cmd_t command_defs[] =
|
||||
},
|
||||
|
||||
{ "/about",
|
||||
cmd_about, parse_args, 0, 0, NULL,
|
||||
parse_args, 0, 0, NULL,
|
||||
CMD_NOSUBFUNCS
|
||||
CMD_MAINFUNC(cmd_about)
|
||||
CMD_NOTAGS
|
||||
CMD_SYN(
|
||||
"/about")
|
||||
@ -184,7 +193,9 @@ static struct cmd_t command_defs[] =
|
||||
},
|
||||
|
||||
{ "/connect",
|
||||
cmd_connect, parse_args, 0, 7, NULL,
|
||||
parse_args, 0, 7, NULL,
|
||||
CMD_NOSUBFUNCS
|
||||
CMD_MAINFUNC(cmd_connect)
|
||||
CMD_TAGS(
|
||||
CMD_TAG_CONNECTION)
|
||||
CMD_SYN(
|
||||
@ -211,7 +222,15 @@ static struct cmd_t command_defs[] =
|
||||
},
|
||||
|
||||
{ "/tls",
|
||||
cmd_tls, parse_args, 1, 3, NULL,
|
||||
parse_args, 1, 3, NULL,
|
||||
CMD_SUBFUNCS(
|
||||
{ "certpath", cmd_tls_certpath },
|
||||
{ "trust", cmd_tls_trust },
|
||||
{ "trusted", cmd_tls_trusted },
|
||||
{ "revoke", cmd_tls_revoke },
|
||||
{ "show", cmd_tls_show },
|
||||
{ "cert", cmd_tls_cert })
|
||||
CMD_NOMAINFUNC
|
||||
CMD_TAGS(
|
||||
CMD_TAG_CONNECTION,
|
||||
CMD_TAG_UI)
|
||||
@ -246,7 +265,9 @@ static struct cmd_t command_defs[] =
|
||||
},
|
||||
|
||||
{ "/disconnect",
|
||||
cmd_disconnect, parse_args, 0, 0, NULL,
|
||||
parse_args, 0, 0, NULL,
|
||||
CMD_NOSUBFUNCS
|
||||
CMD_MAINFUNC(cmd_disconnect)
|
||||
CMD_TAGS(
|
||||
CMD_TAG_CONNECTION)
|
||||
CMD_SYN(
|
||||
@ -258,7 +279,9 @@ static struct cmd_t command_defs[] =
|
||||
},
|
||||
|
||||
{ "/msg",
|
||||
cmd_msg, parse_args_with_freetext, 1, 2, NULL,
|
||||
parse_args_with_freetext, 1, 2, NULL,
|
||||
CMD_NOSUBFUNCS
|
||||
CMD_MAINFUNC(cmd_msg)
|
||||
CMD_TAGS(
|
||||
CMD_TAG_CHAT)
|
||||
CMD_SYN(
|
||||
@ -281,7 +304,9 @@ static struct cmd_t command_defs[] =
|
||||
},
|
||||
|
||||
{ "/roster",
|
||||
cmd_roster, parse_args_with_freetext, 0, 4, NULL,
|
||||
parse_args_with_freetext, 0, 4, NULL,
|
||||
CMD_NOSUBFUNCS
|
||||
CMD_MAINFUNC(cmd_roster)
|
||||
CMD_TAGS(
|
||||
CMD_TAG_ROSTER,
|
||||
CMD_TAG_UI)
|
||||
@ -399,7 +424,9 @@ static struct cmd_t command_defs[] =
|
||||
},
|
||||
|
||||
{ "/group",
|
||||
cmd_group, parse_args_with_freetext, 0, 3, NULL,
|
||||
parse_args_with_freetext, 0, 3, NULL,
|
||||
CMD_NOSUBFUNCS
|
||||
CMD_MAINFUNC(cmd_group)
|
||||
CMD_TAGS(
|
||||
CMD_TAG_ROSTER,
|
||||
CMD_TAG_UI)
|
||||
@ -424,7 +451,9 @@ static struct cmd_t command_defs[] =
|
||||
},
|
||||
|
||||
{ "/info",
|
||||
cmd_info, parse_args, 0, 1, NULL,
|
||||
parse_args, 0, 1, NULL,
|
||||
CMD_NOSUBFUNCS
|
||||
CMD_MAINFUNC(cmd_info)
|
||||
CMD_TAGS(
|
||||
CMD_TAG_ROSTER,
|
||||
CMD_TAG_CHAT,
|
||||
@ -445,7 +474,9 @@ static struct cmd_t command_defs[] =
|
||||
},
|
||||
|
||||
{ "/caps",
|
||||
cmd_caps, parse_args, 0, 1, NULL,
|
||||
parse_args, 0, 1, NULL,
|
||||
CMD_NOSUBFUNCS
|
||||
CMD_MAINFUNC(cmd_caps)
|
||||
CMD_TAGS(
|
||||
CMD_TAG_DISCOVERY,
|
||||
CMD_TAG_CHAT,
|
||||
@ -466,7 +497,9 @@ static struct cmd_t command_defs[] =
|
||||
},
|
||||
|
||||
{ "/software",
|
||||
cmd_software, parse_args, 0, 1, NULL,
|
||||
parse_args, 0, 1, NULL,
|
||||
CMD_NOSUBFUNCS
|
||||
CMD_MAINFUNC(cmd_software)
|
||||
CMD_TAGS(
|
||||
CMD_TAG_DISCOVERY,
|
||||
CMD_TAG_CHAT,
|
||||
@ -488,7 +521,9 @@ static struct cmd_t command_defs[] =
|
||||
},
|
||||
|
||||
{ "/status",
|
||||
cmd_status, parse_args, 0, 1, NULL,
|
||||
parse_args, 0, 1, NULL,
|
||||
CMD_NOSUBFUNCS
|
||||
CMD_MAINFUNC(cmd_status)
|
||||
CMD_TAGS(
|
||||
CMD_TAG_CHAT,
|
||||
CMD_TAG_GROUPCHAT)
|
||||
@ -507,7 +542,9 @@ static struct cmd_t command_defs[] =
|
||||
},
|
||||
|
||||
{ "/resource",
|
||||
cmd_resource, parse_args, 1, 2, &cons_resource_setting,
|
||||
parse_args, 1, 2, &cons_resource_setting,
|
||||
CMD_NOSUBFUNCS
|
||||
CMD_MAINFUNC(cmd_resource)
|
||||
CMD_TAGS(
|
||||
CMD_TAG_CHAT,
|
||||
CMD_TAG_UI)
|
||||
@ -527,7 +564,9 @@ static struct cmd_t command_defs[] =
|
||||
},
|
||||
|
||||
{ "/join",
|
||||
cmd_join, parse_args, 0, 5, NULL,
|
||||
parse_args, 0, 5, NULL,
|
||||
CMD_NOSUBFUNCS
|
||||
CMD_MAINFUNC(cmd_join)
|
||||
CMD_TAGS(
|
||||
CMD_TAG_GROUPCHAT)
|
||||
CMD_SYN(
|
||||
@ -552,7 +591,9 @@ static struct cmd_t command_defs[] =
|
||||
},
|
||||
|
||||
{ "/leave",
|
||||
cmd_leave, parse_args, 0, 0, NULL,
|
||||
parse_args, 0, 0, NULL,
|
||||
CMD_NOSUBFUNCS
|
||||
CMD_MAINFUNC(cmd_leave)
|
||||
CMD_TAGS(
|
||||
CMD_TAG_GROUPCHAT)
|
||||
CMD_SYN(
|
||||
@ -564,7 +605,9 @@ static struct cmd_t command_defs[] =
|
||||
},
|
||||
|
||||
{ "/invite",
|
||||
cmd_invite, parse_args_with_freetext, 1, 2, NULL,
|
||||
parse_args_with_freetext, 1, 2, NULL,
|
||||
CMD_NOSUBFUNCS
|
||||
CMD_MAINFUNC(cmd_invite)
|
||||
CMD_TAGS(
|
||||
CMD_TAG_GROUPCHAT)
|
||||
CMD_SYN(
|
||||
@ -578,7 +621,9 @@ static struct cmd_t command_defs[] =
|
||||
},
|
||||
|
||||
{ "/invites",
|
||||
cmd_invites, parse_args_with_freetext, 0, 0, NULL,
|
||||
parse_args_with_freetext, 0, 0, NULL,
|
||||
CMD_NOSUBFUNCS
|
||||
CMD_MAINFUNC(cmd_invites)
|
||||
CMD_TAGS(
|
||||
CMD_TAG_GROUPCHAT)
|
||||
CMD_SYN(
|
||||
@ -590,7 +635,9 @@ static struct cmd_t command_defs[] =
|
||||
},
|
||||
|
||||
{ "/decline",
|
||||
cmd_decline, parse_args_with_freetext, 1, 1, NULL,
|
||||
parse_args_with_freetext, 1, 1, NULL,
|
||||
CMD_NOSUBFUNCS
|
||||
CMD_MAINFUNC(cmd_decline)
|
||||
CMD_TAGS(
|
||||
CMD_TAG_GROUPCHAT)
|
||||
CMD_SYN(
|
||||
@ -603,7 +650,9 @@ static struct cmd_t command_defs[] =
|
||||
},
|
||||
|
||||
{ "/room",
|
||||
cmd_room, parse_args, 1, 1, NULL,
|
||||
parse_args, 1, 1, NULL,
|
||||
CMD_NOSUBFUNCS
|
||||
CMD_MAINFUNC(cmd_room)
|
||||
CMD_TAGS(
|
||||
CMD_TAG_GROUPCHAT)
|
||||
CMD_SYN(
|
||||
@ -618,7 +667,9 @@ static struct cmd_t command_defs[] =
|
||||
},
|
||||
|
||||
{ "/kick",
|
||||
cmd_kick, parse_args_with_freetext, 1, 2, NULL,
|
||||
parse_args_with_freetext, 1, 2, NULL,
|
||||
CMD_NOSUBFUNCS
|
||||
CMD_MAINFUNC(cmd_kick)
|
||||
CMD_TAGS(
|
||||
CMD_TAG_GROUPCHAT)
|
||||
CMD_SYN(
|
||||
@ -632,7 +683,9 @@ static struct cmd_t command_defs[] =
|
||||
},
|
||||
|
||||
{ "/ban",
|
||||
cmd_ban, parse_args_with_freetext, 1, 2, NULL,
|
||||
parse_args_with_freetext, 1, 2, NULL,
|
||||
CMD_NOSUBFUNCS
|
||||
CMD_MAINFUNC(cmd_ban)
|
||||
CMD_TAGS(
|
||||
CMD_TAG_GROUPCHAT)
|
||||
CMD_SYN(
|
||||
@ -646,7 +699,9 @@ static struct cmd_t command_defs[] =
|
||||
},
|
||||
|
||||
{ "/subject",
|
||||
cmd_subject, parse_args_with_freetext, 0, 2, NULL,
|
||||
parse_args_with_freetext, 0, 2, NULL,
|
||||
CMD_NOSUBFUNCS
|
||||
CMD_MAINFUNC(cmd_subject)
|
||||
CMD_TAGS(
|
||||
CMD_TAG_GROUPCHAT)
|
||||
CMD_SYN(
|
||||
@ -667,7 +722,9 @@ static struct cmd_t command_defs[] =
|
||||
},
|
||||
|
||||
{ "/affiliation",
|
||||
cmd_affiliation, parse_args_with_freetext, 1, 4, NULL,
|
||||
parse_args_with_freetext, 1, 4, NULL,
|
||||
CMD_NOSUBFUNCS
|
||||
CMD_MAINFUNC(cmd_affiliation)
|
||||
CMD_TAGS(
|
||||
CMD_TAG_GROUPCHAT)
|
||||
CMD_SYN(
|
||||
@ -683,7 +740,9 @@ static struct cmd_t command_defs[] =
|
||||
},
|
||||
|
||||
{ "/role",
|
||||
cmd_role, parse_args_with_freetext, 1, 4, NULL,
|
||||
parse_args_with_freetext, 1, 4, NULL,
|
||||
CMD_NOSUBFUNCS
|
||||
CMD_MAINFUNC(cmd_role)
|
||||
CMD_TAGS(
|
||||
CMD_TAG_GROUPCHAT)
|
||||
CMD_SYN(
|
||||
@ -699,7 +758,9 @@ static struct cmd_t command_defs[] =
|
||||
},
|
||||
|
||||
{ "/occupants",
|
||||
cmd_occupants, parse_args, 1, 3, cons_occupants_setting,
|
||||
parse_args, 1, 3, cons_occupants_setting,
|
||||
CMD_NOSUBFUNCS
|
||||
CMD_MAINFUNC(cmd_occupants)
|
||||
CMD_TAGS(
|
||||
CMD_TAG_GROUPCHAT,
|
||||
CMD_TAG_UI)
|
||||
@ -721,7 +782,9 @@ static struct cmd_t command_defs[] =
|
||||
},
|
||||
|
||||
{ "/form",
|
||||
cmd_form, parse_args, 1, 2, NULL,
|
||||
parse_args, 1, 2, NULL,
|
||||
CMD_NOSUBFUNCS
|
||||
CMD_MAINFUNC(cmd_form)
|
||||
CMD_TAGS(
|
||||
CMD_TAG_GROUPCHAT)
|
||||
CMD_SYN(
|
||||
@ -740,7 +803,9 @@ static struct cmd_t command_defs[] =
|
||||
},
|
||||
|
||||
{ "/rooms",
|
||||
cmd_rooms, parse_args, 0, 1, NULL,
|
||||
parse_args, 0, 1, NULL,
|
||||
CMD_NOSUBFUNCS
|
||||
CMD_MAINFUNC(cmd_rooms)
|
||||
CMD_TAGS(
|
||||
CMD_TAG_GROUPCHAT)
|
||||
CMD_SYN(
|
||||
@ -755,7 +820,9 @@ static struct cmd_t command_defs[] =
|
||||
},
|
||||
|
||||
{ "/bookmark",
|
||||
cmd_bookmark, parse_args, 0, 8, NULL,
|
||||
parse_args, 0, 8, NULL,
|
||||
CMD_NOSUBFUNCS
|
||||
CMD_MAINFUNC(cmd_bookmark)
|
||||
CMD_TAGS(
|
||||
CMD_TAG_GROUPCHAT)
|
||||
CMD_SYN(
|
||||
@ -781,7 +848,9 @@ static struct cmd_t command_defs[] =
|
||||
},
|
||||
|
||||
{ "/disco",
|
||||
cmd_disco, parse_args, 1, 2, NULL,
|
||||
parse_args, 1, 2, NULL,
|
||||
CMD_NOSUBFUNCS
|
||||
CMD_MAINFUNC(cmd_disco)
|
||||
CMD_TAGS(
|
||||
CMD_TAG_DISCOVERY)
|
||||
CMD_SYN(
|
||||
@ -801,7 +870,9 @@ static struct cmd_t command_defs[] =
|
||||
},
|
||||
|
||||
{ "/sendfile",
|
||||
cmd_sendfile, parse_args_with_freetext, 1, 1, NULL,
|
||||
parse_args_with_freetext, 1, 1, NULL,
|
||||
CMD_NOSUBFUNCS
|
||||
CMD_MAINFUNC(cmd_sendfile)
|
||||
CMD_TAGS(
|
||||
CMD_TAG_CHAT,
|
||||
CMD_TAG_GROUPCHAT)
|
||||
@ -817,7 +888,9 @@ static struct cmd_t command_defs[] =
|
||||
},
|
||||
|
||||
{ "/lastactivity",
|
||||
cmd_lastactivity, parse_args, 0, 1, NULL,
|
||||
parse_args, 0, 1, NULL,
|
||||
CMD_NOSUBFUNCS
|
||||
CMD_MAINFUNC(cmd_lastactivity)
|
||||
CMD_TAGS(
|
||||
CMD_TAG_PRESENCE)
|
||||
CMD_SYN(
|
||||
@ -837,7 +910,9 @@ static struct cmd_t command_defs[] =
|
||||
},
|
||||
|
||||
{ "/nick",
|
||||
cmd_nick, parse_args_with_freetext, 1, 1, NULL,
|
||||
parse_args_with_freetext, 1, 1, NULL,
|
||||
CMD_NOSUBFUNCS
|
||||
CMD_MAINFUNC(cmd_nick)
|
||||
CMD_TAGS(
|
||||
CMD_TAG_GROUPCHAT)
|
||||
CMD_SYN(
|
||||
@ -850,7 +925,9 @@ static struct cmd_t command_defs[] =
|
||||
},
|
||||
|
||||
{ "/win",
|
||||
cmd_win, parse_args, 1, 1, NULL,
|
||||
parse_args, 1, 1, NULL,
|
||||
CMD_NOSUBFUNCS
|
||||
CMD_MAINFUNC(cmd_win)
|
||||
CMD_TAGS(
|
||||
CMD_TAG_UI)
|
||||
CMD_SYN(
|
||||
@ -881,7 +958,14 @@ static struct cmd_t command_defs[] =
|
||||
},
|
||||
|
||||
{ "/wins",
|
||||
cmd_wins, parse_args, 0, 3, NULL,
|
||||
parse_args, 0, 3, NULL,
|
||||
CMD_SUBFUNCS(
|
||||
{ "unread", cmd_wins_unread },
|
||||
{ "tidy", cmd_wins_tidy },
|
||||
{ "prune", cmd_wins_prune },
|
||||
{ "swap", cmd_wins_swap },
|
||||
{ "autotidy", cmd_wins_autotidy })
|
||||
CMD_MAINFUNC(cmd_wins)
|
||||
CMD_TAGS(
|
||||
CMD_TAG_UI)
|
||||
CMD_SYN(
|
||||
@ -904,7 +988,9 @@ static struct cmd_t command_defs[] =
|
||||
},
|
||||
|
||||
{ "/sub",
|
||||
cmd_sub, parse_args, 1, 2, NULL,
|
||||
parse_args, 1, 2, NULL,
|
||||
CMD_NOSUBFUNCS
|
||||
CMD_MAINFUNC(cmd_sub)
|
||||
CMD_TAGS(
|
||||
CMD_TAG_ROSTER)
|
||||
CMD_SYN(
|
||||
@ -932,7 +1018,9 @@ static struct cmd_t command_defs[] =
|
||||
},
|
||||
|
||||
{ "/tiny",
|
||||
cmd_tiny, parse_args, 1, 1, NULL,
|
||||
parse_args, 1, 1, NULL,
|
||||
CMD_NOSUBFUNCS
|
||||
CMD_MAINFUNC(cmd_tiny)
|
||||
CMD_TAGS(
|
||||
CMD_TAG_CHAT,
|
||||
CMD_TAG_GROUPCHAT)
|
||||
@ -947,7 +1035,9 @@ static struct cmd_t command_defs[] =
|
||||
},
|
||||
|
||||
{ "/who",
|
||||
cmd_who, parse_args, 0, 2, NULL,
|
||||
parse_args, 0, 2, NULL,
|
||||
CMD_NOSUBFUNCS
|
||||
CMD_MAINFUNC(cmd_who)
|
||||
CMD_TAGS(
|
||||
CMD_TAG_CHAT,
|
||||
CMD_TAG_GROUPCHAT,
|
||||
@ -978,7 +1068,9 @@ static struct cmd_t command_defs[] =
|
||||
},
|
||||
|
||||
{ "/close",
|
||||
cmd_close, parse_args, 0, 1, NULL,
|
||||
parse_args, 0, 1, NULL,
|
||||
CMD_NOSUBFUNCS
|
||||
CMD_MAINFUNC(cmd_close)
|
||||
CMD_TAGS(
|
||||
CMD_TAG_UI)
|
||||
CMD_SYN(
|
||||
@ -1006,7 +1098,9 @@ static struct cmd_t command_defs[] =
|
||||
},
|
||||
|
||||
{ "/clear",
|
||||
cmd_clear, parse_args, 0, 0, NULL,
|
||||
parse_args, 0, 0, NULL,
|
||||
CMD_NOSUBFUNCS
|
||||
CMD_MAINFUNC(cmd_clear)
|
||||
CMD_TAGS(
|
||||
CMD_TAG_UI)
|
||||
CMD_SYN(
|
||||
@ -1018,7 +1112,9 @@ static struct cmd_t command_defs[] =
|
||||
},
|
||||
|
||||
{ "/quit",
|
||||
cmd_quit, parse_args, 0, 0, NULL,
|
||||
parse_args, 0, 0, NULL,
|
||||
CMD_NOSUBFUNCS
|
||||
CMD_MAINFUNC(cmd_quit)
|
||||
CMD_NOTAGS
|
||||
CMD_SYN(
|
||||
"/quit")
|
||||
@ -1029,7 +1125,9 @@ static struct cmd_t command_defs[] =
|
||||
},
|
||||
|
||||
{ "/privileges",
|
||||
cmd_privileges, parse_args, 1, 1, &cons_privileges_setting,
|
||||
parse_args, 1, 1, &cons_privileges_setting,
|
||||
CMD_NOSUBFUNCS
|
||||
CMD_MAINFUNC(cmd_privileges)
|
||||
CMD_TAGS(
|
||||
CMD_TAG_GROUPCHAT,
|
||||
CMD_TAG_UI)
|
||||
@ -1043,7 +1141,9 @@ static struct cmd_t command_defs[] =
|
||||
},
|
||||
|
||||
{ "/charset",
|
||||
cmd_charset, parse_args, 0, 0, NULL,
|
||||
parse_args, 0, 0, NULL,
|
||||
CMD_NOSUBFUNCS
|
||||
CMD_MAINFUNC(cmd_charset)
|
||||
CMD_TAGS(
|
||||
CMD_TAG_UI)
|
||||
CMD_SYN(
|
||||
@ -1055,7 +1155,9 @@ static struct cmd_t command_defs[] =
|
||||
},
|
||||
|
||||
{ "/beep",
|
||||
cmd_beep, parse_args, 1, 1, &cons_beep_setting,
|
||||
parse_args, 1, 1, &cons_beep_setting,
|
||||
CMD_NOSUBFUNCS
|
||||
CMD_MAINFUNC(cmd_beep)
|
||||
CMD_TAGS(
|
||||
CMD_TAG_UI)
|
||||
CMD_SYN(
|
||||
@ -1070,7 +1172,9 @@ static struct cmd_t command_defs[] =
|
||||
},
|
||||
|
||||
{ "/console",
|
||||
cmd_console, parse_args, 2, 2, &cons_console_setting,
|
||||
parse_args, 2, 2, &cons_console_setting,
|
||||
CMD_NOSUBFUNCS
|
||||
CMD_MAINFUNC(cmd_console)
|
||||
CMD_TAGS(
|
||||
CMD_TAG_UI,
|
||||
CMD_TAG_CHAT,
|
||||
@ -1096,7 +1200,9 @@ static struct cmd_t command_defs[] =
|
||||
},
|
||||
|
||||
{ "/encwarn",
|
||||
cmd_encwarn, parse_args, 1, 1, &cons_encwarn_setting,
|
||||
parse_args, 1, 1, &cons_encwarn_setting,
|
||||
CMD_NOSUBFUNCS
|
||||
CMD_MAINFUNC(cmd_encwarn)
|
||||
CMD_TAGS(
|
||||
CMD_TAG_CHAT,
|
||||
CMD_TAG_UI)
|
||||
@ -1110,7 +1216,9 @@ static struct cmd_t command_defs[] =
|
||||
},
|
||||
|
||||
{ "/presence",
|
||||
cmd_presence, parse_args, 1, 1, &cons_presence_setting,
|
||||
parse_args, 1, 1, &cons_presence_setting,
|
||||
CMD_NOSUBFUNCS
|
||||
CMD_MAINFUNC(cmd_presence)
|
||||
CMD_TAGS(
|
||||
CMD_TAG_UI,
|
||||
CMD_TAG_CHAT)
|
||||
@ -1124,7 +1232,9 @@ static struct cmd_t command_defs[] =
|
||||
},
|
||||
|
||||
{ "/wrap",
|
||||
cmd_wrap, parse_args, 1, 1, &cons_wrap_setting,
|
||||
parse_args, 1, 1, &cons_wrap_setting,
|
||||
CMD_NOSUBFUNCS
|
||||
CMD_MAINFUNC(cmd_wrap)
|
||||
CMD_TAGS(
|
||||
CMD_TAG_UI)
|
||||
CMD_SYN(
|
||||
@ -1137,7 +1247,9 @@ static struct cmd_t command_defs[] =
|
||||
},
|
||||
|
||||
{ "/time",
|
||||
cmd_time, parse_args, 1, 3, &cons_time_setting,
|
||||
parse_args, 1, 3, &cons_time_setting,
|
||||
CMD_NOSUBFUNCS
|
||||
CMD_MAINFUNC(cmd_time)
|
||||
CMD_TAGS(
|
||||
CMD_TAG_UI)
|
||||
CMD_SYN(
|
||||
@ -1177,7 +1289,9 @@ static struct cmd_t command_defs[] =
|
||||
},
|
||||
|
||||
{ "/inpblock",
|
||||
cmd_inpblock, parse_args, 2, 2, &cons_inpblock_setting,
|
||||
parse_args, 2, 2, &cons_inpblock_setting,
|
||||
CMD_NOSUBFUNCS
|
||||
CMD_MAINFUNC(cmd_inpblock)
|
||||
CMD_TAGS(
|
||||
CMD_TAG_UI)
|
||||
CMD_SYN(
|
||||
@ -1192,7 +1306,9 @@ static struct cmd_t command_defs[] =
|
||||
},
|
||||
|
||||
{ "/notify",
|
||||
cmd_notify, parse_args_with_freetext, 0, 4, NULL,
|
||||
parse_args_with_freetext, 0, 4, NULL,
|
||||
CMD_NOSUBFUNCS
|
||||
CMD_MAINFUNC(cmd_notify)
|
||||
CMD_TAGS(
|
||||
CMD_TAG_UI,
|
||||
CMD_TAG_CHAT,
|
||||
@ -1261,7 +1377,9 @@ static struct cmd_t command_defs[] =
|
||||
},
|
||||
|
||||
{ "/flash",
|
||||
cmd_flash, parse_args, 1, 1, &cons_flash_setting,
|
||||
parse_args, 1, 1, &cons_flash_setting,
|
||||
CMD_NOSUBFUNCS
|
||||
CMD_MAINFUNC(cmd_flash)
|
||||
CMD_TAGS(
|
||||
CMD_TAG_UI)
|
||||
CMD_SYN(
|
||||
@ -1275,7 +1393,9 @@ static struct cmd_t command_defs[] =
|
||||
},
|
||||
|
||||
{ "/tray",
|
||||
cmd_tray, parse_args, 1, 1, &cons_tray_setting,
|
||||
parse_args, 1, 1, &cons_tray_setting,
|
||||
CMD_NOSUBFUNCS
|
||||
CMD_MAINFUNC(cmd_tray)
|
||||
CMD_TAGS(
|
||||
CMD_TAG_UI)
|
||||
CMD_SYN(
|
||||
@ -1288,7 +1408,9 @@ static struct cmd_t command_defs[] =
|
||||
},
|
||||
|
||||
{ "/intype",
|
||||
cmd_intype, parse_args, 1, 1, &cons_intype_setting,
|
||||
parse_args, 1, 1, &cons_intype_setting,
|
||||
CMD_NOSUBFUNCS
|
||||
CMD_MAINFUNC(cmd_intype)
|
||||
CMD_TAGS(
|
||||
CMD_TAG_UI,
|
||||
CMD_TAG_CHAT)
|
||||
@ -1302,7 +1424,9 @@ static struct cmd_t command_defs[] =
|
||||
},
|
||||
|
||||
{ "/splash",
|
||||
cmd_splash, parse_args, 1, 1, &cons_splash_setting,
|
||||
parse_args, 1, 1, &cons_splash_setting,
|
||||
CMD_NOSUBFUNCS
|
||||
CMD_MAINFUNC(cmd_splash)
|
||||
CMD_TAGS(
|
||||
CMD_TAG_UI)
|
||||
CMD_SYN(
|
||||
@ -1315,7 +1439,9 @@ static struct cmd_t command_defs[] =
|
||||
},
|
||||
|
||||
{ "/autoconnect",
|
||||
cmd_autoconnect, parse_args, 1, 2, &cons_autoconnect_setting,
|
||||
parse_args, 1, 2, &cons_autoconnect_setting,
|
||||
CMD_NOSUBFUNCS
|
||||
CMD_MAINFUNC(cmd_autoconnect)
|
||||
CMD_TAGS(
|
||||
CMD_TAG_CONNECTION)
|
||||
CMD_SYN(
|
||||
@ -1333,7 +1459,9 @@ static struct cmd_t command_defs[] =
|
||||
},
|
||||
|
||||
{ "/vercheck",
|
||||
cmd_vercheck, parse_args, 0, 1, NULL,
|
||||
parse_args, 0, 1, NULL,
|
||||
CMD_NOSUBFUNCS
|
||||
CMD_MAINFUNC(cmd_vercheck)
|
||||
CMD_TAGS(
|
||||
CMD_TAG_UI)
|
||||
CMD_SYN(
|
||||
@ -1346,7 +1474,9 @@ static struct cmd_t command_defs[] =
|
||||
},
|
||||
|
||||
{ "/titlebar",
|
||||
cmd_titlebar, parse_args, 2, 2, &cons_titlebar_setting,
|
||||
parse_args, 2, 2, &cons_titlebar_setting,
|
||||
CMD_NOSUBFUNCS
|
||||
CMD_MAINFUNC(cmd_titlebar)
|
||||
CMD_TAGS(
|
||||
CMD_TAG_UI)
|
||||
CMD_SYN(
|
||||
@ -1361,7 +1491,9 @@ static struct cmd_t command_defs[] =
|
||||
},
|
||||
|
||||
{ "/alias",
|
||||
cmd_alias, parse_args_with_freetext, 1, 3, NULL,
|
||||
parse_args_with_freetext, 1, 3, NULL,
|
||||
CMD_NOSUBFUNCS
|
||||
CMD_MAINFUNC(cmd_alias)
|
||||
CMD_NOTAGS
|
||||
CMD_SYN(
|
||||
"/alias list",
|
||||
@ -1382,7 +1514,9 @@ static struct cmd_t command_defs[] =
|
||||
},
|
||||
|
||||
{ "/chlog",
|
||||
cmd_chlog, parse_args, 1, 1, &cons_chlog_setting,
|
||||
parse_args, 1, 1, &cons_chlog_setting,
|
||||
CMD_NOSUBFUNCS
|
||||
CMD_MAINFUNC(cmd_chlog)
|
||||
CMD_TAGS(
|
||||
CMD_TAG_CHAT)
|
||||
CMD_SYN(
|
||||
@ -1398,7 +1532,9 @@ static struct cmd_t command_defs[] =
|
||||
},
|
||||
|
||||
{ "/grlog",
|
||||
cmd_grlog, parse_args, 1, 1, &cons_grlog_setting,
|
||||
parse_args, 1, 1, &cons_grlog_setting,
|
||||
CMD_NOSUBFUNCS
|
||||
CMD_MAINFUNC(cmd_grlog)
|
||||
CMD_TAGS(
|
||||
CMD_TAG_GROUPCHAT)
|
||||
CMD_SYN(
|
||||
@ -1412,7 +1548,9 @@ static struct cmd_t command_defs[] =
|
||||
},
|
||||
|
||||
{ "/states",
|
||||
cmd_states, parse_args, 1, 1, &cons_states_setting,
|
||||
parse_args, 1, 1, &cons_states_setting,
|
||||
CMD_NOSUBFUNCS
|
||||
CMD_MAINFUNC(cmd_states)
|
||||
CMD_TAGS(
|
||||
CMD_TAG_CHAT)
|
||||
CMD_SYN(
|
||||
@ -1425,7 +1563,9 @@ static struct cmd_t command_defs[] =
|
||||
},
|
||||
|
||||
{ "/pgp",
|
||||
cmd_pgp, parse_args, 1, 3, NULL,
|
||||
parse_args, 1, 3, NULL,
|
||||
CMD_NOSUBFUNCS
|
||||
CMD_MAINFUNC(cmd_pgp)
|
||||
CMD_TAGS(
|
||||
CMD_TAG_CHAT,
|
||||
CMD_TAG_UI)
|
||||
@ -1460,7 +1600,23 @@ static struct cmd_t command_defs[] =
|
||||
},
|
||||
|
||||
{ "/otr",
|
||||
cmd_otr, parse_args, 1, 3, NULL,
|
||||
parse_args, 1, 3, NULL,
|
||||
CMD_SUBFUNCS(
|
||||
{ "char", cmd_otr_char },
|
||||
{ "log", cmd_otr_log },
|
||||
{ "libver", cmd_otr_libver },
|
||||
{ "policy", cmd_otr_policy },
|
||||
{ "gen", cmd_otr_gen },
|
||||
{ "myfp", cmd_otr_myfp },
|
||||
{ "theirfp", cmd_otr_theirfp },
|
||||
{ "start", cmd_otr_start },
|
||||
{ "end", cmd_otr_end },
|
||||
{ "trust", cmd_otr_trust },
|
||||
{ "untrust", cmd_otr_untrust },
|
||||
{ "secret", cmd_otr_secret },
|
||||
{ "question", cmd_otr_question },
|
||||
{ "answer", cmd_otr_answer })
|
||||
CMD_NOMAINFUNC
|
||||
CMD_TAGS(
|
||||
CMD_TAG_CHAT,
|
||||
CMD_TAG_UI)
|
||||
@ -1513,7 +1669,9 @@ static struct cmd_t command_defs[] =
|
||||
},
|
||||
|
||||
{ "/outtype",
|
||||
cmd_outtype, parse_args, 1, 1, &cons_outtype_setting,
|
||||
parse_args, 1, 1, &cons_outtype_setting,
|
||||
CMD_NOSUBFUNCS
|
||||
CMD_MAINFUNC(cmd_outtype)
|
||||
CMD_TAGS(
|
||||
CMD_TAG_CHAT)
|
||||
CMD_SYN(
|
||||
@ -1526,7 +1684,9 @@ static struct cmd_t command_defs[] =
|
||||
},
|
||||
|
||||
{ "/gone",
|
||||
cmd_gone, parse_args, 1, 1, &cons_gone_setting,
|
||||
parse_args, 1, 1, &cons_gone_setting,
|
||||
CMD_NOSUBFUNCS
|
||||
CMD_MAINFUNC(cmd_gone)
|
||||
CMD_TAGS(
|
||||
CMD_TAG_CHAT)
|
||||
CMD_SYN(
|
||||
@ -1540,7 +1700,9 @@ static struct cmd_t command_defs[] =
|
||||
},
|
||||
|
||||
{ "/history",
|
||||
cmd_history, parse_args, 1, 1, &cons_history_setting,
|
||||
parse_args, 1, 1, &cons_history_setting,
|
||||
CMD_NOSUBFUNCS
|
||||
CMD_MAINFUNC(cmd_history)
|
||||
CMD_TAGS(
|
||||
CMD_TAG_UI,
|
||||
CMD_TAG_CHAT)
|
||||
@ -1555,7 +1717,9 @@ static struct cmd_t command_defs[] =
|
||||
},
|
||||
|
||||
{ "/log",
|
||||
cmd_log, parse_args, 1, 2, &cons_log_setting,
|
||||
parse_args, 1, 2, &cons_log_setting,
|
||||
CMD_NOSUBFUNCS
|
||||
CMD_MAINFUNC(cmd_log)
|
||||
CMD_NOTAGS
|
||||
CMD_SYN(
|
||||
"/log where",
|
||||
@ -1573,7 +1737,9 @@ static struct cmd_t command_defs[] =
|
||||
},
|
||||
|
||||
{ "/carbons",
|
||||
cmd_carbons, parse_args, 1, 1, &cons_carbons_setting,
|
||||
parse_args, 1, 1, &cons_carbons_setting,
|
||||
CMD_NOSUBFUNCS
|
||||
CMD_MAINFUNC(cmd_carbons)
|
||||
CMD_TAGS(
|
||||
CMD_TAG_CHAT)
|
||||
CMD_SYN(
|
||||
@ -1587,7 +1753,9 @@ static struct cmd_t command_defs[] =
|
||||
},
|
||||
|
||||
{ "/receipts",
|
||||
cmd_receipts, parse_args, 2, 2, &cons_receipts_setting,
|
||||
parse_args, 2, 2, &cons_receipts_setting,
|
||||
CMD_NOSUBFUNCS
|
||||
CMD_MAINFUNC(cmd_receipts)
|
||||
CMD_TAGS(
|
||||
CMD_TAG_CHAT)
|
||||
CMD_SYN(
|
||||
@ -1602,7 +1770,9 @@ static struct cmd_t command_defs[] =
|
||||
},
|
||||
|
||||
{ "/reconnect",
|
||||
cmd_reconnect, parse_args, 1, 1, &cons_reconnect_setting,
|
||||
parse_args, 1, 1, &cons_reconnect_setting,
|
||||
CMD_NOSUBFUNCS
|
||||
CMD_MAINFUNC(cmd_reconnect)
|
||||
CMD_TAGS(
|
||||
CMD_TAG_CONNECTION)
|
||||
CMD_SYN(
|
||||
@ -1615,7 +1785,9 @@ static struct cmd_t command_defs[] =
|
||||
},
|
||||
|
||||
{ "/autoping",
|
||||
cmd_autoping, parse_args, 2, 2, &cons_autoping_setting,
|
||||
parse_args, 2, 2, &cons_autoping_setting,
|
||||
CMD_NOSUBFUNCS
|
||||
CMD_MAINFUNC(cmd_autoping)
|
||||
CMD_TAGS(
|
||||
CMD_TAG_CONNECTION)
|
||||
CMD_SYN(
|
||||
@ -1630,7 +1802,9 @@ static struct cmd_t command_defs[] =
|
||||
},
|
||||
|
||||
{ "/ping",
|
||||
cmd_ping, parse_args, 0, 1, NULL,
|
||||
parse_args, 0, 1, NULL,
|
||||
CMD_NOSUBFUNCS
|
||||
CMD_MAINFUNC(cmd_ping)
|
||||
CMD_TAGS(
|
||||
CMD_TAG_CONNECTION)
|
||||
CMD_SYN(
|
||||
@ -1644,7 +1818,9 @@ static struct cmd_t command_defs[] =
|
||||
},
|
||||
|
||||
{ "/autoaway",
|
||||
cmd_autoaway, parse_args_with_freetext, 2, 3, &cons_autoaway_setting,
|
||||
parse_args_with_freetext, 2, 3, &cons_autoaway_setting,
|
||||
CMD_NOSUBFUNCS
|
||||
CMD_MAINFUNC(cmd_autoaway)
|
||||
CMD_TAGS(
|
||||
CMD_TAG_PRESENCE)
|
||||
CMD_SYN(
|
||||
@ -1675,7 +1851,9 @@ static struct cmd_t command_defs[] =
|
||||
},
|
||||
|
||||
{ "/priority",
|
||||
cmd_priority, parse_args, 1, 1, NULL,
|
||||
parse_args, 1, 1, NULL,
|
||||
CMD_NOSUBFUNCS
|
||||
CMD_MAINFUNC(cmd_priority)
|
||||
CMD_TAGS(
|
||||
CMD_TAG_PRESENCE)
|
||||
CMD_SYN(
|
||||
@ -1689,7 +1867,19 @@ static struct cmd_t command_defs[] =
|
||||
},
|
||||
|
||||
{ "/account",
|
||||
cmd_account, parse_args, 0, 4, NULL,
|
||||
parse_args, 0, 4, NULL,
|
||||
CMD_SUBFUNCS(
|
||||
{ "list", cmd_account_list },
|
||||
{ "show", cmd_account_show },
|
||||
{ "add", cmd_account_add },
|
||||
{ "remove", cmd_account_remove },
|
||||
{ "enable", cmd_account_enable },
|
||||
{ "disable", cmd_account_disable },
|
||||
{ "rename", cmd_account_rename },
|
||||
{ "default", cmd_account_default },
|
||||
{ "set", cmd_account_set },
|
||||
{ "clear", cmd_account_clear })
|
||||
CMD_MAINFUNC(cmd_account)
|
||||
CMD_TAGS(
|
||||
CMD_TAG_CONNECTION
|
||||
CMD_TAG_PRESENCE,
|
||||
@ -1780,7 +1970,9 @@ static struct cmd_t command_defs[] =
|
||||
},
|
||||
|
||||
{ "/plugins",
|
||||
cmd_plugins, parse_args, 0, 2, NULL,
|
||||
parse_args, 0, 2, NULL,
|
||||
CMD_NOSUBFUNCS
|
||||
CMD_MAINFUNC(cmd_plugins)
|
||||
CMD_NOTAGS
|
||||
CMD_SYN(
|
||||
"/plugins",
|
||||
@ -1794,7 +1986,9 @@ static struct cmd_t command_defs[] =
|
||||
},
|
||||
|
||||
{ "/prefs",
|
||||
cmd_prefs, parse_args, 0, 1, NULL,
|
||||
parse_args, 0, 1, NULL,
|
||||
CMD_NOSUBFUNCS
|
||||
CMD_MAINFUNC(cmd_prefs)
|
||||
CMD_NOTAGS
|
||||
CMD_SYN(
|
||||
"/prefs [ui|desktop|chat|log|conn|presence|otr|pgp]")
|
||||
@ -1814,7 +2008,9 @@ static struct cmd_t command_defs[] =
|
||||
},
|
||||
|
||||
{ "/theme",
|
||||
cmd_theme, parse_args, 1, 2, &cons_theme_setting,
|
||||
parse_args, 1, 2, &cons_theme_setting,
|
||||
CMD_NOSUBFUNCS
|
||||
CMD_MAINFUNC(cmd_theme)
|
||||
CMD_TAGS(
|
||||
CMD_TAG_UI)
|
||||
CMD_SYN(
|
||||
@ -1835,7 +2031,9 @@ static struct cmd_t command_defs[] =
|
||||
},
|
||||
|
||||
{ "/statuses",
|
||||
cmd_statuses, parse_args, 2, 2, &cons_statuses_setting,
|
||||
parse_args, 2, 2, &cons_statuses_setting,
|
||||
CMD_NOSUBFUNCS
|
||||
CMD_MAINFUNC(cmd_statuses)
|
||||
CMD_TAGS(
|
||||
CMD_TAG_UI,
|
||||
CMD_TAG_CHAT,
|
||||
@ -1859,7 +2057,9 @@ static struct cmd_t command_defs[] =
|
||||
},
|
||||
|
||||
{ "/xmlconsole",
|
||||
cmd_xmlconsole, parse_args, 0, 0, NULL,
|
||||
parse_args, 0, 0, NULL,
|
||||
CMD_NOSUBFUNCS
|
||||
CMD_MAINFUNC(cmd_xmlconsole)
|
||||
CMD_TAGS(
|
||||
CMD_TAG_UI)
|
||||
CMD_SYN(
|
||||
@ -1871,7 +2071,9 @@ static struct cmd_t command_defs[] =
|
||||
},
|
||||
|
||||
{ "/away",
|
||||
cmd_away, parse_args_with_freetext, 0, 1, NULL,
|
||||
parse_args_with_freetext, 0, 1, NULL,
|
||||
CMD_NOSUBFUNCS
|
||||
CMD_MAINFUNC(cmd_away)
|
||||
CMD_TAGS(
|
||||
CMD_TAG_PRESENCE)
|
||||
CMD_SYN(
|
||||
@ -1886,7 +2088,9 @@ static struct cmd_t command_defs[] =
|
||||
},
|
||||
|
||||
{ "/chat",
|
||||
cmd_chat, parse_args_with_freetext, 0, 1, NULL,
|
||||
parse_args_with_freetext, 0, 1, NULL,
|
||||
CMD_NOSUBFUNCS
|
||||
CMD_MAINFUNC(cmd_chat)
|
||||
CMD_TAGS(
|
||||
CMD_TAG_PRESENCE)
|
||||
CMD_SYN(
|
||||
@ -1901,7 +2105,9 @@ static struct cmd_t command_defs[] =
|
||||
},
|
||||
|
||||
{ "/dnd",
|
||||
cmd_dnd, parse_args_with_freetext, 0, 1, NULL,
|
||||
parse_args_with_freetext, 0, 1, NULL,
|
||||
CMD_NOSUBFUNCS
|
||||
CMD_MAINFUNC(cmd_dnd)
|
||||
CMD_TAGS(
|
||||
CMD_TAG_PRESENCE)
|
||||
CMD_SYN(
|
||||
@ -1916,7 +2122,9 @@ static struct cmd_t command_defs[] =
|
||||
},
|
||||
|
||||
{ "/online",
|
||||
cmd_online, parse_args_with_freetext, 0, 1, NULL,
|
||||
parse_args_with_freetext, 0, 1, NULL,
|
||||
CMD_NOSUBFUNCS
|
||||
CMD_MAINFUNC(cmd_online)
|
||||
CMD_TAGS(
|
||||
CMD_TAG_PRESENCE)
|
||||
CMD_SYN(
|
||||
@ -1931,7 +2139,9 @@ static struct cmd_t command_defs[] =
|
||||
},
|
||||
|
||||
{ "/xa",
|
||||
cmd_xa, parse_args_with_freetext, 0, 1, NULL,
|
||||
parse_args_with_freetext, 0, 1, NULL,
|
||||
CMD_NOSUBFUNCS
|
||||
CMD_MAINFUNC(cmd_xa)
|
||||
CMD_TAGS(
|
||||
CMD_TAG_PRESENCE)
|
||||
CMD_SYN(
|
||||
@ -1946,7 +2156,9 @@ static struct cmd_t command_defs[] =
|
||||
},
|
||||
|
||||
{ "/script",
|
||||
cmd_script, parse_args, 1, 2, NULL,
|
||||
parse_args, 1, 2, NULL,
|
||||
CMD_NOSUBFUNCS
|
||||
CMD_MAINFUNC(cmd_script)
|
||||
CMD_NOTAGS
|
||||
CMD_SYN(
|
||||
"/script run <script>",
|
||||
@ -1966,7 +2178,9 @@ static struct cmd_t command_defs[] =
|
||||
},
|
||||
|
||||
{ "/export",
|
||||
cmd_export, parse_args, 1, 1, NULL,
|
||||
parse_args, 1, 1, NULL,
|
||||
CMD_NOSUBFUNCS
|
||||
CMD_MAINFUNC(cmd_export)
|
||||
CMD_NOTAGS
|
||||
CMD_SYN(
|
||||
"/export <filepath>")
|
||||
@ -3073,11 +3287,26 @@ _cmd_execute(ProfWin *window, const char *const command, const char *const inp)
|
||||
if (result == FALSE) {
|
||||
ui_invalid_command_usage(cmd->cmd, cmd->setting_func);
|
||||
return TRUE;
|
||||
} else {
|
||||
gboolean result = cmd->func(window, command, args);
|
||||
g_strfreev(args);
|
||||
return result;
|
||||
}
|
||||
if (args[0] && cmd->sub_funcs) {
|
||||
int i = 0;
|
||||
while (cmd->sub_funcs[i][0]) {
|
||||
if (g_strcmp0(args[0], (char*)cmd->sub_funcs[i][0]) == 0) {
|
||||
gboolean (*func)(ProfWin *window, const char *const command, gchar **args) = cmd->sub_funcs[i][1];
|
||||
gboolean result = func(window, command, args);
|
||||
g_strfreev(args);
|
||||
return result;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
}
|
||||
if (!cmd->func) {
|
||||
ui_invalid_command_usage(cmd->cmd, cmd->setting_func);
|
||||
return TRUE;
|
||||
}
|
||||
gboolean result = cmd->func(window, command, args);
|
||||
g_strfreev(args);
|
||||
return result;
|
||||
} else if (plugins_run_command(inp)) {
|
||||
return TRUE;
|
||||
} else {
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -50,27 +50,41 @@ typedef struct cmd_help_t {
|
||||
* Command structure
|
||||
*
|
||||
* cmd - The command string including leading '/'
|
||||
* func - The function to execute for the command
|
||||
* parser - The function used to parse arguments
|
||||
* min_args - Minimum number of arguments
|
||||
* max_args - Maximum number of arguments
|
||||
* setting_func - Function to display current settings to the console
|
||||
* sub_funcs - Optional list of functions mapped to the first argument
|
||||
* func - Main function to call when no arguments, or sub_funcs not implemented
|
||||
* help - A help struct containing usage info etc
|
||||
*/
|
||||
typedef struct cmd_t {
|
||||
gchar *cmd;
|
||||
gboolean (*func)(ProfWin *window, const char *const command, gchar **args);
|
||||
gchar** (*parser)(const char *const inp, int min, int max, gboolean *result);
|
||||
int min_args;
|
||||
int max_args;
|
||||
void (*setting_func)(void);
|
||||
void *sub_funcs[50][2];
|
||||
gboolean (*func)(ProfWin *window, const char *const command, gchar **args);
|
||||
CommandHelp help;
|
||||
} Command;
|
||||
|
||||
gboolean cmd_execute_alias(ProfWin *window, const char *const inp, gboolean *ran);
|
||||
gboolean cmd_execute_default(ProfWin *window, const char *inp);
|
||||
|
||||
gboolean cmd_about(ProfWin *window, const char *const command, gchar **args);
|
||||
|
||||
gboolean cmd_account(ProfWin *window, const char *const command, gchar **args);
|
||||
gboolean cmd_account_list(ProfWin *window, const char *const command, gchar **args);
|
||||
gboolean cmd_account_show(ProfWin *window, const char *const command, gchar **args);
|
||||
gboolean cmd_account_add(ProfWin *window, const char *const command, gchar **args);
|
||||
gboolean cmd_account_remove(ProfWin *window, const char *const command, gchar **args);
|
||||
gboolean cmd_account_enable(ProfWin *window, const char *const command, gchar **args);
|
||||
gboolean cmd_account_disable(ProfWin *window, const char *const command, gchar **args);
|
||||
gboolean cmd_account_rename(ProfWin *window, const char *const command, gchar **args);
|
||||
gboolean cmd_account_default(ProfWin *window, const char *const command, gchar **args);
|
||||
gboolean cmd_account_set(ProfWin *window, const char *const command, gchar **args);
|
||||
gboolean cmd_account_clear(ProfWin *window, const char *const command, gchar **args);
|
||||
|
||||
gboolean cmd_autoaway(ProfWin *window, const char *const command, gchar **args);
|
||||
gboolean cmd_autoconnect(ProfWin *window, const char *const command, gchar **args);
|
||||
gboolean cmd_autoping(ProfWin *window, const char *const command, gchar **args);
|
||||
@ -82,7 +96,14 @@ gboolean cmd_chlog(ProfWin *window, const char *const command, gchar **args);
|
||||
gboolean cmd_clear(ProfWin *window, const char *const command, gchar **args);
|
||||
gboolean cmd_close(ProfWin *window, const char *const command, gchar **args);
|
||||
gboolean cmd_connect(ProfWin *window, const char *const command, gchar **args);
|
||||
gboolean cmd_tls(ProfWin *window, const char *const command, gchar **args);
|
||||
|
||||
gboolean cmd_tls_certpath(ProfWin *window, const char *const command, gchar **args);
|
||||
gboolean cmd_tls_trust(ProfWin *window, const char *const command, gchar **args);
|
||||
gboolean cmd_tls_trusted(ProfWin *window, const char *const command, gchar **args);
|
||||
gboolean cmd_tls_revoke(ProfWin *window, const char *const command, gchar **args);
|
||||
gboolean cmd_tls_show(ProfWin *window, const char *const command, gchar **args);
|
||||
gboolean cmd_tls_cert(ProfWin *window, const char *const command, gchar **args);
|
||||
|
||||
gboolean cmd_decline(ProfWin *window, const char *const command, gchar **args);
|
||||
gboolean cmd_disco(ProfWin *window, const char *const command, gchar **args);
|
||||
gboolean cmd_sendfile(ProfWin *window, const char *const command, gchar **args);
|
||||
@ -109,7 +130,22 @@ gboolean cmd_msg(ProfWin *window, const char *const command, gchar **args);
|
||||
gboolean cmd_nick(ProfWin *window, const char *const command, gchar **args);
|
||||
gboolean cmd_notify(ProfWin *window, const char *const command, gchar **args);
|
||||
gboolean cmd_online(ProfWin *window, const char *const command, gchar **args);
|
||||
gboolean cmd_otr(ProfWin *window, const char *const command, gchar **args);
|
||||
|
||||
gboolean cmd_otr_char(ProfWin *window, const char *const command, gchar **args);
|
||||
gboolean cmd_otr_log(ProfWin *window, const char *const command, gchar **args);
|
||||
gboolean cmd_otr_libver(ProfWin *window, const char *const command, gchar **args);
|
||||
gboolean cmd_otr_policy(ProfWin *window, const char *const command, gchar **args);
|
||||
gboolean cmd_otr_gen(ProfWin *window, const char *const command, gchar **args);
|
||||
gboolean cmd_otr_myfp(ProfWin *window, const char *const command, gchar **args);
|
||||
gboolean cmd_otr_theirfp(ProfWin *window, const char *const command, gchar **args);
|
||||
gboolean cmd_otr_start(ProfWin *window, const char *const command, gchar **args);
|
||||
gboolean cmd_otr_end(ProfWin *window, const char *const command, gchar **args);
|
||||
gboolean cmd_otr_trust(ProfWin *window, const char *const command, gchar **args);
|
||||
gboolean cmd_otr_untrust(ProfWin *window, const char *const command, gchar **args);
|
||||
gboolean cmd_otr_secret(ProfWin *window, const char *const command, gchar **args);
|
||||
gboolean cmd_otr_question(ProfWin *window, const char *const command, gchar **args);
|
||||
gboolean cmd_otr_answer(ProfWin *window, const char *const command, gchar **args);
|
||||
|
||||
gboolean cmd_pgp(ProfWin *window, const char *const command, gchar **args);
|
||||
gboolean cmd_outtype(ProfWin *window, const char *const command, gchar **args);
|
||||
gboolean cmd_prefs(ProfWin *window, const char *const command, gchar **args);
|
||||
@ -132,7 +168,14 @@ gboolean cmd_titlebar(ProfWin *window, const char *const command, gchar **args);
|
||||
gboolean cmd_vercheck(ProfWin *window, const char *const command, gchar **args);
|
||||
gboolean cmd_who(ProfWin *window, const char *const command, gchar **args);
|
||||
gboolean cmd_win(ProfWin *window, const char *const command, gchar **args);
|
||||
|
||||
gboolean cmd_wins(ProfWin *window, const char *const command, gchar **args);
|
||||
gboolean cmd_wins_unread(ProfWin *window, const char *const command, gchar **args);
|
||||
gboolean cmd_wins_tidy(ProfWin *window, const char *const command, gchar **args);
|
||||
gboolean cmd_wins_prune(ProfWin *window, const char *const command, gchar **args);
|
||||
gboolean cmd_wins_swap(ProfWin *window, const char *const command, gchar **args);
|
||||
gboolean cmd_wins_autotidy(ProfWin *window, const char *const command, gchar **args);
|
||||
|
||||
gboolean cmd_xa(ProfWin *window, const char *const command, gchar **args);
|
||||
gboolean cmd_alias(ProfWin *window, const char *const command, gchar **args);
|
||||
gboolean cmd_xmlconsole(ProfWin *window, const char *const command, gchar **args);
|
||||
|
@ -61,7 +61,7 @@ void cmd_account_list_shows_accounts(void **state)
|
||||
|
||||
expect_memory(cons_show_account_list, accounts, accounts, sizeof(accounts));
|
||||
|
||||
gboolean result = cmd_account(NULL, CMD_ACCOUNT, args);
|
||||
gboolean result = cmd_account_list(NULL, CMD_ACCOUNT, args);
|
||||
assert_true(result);
|
||||
}
|
||||
|
||||
@ -71,7 +71,7 @@ void cmd_account_show_shows_usage_when_no_arg(void **state)
|
||||
|
||||
expect_string(cons_bad_cmd_usage, cmd, CMD_ACCOUNT);
|
||||
|
||||
gboolean result = cmd_account(NULL, CMD_ACCOUNT, args);
|
||||
gboolean result = cmd_account_show(NULL, CMD_ACCOUNT, args);
|
||||
assert_true(result);
|
||||
}
|
||||
|
||||
@ -85,7 +85,7 @@ void cmd_account_show_shows_message_when_account_does_not_exist(void **state)
|
||||
expect_cons_show("No such account.");
|
||||
expect_cons_show("");
|
||||
|
||||
gboolean result = cmd_account(NULL, CMD_ACCOUNT, args);
|
||||
gboolean result = cmd_account_show(NULL, CMD_ACCOUNT, args);
|
||||
assert_true(result);
|
||||
}
|
||||
|
||||
@ -100,7 +100,7 @@ void cmd_account_show_shows_account_when_exists(void **state)
|
||||
|
||||
expect_memory(cons_show_account, account, account, sizeof(account));
|
||||
|
||||
gboolean result = cmd_account(NULL, CMD_ACCOUNT, args);
|
||||
gboolean result = cmd_account_show(NULL, CMD_ACCOUNT, args);
|
||||
assert_true(result);
|
||||
}
|
||||
|
||||
@ -110,7 +110,7 @@ void cmd_account_add_shows_usage_when_no_arg(void **state)
|
||||
|
||||
expect_string(cons_bad_cmd_usage, cmd, CMD_ACCOUNT);
|
||||
|
||||
gboolean result = cmd_account(NULL, CMD_ACCOUNT, args);
|
||||
gboolean result = cmd_account_add(NULL, CMD_ACCOUNT, args);
|
||||
assert_true(result);
|
||||
}
|
||||
|
||||
@ -124,7 +124,7 @@ void cmd_account_add_adds_account(void **state)
|
||||
expect_cons_show("Account created.");
|
||||
expect_cons_show("");
|
||||
|
||||
gboolean result = cmd_account(NULL, CMD_ACCOUNT, args);
|
||||
gboolean result = cmd_account_add(NULL, CMD_ACCOUNT, args);
|
||||
assert_true(result);
|
||||
}
|
||||
|
||||
@ -134,7 +134,7 @@ void cmd_account_enable_shows_usage_when_no_arg(void **state)
|
||||
|
||||
expect_string(cons_bad_cmd_usage, cmd, CMD_ACCOUNT);
|
||||
|
||||
gboolean result = cmd_account(NULL, CMD_ACCOUNT, args);
|
||||
gboolean result = cmd_account_enable(NULL, CMD_ACCOUNT, args);
|
||||
assert_true(result);
|
||||
}
|
||||
|
||||
@ -148,7 +148,7 @@ void cmd_account_enable_enables_account(void **state)
|
||||
expect_cons_show("Account enabled.");
|
||||
expect_cons_show("");
|
||||
|
||||
gboolean result = cmd_account(NULL, CMD_ACCOUNT, args);
|
||||
gboolean result = cmd_account_enable(NULL, CMD_ACCOUNT, args);
|
||||
assert_true(result);
|
||||
}
|
||||
|
||||
@ -162,7 +162,7 @@ void cmd_account_enable_shows_message_when_account_doesnt_exist(void **state)
|
||||
expect_cons_show("No such account: account_name");
|
||||
expect_cons_show("");
|
||||
|
||||
gboolean result = cmd_account(NULL, CMD_ACCOUNT, args);
|
||||
gboolean result = cmd_account_enable(NULL, CMD_ACCOUNT, args);
|
||||
assert_true(result);
|
||||
}
|
||||
|
||||
@ -172,7 +172,7 @@ void cmd_account_disable_shows_usage_when_no_arg(void **state)
|
||||
|
||||
expect_string(cons_bad_cmd_usage, cmd, CMD_ACCOUNT);
|
||||
|
||||
gboolean result = cmd_account(NULL, CMD_ACCOUNT, args);
|
||||
gboolean result = cmd_account_disable(NULL, CMD_ACCOUNT, args);
|
||||
assert_true(result);
|
||||
}
|
||||
|
||||
@ -186,7 +186,7 @@ void cmd_account_disable_disables_account(void **state)
|
||||
expect_cons_show("Account disabled.");
|
||||
expect_cons_show("");
|
||||
|
||||
gboolean result = cmd_account(NULL, CMD_ACCOUNT, args);
|
||||
gboolean result = cmd_account_disable(NULL, CMD_ACCOUNT, args);
|
||||
assert_true(result);
|
||||
}
|
||||
|
||||
@ -200,7 +200,7 @@ void cmd_account_disable_shows_message_when_account_doesnt_exist(void **state)
|
||||
expect_cons_show("No such account: account_name");
|
||||
expect_cons_show("");
|
||||
|
||||
gboolean result = cmd_account(NULL, CMD_ACCOUNT, args);
|
||||
gboolean result = cmd_account_disable(NULL, CMD_ACCOUNT, args);
|
||||
assert_true(result);
|
||||
}
|
||||
|
||||
@ -210,7 +210,7 @@ void cmd_account_rename_shows_usage_when_no_args(void **state)
|
||||
|
||||
expect_string(cons_bad_cmd_usage, cmd, CMD_ACCOUNT);
|
||||
|
||||
gboolean result = cmd_account(NULL, CMD_ACCOUNT, args);
|
||||
gboolean result = cmd_account_rename(NULL, CMD_ACCOUNT, args);
|
||||
assert_true(result);
|
||||
}
|
||||
|
||||
@ -220,7 +220,7 @@ void cmd_account_rename_shows_usage_when_one_arg(void **state)
|
||||
|
||||
expect_string(cons_bad_cmd_usage, cmd, CMD_ACCOUNT);
|
||||
|
||||
gboolean result = cmd_account(NULL, CMD_ACCOUNT, args);
|
||||
gboolean result = cmd_account_rename(NULL, CMD_ACCOUNT, args);
|
||||
assert_true(result);
|
||||
}
|
||||
|
||||
@ -235,7 +235,7 @@ void cmd_account_rename_renames_account(void **state)
|
||||
expect_cons_show("Account renamed.");
|
||||
expect_cons_show("");
|
||||
|
||||
gboolean result = cmd_account(NULL, CMD_ACCOUNT, args);
|
||||
gboolean result = cmd_account_rename(NULL, CMD_ACCOUNT, args);
|
||||
assert_true(result);
|
||||
}
|
||||
|
||||
@ -250,7 +250,7 @@ void cmd_account_rename_shows_message_when_not_renamed(void **state)
|
||||
expect_cons_show("Either account original_name doesn't exist, or account new_name already exists.");
|
||||
expect_cons_show("");
|
||||
|
||||
gboolean result = cmd_account(NULL, CMD_ACCOUNT, args);
|
||||
gboolean result = cmd_account_rename(NULL, CMD_ACCOUNT, args);
|
||||
assert_true(result);
|
||||
}
|
||||
|
||||
@ -260,7 +260,7 @@ void cmd_account_set_shows_usage_when_no_args(void **state)
|
||||
|
||||
expect_string(cons_bad_cmd_usage, cmd, CMD_ACCOUNT);
|
||||
|
||||
gboolean result = cmd_account(NULL, CMD_ACCOUNT, args);
|
||||
gboolean result = cmd_account_set(NULL, CMD_ACCOUNT, args);
|
||||
assert_true(result);
|
||||
}
|
||||
|
||||
@ -270,7 +270,7 @@ void cmd_account_set_shows_usage_when_one_arg(void **state)
|
||||
|
||||
expect_string(cons_bad_cmd_usage, cmd, CMD_ACCOUNT);
|
||||
|
||||
gboolean result = cmd_account(NULL, CMD_ACCOUNT, args);
|
||||
gboolean result = cmd_account_set(NULL, CMD_ACCOUNT, args);
|
||||
assert_true(result);
|
||||
}
|
||||
|
||||
@ -280,7 +280,7 @@ void cmd_account_set_shows_usage_when_two_args(void **state)
|
||||
|
||||
expect_string(cons_bad_cmd_usage, cmd, CMD_ACCOUNT);
|
||||
|
||||
gboolean result = cmd_account(NULL, CMD_ACCOUNT, args);
|
||||
gboolean result = cmd_account_set(NULL, CMD_ACCOUNT, args);
|
||||
assert_true(result);
|
||||
}
|
||||
|
||||
@ -294,7 +294,7 @@ void cmd_account_set_shows_message_when_account_doesnt_exist(void **state)
|
||||
expect_cons_show("Account a_account doesn't exist");
|
||||
expect_cons_show("");
|
||||
|
||||
gboolean result = cmd_account(NULL, CMD_ACCOUNT, args);
|
||||
gboolean result = cmd_account_set(NULL, CMD_ACCOUNT, args);
|
||||
assert_true(result);
|
||||
}
|
||||
|
||||
@ -307,7 +307,7 @@ void cmd_account_set_jid_shows_message_for_malformed_jid(void **state)
|
||||
|
||||
expect_cons_show("Malformed jid: @malformed");
|
||||
|
||||
gboolean result = cmd_account(NULL, CMD_ACCOUNT, args);
|
||||
gboolean result = cmd_account_set(NULL, CMD_ACCOUNT, args);
|
||||
assert_true(result);
|
||||
}
|
||||
|
||||
@ -324,7 +324,7 @@ void cmd_account_set_jid_sets_barejid(void **state)
|
||||
expect_cons_show("Updated jid for account a_account: a_local@a_domain");
|
||||
expect_cons_show("");
|
||||
|
||||
gboolean result = cmd_account(NULL, CMD_ACCOUNT, args);
|
||||
gboolean result = cmd_account_set(NULL, CMD_ACCOUNT, args);
|
||||
assert_true(result);
|
||||
}
|
||||
|
||||
@ -346,7 +346,7 @@ void cmd_account_set_jid_sets_resource(void **state)
|
||||
expect_cons_show("Updated resource for account a_account: a_resource");
|
||||
expect_cons_show("");
|
||||
|
||||
gboolean result = cmd_account(NULL, CMD_ACCOUNT, args);
|
||||
gboolean result = cmd_account_set(NULL, CMD_ACCOUNT, args);
|
||||
assert_true(result);
|
||||
}
|
||||
|
||||
@ -363,7 +363,7 @@ void cmd_account_set_server_sets_server(void **state)
|
||||
expect_cons_show("Updated server for account a_account: a_server");
|
||||
expect_cons_show("");
|
||||
|
||||
gboolean result = cmd_account(NULL, CMD_ACCOUNT, args);
|
||||
gboolean result = cmd_account_set(NULL, CMD_ACCOUNT, args);
|
||||
assert_true(result);
|
||||
}
|
||||
|
||||
@ -382,7 +382,7 @@ void cmd_account_set_resource_sets_resource(void **state)
|
||||
expect_cons_show("Updated resource for account a_account: a_resource");
|
||||
expect_cons_show("");
|
||||
|
||||
gboolean result = cmd_account(NULL, CMD_ACCOUNT, args);
|
||||
gboolean result = cmd_account_set(NULL, CMD_ACCOUNT, args);
|
||||
assert_true(result);
|
||||
}
|
||||
|
||||
@ -401,7 +401,7 @@ void cmd_account_set_resource_sets_resource_with_online_message(void **state)
|
||||
expect_cons_show("Updated resource for account a_account: a_resource, you will need to reconnect to pick up the change.");
|
||||
expect_cons_show("");
|
||||
|
||||
gboolean result = cmd_account(NULL, CMD_ACCOUNT, args);
|
||||
gboolean result = cmd_account_set(NULL, CMD_ACCOUNT, args);
|
||||
assert_true(result);
|
||||
}
|
||||
|
||||
@ -424,7 +424,7 @@ void cmd_account_set_password_sets_password(void **state)
|
||||
expect_cons_show("Updated password for account a_account");
|
||||
expect_cons_show("");
|
||||
|
||||
gboolean result = cmd_account(NULL, CMD_ACCOUNT, args);
|
||||
gboolean result = cmd_account_set(NULL, CMD_ACCOUNT, args);
|
||||
assert_true(result);
|
||||
}
|
||||
|
||||
@ -446,7 +446,7 @@ void cmd_account_set_eval_password_sets_eval_password(void **state)
|
||||
expect_cons_show("Updated eval_password for account a_account");
|
||||
expect_cons_show("");
|
||||
|
||||
gboolean result = cmd_account(NULL, CMD_ACCOUNT, args);
|
||||
gboolean result = cmd_account_set(NULL, CMD_ACCOUNT, args);
|
||||
assert_true(result);
|
||||
}
|
||||
|
||||
@ -463,7 +463,7 @@ void cmd_account_set_password_when_eval_password_set(void **state) {
|
||||
|
||||
expect_cons_show("Cannot set password when eval_password is set.");
|
||||
|
||||
gboolean result = cmd_account(NULL, CMD_ACCOUNT, args);
|
||||
gboolean result = cmd_account_set(NULL, CMD_ACCOUNT, args);
|
||||
assert_true(result);
|
||||
}
|
||||
|
||||
@ -480,7 +480,7 @@ void cmd_account_set_eval_password_when_password_set(void **state) {
|
||||
|
||||
expect_cons_show("Cannot set eval_password when password is set.");
|
||||
|
||||
gboolean result = cmd_account(NULL, CMD_ACCOUNT, args);
|
||||
gboolean result = cmd_account_set(NULL, CMD_ACCOUNT, args);
|
||||
assert_true(result);
|
||||
}
|
||||
|
||||
@ -497,7 +497,7 @@ void cmd_account_set_muc_sets_muc(void **state)
|
||||
expect_cons_show("Updated muc service for account a_account: a_muc");
|
||||
expect_cons_show("");
|
||||
|
||||
gboolean result = cmd_account(NULL, CMD_ACCOUNT, args);
|
||||
gboolean result = cmd_account_set(NULL, CMD_ACCOUNT, args);
|
||||
assert_true(result);
|
||||
}
|
||||
|
||||
@ -514,7 +514,7 @@ void cmd_account_set_nick_sets_nick(void **state)
|
||||
expect_cons_show("Updated muc nick for account a_account: a_nick");
|
||||
expect_cons_show("");
|
||||
|
||||
gboolean result = cmd_account(NULL, CMD_ACCOUNT, args);
|
||||
gboolean result = cmd_account_set(NULL, CMD_ACCOUNT, args);
|
||||
assert_true(result);
|
||||
}
|
||||
|
||||
@ -524,7 +524,7 @@ void cmd_account_show_message_for_missing_otr_policy(void **state)
|
||||
|
||||
expect_string(cons_bad_cmd_usage, cmd, CMD_ACCOUNT);
|
||||
|
||||
gboolean result = cmd_account(NULL, CMD_ACCOUNT, args);
|
||||
gboolean result = cmd_account_set(NULL, CMD_ACCOUNT, args);
|
||||
assert_true(result);
|
||||
}
|
||||
|
||||
@ -537,7 +537,7 @@ void cmd_account_show_message_for_invalid_otr_policy(void **state)
|
||||
|
||||
expect_cons_show("OTR policy must be one of: manual, opportunistic or always.");
|
||||
|
||||
gboolean result = cmd_account(NULL, CMD_ACCOUNT, args);
|
||||
gboolean result = cmd_account_set(NULL, CMD_ACCOUNT, args);
|
||||
assert_true(result);
|
||||
}
|
||||
|
||||
@ -554,7 +554,7 @@ void cmd_account_set_otr_sets_otr(void **state)
|
||||
expect_cons_show("Updated OTR policy for account a_account: opportunistic");
|
||||
expect_cons_show("");
|
||||
|
||||
gboolean result = cmd_account(NULL, CMD_ACCOUNT, args);
|
||||
gboolean result = cmd_account_set(NULL, CMD_ACCOUNT, args);
|
||||
assert_true(result);
|
||||
}
|
||||
|
||||
@ -568,7 +568,7 @@ void cmd_account_set_status_shows_message_when_invalid_status(void **state)
|
||||
expect_cons_show("Invalid status: bad_status");
|
||||
expect_cons_show("");
|
||||
|
||||
gboolean result = cmd_account(NULL, CMD_ACCOUNT, args);
|
||||
gboolean result = cmd_account_set(NULL, CMD_ACCOUNT, args);
|
||||
assert_true(result);
|
||||
}
|
||||
|
||||
@ -585,7 +585,7 @@ void cmd_account_set_status_sets_status_when_valid(void **state)
|
||||
expect_cons_show("Updated login status for account a_account: away");
|
||||
expect_cons_show("");
|
||||
|
||||
gboolean result = cmd_account(NULL, CMD_ACCOUNT, args);
|
||||
gboolean result = cmd_account_set(NULL, CMD_ACCOUNT, args);
|
||||
assert_true(result);
|
||||
}
|
||||
|
||||
@ -602,7 +602,7 @@ void cmd_account_set_status_sets_status_when_last(void **state)
|
||||
expect_cons_show("Updated login status for account a_account: last");
|
||||
expect_cons_show("");
|
||||
|
||||
gboolean result = cmd_account(NULL, CMD_ACCOUNT, args);
|
||||
gboolean result = cmd_account_set(NULL, CMD_ACCOUNT, args);
|
||||
assert_true(result);
|
||||
}
|
||||
|
||||
@ -616,7 +616,7 @@ void cmd_account_set_invalid_presence_string_priority_shows_message(void **state
|
||||
expect_cons_show("Invalid property: blah");
|
||||
expect_cons_show("");
|
||||
|
||||
gboolean result = cmd_account(NULL, CMD_ACCOUNT, args);
|
||||
gboolean result = cmd_account_set(NULL, CMD_ACCOUNT, args);
|
||||
assert_true(result);
|
||||
}
|
||||
|
||||
@ -630,7 +630,7 @@ void cmd_account_set_last_priority_shows_message(void **state)
|
||||
expect_cons_show("Invalid property: last");
|
||||
expect_cons_show("");
|
||||
|
||||
gboolean result = cmd_account(NULL, CMD_ACCOUNT, args);
|
||||
gboolean result = cmd_account_set(NULL, CMD_ACCOUNT, args);
|
||||
assert_true(result);
|
||||
}
|
||||
|
||||
@ -649,7 +649,7 @@ void cmd_account_set_online_priority_sets_preference(void **state)
|
||||
expect_cons_show("Updated online priority for account a_account: 10");
|
||||
expect_cons_show("");
|
||||
|
||||
gboolean result = cmd_account(NULL, CMD_ACCOUNT, args);
|
||||
gboolean result = cmd_account_set(NULL, CMD_ACCOUNT, args);
|
||||
assert_true(result);
|
||||
}
|
||||
|
||||
@ -668,7 +668,7 @@ void cmd_account_set_chat_priority_sets_preference(void **state)
|
||||
expect_cons_show("Updated chat priority for account a_account: 10");
|
||||
expect_cons_show("");
|
||||
|
||||
gboolean result = cmd_account(NULL, CMD_ACCOUNT, args);
|
||||
gboolean result = cmd_account_set(NULL, CMD_ACCOUNT, args);
|
||||
assert_true(result);
|
||||
}
|
||||
|
||||
@ -687,7 +687,7 @@ void cmd_account_set_away_priority_sets_preference(void **state)
|
||||
expect_cons_show("Updated away priority for account a_account: 10");
|
||||
expect_cons_show("");
|
||||
|
||||
gboolean result = cmd_account(NULL, CMD_ACCOUNT, args);
|
||||
gboolean result = cmd_account_set(NULL, CMD_ACCOUNT, args);
|
||||
assert_true(result);
|
||||
}
|
||||
|
||||
@ -706,7 +706,7 @@ void cmd_account_set_xa_priority_sets_preference(void **state)
|
||||
expect_cons_show("Updated xa priority for account a_account: 10");
|
||||
expect_cons_show("");
|
||||
|
||||
gboolean result = cmd_account(NULL, CMD_ACCOUNT, args);
|
||||
gboolean result = cmd_account_set(NULL, CMD_ACCOUNT, args);
|
||||
assert_true(result);
|
||||
}
|
||||
|
||||
@ -725,7 +725,7 @@ void cmd_account_set_dnd_priority_sets_preference(void **state)
|
||||
expect_cons_show("Updated dnd priority for account a_account: 10");
|
||||
expect_cons_show("");
|
||||
|
||||
gboolean result = cmd_account(NULL, CMD_ACCOUNT, args);
|
||||
gboolean result = cmd_account_set(NULL, CMD_ACCOUNT, args);
|
||||
assert_true(result);
|
||||
}
|
||||
|
||||
@ -738,7 +738,7 @@ void cmd_account_set_priority_too_low_shows_message(void **state)
|
||||
|
||||
expect_cons_show("Value -150 out of range. Must be in -128..127.");
|
||||
|
||||
gboolean result = cmd_account(NULL, CMD_ACCOUNT, args);
|
||||
gboolean result = cmd_account_set(NULL, CMD_ACCOUNT, args);
|
||||
assert_true(result);
|
||||
}
|
||||
|
||||
@ -751,7 +751,7 @@ void cmd_account_set_priority_too_high_shows_message(void **state)
|
||||
|
||||
expect_cons_show("Value 150 out of range. Must be in -128..127.");
|
||||
|
||||
gboolean result = cmd_account(NULL, CMD_ACCOUNT, args);
|
||||
gboolean result = cmd_account_set(NULL, CMD_ACCOUNT, args);
|
||||
assert_true(result);
|
||||
}
|
||||
|
||||
@ -764,7 +764,7 @@ void cmd_account_set_priority_when_not_number_shows_message(void **state)
|
||||
|
||||
expect_cons_show("Could not convert \"abc\" to a number.");
|
||||
|
||||
gboolean result = cmd_account(NULL, CMD_ACCOUNT, args);
|
||||
gboolean result = cmd_account_set(NULL, CMD_ACCOUNT, args);
|
||||
assert_true(result);
|
||||
}
|
||||
|
||||
@ -777,7 +777,7 @@ void cmd_account_set_priority_when_empty_shows_message(void **state)
|
||||
|
||||
expect_cons_show("Could not convert \"\" to a number.");
|
||||
|
||||
gboolean result = cmd_account(NULL, CMD_ACCOUNT, args);
|
||||
gboolean result = cmd_account_set(NULL, CMD_ACCOUNT, args);
|
||||
assert_true(result);
|
||||
}
|
||||
|
||||
@ -817,7 +817,7 @@ void cmd_account_set_priority_updates_presence_when_account_connected_with_prese
|
||||
expect_cons_show("Updated online priority for account a_account: 10");
|
||||
expect_cons_show("");
|
||||
|
||||
gboolean result = cmd_account(NULL, CMD_ACCOUNT, args);
|
||||
gboolean result = cmd_account_set(NULL, CMD_ACCOUNT, args);
|
||||
assert_true(result);
|
||||
}
|
||||
|
||||
@ -827,7 +827,7 @@ void cmd_account_clear_shows_usage_when_no_args(void **state)
|
||||
|
||||
expect_string(cons_bad_cmd_usage, cmd, CMD_ACCOUNT);
|
||||
|
||||
gboolean result = cmd_account(NULL, CMD_ACCOUNT, args);
|
||||
gboolean result = cmd_account_clear(NULL, CMD_ACCOUNT, args);
|
||||
assert_true(result);
|
||||
}
|
||||
|
||||
@ -837,7 +837,7 @@ void cmd_account_clear_shows_usage_when_one_arg(void **state)
|
||||
|
||||
expect_string(cons_bad_cmd_usage, cmd, CMD_ACCOUNT);
|
||||
|
||||
gboolean result = cmd_account(NULL, CMD_ACCOUNT, args);
|
||||
gboolean result = cmd_account_clear(NULL, CMD_ACCOUNT, args);
|
||||
assert_true(result);
|
||||
}
|
||||
|
||||
@ -851,7 +851,7 @@ void cmd_account_clear_shows_message_when_account_doesnt_exist(void **state)
|
||||
expect_cons_show("Account a_account doesn't exist");
|
||||
expect_cons_show("");
|
||||
|
||||
gboolean result = cmd_account(NULL, CMD_ACCOUNT, args);
|
||||
gboolean result = cmd_account_clear(NULL, CMD_ACCOUNT, args);
|
||||
assert_true(result);
|
||||
}
|
||||
|
||||
@ -865,6 +865,6 @@ void cmd_account_clear_shows_message_when_invalid_property(void **state)
|
||||
expect_cons_show("Invalid property: badproperty");
|
||||
expect_cons_show("");
|
||||
|
||||
gboolean result = cmd_account(NULL, CMD_ACCOUNT, args);
|
||||
gboolean result = cmd_account_clear(NULL, CMD_ACCOUNT, args);
|
||||
assert_true(result);
|
||||
}
|
||||
|
@ -25,35 +25,13 @@
|
||||
#define CMD_OTR "/otr"
|
||||
|
||||
#ifdef HAVE_LIBOTR
|
||||
void cmd_otr_shows_usage_when_no_args(void **state)
|
||||
{
|
||||
gchar *args[] = { NULL };
|
||||
|
||||
expect_string(cons_bad_cmd_usage, cmd, CMD_OTR);
|
||||
|
||||
gboolean result = cmd_otr(NULL, CMD_OTR, args);
|
||||
assert_true(result);
|
||||
}
|
||||
|
||||
void cmd_otr_shows_usage_when_invalid_subcommand(void **state)
|
||||
{
|
||||
gchar *args[] = { "unknown", NULL };
|
||||
|
||||
will_return(jabber_get_connection_status, JABBER_CONNECTED);
|
||||
|
||||
expect_string(cons_bad_cmd_usage, cmd, CMD_OTR);
|
||||
|
||||
gboolean result = cmd_otr(NULL, CMD_OTR, args);
|
||||
assert_true(result);
|
||||
}
|
||||
|
||||
void cmd_otr_log_shows_usage_when_no_args(void **state)
|
||||
{
|
||||
gchar *args[] = { "log", NULL };
|
||||
|
||||
expect_string(cons_bad_cmd_usage, cmd, CMD_OTR);
|
||||
|
||||
gboolean result = cmd_otr(NULL, CMD_OTR, args);
|
||||
gboolean result = cmd_otr_log(NULL, CMD_OTR, args);
|
||||
assert_true(result);
|
||||
}
|
||||
|
||||
@ -63,7 +41,7 @@ void cmd_otr_log_shows_usage_when_invalid_subcommand(void **state)
|
||||
|
||||
expect_string(cons_bad_cmd_usage, cmd, CMD_OTR);
|
||||
|
||||
gboolean result = cmd_otr(NULL, CMD_OTR, args);
|
||||
gboolean result = cmd_otr_log(NULL, CMD_OTR, args);
|
||||
assert_true(result);
|
||||
}
|
||||
|
||||
@ -75,7 +53,7 @@ void cmd_otr_log_on_enables_logging(void **state)
|
||||
|
||||
expect_cons_show("OTR messages will be logged as plaintext.");
|
||||
|
||||
gboolean result = cmd_otr(NULL, CMD_OTR, args);
|
||||
gboolean result = cmd_otr_log(NULL, CMD_OTR, args);
|
||||
char *pref_otr_log = prefs_get_string(PREF_OTR_LOG);
|
||||
|
||||
assert_true(result);
|
||||
@ -91,7 +69,7 @@ void cmd_otr_log_on_shows_warning_when_chlog_disabled(void **state)
|
||||
expect_cons_show("OTR messages will be logged as plaintext.");
|
||||
expect_cons_show("Chat logging is currently disabled, use '/chlog on' to enable.");
|
||||
|
||||
gboolean result = cmd_otr(NULL, CMD_OTR, args);
|
||||
gboolean result = cmd_otr_log(NULL, CMD_OTR, args);
|
||||
assert_true(result);
|
||||
}
|
||||
|
||||
@ -103,7 +81,7 @@ void cmd_otr_log_off_disables_logging(void **state)
|
||||
|
||||
expect_cons_show("OTR message logging disabled.");
|
||||
|
||||
gboolean result = cmd_otr(NULL, CMD_OTR, args);
|
||||
gboolean result = cmd_otr_log(NULL, CMD_OTR, args);
|
||||
char *pref_otr_log = prefs_get_string(PREF_OTR_LOG);
|
||||
|
||||
assert_true(result);
|
||||
@ -118,7 +96,7 @@ void cmd_otr_redact_redacts_logging(void **state)
|
||||
|
||||
expect_cons_show("OTR messages will be logged as '[redacted]'.");
|
||||
|
||||
gboolean result = cmd_otr(NULL, CMD_OTR, args);
|
||||
gboolean result = cmd_otr_log(NULL, CMD_OTR, args);
|
||||
char *pref_otr_log = prefs_get_string(PREF_OTR_LOG);
|
||||
|
||||
assert_true(result);
|
||||
@ -134,7 +112,7 @@ void cmd_otr_log_redact_shows_warning_when_chlog_disabled(void **state)
|
||||
expect_cons_show("OTR messages will be logged as '[redacted]'.");
|
||||
expect_cons_show("Chat logging is currently disabled, use '/chlog on' to enable.");
|
||||
|
||||
gboolean result = cmd_otr(NULL, CMD_OTR, args);
|
||||
gboolean result = cmd_otr_log(NULL, CMD_OTR, args);
|
||||
assert_true(result);
|
||||
}
|
||||
|
||||
@ -149,7 +127,7 @@ void cmd_otr_libver_shows_libotr_version(void **state)
|
||||
|
||||
expect_cons_show(message->str);
|
||||
|
||||
gboolean result = cmd_otr(NULL, CMD_OTR, args);
|
||||
gboolean result = cmd_otr_libver(NULL, CMD_OTR, args);
|
||||
assert_true(result);
|
||||
|
||||
g_string_free(message, TRUE);
|
||||
@ -163,11 +141,11 @@ void cmd_otr_gen_shows_message_when_not_connected(void **state)
|
||||
|
||||
expect_cons_show("You must be connected with an account to load OTR information.");
|
||||
|
||||
gboolean result = cmd_otr(NULL, CMD_OTR, args);
|
||||
gboolean result = cmd_otr_gen(NULL, CMD_OTR, args);
|
||||
assert_true(result);
|
||||
}
|
||||
|
||||
static void test_with_command_and_connection_status(char *command, jabber_conn_status_t status)
|
||||
static void test_with_command_and_connection_status(char *command, void *cmd_func, jabber_conn_status_t status)
|
||||
{
|
||||
gchar *args[] = { command, NULL };
|
||||
|
||||
@ -175,33 +153,34 @@ static void test_with_command_and_connection_status(char *command, jabber_conn_s
|
||||
|
||||
expect_cons_show("You must be connected with an account to load OTR information.");
|
||||
|
||||
gboolean result = cmd_otr(NULL, CMD_OTR, args);
|
||||
gboolean (*func)(ProfWin *window, const char *const command, gchar **args) = cmd_func;
|
||||
gboolean result = func(NULL, CMD_OTR, args);
|
||||
assert_true(result);
|
||||
}
|
||||
|
||||
void cmd_otr_gen_shows_message_when_disconnected(void **state)
|
||||
{
|
||||
test_with_command_and_connection_status("gen", JABBER_DISCONNECTED);
|
||||
test_with_command_and_connection_status("gen", cmd_otr_gen, JABBER_DISCONNECTED);
|
||||
}
|
||||
|
||||
void cmd_otr_gen_shows_message_when_undefined(void **state)
|
||||
{
|
||||
test_with_command_and_connection_status("gen", JABBER_UNDEFINED);
|
||||
test_with_command_and_connection_status("gen", cmd_otr_gen, JABBER_UNDEFINED);
|
||||
}
|
||||
|
||||
void cmd_otr_gen_shows_message_when_started(void **state)
|
||||
{
|
||||
test_with_command_and_connection_status("gen", JABBER_STARTED);
|
||||
test_with_command_and_connection_status("gen", cmd_otr_gen, JABBER_STARTED);
|
||||
}
|
||||
|
||||
void cmd_otr_gen_shows_message_when_connecting(void **state)
|
||||
{
|
||||
test_with_command_and_connection_status("gen", JABBER_CONNECTING);
|
||||
test_with_command_and_connection_status("gen", cmd_otr_gen, JABBER_CONNECTING);
|
||||
}
|
||||
|
||||
void cmd_otr_gen_shows_message_when_disconnecting(void **state)
|
||||
{
|
||||
test_with_command_and_connection_status("gen", JABBER_DISCONNECTING);
|
||||
test_with_command_and_connection_status("gen", cmd_otr_gen, JABBER_DISCONNECTING);
|
||||
}
|
||||
|
||||
void cmd_otr_gen_generates_key_for_connected_account(void **state)
|
||||
@ -220,33 +199,33 @@ void cmd_otr_gen_generates_key_for_connected_account(void **state)
|
||||
|
||||
expect_memory(otr_keygen, account, account, sizeof(ProfAccount));
|
||||
|
||||
gboolean result = cmd_otr(NULL, CMD_OTR, args);
|
||||
gboolean result = cmd_otr_gen(NULL, CMD_OTR, args);
|
||||
assert_true(result);
|
||||
}
|
||||
|
||||
void cmd_otr_myfp_shows_message_when_disconnected(void **state)
|
||||
{
|
||||
test_with_command_and_connection_status("myfp", JABBER_DISCONNECTED);
|
||||
test_with_command_and_connection_status("myfp", cmd_otr_myfp, JABBER_DISCONNECTED);
|
||||
}
|
||||
|
||||
void cmd_otr_myfp_shows_message_when_undefined(void **state)
|
||||
{
|
||||
test_with_command_and_connection_status("myfp", JABBER_UNDEFINED);
|
||||
test_with_command_and_connection_status("myfp", cmd_otr_myfp, JABBER_UNDEFINED);
|
||||
}
|
||||
|
||||
void cmd_otr_myfp_shows_message_when_started(void **state)
|
||||
{
|
||||
test_with_command_and_connection_status("myfp", JABBER_STARTED);
|
||||
test_with_command_and_connection_status("myfp", cmd_otr_myfp, JABBER_STARTED);
|
||||
}
|
||||
|
||||
void cmd_otr_myfp_shows_message_when_connecting(void **state)
|
||||
{
|
||||
test_with_command_and_connection_status("myfp", JABBER_CONNECTING);
|
||||
test_with_command_and_connection_status("myfp", cmd_otr_myfp, JABBER_CONNECTING);
|
||||
}
|
||||
|
||||
void cmd_otr_myfp_shows_message_when_disconnecting(void **state)
|
||||
{
|
||||
test_with_command_and_connection_status("myfp", JABBER_DISCONNECTING);
|
||||
test_with_command_and_connection_status("myfp", cmd_otr_myfp, JABBER_DISCONNECTING);
|
||||
}
|
||||
|
||||
void cmd_otr_myfp_shows_message_when_no_key(void **state)
|
||||
@ -258,7 +237,7 @@ void cmd_otr_myfp_shows_message_when_no_key(void **state)
|
||||
|
||||
expect_ui_current_print_formatted_line('!', 0, "You have not generated or loaded a private key, use '/otr gen'");
|
||||
|
||||
gboolean result = cmd_otr(NULL, CMD_OTR, args);
|
||||
gboolean result = cmd_otr_myfp(NULL, CMD_OTR, args);
|
||||
assert_true(result);
|
||||
}
|
||||
|
||||
@ -275,7 +254,7 @@ void cmd_otr_myfp_shows_my_fingerprint(void **state)
|
||||
|
||||
expect_ui_current_print_formatted_line('!', 0, message->str);
|
||||
|
||||
gboolean result = cmd_otr(NULL, CMD_OTR, args);
|
||||
gboolean result = cmd_otr_myfp(NULL, CMD_OTR, args);
|
||||
assert_true(result);
|
||||
|
||||
g_string_free(message, TRUE);
|
||||
@ -292,7 +271,7 @@ test_cmd_otr_theirfp_from_wintype(win_type_t wintype)
|
||||
|
||||
expect_ui_current_print_line("You must be in a regular chat window to view a recipient's fingerprint.");
|
||||
|
||||
gboolean result = cmd_otr(&window, CMD_OTR, args);
|
||||
gboolean result = cmd_otr_theirfp(&window, CMD_OTR, args);
|
||||
|
||||
assert_true(result);
|
||||
}
|
||||
@ -328,7 +307,7 @@ void cmd_otr_theirfp_shows_message_when_non_otr_chat_window(void **state)
|
||||
|
||||
expect_ui_current_print_formatted_line('!', 0, "You are not currently in an OTR session.");
|
||||
|
||||
gboolean result = cmd_otr((ProfWin*)&chatwin, CMD_OTR, args);
|
||||
gboolean result = cmd_otr_theirfp((ProfWin*)&chatwin, CMD_OTR, args);
|
||||
|
||||
assert_true(result);
|
||||
}
|
||||
@ -358,7 +337,7 @@ void cmd_otr_theirfp_shows_fingerprint(void **state)
|
||||
|
||||
expect_ui_current_print_formatted_line('!', 0, message->str);
|
||||
|
||||
gboolean result = cmd_otr((ProfWin*)&chatwin, CMD_OTR, args);
|
||||
gboolean result = cmd_otr_theirfp((ProfWin*)&chatwin, CMD_OTR, args);
|
||||
assert_true(result);
|
||||
|
||||
g_string_free(message, TRUE);
|
||||
@ -375,7 +354,7 @@ test_cmd_otr_start_from_wintype(win_type_t wintype)
|
||||
|
||||
expect_ui_current_print_line("You must be in a regular chat window to start an OTR session.");
|
||||
|
||||
gboolean result = cmd_otr(&window, CMD_OTR, args);
|
||||
gboolean result = cmd_otr_start(&window, CMD_OTR, args);
|
||||
assert_true(result);
|
||||
}
|
||||
|
||||
@ -412,7 +391,7 @@ void cmd_otr_start_shows_message_when_already_started(void **state)
|
||||
|
||||
expect_ui_current_print_formatted_line('!', 0, "You are already in an OTR session.");
|
||||
|
||||
gboolean result = cmd_otr((ProfWin*)&chatwin, CMD_OTR, args);
|
||||
gboolean result = cmd_otr_start((ProfWin*)&chatwin, CMD_OTR, args);
|
||||
assert_true(result);
|
||||
}
|
||||
|
||||
@ -435,7 +414,7 @@ void cmd_otr_start_shows_message_when_no_key(void **state)
|
||||
|
||||
expect_ui_current_print_formatted_line('!', 0, "You have not generated or loaded a private key, use '/otr gen'");
|
||||
|
||||
gboolean result = cmd_otr((ProfWin*)&chatwin, CMD_OTR, args);
|
||||
gboolean result = cmd_otr_start((ProfWin*)&chatwin, CMD_OTR, args);
|
||||
assert_true(result);
|
||||
}
|
||||
|
||||
@ -462,7 +441,7 @@ cmd_otr_start_sends_otr_query_message_to_current_recipeint(void **state)
|
||||
expect_string(message_send_chat_otr, barejid, recipient);
|
||||
expect_string(message_send_chat_otr, msg, query_message);
|
||||
|
||||
gboolean result = cmd_otr((ProfWin*)&chatwin, CMD_OTR, args);
|
||||
gboolean result = cmd_otr_start((ProfWin*)&chatwin, CMD_OTR, args);
|
||||
assert_true(result);
|
||||
}
|
||||
|
||||
@ -473,7 +452,7 @@ void cmd_otr_shows_message_when_otr_unsupported(void **state)
|
||||
|
||||
expect_cons_show("This version of Profanity has not been built with OTR support enabled");
|
||||
|
||||
gboolean result = cmd_otr(NULL, CMD_OTR, args);
|
||||
gboolean result = cmd_otr_gen(NULL, CMD_OTR, args);
|
||||
assert_true(result);
|
||||
}
|
||||
#endif
|
||||
|
@ -1,8 +1,6 @@
|
||||
#include "config.h"
|
||||
|
||||
#ifdef HAVE_LIBOTR
|
||||
void cmd_otr_shows_usage_when_no_args(void **state);
|
||||
void cmd_otr_shows_usage_when_invalid_subcommand(void **state);
|
||||
void cmd_otr_log_shows_usage_when_no_args(void **state);
|
||||
void cmd_otr_log_shows_usage_when_invalid_subcommand(void **state);
|
||||
void cmd_otr_log_on_enables_logging(void **state);
|
||||
|
@ -497,8 +497,6 @@ int main(int argc, char* argv[]) {
|
||||
unit_test(cmd_bookmark_remove_shows_message_when_no_bookmark),
|
||||
|
||||
#ifdef HAVE_LIBOTR
|
||||
unit_test(cmd_otr_shows_usage_when_no_args),
|
||||
unit_test(cmd_otr_shows_usage_when_invalid_subcommand),
|
||||
unit_test(cmd_otr_log_shows_usage_when_no_args),
|
||||
unit_test(cmd_otr_log_shows_usage_when_invalid_subcommand),
|
||||
unit_test_setup_teardown(cmd_otr_log_on_enables_logging,
|
||||
|
Loading…
Reference in New Issue
Block a user