let remove_message_stack (name_in_session : string) (state : string) (message : string) : bool =
let res = ref false in
let message_list = get_message_stack name_in_session state in
let key = (name_in_session,state,"_message_stack") in
let rec aux l buff =
match l with [] -> (List.iter (fun t -> (Hashtbl.add message_stack key t)) buff)
|(x::ls) -> ( Hashtbl.remove message_stack key;
if (x=message)
then(res:=true ; aux ls buff)
else(aux ls (x::buff)));
in
aux message_list [];
if(!res) then
( if(List.mem (key,message) (!add_on_stack))
then add_on_stack:=remove (key,message) (!add_on_stack)
else remove_of_stack:= (key,message)::(!remove_of_stack)
);
(!res)