home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 2 BBS
/
02-BBS.zip
/
orionful.zip
/
Menus
/
Chat.Cmd
< prev
next >
Wrap
OS/2 REXX Batch file
|
1997-05-16
|
15KB
|
335 lines
/* Jewfish's Multi-Line Chat Config */
/* /Invite added by Hagar */
/* /Join and private added by Bill-e */
Arg Line
call RxFuncAdd 'SysLoadFuncs','RexxUtil','SysLoadFuncs'
call SysLoadFuncs
DefaultChannel = 'General Chat' /* Max 15 Chars */
UserChannelCount = Right(AdeptConvert(Line,'{CU'),2,'0')
queuename='ND'line
q =rxqueue('delete', queuename)
q1 =rxqueue('create',queuename)
q2 =rxqueue('set',queuename)
q3 =rxqueue('get')
queue '1036a.none'
UserName = AdeptGetVar(Line,2)
UserNode = Right(Line,2,'0')
UserCount = AdeptConvert(Line,'{CU')
KeyList = D2C(9)
InputText = ''
LastPVT = ''
Start = Time('M')
newchannel.line=''
Call AdeptInitRexx Line
rc = AdeptSysChatConnectUser(Line) /* Connect to Server */
If rc \= 1 Then Do
Call AdeptPrint Line, "\r\n\r\nChat Server isn't available!\r\n"
Call AdeptHitReturn Line
Exit
End
Call Join
joined:
Call AdeptPrint Line, '\r\n{CS{B2{FC AdeptXBBS {FGMulti-Line Chatting System v0.02 {B1{F9▄\r\n'
Call AdeptPrint Line, '{B2 {FFYou have entered the {FC' || DefaultChannel || ' {FFChannel' || Copies(' ',15 - Length(DefaultChannel)) || ' {B1{F9█\r\n'
Call AdeptPrint Line, '{B2 {FGThere are {FB' || UserChannelCount || ' {FGusers in the Chat Subsystem {B1{F9█\r\n'
Call AdeptPrint Line, ' ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀\r\n'
Call AdeptPrint Line, '{FGType /? -or- /H for Quick Help\r\n\r\n'
Call AdeptMenuType Line, 52,""
Call AdeptPrint Line, '\r\n'
Do Forever
RetC = Strip(AdeptSysChatInput(Line, "USERTEXT", KeyList, InputText),'t')
InputText = ''
If (RetC == IRC_CHATWAITING) Then Do
Call ProcessChatMsg(Line)
Iterate
End
Select
When RetC == 1 Then Do
If UserText = 'USERTEXT' Then Iterate
If Left(UserText,1,1) = '/' Then Call Commands
Else Do
If UserCount \= 999 Then Call AdeptSysChatPubMsg Line, '{FE[{FG' || UserNode || '{F8-{FB' || UserName || '{FE] {FC' || UserText
/* Else Call AdeptPrint Line, '\r{FG¡ {FFWarning - You are the only person in this channel.\r\n For a list of people online, type /W' */
Call AdeptPrint Line, '\r\n'
End
Iterate
End
When RetC == 9 Then Do
If LastPvt \= '' Then InputText = '/S,' || LastPvt || ' '
Else InputText = '/S,'
Iterate
End
When RetC == IRC_NOTIMELEFT Then Do
Call AdeptPrint Line, "\r\nYou're outta time sucker!"
Call Leave('Out of Time')
Exit
End
When RetC == LOSTCARRIER Then Do
Call Leave('Lost Carrier')
Exit
End
When RetC == IRC_CHATDOWN Then Call AdeptSysChatReconnectUser Line
When RetC == IRC_CHATWAITING Then Do
Call AdeptPrint Line, '\r\nThe Chatserver is busy at the moment...\r\n'
Iterate
End
Otherwise Nop
End
End
Commands:
If Pos(',',UserText) = 0 Then Parse Var UserText Command NodeTo MsgText
Else Parse Var UserText Command ',' NodeTo ' ' MsgText
Command = Translate(Command)
Select
When Command = '/W' Then Do
Call AdeptMenuType Line, 55,""
Call AdeptPrint Line, '\r\n'
Return
End
When Command = '/Q' Then Do
Call Leave('Leaving')
Exit
End
When Command = '/S' Then Do
If NodeTo = '' | MsgText = '' Then Call AdeptPrint Line, '\rYou screwed that command well and good!\r\n'
Else Do
Chkit = AdeptGetVar(NodeTo,44)
myrt = AdeptCheckBit(NodeTo,24,Chit)
if myrt = 1 then do
Call AdeptPrint Line, '\r{F9■{F5■{FD■{FG■ Private Message Not sent, that user has their Chat Flag Disabled... {FG■{FD■{F5■{F9■\r\n'
Return
end
retc = AdeptSysChatPrivMsg(Line, NodeTo, '{FE[{FG' || UserNode || '{F8-{FB' || UserName || '{FD, Pvt Msg{FE] {FC' || MsgText)
/* Call AdeptComWrite NodeTo, '{FE[{FG' || UserNode || '{F8-{FB' || UserName || '{FD, Pvt Msg{FE] {FC' || MsgText */
NodeUserName = AdeptGetVar(NodeTo, 2)
If NodeUserName \= '' Then Call AdeptPrint Line, '\r{F9■{F2■{FA■{FC■{FG■ Private Message sent to {FB' || NodeUserName || ' {FGon Node {FB' || NodeTo || ' {FG■{FC■{FA■{F2■{F9■\r\n'
Else Call AdeptPrint Line, '\r{F9■{F5■{FD■{FG■ Private Message Not sent, there is no-one on Node {FD' || NodeTo || ' {FG■{FD■{F5■{F9■\r\n'
LastPvt = NodeTo
End
Return
End
When Command = '/H' | Command = '/?' | Command = '/HELP' Then Do
/* Convert to Meta Later */
Call AdeptPrint Line,'\r
┌
────
HELP
──────────────────────────────────────────┬───
EXAMPLES
─────────────┐
'
Call AdeptPrint Line,'\r\n
│
/S,[Node #] [Message]
Send a Private Message.
│
/S,1 Hello
│
'
Call AdeptPrint Line,'\r\n
│
/ME [Message]
Allows you to perform an Action.
│
/ME Laughs!
│
'
Call AdeptPrint Line,'\r\n
│
/G,[Node #]
Get information about another user.
│
/I
│
'
Call AdeptPrint Line,'\r\n
│
/W
Show users Currently logged into the BBS.
├────────────────────────┤
'
Call AdeptPrint Line,'\r\n
│
/T
Time Statistics
/A
Show All Channels
│
/J
Join/Make a Channel
│
'
Call AdeptPrint Line,'\r\n
│
/L
List users in Channel
/CLS
Clears the Screen
│
to make private, 1st
│
'
Call AdeptPrint Line,'\r\n
│
/I
Invite user into your Channel
│
char in name must be "+"
│
'
Call AdeptPrint Line,'\r\n
└────────────────────────────────────
/Q to Quit
────
┴
────────────────────────
┘
\r\n\r\n'
End
When Command = '/T' Then Do
Call AdeptPrint Line, '\r{FGTime Statistics:'
Call AdeptPrint Line, '\r\n
Current time is ' || Time('C') || '.'
Call AdeptPrint Line, '\r\nYou have been in chat for ' || Time('M') - Start || ' Minute(s).'
Call AdeptPrint Line, '\r\nYou have {T0 minute(s) Remaining on the BBS.\r\n\r\n'
End
When Command = '/ME' Then Do
If NodeTo = '' Then Call AdeptPrint Line, '\rCan you *TRY* to get the format of the command right\r\n'
Else Do
Call AdeptSysChatNoPrePubMsg Line, '{FA■ {FF' || UserName || '{ZZ' || SubStr(UserText,4)
Call AdeptPrint Line, '\r{F9■{F2■{FA■{FC■{FG■ Public Action Sent {FG■{FC■{FA■{F2■{F9■\r\n'
End
End
When Command = '/G' Then Do
If NodeTo = '' Then Call AdeptPrint Line, '\rInvalid Command. /I,1 to get info from node 1\r\n'
Else Do
Call AdeptPrint Line, '\r{FGInformation About:'
/* Call AdeptPrint Line, '\r\n
User : ' || AdeptGetVar(NodeTo,1) || ', on Node ' || NodeTo || ' of ' || AdeptGetVar(Line,137) || '.' */
Call AdeptPrint Line, '\r\nAlias : ' || AdeptGetVar(NodeTo,2)
Call AdeptPrint Line, '\r\nTime : ' || AdeptConvert(NodeTo,'{T0') || ' Minute(s) Remaining on the BBS.\r\n\r\n'
End
End
When Command = '/CLS' Then Call AdeptPrint Line, '{CS'
When Command = '/A' Then Do
Call AdeptMenuType Line, 52,""
Call AdeptPrint Line, '\r\n'
Return
End
When Command = '/L' Then Do
Call AdeptMenuType Line, 53,""
Call AdeptPrint Line, '\r\n'
Return
End
When Command = '/I' Then Do
if newchannel= '' then roomname=defaultchannel
else roomname=newchannel
Call AdeptCLS Line
Call AdeptMenuType Line, 52,""
/*Call AdeptMenuType Line,42,""*/
Call AdeptPrint Line,"\r\n"
Call AdeptPrint Line,"\r\nSend Invitation to which Node Number, 1-15... \r\nEnter to abort ..."
Node=AdeptInput(Line,1,1)
if Node = '' then signal done
if Node > '5' then signal NoSuchNode
/* if Node < '1' then signal UnAvail */
CheckChat = AdeptGetVar(Node,44)
IsOn = AdeptCheckBit(Node,24,CheckChat)
if IsOn = 0 then signal UnAvail
/*if left(roomname,1)='+' then do
paswrd = AdeptInput(line,,10,,,'\r\nEnter the Password for your Conference (5 char Max):',,,)
end */
Call AdeptPrint Line,"\r\nInvitation will be sent when you "
Call AdeptHitReturn Line
carrier = AdeptGetVar(Node,276)
cr = X2C('0D')
lf = X2C('0A')
Call Adeptprint Node, cr lf username " is inviting you to the chat lounge room named "roomname cr
if left(roomname,1)='+' then Call Adeptprint Node, cr lf ' The password is: 'paswrd
/* Call AdeptComWrite Node,cr lf "Press <Enter> to continue..."*/
rc = AdeptComPeekByte(Node,1000)
signal done
UnAvail:
Call AdeptCls Line
Call AdeptPrint Line,"\r\nThat Node/User is Currently unavailable for Chat...\r\n"
Call AdeptHitReturn Line
signal done
NoSuchNode:
Call AdeptCls Line
Call AdeptPrint Line,"\r\nNo such Node Number, Node must be between 1 and 5 Inclusive\r\n"
Call AdeptHitReturn Line
signal done
done:
Call AdeptCls Line
return
End
When Command = '/J' Then Do
call adeptprint line, '\r\nEnter the name of your Conference, to make a room PRIVATE'
newchannel = AdeptInput(line,,10,,,'\r\nput a '"+"' as the first letter in the room name, ex. +room (10 chars max):',,,)
if newchannel='' then leave
if left(newchannel,1)='+' then do
idcheck='no'
isfirst='yes'
pwcheck='no'
paswrd = AdeptInput(line,,10,,,'\r\nEnter the Password for your Conference (5 char Max):',,,)
call adeptprint line, '\r\n'
call adeptprint line, '\r\nWhen you /I (invite) a person to your room you the system will give the user'
call adeptprint line, '\r\nthe password 'paswrd'. This will be transmitted ONLY to the user you are'
call adeptprint line, '\r\ninviting in. That user will then enter it along with the room name.'
call adeptprint line, '\r\n'
ok = adeptinput(line,,2,,,'\r\n Press enter to continue',,,)
parse upper var paswrd paswrd
parse upper var newchannel newchannel
pw=paswrd
nc=newchannel
do i=0 to 16
queuename='ND'i
q =rxqueue('set', queuename)
q= rxqueue('set', queuename)
parse pull pw1'.'nc1
if pw1='' then pw1='1036a'
if nc1='' then nc1 = 'none'
if queued() =0 then if i=line then do
q1 =rxqueue('create',queuename)
q2 =rxqueue('set',queuename)
q3 =rxqueue('get')
queue pw1'.'nc1
end
if nc<>nc1 then idcheck='ok'
if nc=nc1 then isfirst='no'
if nc=nc1 then idcheck='no'
if pw=pw1 then pwcheck='ok'
if isfirst='no' then leave
end
if isfirst='yes' then do
queuename='ND'line
q0 =rxqueue('delete',queuename)
q1 =rxqueue('create',queuename)
q2 =rxqueue('set',queuename)
q3 =rxqueue('get')
queuein = pw'.'nc
queue queuein
end
end
if left(newchannel,1)<>'+' then idcheck='ok'
if isfirst='yes' then idcheck='ok'
if isfirst='yes' then pwcheck='ok'
if idcheck='ok' then do
rc = AdeptSysChatJoinConf(Line,newchannel)
If rc = 2 Then rc = AdeptSysChatPubMsg(Line, '{FG» {FF' || UserName || ' has Joined the Channel')
UserChannelCount = Right(AdeptConvert(Line,'{CU'),2,'0')
end
if isfirst='no' then if pwcheck='no' then do
newchannel=defaultchannel
call adeptprint line, "\r\nSorry, you do not have access to that chat room"
ok = adeptinput(line,,2,,,'\r\n Press enter to continue',,,)
end
Call AdeptPrint Line, '\r\n{CS{B2{FC AdeptXBBS {FGMulti-Line Chatting System v0.02 {B1{F9▄\r\n'
Call AdeptPrint Line, '{B2 {FFYou have entered the {FC' || newChannel || ' {FFChannel' || Copies(' ',15 - Length(newChannel)) || ' {B1{F9█\r\n'
Call AdeptPrint Line, '{B2 {FGThere are {FB' || UserChannelCount || ' {FGusers in the Chat Subsystem {B1{F9█\r\n'
Call AdeptPrint Line, ' ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀\r\n'
Call AdeptPrint Line, '{FGType /? -or- /H for Quick Help\r\n\r\n'
return
end
Otherwise Call AdeptPrint Line, "\r{FG¡ {FFUnrecognised Command, Type /H for help.\r\n"
End
Return
ProcessChatMsg:
ARG line
do while(AdeptSysChatMsgWaiting(line) == 1)
RetC = AdeptSysChatGetMsg(line)
if(RetC == 3) then do
/*
Call AdeptPrint Line, '\r\nPktType = ' || PktType || '\r\n'
Call AdeptPrint Line, '\r\nRetC = ' || RetC || '\r\n'
*/
if(PktType == 100) then do
AdeptPrint(line, "\r" || ChatMsgData || "\r\n")
end
if(PktType == 101) Then do
AdeptPrint(line, "\r" || ChatMsgData || "\r\n")
end
if(PktType == 102) then do
LastPVT = SubStr(ChatMsgData,9,2)
AdeptPrint(line, "\r" || ChatMsgData || "\r\n")
end
end
end
return
Join:
rc = AdeptSysChatJoinConf(Line, "Main")
If rc = 2 Then rc = AdeptSysChatPubMsg(Line, '{FG» {FF' || UserName || ' has Joined the Channel')
Return
Leave:
Parse Arg Reason
rc = AdeptSysChatPubMsg(Line, '{FG« {FF' || UserName || ' has Left the Channel ({FG' || Reason || '{FF)')
rc = AdeptSysChatLeaveConf(Line)
Return