anchor.diff:      receive_data(State#pstate{more=false});
   receive_data(State=#pstate{port=Port,acc=[],more=true,remain=Remain}) ->
       Res = gen_tcp:recv(Port, 0),
  -						% io:format("Remain = ~p\n", [Remain]),
       case Res of
   	{ok, Bin} ->
  -						% io:format("got ~s~n", [binary_to_list(Bin)]),
   	    Acc = binary_to_list(Bin),
   	    if
   		Remain =< length(Acc) ->
  
positive.code:     psend(C, State#pstate.port),
      ploop(S, State#pstate{cmd=Cmds}).
  
  						%
  
  psend(Str, Port) ->
      gen_tcp:send(Port, Str++"\r\n").
  
  						%
  
  receive_reply(State=#pstate{port=Port,acc=Acc,more=false}) ->
      check_reply(State#pstate.acc, State);
  
negative.code:        ]}]).
  
  list(Session) ->
      list(Session, ?RETRYCOUNT).
  
  list(Session, 0) ->
      format_error("Mailbox locked by other mail process.");
  list(Session, Count) ->
      tick_session(Session#session.cookie),
      case list(popserver(), Session#session.user, Session#session.passwd) of
  	{error, Reason} ->
  	    case string:str(lowercase(Reason), "lock") of
  		0 ->
  		    format_error(Reason);
  		N ->
  		    sleep(?RETRYTIMEOUT),
  		    list(Session, Count-1)
  	    end;
  	H ->
  	    (dynamic_headers()++
  	     [{ehtml,
  	       [{script,[],
  		 "function setCmd(val) { \n"
  		 "   if (val == 'delete') {\n"
  		 "      var res = confirm('Are you sure you want"
  		 " to delete the selected emails?');\n" 
  		 "      if (res) { \n"
  		 "           document.list.cmd.value=val;\n"
  		 "           document.list.submit();\n"
  		 "      } else { \n"
  		 "           return;\n"
  		 "      }\n"
  		 "   }\n"
  		 "   document.list.cmd.value=val;\n"
  		 "   document.list.submit();\n"
  		 "}"
  		},
  		{style,[{type,"text/css"}],
  		 "A:link    { color: black; text-decoration: none}\n"
  		 "A:visited { color: black; text-decoration: none}\n"
  		 "A:active  { color: black; text-decoration: none}\n"
  		 ".AList    { color: black; text-decoration: none}\n"
  		 ".Head     { border-right:1px solid white}"},
  		{form, [{name,list},{action,"listop.yaws"},{method,post}],
  		 [{table, [{border,0},{bgcolor,"c0c0c0"},
  			   {cellspacing,0},{width,"100%"}],
  		   {tr,[],{td,[{nowrap,true},{align,left},{valign,middle}],
  			   {font, [{size,6},{color,black}],
  			    "WebMail at "++maildomain()}}}},
  		  build_toolbar([{"tool-newmail.gif","compose.yaws",
  				  "New Message"},
  				 {"tool-delete.gif",
  				  "javascript:setCmd('delete')",
  				  "Delete"},
  				 {"","logout.yaws","Logout"}]),
  		  {table, [{border,0},{bgcolor,"666666"},{cellspacing,0},
  			   {width,"100%"}],
  		   {tr,[],{td,[{nowrap,true},{align,left},{valign,middle}],
  			   {font, [{size,2},{color,"#ffffff"}],
  			    "Inbox for "++Session#session.user}}}},
  		  {table, [{border,0},{cellspacing,0},{cellpadding,1},
  			   {width,"100%"}],
  		   [{tr, [{bgcolor,"c0c0c0"},{valign,middle}],
  		     [{th,[{class,head}],
  		       {img,[{src,"view-mark.gif"},{width,13},
  			     {height,13}],[]}},
  		      {th,[{align,left},{valign,middle},{class,head}],
  		       {font,[{size,2},{color,black}],"From"}},
  		      {th,[{align,left},{valign,middle},{class,head}],
  		       {font,[{size,2},{color,black}],"Subject"}},
  		      {th,[{align,left},{valign,middle},{class,head}],
  		       {font,[{size,2},{color,black}],"Size"}}]}] ++
  		   format_summary(H)},
  		  {input,[{type,hidden},{name,cmd},{value,""}],[]}
  		 ]}]}])
      end.
  
  format_summary(Hs) ->
      [format_summary_line(H) || H <- Hs].
  