anchor.diff:  	imapd_util:send(#imap_resp{tag = Tag, status = no, cmd = Command, info = "Failure: not authenticated"},State),
   	State;
   command(#imap_cmd{tag = Tag, cmd = rename = Command, data = {Src,Dst}},
  -        #imapd_fsm{state = authenticated, user = User} = State) -> 
  +		#imapd_fsm{state = FSMState, user = User} = State) when FSMState =:= authenticated; FSMState =:= selected -> 
   	imapd_util:out(Command,{Src,Dst},State),
   	Store = gen_store:lookup(mailbox_store, State),
   	SrcMB = Store:select({string:strip(Src),User#user.name}),
  
positive.code: 	imapd_util:send(#imap_resp{tag = Tag, status = no},State),
  	State;
  command(#imap_cmd{tag = Tag, cmd = status = Command, data = {MailBoxName,Flags}},
  		#imapd_fsm{state = authenticated, user = User} = State) -> 
  	imapd_util:out(Command,MailBoxName,State),
  	Store = gen_store:lookup(mailbox_store, State),
  	case Store:select({string:strip(MailBoxName),User#user.name}) of
  
negative.code: 	imapd_util:send(#imap_resp{tag = Tag, status = no},State),
  	State;
  command(#imap_cmd{tag = Tag, cmd = list = Command, data = {Reference,MailBoxName}},
  		#imapd_fsm{state = FSMState, user = User} = State) when FSMState =:= authenticated; FSMState =:= selected -> 
  	% @todo incorparete reference name. Simplier not to use at first
  %	?D({Reference,MailBoxName}),
  	Store = gen_store:lookup(mailbox_store, State),
  	Heirachy = imapd_util:heirachy_char(),
  %	?D(Heirachy),
  	case Store:mlist(MailBoxName,User#user.name,false) of
  		List when is_list(List) -> 
  %			?D(List),
  			lists:map(fun(Name) -> 
  				Info = {Command,Heirachy,Name},
  				Data = {Command,[]},
  