mirror of
https://github.com/profanity-im/profanity.git
synced 2024-09-22 19:45:54 -04:00
Added status handler code to profanity module
This commit is contained in:
parent
310d712d42
commit
02224ea7bb
16
src/jabber.c
16
src/jabber.c
@ -490,19 +490,11 @@ _jabber_presence_handler(xmpp_conn_t * const conn,
|
|||||||
status_str = NULL;
|
status_str = NULL;
|
||||||
|
|
||||||
if (strcmp(short_jid, short_from) !=0) {
|
if (strcmp(short_jid, short_from) !=0) {
|
||||||
if (type == NULL) {// online
|
if (type == NULL) {
|
||||||
gboolean result = contact_list_add(short_from, show_str, status_str);
|
prof_handle_contact_online(short_from, show_str, status_str);
|
||||||
if (result) {
|
} else {
|
||||||
win_contact_online(short_from, show_str, status_str);
|
prof_handle_contact_offline(short_from, show_str, status_str);
|
||||||
}
|
|
||||||
} else {// offline
|
|
||||||
gboolean result = contact_list_remove(short_from);
|
|
||||||
if (result) {
|
|
||||||
win_contact_offline(short_from, show_str, status_str);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
win_page_off();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -227,6 +227,26 @@ prof_handle_failed_login(void)
|
|||||||
log_info("disconnected");
|
log_info("disconnected");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
prof_handle_contact_online(char *contact, char *show, char *status)
|
||||||
|
{
|
||||||
|
gboolean result = contact_list_add(contact, show, status);
|
||||||
|
if (result) {
|
||||||
|
win_contact_online(contact, show, status);
|
||||||
|
}
|
||||||
|
win_page_off();
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
prof_handle_contact_offline(char *contact, char *show, char *status)
|
||||||
|
{
|
||||||
|
gboolean result = contact_list_remove(contact);
|
||||||
|
if (result) {
|
||||||
|
win_contact_offline(contact, show, status);
|
||||||
|
}
|
||||||
|
win_page_off();
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_create_config_directory()
|
_create_config_directory()
|
||||||
{
|
{
|
||||||
|
@ -29,6 +29,8 @@ void prof_handle_login_success(const char *jid);
|
|||||||
void prof_handle_lost_connection(void);
|
void prof_handle_lost_connection(void);
|
||||||
void prof_handle_failed_login(void);
|
void prof_handle_failed_login(void);
|
||||||
void prof_handle_typing(char *from);
|
void prof_handle_typing(char *from);
|
||||||
|
void prof_handle_contact_online(char *contact, char *show, char *status);
|
||||||
|
void prof_handle_contact_offline(char *contact, char *show, char *status);
|
||||||
void prof_handle_incoming_message(char *from, char *message);
|
void prof_handle_incoming_message(char *from, char *message);
|
||||||
void profanity_shutdown_init(void);
|
void profanity_shutdown_init(void);
|
||||||
void profanity_shutdown(void);
|
void profanity_shutdown(void);
|
||||||
|
Loading…
Reference in New Issue
Block a user