// Starting an IM? The IM will popup by AJAX once the page loads, because it's in the system now
$enter_im=get_param_integer('enter_im',null);
if((!is_null($enter_im))&&(!is_guest())){
$test=$GLOBALS['SITE_DB']->query('SELECT * FROM '.get_table_prefix().'chat_rooms WHERE is_im=1 AND allow_list LIKE \''.db_encode_like('%'.strval($enter_im).'%').'\'');
$test=$GLOBALS['SITE_DB']->query('SELECT * FROM '.get_table_prefix().'chat_rooms WHERE '.sql_members_in_im_conversation(array(get_member(),$enter_im)));
$room_check=$GLOBALS['SITE_DB']->query('SELECT id,is_im,c_welcome,allow_list_groups,disallow_list_groups,allow_list,disallow_list,room_owner FROM '.get_table_prefix().'chat_rooms WHERE is_im=1 AND allow_list LIKE \''.db_encode_like('%'.strval(get_member()).'%').'\'');
$room_check=$GLOBALS['SITE_DB']->query('SELECT id,is_im,c_welcome,allow_list_groups,disallow_list_groups,allow_list,disallow_list,room_owner FROM '.get_table_prefix().'chat_rooms WHERE '.sql_members_in_im_conversation(array(get_member())));
$welcome=null;
}
@@ -523,7 +523,7 @@ function _chat_messages_script_ajax($room_id, $backlog = false, $message_id = nu
// IM events and invitations, but only for the lobby IM interface
$invitations_output='';
if($room_id<0){
$room_check=list_to_map('id',$GLOBALS['SITE_DB']->query('SELECT * FROM '.get_table_prefix().'chat_rooms WHERE is_im=1 AND allow_list LIKE \''.db_encode_like('%'.strval(get_member()).'%').'\''));
$room_check=list_to_map('id',$GLOBALS['SITE_DB']->query('SELECT * FROM '.get_table_prefix().'chat_rooms WHERE '.sql_members_in_im_conversation(array(get_member()))));
foreach($room_checkas$room){
if(check_chatroom_access($room,true,null,true)){
if((($room['allow_list']==strval(get_member()).','.strval(get_member())/*Opened room with self? Weird*/)||($room['allow_list']==strval(get_member())))&&(is_null($event_id)/*Only on fresh start, not repeat AJAX requests*/)){// If it's just you in the room, close that room down
@@ -1622,3 +1622,18 @@ function get_chat_sound_tpl()