home *** CD-ROM | disk | FTP | other *** search
/ DP Tool Club 12 / CD_ASCQ_12_0294.iso / vrac / netmail.zip / NETMAIL.PPS < prev    next >
Text File  |  1994-02-11  |  12KB  |  516 lines

  1. ;==========================================================================
  2. ;           :
  3. ; Name      : NetMail.PPE
  4. ;           :
  5. ; Syntax    : NetMail.PPE <Name of Addressee>
  6. ;           :       NOTE: The name of the addressee is optional.  If it
  7. ;           :               is supplied then NetMail will use it.
  8. ;           :
  9. ; Copyright : (c) 1994 Tranquility Base
  10. ;           :
  11. ; Version   : 1.3
  12. ;           :
  13. ; Action    : This program is designed to replace the (E) command in your 
  14. ;           : NetMail conference.  It will prompt your user for the name of 
  15. ;           : the person to send to, the Netmail address to send it to, and 
  16. ;           : it will list the available options for sending and allow them 
  17. ;           : to chose one.
  18. ;==========================================================================
  19. ; CHANGES 
  20. ;
  21. ; V1.00
  22. ;----------------
  23. ; Initial Release
  24. ;
  25. ; v1.1
  26. ;----------------
  27. ; Fixed bugs with handeling Organization names
  28. ;
  29. ; v1.2
  30. ;----------------
  31. ; Changed the NAME prompt to include the word NAME
  32. ;
  33. ; v1.3
  34. ;----------------
  35. ; Added Expert Mode.  If the user is in expert mode, it will not
  36. ; display the help files
  37. ;
  38. ; Also changed the name of the URGENT and the WELCOME files.  This was to
  39. ; allow PCB to properly search for Security and Grahpics mode flags in the
  40. ; File name.  If you are using SEC level files make sure you either have
  41. ; a base file without a SEC level or that you have one file for EACH
  42. ; sec level you have set up on your BBS.
  43. ;
  44. ; NETMAIL.PPE will honor Security Leve, Graphics Mode and Current Language
  45. ; on all the files that it uses.  BUT It's up to YOU to create these files.
  46. ; If you do create some nice language files for the files in NetMail and you
  47. ; would be willing to share them with others; send them to me and I will
  48. ; include them in the ZIP file.
  49. ;
  50. ;==========================================================================
  51. ;
  52. ; Initalize Variables
  53. ;
  54. STRING  ThisName, ThisAddress, InString, Organization, Accumulator, OutString
  55. STRING  WorkString, Subject, CrLf, Urgency, Valid, UseFullScreen
  56. INTEGER Zone, Net, Node, Point, DefaultZone, DefaultNet, Counter
  57. INTEGER ImmediateLevel, CrashLevel, HoldLevel, DirectLevel
  58. INTEGER GotZone, GotNet, GotNode, GotPoint, GotOrg
  59.  
  60. DefaultZone=1
  61. DefaultNet=3625
  62. ZONE    = 0
  63. Net     = 0
  64. Node    = 0
  65. Point   = 0
  66. GotZone = 0
  67. GotNet  = 0
  68. GotNode = 0
  69. GotPoint= 0
  70. GotOrg  = 0
  71.  
  72. CrLf=Chr(13)+Chr(10)
  73. Organization  = ""
  74. Urgency       = "N"
  75. Valid         = "N"
  76. UseFullScreen = "Y"
  77. OutString     = ""
  78.  
  79.  
  80. ;
  81. ; Get The USER Info
  82. ;
  83. GETUSER
  84.  
  85.  
  86. ;
  87. ; Set Up The Screen
  88. ;
  89. If (U_EXPERT=FALSE) THEN
  90.    CLS
  91. EndIF
  92.  
  93.  
  94. ;
  95. ; Open the Config File
  96. ;
  97. FOPEN 1,PPEPATH()+PPENAME()+".CFG",o_rd,s_dn
  98.  
  99.  
  100. ;
  101. ; Read in the config file options
  102. ;
  103. FGet 1, DefaultZone
  104. FGet 1, DefaultNet
  105. FGet 1, ImmediateLevel
  106. FGet 1, CrashLevel
  107. FGet 1, HoldLevel
  108. FGet 1, DirectLevel
  109.  
  110.  
  111. ;
  112. ; Now check to make sure we got them all
  113. ;
  114. If (FERR(1)) Then
  115.    PRINTLN "Please inform the SYSOP that there is a problem with the CONFIG file."
  116.    FClose 1
  117.    Goto End
  118. EndIf
  119.  
  120. FClose 1
  121.  
  122.  
  123. ;
  124. ; Send Out the Opening File
  125. ; This File can contain an explanation of what NetMail is, and how to
  126. ; run your Nodelist Scanner if you have one and they need to find an 
  127. ; address.
  128. ;
  129. If ((U_EXPERT=FALSE) && (Exist(PPEPath()+"Wlcm*.*"))) Then
  130.    DispFile PPEPath()+"Wlcm",SEC+GRAPH+LANG
  131. EndIf
  132.  
  133.  
  134. ;
  135. ; Get any tokens passed
  136. ; We are assuming that anything passes to the program is the name of the
  137. ; person to send mail to.  (Similar to the existing E command.)
  138. ;
  139. While (TOKCOUNT()>0) DO
  140.    ThisName=ThisName+" "+GetToken()
  141. EndWhile
  142.  
  143. ThisName=Trim(ThisName," ")
  144.  
  145.  
  146. ;
  147. ; Now prompt the user for the name, using the name provide if available
  148. ;
  149. INPUTTEXT "Name (Enter)=ABORT ?",ThisName,@X0F,25
  150. NEWLINE
  151.  
  152. ;
  153. ; Check for an empty name and bail if found
  154. ;
  155. If (Len(Trim(ThisName," "))<1) Then
  156.    Goto End
  157. EndIf
  158.  
  159. ;
  160. ; Now get the Subject of the Message
  161. ;
  162. INPUTTEXT "Subject (ENTER)=Abort ?",Subject,@X0F,60
  163. NewLine
  164.  
  165. If (LEN(Subject)<1) Then
  166.    Goto END
  167. EndIf
  168.  
  169.  
  170. : Address
  171. ;
  172. ; Now look to see if the SYSOP has created an ADDRESS prompt file.
  173. ; If so then display it.  If not then Ask for the Address.
  174. ; NOTE:  The ADDR* file should NOT end with a LF.  The last line of
  175. ; the file IS the prompt for the Address.  You need to make sure and leave
  176. ; at lease 32 spaces at the end of your prompt for them to enter the 
  177. ; address in.
  178. ;
  179.  
  180. If ((U_EXPERT=FALSE) && (EXIST(PPEPATH()+"ADDR*.*"))) Then
  181.    DispFile PPEPath()+"ADDR",SEC+GRAPH+LANG
  182.    INPUTTEXT "",ThisAddress,@X0F,30
  183. Else
  184.    INPUTTEXT "@X0FAddress to Send To (ENTER)=Abort ?",ThisAddress,@X0F,30
  185. EndIF
  186.  
  187. NEWLINE
  188.  
  189.  
  190. ;
  191. ; Check for an empty address and bail if found
  192. ;
  193. If (Len(Trim(ThisAddress," "))<1) Then
  194.    Goto END
  195. EndIf
  196.  
  197.  
  198. ;
  199. ; Now Check for a VALID address.
  200. ; We are going to take the address apart just to make sure that all the
  201. ; parts are there.    
  202. ;
  203. ThisAddress=Trim(ThisAddress," ")
  204.  
  205. For Counter=1 to Len(ThisAddress)
  206.    WorkString=Mid(ThisAddress,Counter,1)
  207.  
  208.    If (WorkString=":") Then
  209.       ;      
  210.       ; If this is a COLON then the Accumulator holds the ZONE
  211.       ;
  212.       Zone=S2I(Accumulator,10)
  213.       Accumulator=""
  214.       GotZone=1
  215.  
  216.    ElseIf (WorkString="/") Then
  217.       ;      
  218.       ; If this is a SLASH then the Accumulator holds the NET
  219.       ;
  220.       Net=S2I(Accumulator,10)
  221.       Accumulator=""
  222.       GotNet=1
  223.  
  224.    ElseIf (WorkString=".") Then
  225.       ;      
  226.       ; If this is a PERIOD and we don't already HAVE a NODE 
  227.       ; then the Accumulator holds the NODE
  228.       ;
  229.             
  230.       If (GotNode=0) THEN
  231.          Node=S2I(Accumulator,10)
  232.          Accumulator=""
  233.          GotNode=1
  234.       Else
  235.          ;      
  236.          ; If this is a PERIOD and we DO already have a NODE then 
  237.          ; the Accumulator holds the domain
  238.          ;
  239.          Accumulator=Accumulator+WorkString
  240.       EndIf
  241.  
  242.    ElseIf (WorkString="@") Then
  243.       ;      
  244.       ; If this is an @ then the Accumulator holds a POINT
  245.       ;
  246.       Point=S2I(Accumulator,10)
  247.       Accumulator=""
  248.       GotPoint=1
  249.  
  250.    Else
  251.       ;
  252.       ; Anything else is just part of the address.
  253.       ;
  254.       Accumulator=Accumulator+WorkString
  255.    EndIf
  256.  
  257. Next Counter
  258.  
  259. If (Len(Accumulator)>0) Then
  260.    ;
  261.    ; If we have somthing left in the accumulator then let's figure
  262.    ; out what it is.
  263.    ;
  264.    If (GotNode>0) Then
  265.       ;
  266.       ; If GotNode > 0 then it's not the Node number. Let's
  267.       ; check to see if it's a PONT
  268.       ;
  269.       If (GotPoint>0) Then 
  270.          ;
  271.          ; If GotPoint > 0 then We've already got a Point
  272.          ; so it HAS to be the Domain name
  273.          ;
  274.          Organization=Trim(Accumulator," ")
  275.          GotOrg=1
  276.       Else
  277.          ;
  278.          ; If we DON'T have a Point number then let's assume 
  279.          ; that this is a POINT number.
  280.          ;
  281.          Point=S2I(Accumulator,10)
  282.          GotPoint=1
  283.       EndIf
  284.    
  285.    Else
  286.       ;
  287.       ; If we don't have a NODE number then what's left in the Accumulator
  288.       ; MUST be the NODE number.
  289.       ;
  290.       Node=S2I(Accumulator,10)
  291.       GotNode=1
  292.    EndIf
  293.  
  294. EndIf
  295.  
  296. ;
  297. ; Now that we have it in pieces, let's check each piece
  298. ; First : Let's check the ZONE number.  If GotZone=0 then set
  299. ;         ZONE number to the Default ZONE.
  300. If (GotZone=0) ZONE=DefaultZone
  301.  
  302.  
  303. ; Second: If Check the GotNet, if GotNet says that we DO NOT have
  304. ;         a net then set the net to the default net.
  305. If (GotNet=0) Net=DefaultNet
  306.  
  307.  
  308. ;
  309. ; Third : Check the Node Number
  310. ;
  311. If (GotNode=0) Then
  312.    ; If we don't have a NODE number then they obviously 
  313.    ; typed something in wrong.  If this is the case then
  314.    ; tell the user and allow them to change it.
  315.    PRINTLN "Your address is improperly formatted, please try again."
  316.    NewLine
  317.    Goto Address
  318. EndIf
  319.  
  320.  
  321. ;
  322. ; Now that we have checked each part for viability, let's
  323. ; put it all back together.
  324. ;
  325. ThisAddress=Trim(I2S(Zone,10)," ")
  326. ThisAddress=ThisAddress+":"+Trim(I2S(Net,10)," ")
  327. ThisAddress=ThisAddress+"/"+Trim(I2S(Node,10)," ")
  328.  
  329.  
  330. ;
  331. ; If we have a Point address then add it in.
  332. ;
  333. If (GotPoint=1) Then
  334.    ThisAddress=ThisAddress+"."+Trim(I2S(Point,10)," ")
  335. EndIf
  336.  
  337.  
  338. ;
  339. ; If we have a domain then add it in.
  340. ;
  341. If (GotOrg=1) Then
  342.    ThisAddress=ThisAddress+"@"+Organization
  343. EndIf
  344.  
  345.  
  346. ;
  347. ; Send Out The Urgency File
  348. ; This File can be tailored by security level.  I recomend one file for each
  349. ; secuity level specified in the NETMAIL.CFG file.
  350. ;
  351. If ((U_EXPERT=FALSE) && (Exist(PPEPath()+"Ugnt*.*"))) Then
  352.       DispFile PPEPath()+"Ugnt",SEC+GRAPH+LANG
  353. Else
  354.    ;
  355.    ; If the program cannot find an Urgency file then use these
  356.    ; defauly prompts.  They arn't pretty...but they work.
  357.    ;
  358.    ; NOTE: These prompts are skipped if you have set up an urgency file.
  359.    ;
  360.    PRINTLN "Urgency Level:"
  361.  
  362.    ;
  363.    ; Does this user have access to the Immediate command?
  364.    ;
  365.    If (U_Sec>=ImmediateLevel) THEN
  366.       PRINTLN "     (I)mmediate"
  367.    EndIf
  368.  
  369.    
  370.    ;
  371.    ; Does this user have access to the Crash command?
  372.    ;
  373.    If (U_Sec>= CrashLevel) THEN
  374.       PRINTLN "     (C)rash"
  375.    EndIf
  376.  
  377.    
  378.    ;
  379.    ; Does this user have access to the Hold command?
  380.    ;
  381.    If (U_Sec>= HoldLevel) THEN
  382.       PRINTLN "     (H)old"
  383.    EndIf
  384.  
  385.  
  386.    
  387.    ;
  388.    ; Does this user have access to the Direct command?
  389.    ;
  390.    If (U_Sec>= DirectLevel) THEN
  391.       PRINTLN "     (D)irect"
  392.    EndIf
  393.  
  394.    ;
  395.    ; Everybody has access to the Normal Command since it dosen't do
  396.    ; ANYTHING to the message. It's really only here for cosmetics.
  397.    ;
  398.    PRINTLN "     (N)ormal"
  399.  
  400.    PRINT "Urgency Level (Enter)=Normal"
  401.  
  402. EndIf
  403.    
  404. ;
  405. ; Now Build the Valid String
  406. ; The VALID string is used in the INPUTSTR command.  It puts the first letter
  407. ; of each command that the user has access to into a string called Valid.
  408. '
  409. If (U_Sec>=ImmediateLevel) THEN
  410.    Valid=Valid+"I"
  411. EndIf
  412.  
  413. If (U_Sec>= CrashLevel) THEN
  414.    Valid=Valid+"C"
  415. EndIf
  416.  
  417. If (U_Sec>= HoldLevel)  THEN
  418.    Valid=Valid+"H"
  419. EndIf
  420.  
  421. If (U_Sec>= DirectLevel) THEN
  422.    Valid=Valid+"D"
  423. EndIf
  424.  
  425.  
  426. ;
  427. ; This is the InputStr for the Urgency flag.
  428. ;
  429. INPUTSTR "",Urgency,@X0F,1,Valid,LFAfter+Guide+UpCase
  430.  
  431.  
  432. ;
  433. ; Check for Full Screen Editor
  434. ; If this user has set the FullScreen flag then we don't need to worry 
  435. ; about it.  Otherwise, we need to see if the user want's to use the 
  436. ; Full Screen user or not.
  437. ;
  438. If (U_FSEP) Then
  439.    PROMPTSTR 498,UseFullScreen,1,"Y",LFAFTER+UPCASE+GUIDE
  440. EndIf
  441.  
  442. ;
  443. ; Now let's build the Output String
  444. ; Line 1: The E Command
  445. OutString="E"+Chr(13)+Chr(10)
  446.  
  447. ; Line 2: The name of the user to send the message to
  448. OutString=OutString+ThisName+CrLf
  449.  
  450. ; Line 3:The Subject of this message
  451. OutString=OutString+Subject +CrLf
  452.  
  453. ; Line 4:Answer the Return Request question
  454. OutString=OutString+"N"     +CrLf
  455.  
  456.  
  457. ;
  458. ; If the user is using the Full Screen Editor then don't worry
  459. ; about the FSE question.  Otherwise, load the answer to the
  460. ; 'Use FSE' question into the Output String.
  461. ;
  462. If (U_FSE=FALSE) THEN
  463.  
  464.    If (U_FSEP=TRUE) THEN
  465.    
  466.       If (UseFullScreen="Y") THEN
  467.          OutString=OutString+"Y"+CrLf
  468.       Else
  469.          OutString=OutString+"N"+CrLf
  470.       EndIf
  471.  
  472.    EndIf
  473.  
  474. EndIf
  475.  
  476.  
  477. ; Now Stuff the Address into the message along with the ()'s
  478. OutString=OutString+"("+ThisAddress+")"+CrLf
  479.  
  480. ; Now Stuff the Urgency Flag into the message
  481. If (Urgency="I" )  THEN
  482.    OutString=OutString+"(IMMEDIATE)"+CrLf
  483. EndIf
  484.  
  485. If (Urgency="D") THEN
  486.    OutString=OutString+"(DIRECT)"+CrLf
  487. EndIf
  488.  
  489. If (Urgency="H") THEN
  490.    OutString=OutString+"(HOLD)"+CrLf
  491. EndIf
  492.  
  493. If (Urgency="C") THEN
  494.    OutString=OutString+"(CRASH)"+CrLf
  495. EndIf
  496.  
  497.  
  498.  
  499. : END
  500. ;
  501. ; PLEASE don't remove this (Pretty Please!)
  502. ; It only shows breifly and it annoys no-one.
  503. PrintLn "    NetMailer -- v1.3    "
  504. PrintLN "(c) 1994 Tranquility Base"
  505. PrintLN "   All Rights Reserved   "
  506.  
  507. ;
  508. ; Stuff The Keyboard if there is anything there.
  509. ;
  510. If (Len(OutString)>0) THEN
  511.    KBDSTUFF OutString
  512. EndIf
  513.  
  514. End
  515.  
  516.