home *** CD-ROM | disk | FTP | other *** search
RISC OS BBC BASIC V Source | 1997-03-20 | 5.5 KB | 239 lines |
- > Logs
- Logs channels and chats to file
- Justin Fletcher
- 12 Sep 1996 - JF: Started v1.00
- 12 Sep 1996 - JF: Configuration added v1.01
- 26 Sep 1996 - JF: Debug option added v1.02
- 27 Sep 1996 - JF: Debug tied into the configuration v1.03
- 28 Sep 1996 - JF: Modified for new dir structure v1.04
- 0,"This is an IRClient script and cannot be run."
- InitialiseModule
- Read configuration
- StartupStatus("Initialising Logs...")
- 4Logs_channels=
- DB_ReadConfig("Logs_Channels"))
- .Logs_users=
- DB_ReadConfig("Logs_Users"))
- 2Logs_dccchat=
- DB_ReadConfig("Logs_DCCChat"))
- .Logs_other=
- DB_ReadConfig("Logs_Other"))
- (Logs_dir$=
- DB_ReadConfig("Logs_Dir")
- Logs_dir$=""
- & Logs_dir$=magrathea_user$+".Logs"
- "OS_File",8,Logs_dir$
- "OS_File",8,Logs_dir$+".Channels"
- "OS_File",8,Logs_dir$+".DCCChat"
- "OS_File",8,Logs_dir$+".Other"
- Pass on to the next module
- ******* Overloaded configuration options ********
- Give ourselves a sensible name
- Overload_ScriptInfo(num)
- ret$
- num=0
- ret$="Logs v1.04 (Gerph)"
- ret$=
- @(num-1)
- ) =ret$
- Enumerate module names
- Overload_ConfigModName(count)
- ret$
- count=0
- ret$="Logs"
- ret$=
- @(count-1)
- 3 =ret$
- What options do we provide ?
- Overload_ConfigOptions(module$)
- module$="Logs"
- DisplayConfig("")
- DisplayConfig("-- Logs configuration --")
- DisplayConfig("You can configure :")
- DisplayConfig(" Channels : Whether channels are logged")
- DisplayConfig(" Users : Whether chats are logged")
- DisplayConfig(" DCCChat : Whether DCC Chats are logged")
- DisplayConfig(" Other : Whether other windows are logged")
- DisplayConfig(" Directory : The directory to which logs are sent")
- @(module$)
- How do we configure things
- Overload_ConfigCommand(module$,com$,str$)
- module$="Logs"
- com$
- "CHANNELS"
- val=
- boolean(str$)
- val=-2
- L4
- DisplayConfig("Syntax: Channels <boolean>")
- Logs_channels=val
- O8
- DB_WriteConfig("Logs_Channels",
- Logs_channels)
- PC
- DisplayConfig("Set Channels to "+
- booltext(Logs_channels))
- "USERS"
- val=
- boolean(str$)
- val=-2
- V1
- DisplayConfig("Syntax: Users <boolean>")
- Logs_users=val
- Y2
- DB_WriteConfig("Logs_Users",
- Logs_users)
- Z=
- DisplayConfig("Set Users to "+
- booltext(Logs_users))
- "DCCCHAT"
- val=
- boolean(str$)
- val=-2
- `3
- DisplayConfig("Syntax: DCCChat <boolean>")
- Logs_dccchat=val
- c4
- DB_WriteConfig("Logs_Users",
- Logs_dccchat)
- dA
- DisplayConfig("Set DCCChat to "+
- booltext(Logs_dccchat))
- "OTHER"
- val=
- boolean(str$)
- val=-2
- j1
- DisplayConfig("Syntax: Other <boolean>")
- Logs_other=val
- m2
- DB_WriteConfig("Logs_Other",
- Logs_other)
- n=
- DisplayConfig("Set Other to "+
- booltext(Logs_other))
- "DIRECTORY"
- r+
- str$=""
- filetype(str$)<>&1000
- s1
- DisplayConfig("Syntax: Directory <dir>")
- Logs_dir$=str$
- v-
- DB_WriteConfig("Logs_Dir",Logs_dir$)
- w5
- DisplayConfig("Set Directory to "+Logs_dir$)
- x
- "OS_File",8,Logs_dir$
- y,
- "OS_File",8,Logs_dir$+".Channels"
- z+
- "OS_File",8,Logs_dir$+".DCCChat"
- {)
- "OS_File",8,Logs_dir$+".Other"
- "LIST"
- DisplayConfig("")
- DisplayConfig("Channels : "+
- booltext(Logs_channels))
- DisplayConfig("Users : "+
- booltext(Logs_users))
- DisplayConfig("DCCChat : "+
- booltext(Logs_dccchat))
- DisplayConfig("Other : "+
- booltext(Logs_other))
- DisplayConfig("Directory : "+Logs_dir$)
- "HELP"
- Overload_ConfigOptions(module$)
- DisplayConfig("Command not recognised")
- @(module$,com$,str$)
- *************** Logging overloads *********************
- Main overload on PROCDisplay
- Display(mess$,from$,to$)
- out,channel,user,dccchat,other
- @(mess$,from$,to$)
- Most of the time it's to$ that we're interested in
- to$<>""
- Initialised
- , channel=(
- to$,1)="#")
- to$,2)<>"##")
- ) user=(
- to$,1)<>"#")
- to$,1)<>"=")
- dccchat=(
- to$,1)="=")
- * other=(
- to$,2)="##")
- to$,".")<>0)
- (channel
- Logs_channels)
- (dccchat
- Logs_dccchat)
- (user
- Logs_users)
- (other
- Logs_other)
- channel
- to$="Channels."+
- to$,2)
- dccchat
- to$="DCCChat."+
- to$,2)
- other
-
- to$,".")=0
- to$="Other."+
- to$,3)
-
- to$="Other.FromServer"
-
-
- to$,"#")>0
- . to$=
- to$,"#")-1)+
- to$,"#")+1)
- to$,"^")>0
- 2 to$=
- to$,"^")-1)+"+"+
- to$,"^")+1)
- to$,"|")>0
- 2 to$=
- to$,"|")-1)+"_"+
- to$,"|")+1)
- to$=Logs_dir$+"."+to$
- out=
- (to$)
- out=0
- out=
- (to$)
- "XOS_File",18,to$,&FFF
- #out=
- Remove Bold
- mess$,
- : mess$=
- mess$,
- mess$,
- 2)-1)+"*"+
- mess$,
- mess$,
- 2)+1)
- Remove Underline
- mess$,
- < mess$=
- mess$,
- mess$,
- 31)-1)+"_"+
- mess$,
- mess$,
- 31)+1)
- Remove colours
- mess$,
- 8 mess$=
- mess$,
- mess$,
- 27)-1)+
- mess$,
- mess$,
- 27)+3)
- #out,mess$
-