-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMDS.PAS
107 lines (93 loc) · 2.15 KB
/
CMDS.PAS
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
Unit Cmds;
Interface
Procedure Quit;
Procedure Msg(S:String);
Procedure Who;
Procedure Cmd(S:String);
Procedure Summon(S:String);
Procedure Away(S:String);
Implementation
Uses OpCrt,Dos,CnfgRec,IRCVars,Gensubs,IRCIO,IRCDis,IO;
Procedure Help;
Begin
Writelist('/BYE - Quit');
Writelist('/W - Whos in Chat');
Writelist('/M - Send Private Message');
Writelist('/ME - Perform an Action');
Writelist('/CL - Clear Screen');
Writelist('/SETBACK - Set yourself as here');
Writelist('/AWAY - Set yourself as away');
End;
Procedure Msg(S:String);
Begin
GoXy(1,1);
Delete(S,1,3);
MsgTo:=StripSpace(Copy(S,1,Pos(' ',S)));
Delete(S,1,Length(MsgTo));
OutStr:=Copy(S,1,Length(S));
If Length(MsgTo)>0 Then SaveChat('M');
End;
Procedure Who;
Begin
UserList;
End;
Procedure Quit;
Begin
SignOff;
End;
Procedure Action(S:String);
Begin
OutStr:=Copy(S,4,Length(S));
SaveChat('A');
End;
Procedure Summon(S:String);
Begin
WriteList('Not implemented yet!');
End;
Procedure Away(S:String);
Begin
OutStr:=' Set away: ';
OutStr:=OutStr+Copy(S,7,Length(S));
User.Away:=OutStr;
Saveuser;
SaveChat('A');
End;
Procedure SetBack(S:String);
Var L,TS:String;
T:Text;
Begin
OutStr:=' Returns: '+Copy(S,10,Length(S));
SaveChat('A');
User.Away:='';
SaveUser;
TS:=ChatFile;
Delete(TS,Length(TS)-2,3);
TS:=TS+'SAV';
If Exist(CNF^.WorkDir+TS) Then
Begin
Assign(T,CNF^.WorkDir+TS);
ReSet(T);
While (NOT Eof(T)) Do
Begin
Readln(T,L);
WriteList(L);
End;
Erase(T);
End;
End;
Procedure Cmd(S:String);
Begin
User.Idle:=TimePart(Now);
Saveuser;
If Match(Copy(S,1,3),'/ME') Then Action(S) Else
If Match(Copy(S,1,3),'/CL') Then Clear Else
If Match(Copy(S,1,4),'/BYE') Then Quit Else
If Match(Copy(S,1,2),'/W') Then Who Else
If Match(Copy(S,1,5),'/HELP') Then Help Else
If Match(Copy(S,1,5),'/AWAY') Then Away(S) Else
If Match(Copy(S,1,8),'/SETBACK') Then SetBack(S) Else
If Match(Copy(S,1,7),'/SUMMON') Then Summon(S) Else
If Match(Copy(S,1,2),'/M') Then Msg(s);
End;
Begin
End.