mirror of
https://github.com/profanity-im/profanity.git
synced 2024-12-04 14:46:46 -05:00
Added _cmd_away
Not yet sending message to server
This commit is contained in:
parent
11ce116a85
commit
f5eab87588
17
command.c
17
command.c
@ -44,6 +44,7 @@ static gboolean _cmd_msg(const char * const inp);
|
||||
static gboolean _cmd_close(const char * const inp);
|
||||
static gboolean _cmd_set_beep(const char * const inp);
|
||||
static gboolean _cmd_set_flash(const char * const inp);
|
||||
static gboolean _cmd_away(const char * const inp);
|
||||
static gboolean _cmd_default(const char * const inp);
|
||||
|
||||
gboolean process_input(char *inp)
|
||||
@ -100,6 +101,8 @@ static gboolean _handle_command(const char * const command, const char * const i
|
||||
result = _cmd_set_beep(inp);
|
||||
} else if (strcmp(command, "/flash") == 0) {
|
||||
result = _cmd_set_flash(inp);
|
||||
} else if (strcmp(command, "/away") == 0) {
|
||||
result = _cmd_away(inp);
|
||||
} else {
|
||||
result = _cmd_default(inp);
|
||||
}
|
||||
@ -250,6 +253,20 @@ static gboolean _cmd_set_flash(const char * const inp)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean _cmd_away(const char * const inp)
|
||||
{
|
||||
jabber_conn_status_t conn_status = jabber_connection_status();
|
||||
|
||||
if (conn_status != JABBER_CONNECTED) {
|
||||
cons_show("You are not currently connected.");
|
||||
} else {
|
||||
jabber_update_presence(PRESENCE_AWAY);
|
||||
cons_show("Status set to \"away\"");
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean _cmd_default(const char * const inp)
|
||||
{
|
||||
if (win_in_chat()) {
|
||||
|
5
jabber.c
5
jabber.c
@ -179,6 +179,11 @@ void jabber_roster_request(void)
|
||||
xmpp_stanza_release(iq);
|
||||
}
|
||||
|
||||
void jabber_update_presence(jabber_presence_t status)
|
||||
{
|
||||
jabber_conn.presence = status;
|
||||
}
|
||||
|
||||
static int _jabber_message_handler(xmpp_conn_t * const conn,
|
||||
xmpp_stanza_t * const stanza, void * const userdata)
|
||||
{
|
||||
|
2
jabber.h
2
jabber.h
@ -38,6 +38,7 @@ typedef enum {
|
||||
|
||||
void jabber_init(const int disable_tls);
|
||||
jabber_conn_status_t jabber_connection_status(void);
|
||||
jabber_presence_t jabber_presence_status(void);
|
||||
jabber_conn_status_t jabber_connect(const char * const user,
|
||||
const char * const passwd);
|
||||
void jabber_disconnect(void);
|
||||
@ -45,5 +46,6 @@ void jabber_roster_request(void);
|
||||
void jabber_process_events(void);
|
||||
void jabber_send(const char * const msg, const char * const recipient);
|
||||
const char * jabber_get_jid(void);
|
||||
void jabber_update_presence(jabber_presence_t status);
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user