mirror of
https://github.com/profanity-im/profanity.git
synced 2024-11-03 19:37:16 -05:00
jabber: added _room_presence_handler
This commit is contained in:
parent
a676c50b68
commit
6cb9c853cb
42
src/jabber.c
42
src/jabber.c
@ -644,6 +644,30 @@ _ping_timed_handler(xmpp_conn_t * const conn, void * const userdata)
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int
|
||||
_room_presence_handler(const char * const jid)
|
||||
{
|
||||
char *room = NULL;
|
||||
char *nick = NULL;
|
||||
|
||||
if (!room_parse_room_jid(jid, &room, &nick)) {
|
||||
log_error("Could not parse room jid: %s", room);
|
||||
g_free(room);
|
||||
g_free(nick);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
// handle self presence (means room roster has been sent)
|
||||
if (strcmp(room_get_nick_for_room(room), nick) == 0) {
|
||||
prof_handle_room_roster_complete(room);
|
||||
} else {
|
||||
room_add_to_roster(room, nick);
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int
|
||||
_presence_handler(xmpp_conn_t * const conn,
|
||||
xmpp_stanza_t * const stanza, void * const userdata)
|
||||
@ -657,23 +681,7 @@ _presence_handler(xmpp_conn_t * const conn,
|
||||
|
||||
// handle chat room presence
|
||||
if (room_is_active(from)) {
|
||||
char *room = NULL;
|
||||
char *nick = NULL;
|
||||
|
||||
if (!room_parse_room_jid(from, &room, &nick)) {
|
||||
log_error("Could not parse room jid: %s", room);
|
||||
g_free(room);
|
||||
g_free(nick);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
// handle self presence (means room roster has been sent)
|
||||
if (strcmp(room_get_nick_for_room(room), nick) == 0) {
|
||||
prof_handle_room_roster_complete(room);
|
||||
} else {
|
||||
room_add_to_roster(room, nick);
|
||||
}
|
||||
return _room_presence_handler(from);
|
||||
|
||||
// handle regular presence
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user