mirror of
https://github.com/profanity-im/profanity.git
synced 2024-06-30 21:55:24 +00:00
Added "set status" to /account
This commit is contained in:
parent
603e1934a5
commit
fa9826a36a
|
@ -1157,6 +1157,14 @@ _cmd_account(gchar **args, struct cmd_help_t help)
|
||||||
accounts_set_resource(account_name, value);
|
accounts_set_resource(account_name, value);
|
||||||
cons_show("Updated resource for account %s: %s", account_name, value);
|
cons_show("Updated resource for account %s: %s", account_name, value);
|
||||||
cons_show("");
|
cons_show("");
|
||||||
|
} else if (strcmp(property, "status") == 0) {
|
||||||
|
if (!presence_valid_string(value)) {
|
||||||
|
cons_show("Invalud status: %s", value);
|
||||||
|
} else {
|
||||||
|
accounts_set_login_presence(account_name, value);
|
||||||
|
cons_show("Updated login status for account %s: %s", account_name, value);
|
||||||
|
}
|
||||||
|
cons_show("");
|
||||||
} else {
|
} else {
|
||||||
cons_show("Invalid property: %s", property);
|
cons_show("Invalid property: %s", property);
|
||||||
cons_show("");
|
cons_show("");
|
||||||
|
|
|
@ -178,6 +178,7 @@ void iq_roster_request(void);
|
||||||
// presence functions
|
// presence functions
|
||||||
void presence_add_handlers(void);
|
void presence_add_handlers(void);
|
||||||
void presence_init(void);
|
void presence_init(void);
|
||||||
|
gboolean presence_valid_string(const char * const str);
|
||||||
void presence_subscription(const char * const jid, const jabber_subscr_t action);
|
void presence_subscription(const char * const jid, const jabber_subscr_t action);
|
||||||
GList* presence_get_subscription_requests(void);
|
GList* presence_get_subscription_requests(void);
|
||||||
void presence_free_sub_requests(void);
|
void presence_free_sub_requests(void);
|
||||||
|
|
|
@ -56,6 +56,23 @@ presence_add_handlers(void)
|
||||||
HANDLE(NULL, NULL, _presence_handler);
|
HANDLE(NULL, NULL, _presence_handler);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gboolean
|
||||||
|
presence_valid_string(const char * const str)
|
||||||
|
{
|
||||||
|
if (str == NULL) {
|
||||||
|
return FALSE;
|
||||||
|
} else if ((strcmp(str, "online") == 0) ||
|
||||||
|
(strcmp(str, "chat") == 0) ||
|
||||||
|
(strcmp(str, "away") == 0) ||
|
||||||
|
(strcmp(str, "xa") == 0) ||
|
||||||
|
(strcmp(str, "dnd") == 0)) {
|
||||||
|
return TRUE;
|
||||||
|
} else {
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
presence_subscription(const char * const jid, const jabber_subscr_t action)
|
presence_subscription(const char * const jid, const jabber_subscr_t action)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue
Block a user