home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ARM Club 3
/
TheARMClub_PDCD3.iso
/
programs
/
comms_networking
/
irclient
/
!IRClient
/
Scripts
/
Magrathea
(
.txt
)
Encoding:
Amiga
Atari
Commodore
DOS
FM Towns/JPY
Macintosh
Macintosh JP
Macintosh to JP
NeXTSTEP
RISC OS/Acorn
Shift JIS
UTF-8
Wrap
RISC OS BBC BASIC V Source
|
1997-03-21
|
36.5 KB
|
1,513 lines
>Magrathea
IRClient script
Gerph + Zarni 1996
Please refer to documentation for details
0,"This is an IRClient script and cannot be run."
At the very start we do this lot - called by Internal.Boot
MagratheaAwakes
The version of magrathea this is
magver$="1.19"
Make some sensible version string to return to user
Version$=
Version,2,4)
"Version$="IRClient v"+Version$
Version,"nregistered")<>0
Version$+=" (Unregistered)"
7Version$+=", Magrathea v"+magver$+" (Gerph+Zarni)."
Initialise various path variables
Claim(256)
"OS_ReadVarVal","IRClient$Dir",mem,256,0,3
,,read
?(mem+read)=0
magrathea$=($mem)+".Scripts"
Release(mem)
)magrathea_mods$=magrathea$+".Modules"
&magrathea_user$=magrathea$+".User"
debug=
"SendingToDisplay$="##server##"
OurNick$=
GetNickname
"Hourglass_Start",1
StartupStatus("Initialising Magrathea...")
We desperately need the utils to handle simple things
magrathea$+".Default.Utils.!Module"
Utils_Initialise
Delay so that Hourglass comes on - the doggysoft one has probs
"Hourglass_LEDs",1,
We need GDBM to handle the database functions
magrathea$+".Default.GDBM.!Module"
DB_Initialise
We need to load the standard configuration module
magrathea$+".Default.Config"
We'll need the Dependency handler to load our extensions
in the correct order.
StartupStatus("Loading modules...")
magrathea$+".Default.Dependency"
You should use Initialised to spot when the module has been
initialised if you are likely to overload very basic routines
Initialised=
Dependency_LoadModules
Now we initialise all the libraries
"Hourglass_LEDs",2,
StartupStatus("Initialising modules...")
InitialiseModule
Initialised=
If the hourglass remains on then one module is not passing
the call on - I'll switch it off anyhow...
"Hourglass_Off"
If I ever need to handle them, this is where it'll be !
WimpMessage_Received(message,block)
PRINT"Message "+STR$message
@(message,block)
Any menu entries we feel like adding
Overload_AddMenuEntries(name$)
name$
"_User_Action"
user$,chan$
user$=
GetMenuParameter
chan$=
GetMenuChannel
AddMenuEntry("Slap","Action("""+chan$+""",""slaps "+user$+" around the face with a twelve storey building"")",0,0,"")
"_CTCPList"
user$,chan$
user$=
GetMenuParameter
AddMenuEntry("Scripts","CTCP_DoScripts("""+user$+""")",0,0,"")
AddMenuEntry("Source","CTCP_DoSource("""+user$+""")",0,0,"")
@(name$)
Session_Initialise(server$,port,ircflag)
Remember them for later
IRC_Server$=server$
IRC_Port=port
Cache our nick name
OurNick$=
GetNickname
registered=
Initialise the MOTD and main IRC sockets
MasterBuffer =
NewBuffer
b\MasterSocket =
Connect(server$,port,"MasterConnected","MasterError","MasterIncoming",0)
MasterSocket = 0
Offline
Notify("Unable to resolve that hostname")
SelectNoFocus
SendToIRC("NICK "+OurNick$)
SendToIRC("USER "+
GetUsername+" * * :"+
GetIRLname)
Connecting(server$,port)
Called when all the modules have initialised
(ie others overload this routine)
InitialiseModule
Called to find out what scripts are available
Overload_ScriptInfo(num)
Called when all the modules have shutdown
ShutdownModule(mask)
y =mask
Called just before we exit - modules should overload if
they use persistent files or caching (I think)
Finalise
AbortConnection
CloseInputBox
Disconnect
Called as we begin to connect
Connecting(server$,port)
List_Reset
MasterError(i1,i2,reason$)
Notify("Error: "+reason$)
CloseInputBox
Disconnect
MasterIncoming(i1,i2)
numbytes,str$
.numbytes=
ReadToStaticBuffer(MasterSocket)
BufferAdd(MasterBuffer,
StaticBufferAddr,numbytes)
)str$=
GetLineFromBuffer(MasterBuffer)
(str$)
IRCLine(str$)
* str$=
GetLineFromBuffer(MasterBuffer)
MasterConnected(i1,i2)
Online
OpenInputBox(0)
OpenServerWindow
This routine is called when the disconnect menu is clicked
Disconnect
Offline
Close(MasterSocket)
FreeBuffer(MasterBuffer)
Disconnected
Called when we disconnect - by any means
Disconnected
mask,LeaveInputBox,ConnectionsOpen
Shuts down /all/ modules
LeaveInputBox=1
Connections open is not currently used although it is shown
ConnectionsOpen=8
mask=
ShutdownModule(0)
(mask
1)=0
CloseInputBox
(mask
(255*ConnectionsOpen))>0
Notify(
(mask/256))
DisplaySelected(display$)
display$,2)<>"##"
display$,1)="#"
display$=""
SelectChannel(display$)
SelectUser(display$)
Overload_DisplaySelected(display$)
SelectUser(user$)
SetPreInput("*"+OurNick$+"* ")
SetInputTitle(OurNick$+", talking to "+user$)
SetFocus(user$)
SetDisplayForRecall(user$)
SendingToDisplay$=user$
SelectChannel(channel$)
SetPreInput("<"+OurNick$+"> ")
channel$<>""
SetInputTitle(OurNick$+", Talking to channel "+channel$)
SetDisplayForRecall(channel$)
SetInputTitle(OurNick$+", Talking to IRC server")
SetDisplayForRecall("##server##")
SendingToDisplay$=channel$
SetFocus(channel$)
@(channel$)
Call this when you drop the current focus
SelectNoFocus
SelectChannel("")
JoinChannel(channel$)
NewChannel(channel$,32,"Channel "+channel$,0,0)
UpdateUser(OurNick$,channel$,0)
SelectChannel(channel$)
SendToIRC("MODE "+channel$)
LeftChannel(channel$)
DeleteChannel(channel$)
KillDisplay(channel$)
SendingToDisplay$=channel$
SelectNoFocus
IRCLine(line$)
line$,1)=":"
2
debug
Display(line$, "", "##Debug##")
line$=
line$,2)
from$=
oneparam(line$)
line$=
moveon(line$)
! command$=
oneparam(line$)
line$=
moveon(line$)
to$=
oneparam(line$)
line$=
moveon(line$)
(command$)<>0
5
Overload_ServerResponse(
(command$),line$)
nick$=
getnick(from$)
# userid$=
getuserid(from$)
E
Overload_ServerMessage(from$,nick$,userid$,command$,line$)
line$,4)="PING"
7
Send directly, avoiding any caching present
5
SendString(MasterSocket,"PONG "+
line$,6))
2
Display("*-> "+line$, "", "##server##")
Overloads for hooking onto...
Overload_On_Kick(victim$,chan$,by$,uid$,reason$)
DisplayInfo("*** "+victim$+" has been kicked off channel "+chan$+" by "+by$+" ("+reason$+")",chan$)
Overload_On_Part(nick$,chan$,uid$)
DisplayInfo("*** "+nick$+" ("+uid$+") has left channel "+chan$,chan$)
DeleteUser(nick$,chan$)
Overload_On_Nick(nick$,chan$,uid$,new$)
DisplayInfo("*** "+nick$+" ("+uid$+") has changed his nickname to "+new$,chan$)
Overload_On_Quit(nick$,chan$,uid$,message$)
DisplayInfo("*** "+nick$+" ("+uid$+") has left IRC ("+message$+")",chan$)
Overload_On_Join(nick$,chan$,uid$)
DisplayInfo("*** "+nick$+" ("+uid$+") has joined channel "+chan$,chan$)
Overload_On_Say(nick$,chan$,uid$,message$)
MessageToDisplay(message$,nick$,chan$)
Overload_On_Notice(nick$,chan$,uid$,message$)
MessageToDisplay(message$,nick$,"-"+chan$)
Overload_ServerMessage(from$,nick$,userid$,command$,line$)
command$
"JOIN":
nick$=OurNick$
JoinChannel(to$)
,+
Overload_On_Join(nick$,to$,userid$)
UpdateUser(nick$,to$,0)
"TOPIC":
topic$
topic$=
oneparam(line$)
nick$=OurNick$
3=
DisplayInfo("*** You have changed the topic to:",to$)
5P
DisplayInfo("*** "+nick$+" ("+userid$+") has changed the topic to:",to$)
CentredDisplay("*** "+topic$+" ***",from$,to$)
ChangeChannelTopic(to$,topic$)
"NICK":
newnick$,display$
newnick$=to$
nick$=OurNick$
SetNickname(newnick$)
OurNick$=newnick$
@*
DisplaySelected(SendingToDisplay$)
A display$=
FindUser(nick$)
display$=""
CG
DisplayInfo("*** You are now known as "+newnick$,"##server##")
display$<>""
FD
DisplayInfo("*** You are now known as "+newnick$,display$)
G$
DeleteUser(nick$,display$)
H'
SendToIRC("NAMES :"+display$)
I" display$=
FindUser(nick$)
J
M display$=
FindUser(nick$)
display$<>""
O:
Overload_On_Nick(nick$,display$,userid$,newnick$)
P#
DeleteUser(nick$,display$)
Q&
SendToIRC("NAMES :"+display$)
R! display$=
FindUser(nick$)
"PART":
nick$=OurNick$
LeftChannel(to$)
Z+
Overload_On_Part(nick$,to$,userid$)
"KICK":
victim$,reason$
victim$=
oneparam(line$)
`' reason$=
oneparam(
moveon(line$))
reason$=""
reason$="No reason given"
victim$=OurNick$
cn
DisplayWarning("*** You have been kicked off channel "+to$+" by "+nick$+" ("+reason$+")","##server##")
LeftChannel(to$)
f;
Overload_On_Kick(victim$,to$,nick$,userid$,reason$)
DeleteUser(victim$,to$)
"KILL"
reason$
reason$=
oneparam(line$)
reason$=""
reason$="No reason given"
to$=OurNick$
oN
DisplayError("*** You have been killed by "+nick$+" ("+reason$+")","")
q display$=
FindUser(nick$)
display$<>""
sW
DisplayInfo("*** "+to$+" has been killed by "+nick$+" ("+reason$+")",display$)
t!
DeleteUser(to$,display$)
display$=
FindUser(to$)
"QUIT":
message$
message$=to$
message$=""
message$="No reason"
display$=
FindUser(nick$)
display$<>""
Overload_On_Quit(nick$,display$,userid$,message$)
DeleteUser(nick$,display$)
display$=
FindUser(nick$)
"MODE":
ModeChange(to$,nick$,line$)
"PRIVMSG":
message$
message$=
oneparam(line$)
message$,1)=
CTCP_request(to$,nick$,message$)
to$,1)<>"#"
to$=nick$
Overload_On_Say(nick$,to$,userid$,message$)
"NOTICE":
message$
message$=
oneparam(line$)
message$,1)=
CTCP_reply(nick$,message$)
to$,1)<>"#"
to$=nick$
Overload_On_Notice(nick$,to$,userid$,message$)
Overload_ServerResponse(code,line$)
code
002:
line$=
oneparam(line$)
line$,13)="Your host is "
IRChost$=
oneparam(
line$,14))
DisplayInfo(line$, "##server##")
RunInitialScript
221:
opts$=
oneparam(line$)
DisplayInfo("You are in mode "+opts$,"")
302:
RPL_USERHOST
303:
users$=
pasteargs(line$)
users$=" "
users$=""
DisplayInfo("There is nobody in the list on IRC", "")
DisplayInfo("The following users are on IRC :","")
CentredDisplay(users$,OurNick$,SendingToDisplay$)
305:
DisplayInfo("You are no longer marked as being away","")
306:
DisplayInfo("You are now marked as being away. /AWAY will unmark","")
321:
KillDisplay("##list##")
NewDisplay("##list##",256,"Results of /LIST",0)
List_num=0
Notify("Please wait - collecting list")
322:
chan$=
oneparam(line$)
line$=
moveon(line$)
num$=
oneparam(line$)
num=
num$
& topic$=
oneparam(
moveon(line$))
0 ok =
WildcardMatch(List_match$,
chan$,2))
(ok
(num >= List_min)
(num <= List_max))
List_num=0
I
Display("Channel name No.Users Topic","","##list##")
List_num = List_num+1
chan$=
chan$,22)
topic$=
topic$,55)
Display(chan$+
chan$)," ")+num$+
num$)," ")+topic$,"","##list##")
List_num=0
DisplayInfo("No matching results","##list##")
DisplayInfo(" = "+
(List_num)+" matching channels","##list##")
301:
nick$=
oneparam(line$)
' reason$=
oneparam(
moveon(line$))
DisplayInfo(
Colour(
GetMeColour)+"* "+nick$+" is away: "+reason$,nick$)
311,312,313,317,318,319:
nick$=
oneparam(line$)
line$=
moveon(line$)
DisplayCTCP("WhoIs> "+
pasteargs(line$),
GuessDisplay(nick$))
369,314:
nick$=
oneparam(line$)
line$=
moveon(line$)
DisplayCTCP("WhoWas> "+
pasteargs(line$),
GuessDisplay(nick$))
353:
line$=
line$,3)
channel$=
oneparam(line$)
line$=
moveon(line$)
line$=
oneparam(line$)
line$<>""
a_nick$=
oneparam(line$)
line$=
moveon(line$)
hasops=0
a_nick$,1)="@"
hasops=U_HasOps
a_nick$=
a_nick$,2)
a_nick$,1)="+"
hasops=U_HasVoice
B
Can we show 'voiced' people with orange, say hasops=2 ?
a_nick$=
a_nick$,2)
UpdateUser(a_nick$,channel$,hasops)
331:
channel$=
oneparam(line$)
DisplayInfo("* Channel "+channel$+" has no topic", channel$)
ChangeChannelTopic(channel$,"")
332:
channel$=
oneparam(line$)
& topic$=
oneparam(
moveon(line$))
CentredDisplay("The topic for channel "+channel$+" is "+topic$, from$, channel$)
ChangeChannelTopic(channel$,topic$)
324:
channel$=
oneparam(line$)
! channelmode$=
moveon(line$)
DisplayInfo("* Channel mode for "+channel$+" is "+channelmode$,channel$)
Channel_ModeIs(channel$,channelmode$)
341:
channel$=
oneparam(line$)
% nick$=
oneparam(
moveon(line$))
DisplayInfo("* Inviting "+nick$+" to channel "+channel$,channel$)
nick$=
oneparam(line$)
DisplayInfo("Summoning "+nick$+" to IRC","")
367:
channel$=
oneparam(line$)
& banid$=
oneparam(
moveon(line$))
DisplayInfo("BanID> "+banid$,channel$)
366,368:
Ignore messages
401:
nick$=
oneparam(line$)
DisplayWarning("*** "+nick$+" is not on IRC at present",
GuessDisplay(nick$))
404:
chan$=
oneparam(line$)
DisplayWarning("*** You cannot talk to channel "+chan$+" as you do not have enough priveledges to do so","")
422,375
registered=
DisplayInfo("*** "+
pasteargs(line$), "##server##")
432:
DisplayWarning("You have specified an illegal nickname. Use /NICK <nickname> to choose another one","##server##")
registered
OurNick$="!"
433:
DisplayWarning("The nickname you have chosen is already in use. Use /NICK <nickname> to choose another one","")
registered
OurNick$="!"
443:
nick$=
oneparam(line$)
4% chan$=
moveon(
oneparam(line$))
DisplayWarning(nick$+" is already on "+chan$, chan$)
451:
SendToIRC("USER "+OurNick$+" * * :"+
GetIRLname)
461:
line$=
oneparam(line$)
DisplayWarning("Bad parameters used for "+line$,"")
482:
chan$=
oneparam(line$)
DisplayWarning("*** You are not an operator on channel "+chan$,chan$)
DisplayInfo(
pasteargs(line$), "##server##")
ModeChange(chan$,nick$,change$)
who$,rest$,dir,c$,person$
rest$=
oneparam(change$)
who$=
moveon(change$)
rest$,1)="+")
dir = 1
dir = -1
rest$=
rest$,2)
who$,1)=""
DisplayInfo("* Channel mode change by "+nick$+" ("+
Strip(change$)+")",chan$)
SendToIRC("MODE :"+chan$)
change$,"+l")=0
DisplayInfo("* Mode change by "+nick$+" ("+
Strip(change$)+")",chan$)
c$=
rest$,1)
rest$=
rest$,2)
"o","O"
person$=
oneparam(who$)
who$=
moveon(who$)
IF dir=1 THEN
`1
PROCUpdateUser(person$,chan$,U_HasOps)
ELSE
b*
PROCUpdateUser(person$,chan$,0)
ENDIF
d#
SendToIRC("NAMES :"+chan$)
"v","V"
f#
SendToIRC("NAMES :"+chan$)
num=
oneparam(who$))
who$=
moveon(who$)
kH
DisplayInfo("* Mode change by "+nick$+" (+l "+
(num)+")",chan$)
c$=""
CTCP_reply(from$,message$)
command$,tim
s) message$=
message$,2,
(message$)-2)
t" command$=
oneparam(message$)
u message$=
moveon(message$)
command$
"PING":
tim=(
(message$)))
yC
TellUserCTCPReply(command$,from$,
tim+" centi-seconds")
"ERRMSG":
{& command$=
oneparam(message$)
|$ message$=
moveon(message$)
}2
message$<>""
message$=" : "+message$
~>
DisplayCTCP("CTCP Error for "+command$+message$,"")
=
Overload_UnknownCTCPReply(from$,command$,message$)
CTCP_request(to$,from$,message$)
command$,prefix$,notify
notify=
) message$=
message$,2,
(message$)-2)
/ command$=
Capitalise(
oneparam(message$))
message$=
moveon(message$)
command$
"ECHO","PING":
1
SendCTCPReply(from$,command$,message$)
"VERSION":
1
SendCTCPReply(from$,command$,Version$)
"ACTION":
+ prefix$=
ReturnPadded("* "+from$)
to$,1)="#"
Y
Display(
Colour(
GetMeColour)+prefix$+" "+
BoldYourNick(message$),from$,to$)
!
CreateUserWin(from$)
^
Display(
Colour(
GetMeColour)+prefix$+" "+
BoldYourNick(message$),OurNick$,from$)
msgbeep
notify=
"FINGER","USERINFO":
I
SendCTCPReply(from$,command$,
GetUsername+"("+
GetIRLname+")")
"CLIENTINFO":
!
CTCP_ClientInfo(from$)
"TIME":
2
SendCTCPReply(from$,command$,
ReadTime)
"MACHINEINFO":
,
"Wimp_ReadSysInfo",0
NumTasks
/
"Wimp_ReadSysInfo",7
WimpVersion
3
"OS_ReadMemMapInfo"
Memsize,Mempages
B WimpVersion$=
(WimpVersion/100)+"."+
(WimpVersion
100)
SendCTCPReply(from$,command$,
((Memsize*Mempages)/(1024*1024))+"Mb, "+
NumTasks+" tasks running under Risc OS "+WimpVersion$)
"SOURCE":
SendCTCPReply(from$,command$,"This script is not currently available for distribution - mail gerph@essex.ac.uk for details")
"ERRMSG":
?
SendCTCPReply(from$,command$,message$+" :Worked ok")
notify=
C
Overload_UnknownCTCPRequest(from$,to$,command$,message$)
notify
TellUserCTCP(command$,from$)
CTCP_ClientInfo(from$)
a$,num,b$
ca$="ECHO PING ACTION VERSION ERRMSG FINGER USERINFO MACHINEINFO CLIENTINFO TIME SOURCE SCRIPTS"
num=0
b$=
Overload_ListCTCP(num)
b$<>""
a$+=" "+b$
num+=1
b$=""
SendCTCPReply(from$,"CLIENTINFO",a$)
Overload_UnknownCTCPRequest : /CTCP <command> done
You should overload this routine and pass it on if you
don't respond
Overload_UnknownCTCPRequest(from$,to$,com$,message$)
num,a$
com$
"SCRIPTS"
num=0
# b$=
Overload_ScriptInfo(num)
b$<>""
SendCTCPReply(from$,"SCRIPTS",
(num+1)+": "+b$)
num+=1
b$=""
to$,1)="#"
DisplayCTCP("Unknown CTCP '"+com$+"' received from "+from$,to$)
DisplayCTCP("Unknown CTCP '"+com$+"' received from "+from$,
GuessDisplay(from$))
notify=
Overload_UnknownCTCPReply : Reply from other end
Overload_UnknownCTCPReply(from$,command$,str$)
TellUserCTCPReply(command$,from$,str$)
Overload_ListCTCP : List all CTCP requests available
Overload with :
DEFFNOverload_ListCTCP(count)
LOCAL ret$
IF count=0 THEN
ret$="<command>"
ELSE
ret$=FN@(count-1)
ENDIF
=ret$
Multiple commands should be space seperated
Overload_ListCTCP(count)
ret$
count=0
ret$=""
DisplayError("Someone hasn't done ListCTCP properly...","")
ret$=""
=ret$
Will give the name of the channel if you are on a channel
GuessDisplay(from$)
ret$
SendingToDisplay$,1)="#"
ret$=SendingToDisplay$
Capitalise(from$)=
Capitalise(SendingToDisplay$)
FindDisplay(from$)
ret$=from$
ret$=SendingToDisplay$
=SendingToDisplay$
LOCAL ret$
IF FNFindUserChan(from$,SendingToDisplay$) OR FNCapitalise(SendingToDisplay$)=FNCapitalise(from$) THEN
ret$=SendingToDisplay$
ELSE
&
IF FNFindDisplay(from$) THEN
ret$=from$
ELSE
"
ret$=FNFindUser(from$)
IF ret$="" THEN
ret$="##server##"
ENDIF
ENDIF
ENDIF
=ret$
TellUserCTCP(command$,from$)
DisplayCTCP("CTCP "+command$+" received from "+from$,
GuessDisplay(from$))
TellUserCTCPReply(command$,from$,message$)
DisplayCTCP("CTCP "+command$+" reply received from "+from$+" ("+message$+")",
GuessDisplay(from$))
Channel_ModeIs(channel$,mode$)
UpdateChannel(channel$,
ChannelFlags(mode$))
ChannelFlags(mode$)
flags
flags = 0
mode$<>""
mode$,1)
"t" :
flags = flags
CF_Topic
"n" :
flags = flags
CF_Msgs
"i" :
! flags = flags
CF_Invite
"m" :
## flags = flags
CF_Moderated
"s" :
% flags = flags
CF_Secret
"p" :
'! flags = flags
CF_Private
"l" :
)! flags = flags
CF_Limited
mode$=
mode$,2)
=flags
Join(channel$)
SendToIRC("JOIN :"+channel$)
Leave(channel$)
SendToIRC("PART :"+channel$)
UserLine(str$)
command$,prefix$,found
SendingToDisplay$,2)="##"
Overload_UserLine(str$)
str$<>""
str$,1)<>"/"
>#
SendingToDisplay$<>""
?- str$=
Overload_AboutToSay(str$,0)
@(
Say(SendingToDisplay$,str$)
B
C3 command$=
Capitalise(
oneparam(
str$,2)))
D str$=
moveon(
str$,2))
command$
"ME":
G/ str$=
Overload_AboutToSay(str$,1)
H-
Action(SendingToDisplay$,str$)
"DESCRIBE":
J! to$=
oneparam(str$)
K8 str$=
Overload_AboutToSay(
moveon(str$),1)
L!
CreateUserWin(to$)
Say(to$,str$)
"QUIT"
O(
str$=""
str$="Leaving"
P,
SendToIRC(command$+" :"+str$)
"JOIN","PART":
R,
SendToIRC(command$+" :"+str$)
"LEAVE":
T'
SendToIRC("PART :"+str$)
"QUERY":
str$=""
W3
DisplayWarning("* Query whom?","")
Y
str$,2)="#"
ZC
DisplayWarning("* Query whom? (must be a user)")
\*
UserDoubleClicked(str$)
"MSG":
`! to$=
oneparam(str$)
a2
to$,1)<>"#"
CreateUserWin(to$)
b8 str$=
Overload_AboutToSay(
moveon(str$),0)
cP
PROCDisplay("->*"+to$+"* "+FNmoveon(str$),OurNick$,"##Server##")
Say(to$,str$)
"SAY"
gJ
SendingToDisplay$,2)<>"##"
Say(SendingToDisplay$,str$)
"NOTICE":
j! to$=
oneparam(str$)
k2
to$,1)<>"#"
CreateUserWin(to$)
l:
SendToIRC("NOTICE "+to$+" :"+
moveon(str$))
mP
PROCDisplay("->*"+to$+"* "+FNmoveon(str$),OurNick$,"##Server##")
n?
MessageToDisplay(
moveon(str$),OurNick$,"-"+to$)
"CTCP":
q$ whoto$=
oneparam(str$)
r str$=
moveon(str$)
sN
CTCP_Command(whoto$,
Capitalise(
oneparam(str$)),
moveon(str$))
"SCRIPTS"
DoScripts
"PING":
w8
CTCP_Command(
oneparam(str$),"PING",
x;
PROCSendCTCPRequest(str$,"PING",STR$(TIME))
"UMODE":
z3
SendToIRC("MODE "+OurNick$+" "+str$)
"QUOTE","RAW":
SendToIRC(str$)
"TEST":
IRCLine(str$)
"KICK"
DoKick(str$)
"NICK"
&
SendToIRC("NICK "+str$)
OurNick$="!"
OurNick$=str$
"
SetNickname(str$)
"INVITE"
DoInvite(str$)
"LIST"
DoList(str$)
"TOPIC"
DoTopic(str$)
"AWAY"
DoAway(str$)
"MODE"
DoMode(str$)
"SVERSION"
DoServerVersion
"PASS","OPER","WHOIS","WHOWAS","LUSERS","LINKS","TIME","TRACE","ADMIN","INFO","WHO","USERHOST","STATS","ISON","MOTD","SQUIT","SUMMON":
+
SendToIRC(command$+" "+str$)
5
Overload_UnknownCommand(command$,str$)
DoServerVersion
SendToIRC("VERSION")
DoScripts
num=0
DisplayInfo("You are currently running :","")
! b$=
Overload_ScriptInfo(num)
b$<>""
DisplayInfo(" "+
(num+1)+": "+b$,"")
num+=1
b$=""
DoKick(str$)
chan$,nick$,reason$
str$,1)="#"
chan$=
oneparam(str$)
str$=
moveon(str$)
chan$=SendingToDisplay$
nick$=
oneparam(str$)
reason$=
moveon(str$)
chan$,1)<>"#"
A
DisplayWarning("* Kick "+nick$+" off which channel?","")
reason$=""
reason$="No reason"
8
SendToIRC("KICK "+chan$+" "+nick$+" :"+reason$)
DoInvite(str$)
chan$,invite$
str$,1)="#"
chan$=
oneparam(str$)
str$=
moveon(str$)
chan$=SendingToDisplay$
invite$=str$
chan$,1)<>"#"
D
DisplayWarning("* Invite "+invite$+" to which channel?","")
/
SendToIRC("INVITE "+invite$+" "+chan$)
DoTopic(str$)
chan$,topic$
str$,1)="#"
chan$=
oneparam(str$)
str$=
moveon(str$)
chan$=SendingToDisplay$
topic$=str$
chan$,1)<>"#"
B
DisplayWarning("* Change the topic of which channel?","")
"
ChangeTopic(chan$,topic$)
DoAway(str$)
str$<>""
str$=":"+str$
SendToIRC("AWAY "+str$)
DoMode(str$)
chan$,mode$
str$,1)="#"
chan$=
oneparam(str$)
str$=
moveon(str$)
chan$=SendingToDisplay$
mode$=str$
chan$,1)<>"#"
>
DisplayInfo("* Change the mode of which channel?","")
+
SendToIRC("MODE "+chan$+" "+mode$)
List_Reset
List_min=0
List_max=65536
List_match$="*"
DoList(str$)
chan$,com$,val
List_Reset
! List_match$=
oneparam(str$)
str$=
Strip(
moveon(str$))
str$<>""
str$,1)="-"
/ com$=
Capitalise(
oneparam(
str$,2)))
str$=
moveon(
str$,2))
val=
oneparam(str$))
str$=
moveon(str$)
com$
"MIN","MINIMUM"
List_min=val
"MAX","MAXIMUM"
List_max=val
P
DisplayWarning("* Unknown list modifier '-"+str$+"' ignored.","")
K
DisplayWarning("* Unknown list modifier '"+str$+"' ignored.","")
str$=
moveon(str$)
(List_min > List_max)
R
DisplayWarning("* Silly. List minimum > list maximum. List ignored","")
9
List_match$,"*"))
List_match$,"?")) )
SendToIRC("LIST")
)
SendToIRC("LIST "+List_match$)
List_match$="*"
UserDoubleClicked(user$)
CreateUserWin(user$)
SelectUser(user$)
CreateUserWin(user$)
NewDisplay(user$,32,OurNick$+"->"+user$,0)
CentredDisplay(message$,from$,display$)
message$ < 80
)A
Display(
message$)/2," ")+message$,from$,display$)
+)
Display(message$,from$,display$)
Say(chan$,str$)
SendToIRC("PRIVMSG "+chan$+" :"+str$)
MessageToDisplay(str$,OurNick$,chan$)
Action(chan$,str$)
prefix$
SendCTCPRequest(chan$,"ACTION",str$)
7(prefix$=
ReturnPadded("* "+OurNick$)
Display(
Colour(
GetMeColour)+prefix$+" "+str$,OurNick$,chan$)
MessageToDisplay(message$,from$,display$)
prefix$
display$,1)="-"
>) prefix$=
ReturnPadded("-"+from$+"-")
display$=
display$,2)
display$,1)="#"
B* prefix$=
ReturnPadded("<"+from$+">")
D* prefix$=
ReturnPadded("*"+from$+"*")
Open a nice window for this user
CreateUserWin(display$)
Capitalise(from$)<>
Capitalise(OurNick$)
display$,1)<>"#"
msgbeep=
Display(prefix$+" "+
BoldYourNick(message$),OurNick$,display$)
SendToIRC(m$)
SendString(MasterSocket,m$)
SendCTCPReply(to$,command$,message$)
SendToIRC("NOTICE "+to$+" :"+
1+command$+" "+message$+
SendCTCPError(to$,command$,message$)
SendToIRC("NOTICE "+to$+" :"+
1+"ERRMSG "+command$+" :"+message$+
SendCTCPRequest(to$,command$,message$)
message$<>""
message$=" "+message$
]"command$=
Capitalise(command$)
SendToIRC("PRIVMSG "+to$+" :"+
1+command$+message$+
IconbarClick
Online
OpenInputBox(0)
OpenServerWindow
OpenConnect
ChangeTopic(channel$,topic$)
topic$<>""
topic$=":"+topic$
SendToIRC("TOPIC "+channel$+" "+topic$)
ChannelStateChange(chan$,flag,char)
gonk$
flag
gonk$="+"
gonk$="-"
SendToIRC("MODE "+chan$+" "+gonk$+
char)
ChangeChannelTopic(channel$,topic$)
(topic$) < 40
@(channel$,topic$)
@(channel$,
topic$,38)+"...")
'special' overload for the menu
CTCPrequest(CTCP$,whoto$)
CTCP_Command(whoto$,CTCP$,"")
CTCP_Command(whoto$,CTCP$,message$)
CTCP$="PING"
SendCTCPRequest(whoto$,"PING",
SendCTCPRequest(whoto$,CTCP$,message$)
Display(what$,from$,to$)
to$=""
to$="##server##"
@(what$,from$,to$)
When you want an error displayed (in red)
DisplayError(mess$,win$)
win$=""
mess$,1)<>"*"
mess$="*** "+mess$
win$=""
win$=SendingToDisplay$
Display(
Colour(11)+mess$+
Colour(0),OurNick$,win$)
When you want a warning displayed (in orange)
DisplayWarning(mess$,win$)
win$=""
mess$,1)<>"*"
mess$="*** "+mess$
win$=""
win$=SendingToDisplay$
Display(
Colour(14)+mess$+
Colour(0),OurNick$,win$)
When you want an informational displaying (usually lblue)
DisplayInfo(mess$,win$)
win$=""
mess$,1)<>"*"
mess$="*** "+mess$
win$=""
win$=SendingToDisplay$
Display(
Colour(15)+mess$,OurNick$,win$)
DisplayCTCP(mess$,win$)
win$=""
win$=SendingToDisplay$
mess$="*** "+mess$
Display(
Colour(
GetCTCPColour)+mess$,OurNick$,win$)
Display(mess$,from$,to$)
(from$=""
from$=OurNick$)
to$=""
to$="##server##"
@(mess$,from$,to$)
************************ Used by menus **********************
Op a user
Op(channel$,nick$,flag)
flag
SendToIRC("MODE "+channel$+" +o "+nick$)
SendToIRC("MODE "+channel$+" -o "+nick$)
SendToIRC("NAMES :"+channel$)
Give a user a voice
Voice(channel$,nick$,flag)
flag
SendToIRC("MODE "+channel$+" +v "+nick$)
SendToIRC("MODE "+channel$+" -v "+nick$)
SendToIRC("NAMES :"+channel$)
Leave channel
LeaveChannel(channel$)
SendToIRC("PART "+channel$)
Boot some one...
Kick(channel$,nick$)
SendToIRC("KICK "+channel$+" "+nick$+" :No reason")
DCCChat(nick$)
Notify("DCC Chat is not available")
CTCP Extras for menus
CTCP_DoPing(nick$)
CTCP_Command(nick$,"PING","")
CTCP_DoClientInfo(nick$)
CTCP_Command(nick$,"CLIENTINFO","")
CTCP_DoFinger(nick$)
CTCP_Command(nick$,"FINGER","")
CTCP_DoVersion(nick$)
CTCP_Command(nick$,"VERSION","")
CTCP_DoUserInfo(nick$)
CTCP_Command(nick$,"USERINFO","")
CTCP_DoScripts(nick$)
CTCP_Command(nick$,"SCRIPTS","")
CTCP_DoSource(nick$)
CTCP_Command(nick$,"SOURCE","")
CTCP_DoTime(nick$)
CTCP_Command(nick$,"TIME","")
************************
Extra routines by Justin
************************
Pad a name if columns is selected
ReturnPadded(prefix$)
columns
prefix$=
(prefix$)," ")+prefix$
=prefix$
See if the command matches any of the aliases we have set
CheckAliases(command$,line$)
in,a$,com$,found,in
found=
(magrathea_user$+".Aliases")
in<>0
a$=
com$=
a$+" "," ")-1)
com$,1)<>"#"
a$<>""
Capitalise(com$)=command$
found=
+
a$," ")=0
a$," "))=" {"
,
A long command, delimited by {}'s
a$=
Strip(
(a$<>"}"
a$="{"
Ignore
' a$=
SubstituteArgs(a$,line$)
UserLine(a$)
a$=
Strip(
!
A short simple command
! a$=
Strip(
a$," ")))
% a$=
SubstituteArgs(a$,line$)
UserLine(a$)
found
Skip any long commands
a$," ")=0
a$,1)<>"#")
a$," "))=" {")
a$<>""
a$=
Strip(
(a$<>"}"
a$=
Strip(
"
found)
=found
Substitue arguments from line$ into a$ using :
%[0-9] for words
%*[0-9] for the text after that (inc)
%% for % symbol
%R for the current recipient
%M for our nick name
%b for bold toggle
SubstituteArgs(a$,line$)
b$,i,c$,n
3 b$=""
a$,i,1)="%"
i=i+1
a$,i,1)
91
"0","1","2","3","4","5","6","7","8","9":
c$=line$
n=
a$,i,1))
c$=
c$+" "," ")+1)
n=n-1
?
@! b$=b$+
c$+" "," ")-1)
"*":
i=i+1
c$=line$
n=
a$,i,1))
c$=
c$+" "," ")+1)
n=n-1
I
b$=b$+c$
"%":
b$=b$+"%"
"R":
P/
Current recipient (SendingToDisplay$)
b$=b$+SendingToDisplay$
"b":
Use bold characters
b$=b$+
"M":
My nick name
b$=b$+OurNick$
Z
b$=b$+"%"+
a$,i,1)
b$=b$+
a$,i,1)
i=i+1
*********************************************************
The following are routines you should use for overloading
The display should be recognised from it's name and should
usually start with ## if you are providing extensions
*********************************************************
Overload_DisplaySelected : A display has been selected
only displays with ## prefixes will be passed here
Overload_DisplaySelected(display$)
display$
"##InputBox##"
DisplaySelected(SendingToDisplay$)
"##server##"
SelectNoFocus
Overload_UserLine : Process a users input
Overload_UserLine(str$)
Overload_AboutToSay : About to say something - pre-process
type will be 0 for 'spoken' thing, and 1 for actions
You should overload this ALWAYS with
=FN@(newstr$,type) or similar
Overload_AboutToSay(str$,type)
=str$
Overload_UnknownCommand : Process an unknown command
The last thing will be this routine which processes aliases
The command will be capitalised already, so don't waste time
Overload_UnknownCommand(command$,str$)
&found=
CheckAliases(command$,str$)
found
DisplayWarning("*** Unknown command '"+command$+"'","")
*********************************************************
Execute a script as we log on
RunInitialScript
in,a$
(magrathea_user$+".Initial")
in<>0
a$=
Strip(
a$,1)<>"#"
Capitalise(
a$,5))="/JOIN"
NewChannel(
moveon(a$),32,"Channel "+
moveon(a$),0,0)
UserLine(a$)