From 84486dcb2ce39b86811453648d80ec338e7567a9 Mon Sep 17 00:00:00 2001 From: Badlop Date: Tue, 23 Aug 2011 21:53:41 +0200 Subject: [PATCH] Support multiple sessions per nick in muc_online_users, relevant for max_user_conferences (EJAB-305) --- src/mod_muc/mod_muc_room.erl | 8 ++++---- src/mod_muc/mod_muc_room.hrl | 1 + 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/mod_muc/mod_muc_room.erl b/src/mod_muc/mod_muc_room.erl index efd8e917e..e31f565aa 100644 --- a/src/mod_muc/mod_muc_room.erl +++ b/src/mod_muc/mod_muc_room.erl @@ -3811,23 +3811,23 @@ add_to_log(Type, Data, StateData) -> %% Users number checking tab_add_online_user(JID, StateData) -> - {LUser, LServer, _} = jlib:jid_tolower(JID), + {LUser, LServer, LResource} = jlib:jid_tolower(JID), US = {LUser, LServer}, Room = StateData#state.room, Host = StateData#state.host, catch ets:insert( muc_online_users, - #muc_online_users{us = US, room = Room, host = Host}). + #muc_online_users{us = US, resource = LResource, room = Room, host = Host}). tab_remove_online_user(JID, StateData) -> - {LUser, LServer, _} = jlib:jid_tolower(JID), + {LUser, LServer, LResource} = jlib:jid_tolower(JID), US = {LUser, LServer}, Room = StateData#state.room, Host = StateData#state.host, catch ets:delete_object( muc_online_users, - #muc_online_users{us = US, room = Room, host = Host}). + #muc_online_users{us = US, resource = LResource, room = Room, host = Host}). tab_count_user(JID) -> {LUser, LServer, _} = jlib:jid_tolower(JID), diff --git a/src/mod_muc/mod_muc_room.hrl b/src/mod_muc/mod_muc_room.hrl index 6a4921865..10120cba6 100644 --- a/src/mod_muc/mod_muc_room.hrl +++ b/src/mod_muc/mod_muc_room.hrl @@ -81,5 +81,6 @@ room_queue = queue:new()}). -record(muc_online_users, {us, + resource, room, host}).