mirror of
https://git.jabber.space/devs/cproof.git
synced 2026-07-19 23:36:21 +00:00
introduce priority support
add new command /priority <int> improve jabber_update_presence() use jabber_update_presence() for sending initial presence save priority and status string to jabber_conn structure
This commit is contained in:
@@ -95,6 +95,7 @@ static gboolean _cmd_join(const char * const inp, struct cmd_help_t help);
|
||||
static gboolean _cmd_set_beep(const char * const inp, struct cmd_help_t help);
|
||||
static gboolean _cmd_set_notify(const char * const inp, struct cmd_help_t help);
|
||||
static gboolean _cmd_set_log(const char * const inp, struct cmd_help_t help);
|
||||
static gboolean _cmd_set_priority(const char * const inp, struct cmd_help_t help);
|
||||
static gboolean _cmd_set_intype(const char * const inp, struct cmd_help_t help);
|
||||
static gboolean _cmd_set_flash(const char * const inp, struct cmd_help_t help);
|
||||
static gboolean _cmd_set_showsplash(const char * const inp, struct cmd_help_t help);
|
||||
@@ -423,6 +424,16 @@ static struct cmd_t setting_commands[] =
|
||||
"",
|
||||
"Config file section : [log]",
|
||||
"Config file value : maxsize=bytes",
|
||||
NULL } } },
|
||||
|
||||
{ "/priority",
|
||||
_cmd_set_priority,
|
||||
{ "/priority <value>", "Set priority for connection.",
|
||||
{ "/priority <value>",
|
||||
"--------------------",
|
||||
"value : Number between -128 and 127. Default value is 0.",
|
||||
"",
|
||||
"Config file section : [jabber]",
|
||||
NULL } } }
|
||||
};
|
||||
|
||||
@@ -1404,6 +1415,31 @@ _cmd_set_log(const char * const inp, struct cmd_help_t help)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
_cmd_set_priority(const char * const inp, struct cmd_help_t help)
|
||||
{
|
||||
char *value;
|
||||
char inp_cpy[strlen(inp) + 1];
|
||||
int intval;
|
||||
|
||||
strcpy(inp_cpy, inp);
|
||||
strtok(inp_cpy, " ");
|
||||
value = strtok(NULL, " ");
|
||||
if (value == NULL) {
|
||||
cons_show("Usage: %s", help.usage);
|
||||
} else {
|
||||
char *status = jabber_get_status();
|
||||
intval = atoi(value);
|
||||
prefs_set_priority(intval);
|
||||
// update presence with new priority
|
||||
jabber_update_presence(jabber_get_presence(), status);
|
||||
if (status != NULL)
|
||||
free(status);
|
||||
cons_show("Priority set to %d.", intval);
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
_cmd_vercheck(const char * const inp, struct cmd_help_t help)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user