/* FILEUPLOAD - Part Server by iri - http://www.irizone.net july 2007 under GNU/GPL v3 licence */ typeof upfolder = S;; typeof upextension = [S r1];; typeof upsize = I;; typeof clis = [CLIENT r1];; defcom Cunregister = unregister;; defcom Cregister = register S;; fun cbUpFile(cli, name, content)= let getExtensionFromFile name -> ext in if (is_in_list clis cli) && (is_string_in_list upextension ext) && (upsize >= strlen content) then ( _createpack unzip content _getmodifypack strcatn upfolder :: "/" :: name :: nil; _DMSevent this cli "succeed" strcatn upfolder :: "/" :: name :: nil nil ) else _DMSevent this cli "notvalide" name nil;; fun cbStart(from, user, action, param, others, tag)= if (_DMSclientAlive UtoC user) == 1 then _DMScreateClientDMI this UtoC user nil else 0;; fun cbRegister(from, user, action, param, others, tag)= set clis = removef_from_list clis @cmpcli UtoC user; set clis = (UtoC user) :: clis; _DMSsend this UtoC user Cregister [strbuild upextension :: ((itoa upsize) :: nil) :: nil];; fun cbUnregister(from, user, action, param, others, tag)= set clis = removef_from_list clis @cmpcli UtoC user; _DMSsend this UtoC user Cunregister nil;; fun cbGetfolder(from, user, action, param, others, tag)= _DMSevent this UtoC user "getfolder" upfolder nil;; fun cbSetfolder(from, user, action, param, others, tag)= set upfolder = param; _DMSevent this UtoC user "getfolder" upfolder nil;; fun cbGetextension(from, user, action, param, others, tag)= _DMSevent this UtoC user "getextension" linebuild upextension nil;; fun cbSetextension(from, user, action, param, others, tag)= set upextension = lineextr param; _DMSevent this UtoC user "getextension" linebuild upextension nil;; fun cbGetsize(from, user, action, param, others, tag)= _DMSevent this UtoC user "getsize" itoa upsize nil;; fun cbSetsize(from, user, action, param, others, tag)= set upsize = atoi param; _DMSevent this UtoC user "getsize" itoa upsize nil;; fun logout(cli)= set clis = remove_from_list clis cli; 0;; fun IniDMI(param)= let strextr _getpack _checkpack param -> l in ( set upfolder = getInfo l "upfolder"; set upextension = hd strextr getInfo l "upextension"; set upsize = atoi getInfo l "upsize"; ); _DMSdefineActions this ([ "register" @cbRegister ]) :: ([ "unregister" @cbUnregister ]) :: ([ "getfolder" @cbGetfolder ]) :: ([ "setfolder" @cbSetfolder ]) :: ([ "getextension" @cbGetextension ]) :: ([ "setextension" @cbSetextension ]) :: ([ "getsize" @cbGetsize ]) :: ([ "setsize" @cbSetsize ]) :: ([ "start" @cbStart ]) :: nil; _DMSregister this @logout nil nil; _DMScbUpload this @cbUpFile;;