mirror of
https://github.com/profanity-im/profanity.git
synced 2024-12-04 14:46:46 -05:00
Return whether or not room member presence was changed
This commit is contained in:
parent
bd3f1d1575
commit
6c52ccae1f
@ -201,16 +201,28 @@ room_parse_room_jid(const char * const full_room_jid, char **room, char **nick)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
gboolean
|
||||||
room_add_to_roster(const char * const room, const char * const nick,
|
room_add_to_roster(const char * const room, const char * const nick,
|
||||||
const char * const show, const char * const status)
|
const char * const show, const char * const status)
|
||||||
{
|
{
|
||||||
muc_room *chat_room = g_hash_table_lookup(rooms, room);
|
muc_room *chat_room = g_hash_table_lookup(rooms, room);
|
||||||
|
gboolean updated = FALSE;
|
||||||
|
|
||||||
if (chat_room != NULL) {
|
if (chat_room != NULL) {
|
||||||
|
PContact old = g_hash_table_lookup(chat_room->roster, nick);
|
||||||
|
|
||||||
|
if (old == NULL) {
|
||||||
|
updated = TRUE;
|
||||||
|
} else if ((g_strcmp0(p_contact_presence(old), show) != 0) ||
|
||||||
|
(g_strcmp0(p_contact_status(old), status) != 0)) {
|
||||||
|
updated = TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
PContact contact = p_contact_new(nick, NULL, show, status, NULL);
|
PContact contact = p_contact_new(nick, NULL, show, status, NULL);
|
||||||
g_hash_table_replace(chat_room->roster, strdup(nick), contact);
|
g_hash_table_replace(chat_room->roster, strdup(nick), contact);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return updated;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -34,7 +34,7 @@ char * room_get_room_from_full_jid(const char * const full_room_jid);
|
|||||||
char * room_get_nick_from_full_jid(const char * const full_room_jid);
|
char * room_get_nick_from_full_jid(const char * const full_room_jid);
|
||||||
gboolean room_parse_room_jid(const char * const full_room_jid, char **room,
|
gboolean room_parse_room_jid(const char * const full_room_jid, char **room,
|
||||||
char **nick);
|
char **nick);
|
||||||
void room_add_to_roster(const char * const room, const char * const nick,
|
gboolean room_add_to_roster(const char * const room, const char * const nick,
|
||||||
const char * const show, const char * const status);
|
const char * const show, const char * const status);
|
||||||
void room_add_pending_nick_change(const char * const room,
|
void room_add_pending_nick_change(const char * const room,
|
||||||
const char * const new_nick, const char * const old_nick);
|
const char * const new_nick, const char * const old_nick);
|
||||||
|
Loading…
Reference in New Issue
Block a user