📄 actuser.pas
字号:
SendLine(PM_CLOAK,BS[Hidden],EC_NOERROR,'');
end;
PM_JOIN :begin
if st='' then st:=Invited;
if (LoggedIn(PM_JOIN)=false)or(st='') then Exit;
i:=RoomList.IndexOf(st);
if i=-1 then
begin
if (maxrooms>-1)and(RoomList.Count-SystemRoomCount>=maxrooms) then
begin
SendLine(PM_JOIN,SC_NORMAL,EC_TOOMANYROOMS,'');
Exit;
end;
room:=TRoom.Create(st);
end else room:=TRoom(RoomList.Objects[i]);
room.AddUser(self,st=Invited);
if Invited=st then Invited:='';
end;
PM_LEAVE :begin
i:=Rooms.IndexOf(st);
if (LoggedIn(PM_LEAVE)=false)or(i=-1) then Exit;
TRoom(Rooms.Objects[i]).RemoveUser(self);
end;
PM_PRIVMSG :begin
if LoggedIn(PM_PRIVMSG)=false then Exit;
DivUp(st,#1,tokens,2,2);
i:=ActUsers.IndexOf(tokens[0]);
if i>-1 then
begin
au:=TActUser(ActUsers.Objects[i]);
au.CheckAway(PM_PRIVMSG,self,'');
SendLine(PM_PRIVMSG,SC_NORMAL,EC_NOERROR,tokens[0]+#1+Color+#1+tokens[1]);
au.UserAction(UA_PRIVMSG,SC_NORMAL,self,tokens[1]);
end else SendLine(PM_PRIVMSG,SC_NORMAL,EC_USERNOTFOUND,tokens[0]);
end;
PM_ROOMMSG :begin
if LoggedIn(PM_ROOMMSG)=false then Exit;
DivUp(st,#1,tokens,2,2);
i:=Rooms.IndexOf(tokens[0]);
if i=-1 then Exit;
room:=TRoom(Rooms.Objects[i]);
if room.Gagged.IndexOf(self)>-1 then
begin
SendLine(PM_ROOMMSG,SC_NORMAL,EC_GAGGED,tokens[0]);
Exit;
end;
if (stat=SC_ALERT)and(UserStatus(room,false)=US_NOOP) then
begin
SendLine(PM_ROOMMSG,SC_ALERT,EC_FORBIDDENCMD,tokens[0]);
Exit;
end;
room.RoomAction(RA_MESSAGE,stat,self,tokens[1]);
end;
PM_COLOR :begin
if (LoggedIn(PM_COLOR)=false)or(StrToIntDef('$'+st,-1)=-1)or(Length(st)<>6) then Exit;
Color:=st;
if RegUser<>nil then
begin
RegUser^.color:=StrToInt('$'+Color);
WriteUserData(RegUser);
end;
for i:=0 to Rooms.Count-1 do TRoom(Rooms.Objects[i]).RoomAction(RA_COLOR,SC_NORMAL,self,'');
UpdateUserInfo;
end;
PM_INVITE :begin
if LoggedIn(PM_INVITE)=false then Exit;
DivUp(st,#1,tokens,2,2);
i:=ActUsers.IndexOf(tokens[1]); // Ist eingeladener Benutzer vorhanden?
if i>-1 then
begin // falls ja...
au:=TActUser(ActUsers.Objects[i]); // speicher Benutzerobjekt in "au"
i:=Rooms.IndexOf(tokens[0]); // Ist Einlader im Zielraum?
if (i=-1)or(au.Rooms.IndexOf(tokens[0])>-1) then Exit; // falls nein oder Benutzer schon im Raum, abbrechen
if UserStatus(Rooms.Objects[i],false)=US_NOOP then // falls Einladender kein RoomOP, ChatOP oder RoomOwner ist
begin
SendLine(PM_INVITE,SC_NORMAL,EC_FORBIDDENCMD,tokens[0]); // schicke Fehlermeldung
Exit; // und breche ab
end;
au.Invited:=tokens[0]; // speichere Zielraum in "Invited" des Eingeladenen ab
au.CheckAway(PM_INVITE,self,tokens[0]);
SendLine(PM_INVITE,SC_NORMAL,EC_NOERROR,tokens[0]+#1+tokens[1]); // informiere Einladenden
au.UserAction(UA_INVITE,SC_NORMAL,self,tokens[0]);
end else SendLine(PM_INVITE,SC_NORMAL,EC_USERNOTFOUND,tokens[0]+#1+tokens[1]); // falls nein schicke Fehlermeldung an Einladenden
end;
PM_KICK :begin
if LoggedIn(PM_KICK)=false then Exit;
DivUp(st,#1,tokens,2,2);
i:=Rooms.IndexOf(tokens[0]);
if i=-1 then Exit;
room:=TRoom(Rooms.Objects[i]);
i:=room.Users.IndexOf(tokens[1]);
if i=-1 then
begin
SendLine(PM_KICK,SC_NORMAL,EC_USERNOTFOUND,tokens[0]+#1+tokens[1]);
Exit;
end;
au:=TActUser(room.Users.Objects[i]);
if (UserStatus(room,false)>US_NOOP)and(room.Owner<>au) then
begin
room.RoomAction(RA_KICK,SC_NORMAL,self,tokens[1]);
room.RemoveUser(au);
au.UserAction(UA_KICK,SC_NORMAL,self,tokens[0]);
end else SendLine(PM_KICK,SC_NORMAL,EC_FORBIDDENCMD,tokens[0]);
end;
PM_AWAY :begin
if (LoggedIn(PM_AWAY)=false)or(stat=SC_UNSET)and(Away=false) then Exit;
Away:=stat<>SC_UNSET;
if Away then AwayReason:=st;
for i:=0 to Rooms.Count-1 do
begin
room:=TRoom(Rooms.Objects[i]);
room.RoomAction(RA_AWAY,BS[Away],self,AwayReason+#1+UserStatus(room,true));
end;
UpdateUserInfo;
if Away=false then AwayReason:='';
end;
PM_SETRIGHTS :begin
if LoggedIn(PM_SETRIGHTS)=false then Exit;
DivUp(st,#1,tokens,2,2);
i:=Rooms.IndexOf(tokens[0]);
if i=-1 then Exit;
room:=TRoom(Rooms.Objects[i]);
i:=room.Users.IndexOf(tokens[1]);
if i=-1 then
begin
SendLine(PM_SETRIGHTS,SC_NORMAL,EC_USERNOTFOUND,tokens[0]+#1+tokens[1]);
Exit;
end;
au:=TActUser(room.Users.Objects[i]);
case stat of
US_NOOP :begin
if (UserStatus(room,false)<US_ROOMOWNER)or(au.UserStatus(room,false)>US_ROOMOP) then
begin
SendLine(PM_SETRIGHTS,SC_NORMAL,EC_FORBIDDENCMD,tokens[0]);
Exit;
end;
if room.ROPS.Remove(au)=-1 then Exit;
stat:=SC_LOST_ROP;
end;
US_ROOMOP :begin
if UserStatus(room,false)=US_NOOP then
begin
SendLine(PM_SETRIGHTS,SC_NORMAL,EC_FORBIDDENCMD,tokens[0]);
Exit;
end;
if room.ROPS.IndexOf(au)=-1 then room.ROPS.Add(au);
stat:=SC_GOT_ROP;
end;
US_ROOMOWNER:begin
if room.Owner<>self then
begin
SendLine(PM_SETRIGHTS,SC_NORMAL,EC_FORBIDDENCMD,tokens[0]);
Exit;
end;
room.Owner:=au;
if room.ROPS.IndexOf(au)=-1 then room.ROPS.Add(au);
room.RoomAction(RA_RIGHTS,SC_LOST_ROW,nil,Nick+#1+UserStatus(room,true));
stat:=SC_GOT_ROW;
end;
end;
room.RoomAction(RA_RIGHTS,stat,self,au.Nick+#1+au.UserStatus(room,true));
end;
PM_BOOT :begin
if LoggedIn(PM_BOOT)=false then Exit;
if (RegUser=nil)or(RegUser^.chatop=false) then
begin
SendLine(PM_BOOT,SC_NORMAL,EC_FORBIDDENCMD,'');
Exit;
end;
DivUp(st,#1,tokens,1,2);
i:=ActUsers.IndexOf(tokens[0]);
if i=-1 then
begin
SendLine(PM_BOOT,SC_NORMAL,EC_USERNOTFOUND,tokens[0]);
Exit;
end;
au:=TActUser(ActUsers.Objects[i]);
if tokens.Count=2 then OPKicked.AddObject(FloatToStr(Now+StrToIntDef(tokens[1],0)*0.0006944444),Pointer(au.IP.S_addr));
for i:=0 to au.Rooms.Count-1 do
begin
room:=TRoom(au.Rooms.Objects[i]);
room.RoomAction(RA_BOOT,SC_NORMAL,self,au.Nick);
end;
au.SendLine(PM_DISCONN,SC_NORMAL,EC_BOOTED,Nick);
SendLine(PM_BOOT,SC_NORMAL,EC_NOERROR,au.Nick);
au.Close;
end;
PM_BAN :begin
if LoggedIn(PM_BAN)=false then Exit;
DivUp(st,#1,tokens,2,2);
i:=ActUsers.IndexOf(tokens[1]);
if i>-1 then
begin
au:=TActUser(ActUsers.Objects[i]);
i:=Rooms.IndexOf(tokens[0]);
if i=-1 then Exit;
room:=TRoom(Rooms.Objects[i]);
if UserStatus(room,false)=US_NOOP then
begin
SendLine(PM_BAN,SC_NORMAL,EC_FORBIDDENCMD,tokens[0]);
Exit;
end;
case stat of
SC_NORMAL:if room.BannedIPs.Remove(Pointer(au.IP.S_addr))=-1 then room.BannedIPs.Add(Pointer(au.IP.S_addr));
SC_SET :if room.BannedIPs.IndexOf(Pointer(au.IP.S_addr))=-1 then room.BannedIPs.Add(Pointer(au.IP.S_addr)) else Exit;
SC_UNSET :if room.BannedIPs.Remove(Pointer(au.IP.S_addr))=-1 then Exit;
end;
room.RoomAction(RA_BAN,BS[room.BannedIPs.IndexOf(Pointer(au.IP.S_addr))>-1],self,au.Nick);
end else SendLine(PM_BAN,SC_NORMAL,EC_USERNOTFOUND,tokens[0]+#1+tokens[1]);
end;
PM_GAG :begin
if LoggedIn(PM_GAG)=false then Exit;
DivUp(st,#1,tokens,2,2);
i:=Rooms.IndexOf(tokens[0]);
if i=-1 then Exit;
room:=TRoom(Rooms.Objects[i]);
i:=room.Users.IndexOf(tokens[1]);
if i=-1 then
begin
SendLine(PM_GAG,SC_NORMAL,EC_USERNOTFOUND,tokens[0]+#1+tokens[1]);
Exit;
end;
au:=TActUser(room.Users.Objects[i]);
if (UserStatus(room,false)>US_NOOP)and(room.Owner<>au)and(au<>self)or(room.Owner=self) then
begin
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -