<?vsp 
--  
--  $Id$
--  
--  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
--  project.
--  
--  Copyright (C) 1998-2012 OpenLink Software
--  
--  This project is free software; you can redistribute it and/or modify it
--  under the terms of the GNU General Public License as published by the
--  Free Software Foundation; only version 2 of the License, dated June 1991.
--  
--  This program is distributed in the hope that it will be useful, but
--  WITHOUT ANY WARRANTY; without even the implied warranty of
--  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
--  General Public License for more details.
--  
--  You should have received a copy of the GNU General Public License along
--  with this program; if not, write to the Free Software Foundation, Inc.,
--  51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
--  
--  
 http_rewrite(); http_header('Content-type: text/vnd.wap.wml\r\n');
 declare _mm_bcc, _mm_body, _mm_cc, _mm_fld, _mm_from, _mm_own, _mm_rec_date, _mm_snd_time, _mm_subj, _mm_to varchar;
 declare _mm_id varchar;
   declare _user_name, _login_ok varchar;

 declare _login_ok varchar;
  declare _num1, _counter1, _msg_idd integer;
  declare _sid, _action, _to, _msg, _subj, _msg_id, _from, _msg1, _folder, _to_folder varchar;
  declare _err long varchar;
  declare _offset, _list, _random1 integer;

 _random1 := rnd(9999999);
  _sid := '';
  _sid := get_keyword('SESS', params);
   _msg_id := get_keyword('MSG_ID', params);
   _to_folder := get_keyword('TO_FOLDER', params);
   _login_ok := 'NO';

 if (_sid   <> '')
 {
  for select * from wapsession where sid = _sid  do
  {
   _login_ok := 'YES';
   _user_name := _username;
   _folder := _sess_folder;
   _list := _sess_list;
   update wapsession set _time_last_active = datestring ( now() ) where  sid = _sid;
  }
  }else{
    _login_ok := 'NO';
  }

if (_login_ok = 'YES')
{
 update MAIL_MESSAGE set MM_FLD = _to_folder where MM_OWN = _user_name and MM_ID = atoi(_msg_id) and MM_FLD = _folder;
 http_rewrite(); http_header('Content-type: text/vnd.wap.wml\r\n');
?><?xml version="1.0"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml">


<wml>
  <card id="deleted" title="Message Deleted" >
  <do type="accept" label="Mail Menu">
   <go href="checkmail.vsp?SESS=<?=_sid?>&amp;MOVED=<?=_sid?>&amp;OPEN=Inbox"/>
  </do>
    <p>  Message moved to<br/> <?=_to_folder?></p>

 <p><a href="checkmail.vsp?SESS=<?=_sid?>&amp;MOVED=<?=_sid?>&amp;OPEN=Inbox&amp;REFRESH=<?vsp http(sprintf('%d',_random1));?>" title="Mail Menu">Mail Menu</a></p>

  </card>
</wml>
<?vsp
}else{ http_rewrite(); http_header('Content-type: text/vnd.wap.wml\r\n');
?><?xml version="1.0"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml">


<wml>
  <card id="P1" title="Wrong" >
    <p mode="nowrap">
   Wrong Login
    </p>
  </card>
</wml>
<?vsp
}
?>


