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

Added /lastactivity on|off

This commit is contained in:
James Booth 2015-10-14 22:09:18 +01:00
parent 1fd2a8a4e9
commit d38e10828e
3 changed files with 19 additions and 5 deletions

View File

@ -703,13 +703,16 @@ static struct cmd_t command_defs[] =
CMD_TAGS(
CMD_TAG_PRESENCE)
CMD_SYN(
"/lastactivity on|off",
"/lastactivity [<jid>]")
CMD_DESC(
"Send a last activity query to the supplied JID, omitting the JID will send the query to your server.")
"Enable/disable sending last activity, and send last activity requests.")
CMD_ARGS(
{ "<jid>", "The JID of the entity to which the query will be sent." })
{ "on|off", "Enable or disable sending of last activity." },
{ "<jid>", "The JID of the entity to query, omitting the JID will query your server." })
CMD_EXAMPLES(
"/lastactivity",
"/lastactivity off",
"/lastactivity alice@securechat.org",
"/lastactivity alice@securechat.org/laptop",
"/lastactivity someserver.com")
@ -2564,7 +2567,7 @@ _cmd_complete_parameters(ProfWin *window, const char * const input)
// autocomplete boolean settings
gchar *boolean_choices[] = { "/beep", "/intype", "/states", "/outtype",
"/flash", "/splash", "/chlog", "/grlog", "/history", "/vercheck",
"/privileges", "/presence", "/wrap", "/winstidy", "/carbons", "/encwarn" };
"/privileges", "/presence", "/wrap", "/winstidy", "/carbons", "/encwarn", "/lastactivity" };
for (i = 0; i < ARRAY_SIZE(boolean_choices); i++) {
result = autocomplete_param_with_func(input, boolean_choices[i], prefs_autocomplete_boolean_choice);

View File

@ -3279,11 +3279,16 @@ cmd_lastactivity(ProfWin *window, const char * const command, gchar **args)
g_string_free(jid, TRUE);
jid_destroy(jidp);
} else {
iq_last_activity_request(args[0]);
}
return TRUE;
} else if ((g_strcmp0(args[0], "on") == 0) || (g_strcmp0(args[0], "off") == 0)) {
return _cmd_set_boolean_preference(args[0], command, "Last activity responses", PREF_LASTACTIVITY);
} else {
iq_last_activity_request(args[0]);
return TRUE;
}
}
gboolean

View File

@ -1459,6 +1459,12 @@ cons_show_presence_prefs(void)
cons_show("");
cons_autoaway_setting();
if (prefs_get_boolean(PREF_LASTACTIVITY)) {
cons_show("Send last activity (/lastactivity) : ON");
} else {
cons_show("Send last activity (/lastactivity) : OFF");
}
cons_alert();
}