home *** CD-ROM | disk | FTP | other *** search
/ ARM Club 3 / TheARMClub_PDCD3.iso / programs / comms_networking / irclient / !IRClient / Scripts / Modules / Logs (.txt) < prev    next >
Encoding:
RISC OS BBC BASIC V Source  |  1997-03-20  |  5.5 KB  |  239 lines

  1.  > Logs
  2.  Logs channels and chats to file
  3. Justin Fletcher
  4.  12 Sep 1996 - JF: Started                             v1.00
  5.  12 Sep 1996 - JF: Configuration added                 v1.01
  6.  26 Sep 1996 - JF: Debug option added                  v1.02
  7.  27 Sep 1996 - JF: Debug tied into the configuration   v1.03
  8.  28 Sep 1996 - JF: Modified for new dir structure      v1.04
  9.  0,"This is an IRClient script and cannot be run."
  10. InitialiseModule
  11.  Read configuration
  12. StartupStatus("Initialising Logs...")
  13. 4Logs_channels=
  14. DB_ReadConfig("Logs_Channels"))
  15. .Logs_users=
  16. DB_ReadConfig("Logs_Users"))
  17. 2Logs_dccchat=
  18. DB_ReadConfig("Logs_DCCChat"))
  19. .Logs_other=
  20. DB_ReadConfig("Logs_Other"))
  21. (Logs_dir$=
  22. DB_ReadConfig("Logs_Dir")
  23.  Logs_dir$="" 
  24. & Logs_dir$=magrathea_user$+".Logs"
  25.  "OS_File",8,Logs_dir$
  26.  "OS_File",8,Logs_dir$+".Channels"
  27.  "OS_File",8,Logs_dir$+".DCCChat"
  28.  "OS_File",8,Logs_dir$+".Other"
  29.  Pass on to the next module
  30.  ******* Overloaded configuration options ********
  31.  Give ourselves a sensible name
  32. Overload_ScriptInfo(num)
  33.  ret$
  34.  num=0 
  35.  ret$="Logs v1.04 (Gerph)"
  36.  ret$=
  37. @(num-1)
  38. )    =ret$
  39.  Enumerate module names
  40. Overload_ConfigModName(count)
  41.  ret$
  42.  count=0 
  43.  ret$="Logs"
  44.  ret$=
  45. @(count-1)
  46. 3    =ret$
  47.  What options do we provide ?
  48. Overload_ConfigOptions(module$)
  49.  module$="Logs" 
  50. DisplayConfig("")
  51. DisplayConfig("-- Logs configuration --")
  52. DisplayConfig("You can configure :")
  53. DisplayConfig("  Channels  : Whether channels are logged")
  54. DisplayConfig("  Users     : Whether chats are logged")
  55. DisplayConfig("  DCCChat   : Whether DCC Chats are logged")
  56. DisplayConfig("  Other     : Whether other windows are logged")
  57. DisplayConfig("  Directory : The directory to which logs are sent")
  58. @(module$)
  59.  How do we configure things
  60. Overload_ConfigCommand(module$,com$,str$)
  61.  module$="Logs" 
  62.  com$ 
  63.  "CHANNELS"
  64.    val=
  65. boolean(str$)
  66.  val=-2 
  67. L4    
  68. DisplayConfig("Syntax: Channels <boolean>")
  69.     Logs_channels=val
  70. O8    
  71. DB_WriteConfig("Logs_Channels",
  72.  Logs_channels)
  73. PC    
  74. DisplayConfig("Set Channels to "+
  75. booltext(Logs_channels))
  76.  "USERS"
  77.    val=
  78. boolean(str$)
  79.  val=-2 
  80. V1    
  81. DisplayConfig("Syntax: Users <boolean>")
  82.     Logs_users=val
  83. Y2    
  84. DB_WriteConfig("Logs_Users",
  85.  Logs_users)
  86. Z=    
  87. DisplayConfig("Set Users to "+
  88. booltext(Logs_users))
  89.  "DCCCHAT"
  90.    val=
  91. boolean(str$)
  92.  val=-2 
  93. `3    
  94. DisplayConfig("Syntax: DCCChat <boolean>")
  95.     Logs_dccchat=val
  96. c4    
  97. DB_WriteConfig("Logs_Users",
  98.  Logs_dccchat)
  99. dA    
  100. DisplayConfig("Set DCCChat to "+
  101. booltext(Logs_dccchat))
  102.  "OTHER"
  103.    val=
  104. boolean(str$)
  105.  val=-2 
  106. j1    
  107. DisplayConfig("Syntax: Other <boolean>")
  108.     Logs_other=val
  109. m2    
  110. DB_WriteConfig("Logs_Other",
  111.  Logs_other)
  112. n=    
  113. DisplayConfig("Set Other to "+
  114. booltext(Logs_other))
  115.  "DIRECTORY"
  116. r+   
  117.  str$="" 
  118. filetype(str$)<>&1000 
  119. s1    
  120. DisplayConfig("Syntax: Directory <dir>")
  121.     Logs_dir$=str$
  122. v-    
  123. DB_WriteConfig("Logs_Dir",Logs_dir$)
  124. w5    
  125. DisplayConfig("Set Directory to "+Logs_dir$)
  126. x     
  127.  "OS_File",8,Logs_dir$
  128. y,    
  129.  "OS_File",8,Logs_dir$+".Channels"
  130. z+    
  131.  "OS_File",8,Logs_dir$+".DCCChat"
  132. {)    
  133.  "OS_File",8,Logs_dir$+".Other"
  134.  "LIST"
  135. DisplayConfig("")
  136. DisplayConfig("Channels  : "+
  137. booltext(Logs_channels))
  138. DisplayConfig("Users     : "+
  139. booltext(Logs_users))
  140. DisplayConfig("DCCChat   : "+
  141. booltext(Logs_dccchat))
  142. DisplayConfig("Other     : "+
  143. booltext(Logs_other))
  144. DisplayConfig("Directory : "+Logs_dir$)
  145.  "HELP"
  146. Overload_ConfigOptions(module$)
  147. DisplayConfig("Command not recognised")
  148. @(module$,com$,str$)
  149.  *************** Logging overloads *********************
  150.  Main overload on PROCDisplay
  151. Display(mess$,from$,to$)
  152.  out,channel,user,dccchat,other
  153. @(mess$,from$,to$)
  154.  Most of the time it's to$ that we're interested in
  155.  to$<>"" 
  156.  Initialised 
  157. , channel=(
  158. to$,1)="#") 
  159. to$,2)<>"##")
  160. ) user=(
  161. to$,1)<>"#") 
  162. to$,1)<>"=")
  163.  dccchat=(
  164. to$,1)="=")
  165. * other=(
  166. to$,2)="##") 
  167. to$,".")<>0)
  168.  (channel 
  169.  Logs_channels) 
  170.  (dccchat 
  171.  Logs_dccchat) 
  172.  (user 
  173.  Logs_users) 
  174.  (other 
  175.  Logs_other) 
  176.  channel 
  177.    to$="Channels."+
  178. to$,2)
  179.  dccchat 
  180.     to$="DCCChat."+
  181. to$,2)
  182.  other 
  183.      
  184. to$,".")=0 
  185.       to$="Other."+
  186. to$,3)
  187.      
  188.        to$="Other.FromServer"
  189.      
  190.         
  191. to$,"#")>0
  192. .   to$=
  193. to$,"#")-1)+
  194. to$,"#")+1)
  195. to$,"^")>0
  196. 2   to$=
  197. to$,"^")-1)+"+"+
  198. to$,"^")+1)
  199. to$,"|")>0
  200. 2   to$=
  201. to$,"|")-1)+"_"+
  202. to$,"|")+1)
  203.   to$=Logs_dir$+"."+to$
  204.   out=
  205. (to$)
  206.  out=0 
  207.    out=
  208. (to$)
  209.  "XOS_File",18,to$,&FFF
  210. #out=
  211.  Remove Bold
  212. mess$,
  213. :   mess$=
  214. mess$,
  215. mess$,
  216. 2)-1)+"*"+
  217. mess$,
  218. mess$,
  219. 2)+1)
  220.  Remove Underline
  221. mess$,
  222. <   mess$=
  223. mess$,
  224. mess$,
  225. 31)-1)+"_"+
  226. mess$,
  227. mess$,
  228. 31)+1)
  229.  Remove colours
  230. mess$,
  231. 8   mess$=
  232. mess$,
  233. mess$,
  234. 27)-1)+
  235. mess$,
  236. mess$,
  237. 27)+3)
  238. #out,mess$
  239.