home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus Extra 1997 #5 / AmigaPlus_Extra-CD_5-97.iso / online-tools / mail / ems / rexx / import.ems < prev    next >
Text File  |  1993-08-30  |  3KB  |  118 lines

  1. /* Import.ems */
  2.  
  3. options results
  4. signal on error
  5. signal on syntax
  6.  
  7. parse arg mode domain .
  8.  
  9. if( ~show( 'l', "ems_rexx.library" ) ) then
  10. do
  11.    if( ~addlib( "ems_rexx.library", 0, -30, 0 ) )then
  12.    do
  13.       say "Could not open ems_rexx.library"
  14.       exit 10
  15.    end
  16. end
  17.  
  18. mode = upper( mode )
  19.  
  20. if mode = '' | mode = 'NORMAL' then
  21. do
  22.    if domain = '' then call EMS_Tosser_Import(        )
  23.    else                call EMS_Tosser_Import( domain )
  24. end
  25.  
  26. call EMS_Areas_Imported( 'areas' )
  27.  
  28. call EMS_Switch_Local( 'SEARCH_NEW'    , 'ON' )
  29. call EMS_Switch_Local( 'SEARCH_ON_TO'  , 'ON' )
  30. call EMS_Switch_Local( 'IGNORE_FROM'   , 'ON' )
  31. call EMS_Switch_Local( 'IGNORE_SUBJECT', 'ON' )
  32. call EMS_Switch_Local( 'IGNORE_DATE'   , 'ON' )
  33. call EMS_Switch_Local( 'IGNORE_TEXT'   , 'ON' )
  34.  
  35. sysop_name = EMS_Var_Local( 'SYSOP_NAME' )
  36.  
  37.  
  38. len_name          = 0
  39.  
  40. msg_count.        = 0
  41. msg_count_forus.  = 0
  42. len_msg           = 0
  43. len_msg_forus     = 0
  44.  
  45. file_count.       = 0
  46. file_count_forus. = 0
  47. len_file          = 0
  48. len_file_forus    = 0
  49.  
  50. doareafix         = 'NO'
  51.  
  52. do i=1 to areas.0
  53.  
  54.    if upper( EMS_Area_Type( areas.i ) ) = 'MAIL' then doareafix = 'YES'
  55.  
  56.    if EMS_Area_Msg_DBname( areas.i ) ~= '' then
  57.    do
  58.       call EMS_Database_Search( areas.i, 'MSG' , 'items', '#?'       ); msg_count.i       = items.0; drop items.
  59.       call EMS_Database_Search( areas.i, 'MSG' , 'items', sysop_name ); msg_count_forus.i = items.0; drop items.
  60.    end
  61.  
  62.    if EMS_Area_File_DBname( areas.i ) ~= '' then
  63.    do
  64.       call EMS_Database_Search( areas.i, 'FILE', 'items', '#?'       ); file_count.i       = items.0; drop items.
  65.       call EMS_Database_Search( areas.i, 'FILE', 'items', sysop_name ); file_count_forus.i = items.0; drop items.
  66.    end
  67.  
  68.    len_name       = max( len_name      , length( areas.i            ) )
  69.    len_msg        = max( len_msg       , length( msg_count.i        ) )
  70.    len_msg_forus  = max( len_msg_forus , length( msg_count_forus.i  ) )
  71.    len_file       = max( len_file      , length( file_count.i       ) )
  72.    len_file_forus = max( len_file_forus, length( file_count_forus.i ) )
  73. end
  74.  
  75.  
  76. /* Prints the list */
  77. if areas.0 ~= 0 then
  78. do
  79.    call EMS_Log_Print( 4, '|'                        , 'TIME' )
  80.    call EMS_Log_Print( 4, '| List of imported areas:', 'TIME' )
  81.  
  82.    space_name       = copies( ' ', len_name       )
  83.    space_msg        = copies( ' ', len_msg        )
  84.    space_msg_forus  = copies( ' ', len_msg_forus  )
  85.    space_file       = copies( ' ', len_file       )
  86.    space_file_forus = copies( ' ', len_file_forus )
  87.  
  88.    do i=1 to areas.0
  89.  
  90.       line =      '|'              overlay( areas.i           , space_name       )
  91.       line = line 'New msg(s):'    overlay( msg_count.i       , space_msg        )
  92.       line = line '(' ||           overlay( msg_count_forus.i , space_msg_forus  ) || ')'
  93.       line = line '- New File(s):' overlay( file_count.i      , space_file       )
  94.       line = line '(' ||           overlay( file_count_forus.i, space_file_forus ) || ')'
  95.  
  96.       call EMS_Log_Print( 4, line, 'TIME' )
  97.  
  98.    end
  99.  
  100. end
  101.  
  102. if doareafix = 'YES' then call 'EMS:rexx/Areafix.ems'
  103.  
  104. call EMS_FreeScriptData()
  105. exit 0
  106.  
  107. error:
  108. syntax:
  109.  
  110. error_text = EMS_LastError()
  111.  
  112. if error_text = '' then error_text = rc ErrorText( rc )
  113.  
  114. say '| ***BREAK: error at' sigl error_text
  115.  
  116. call EMS_FreeScriptData()
  117. exit rc
  118.