home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 13 / AACD13.ISO / AACD / Online / StrICQ / Src / rexx / QSilver-ICQ.rexx < prev   
OS/2 REXX Batch file  |  1999-05-21  |  3KB  |  87 lines

  1. /*
  2.   QSilver-ICQ.rexx - A simple example of how to use STRICQ as a file server
  3.   $VER: QSilver-ICQ.rexx v1.0 12.05.99 Copyright (C) 1999 Douglas F. McLaughlin & Roger Clark
  4.   Based on original script written by: Douglas F. McLaughlin
  5.   Note: Permission is granted to use this script in any form or make any modifications as necessary.
  6. */
  7.  
  8. Config:
  9. UserName = 'Douglas McLaughlin'
  10. MyUIN = '8083608'
  11. Path = 'DH0:STRICQ/Downloads/'
  12. MaxFiles = 5
  13.  
  14. ReadFile:
  15. In = 'In'
  16. Parse Arg UIN Type File .
  17. Address STRICQ.1
  18. GetContact 'UIN='UIN 'VAR=USER'
  19. If ~Open(In,File,'R') Then Exit(10)
  20.   Line = Strip(ReadLn(In),"T","0d"x)
  21. Call Close(In)
  22. Call Delete(File)
  23. If Type ~= 1 Then Exit(0)
  24.  
  25. CheckOnline:
  26. If Upper(Word(Line,1)) = '!LIST' | Upper(Word(Line,1)) = '!GET' Then Do
  27.   If User.IP = '0.0.0.0' Then Do
  28.     SendMessage 'UIN='UIN 'MSG="Sorry, you are either not in my Contact List, have your IP address hidden, or are currently offline.  Your filerequest has been cancelled."'
  29.     Call Delete("Env:QSilver-ICQ")
  30.     Exit(0)
  31.   End
  32. End
  33.  
  34. Serve:
  35. If Upper(Word(Line,1)) = '!LIST' Then Do
  36.   If Exists("Env:QSilver-ICQ") then Do
  37.     SendMessage 'UIN='UIN 'MSG="Sorry, the file server is busy.  Please try again in a few minutes."'
  38.     Exit(0)
  39.   End
  40.   Else Do
  41.     Call Open("E","ENV:QSilver-ICQ","W")
  42.       Call WriteLn("E","UIN "UIN)
  43.     Call Close("E")
  44.   End
  45.   Address Command 'List >T:FileList 'Path' FILES LFORMAT="%-24N %7L %C"'
  46.   Address Command 'Sort T:FileList to T:FileList'
  47.   Call Open('Out','T:FileList2','W')
  48.     Call WriteLn('Out','Files available from 'UserName' ('MyUIN')')
  49.     Call WriteLn('Out',' ')
  50.   Call Close('Out')
  51.   Address Command 'Join T:FileList2 T:FileList as T:Filelist.'MyUIN
  52.   Call Delete('T:FileList')
  53.   Call Delete('T:FileList2')
  54.   AddFile 'FILE=T:FileList.'||MyUIN
  55.   FileDirect 'UIN='UIN 'SPEED=100' 'DESC="Current Files Available"'
  56.   Call Delete("Env:QSilver-ICQ")
  57.   Exit(0)
  58. End
  59. If Upper(Word(Line,1)) = '!GET' Then Do
  60.   If Exists("Env:QSilver-ICQ") then Do
  61.     SendMessage 'UIN='UIN 'MSG="Sorry, the file server is busy.  Please try again in a few minutes."'
  62.     Exit(0)
  63.   End
  64.   Else Do
  65.     Call Open("E","ENV:QSilver-ICQ","W")
  66.       Call WriteLn("E","UIN "UIN)
  67.     Call Close("E")
  68.   End
  69.   AddFile CLEAR
  70.   Sending = ""
  71.   If Words(Line) - 1 > MaxFiles Then Line = SubWord(Line,1,MaxFiles + 1)
  72.   Do Loop = 2 to Words(Line)
  73.     File = Path || Word(Line,Loop)
  74.     If Exists(File) Then Do
  75.       Sending = Sending||" "||Word(Line,Loop)||";"
  76.       AddFile 'FILE='File
  77.     End
  78.   End
  79.   Sending = Strip(Sending,"T",";")
  80.   If Words(Line) > 2 then Desc = 'Here are the files you requested:'Sending
  81.   Else Desc = 'Here is the file you requested: 'Sending
  82.   FileDirect 'UIN='UIN 'SPEED=100' 'DESC="'Desc'"'
  83.   Call Delete("Env:QSilver-ICQ")
  84.   Exit(0)
  85. End
  86. Exit(0)
  87.