mirror of
https://github.com/profanity-im/profanity.git
synced 2024-12-04 14:46:46 -05:00
room_chat: add occupants to room roster until roster received
This commit is contained in:
parent
6cb9c853cb
commit
c4c5668779
@ -660,9 +660,12 @@ _room_presence_handler(const char * const jid)
|
||||
|
||||
// handle self presence (means room roster has been sent)
|
||||
if (strcmp(room_get_nick_for_room(room), nick) == 0) {
|
||||
room_set_roster_received(room);
|
||||
prof_handle_room_roster_complete(room);
|
||||
} else {
|
||||
room_add_to_roster(room, nick);
|
||||
if (!room_get_roster_received(room)) {
|
||||
room_add_to_roster(room, nick);
|
||||
}
|
||||
}
|
||||
|
||||
return 1;
|
||||
|
@ -29,6 +29,7 @@ typedef struct _muc_room_t {
|
||||
char *jid;
|
||||
char *nick;
|
||||
GSList *roster;
|
||||
gboolean roster_received;
|
||||
} muc_room;
|
||||
|
||||
GHashTable *rooms = NULL;
|
||||
@ -47,6 +48,7 @@ room_join(const char * const jid, const char * const nick)
|
||||
new_room->jid = strdup(jid);
|
||||
new_room->nick = strdup(nick);
|
||||
new_room->roster = NULL;
|
||||
new_room->roster_received = FALSE;
|
||||
|
||||
g_hash_table_insert(rooms, strdup(jid), new_room);
|
||||
}
|
||||
@ -131,6 +133,28 @@ room_get_roster(const char * const jid)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
room_set_roster_received(const char * const jid)
|
||||
{
|
||||
muc_room *room = g_hash_table_lookup(rooms, jid);
|
||||
|
||||
if (room != NULL) {
|
||||
room->roster_received = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
gboolean
|
||||
room_get_roster_received(const char * const jid)
|
||||
{
|
||||
muc_room *room = g_hash_table_lookup(rooms, jid);
|
||||
|
||||
if (room != NULL) {
|
||||
return room->roster_received;
|
||||
} else {
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_room_free(muc_room *room)
|
||||
{
|
||||
|
@ -30,3 +30,5 @@ gboolean room_parse_room_jid(const char * const room_jid, char **room,
|
||||
char **nick);
|
||||
void room_add_to_roster(const char * const jid, const char * const nick);
|
||||
GSList * room_get_roster(const char * const jid);
|
||||
void room_set_roster_received(const char * const jid);
|
||||
gboolean room_get_roster_received(const char * const jid);
|
||||
|
Loading…
Reference in New Issue
Block a user