MDL-61484 mod_chat: Fix chat_get_sessions logic