⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 actuser.pas

📁 flash视频源码 flash视频源码
💻 PAS
📖 第 1 页 / 共 3 页
字号:
                           case stat of
                             SC_NORMAL:if room.Gagged.Remove(au)=-1 then room.Gagged.Add(au);
                             SC_SET   :if room.Gagged.IndexOf(au)=-1 then room.Gagged.Add(au) else Exit;
                             SC_UNSET :if room.Gagged.Remove(au)=-1 then Exit;
                           end;

                           room.RoomAction(RA_GAG,BS[room.Gagged.IndexOf(au)>-1],self,au.Nick);
                         end else SendLine(PM_GAG,SC_NORMAL,EC_FORBIDDENCMD,tokens[0]);
                     end;
      PM_PROFILE    :begin
                       DivUp(st,#1,tokens,6,6);

                       case stat of
                         SC_REGISTER:begin
                                       if ValidNickname(tokens[0])=false then
                                         begin
                                           SendLine(PM_PROFILE,SC_REGISTER,EC_INVALIDNICK,'');
                                           Exit;
                                         end;

                                       i:=RegUsers.IndexOf(tokens[0]);
                                       if i>-1 then
                                         begin
                                           SendLine(PM_PROFILE,SC_REGISTER,EC_NICKREGED,'');
                                           Exit;
                                         end;

                                       i:=ActUsers.IndexOf(tokens[0]);
                                       if (i>-1)and(ActUsers.Objects[i]<>self) then
                                         begin
                                           SendLine(PM_PROFILE,SC_REGISTER,EC_NICKINUSE,'');
                                           Exit;
                                         end;

                                       if (regpass<>0)and(tokens[1]<>IntToStr(regpass)) then
                                         begin
                                           SendLine(PM_PROFILE,SC_REGISTER,EC_WRONGPWD,'');
                                           Exit;
                                         end;

                                       New(ru);
                                       ru^.nick:=tokens[0];
                                       ru^.pwd:=StrToIntDef(tokens[1],0);
                                       ru^.email:=tokens[2];
                                       ru^.hp:=tokens[3];
                                       ru^.note:=tokens[4];
                                       if Nick=ru^.nick then ru^.color:=StrToInt('$'+Color) else ru^.Color:=$000000;
                                       ru^.cloak:=StrToBool(tokens[5],false);
                                       ru^.reged:=Now;
                                       if Nick=ru^.nick then ru^.lastlogin:=Now else ru^.lastlogin:=0;
                                       ru^.active:=true;
                                       ru^.chatop:=false;

                                       i:=RegUsers.IndexOf('');
                                       if i>-1 then
                                         begin
                                           RegUsers[i]:=ru^.nick;
                                           RegUsers.Objects[i]:=Pointer(ru);
                                         end else RegUsers.AddObject(ru^.nick,Pointer(ru));

                                       WriteUserData(ru);
                                       if Nick=ru^.nick then RegUser:=ru;
                                       SendLine(PM_PROFILE,SC_REGISTER,EC_NOERROR,'');
                                     end;
                         SC_GET     :begin
                                       if (LoggedIn(PM_PROFILE)=false)or(RegUser=nil) then Exit;

                                       if tokens[0]<>IntToStr(RegUser^.pwd) then
                                         begin
                                           SendLine(PM_PROFILE,SC_GET,EC_WRONGPWD,'');
                                           Exit;
                                         end;

                                       SendLine(PM_PROFILE,SC_GET,EC_NOERROR,RegUser^.email+#1+RegUser^.hp+#1+RegUser^.note+#1+BS[RegUser^.cloak]);
                                     end;
                         SC_EDIT    :begin
                                       if (LoggedIn(PM_PROFILE)=false)or(RegUser=nil) then Exit;

                                       if tokens[0]<>IntToStr(RegUser^.pwd) then
                                         begin
                                           SendLine(PM_PROFILE,SC_EDIT,EC_WRONGPWD,'');
                                           Exit;
                                         end;

                                       RegUser^.pwd:=StrToIntDef(tokens[1],0);
                                       RegUser^.email:=tokens[2];
                                       RegUser^.hp:=tokens[3];
                                       RegUser^.note:=tokens[4];
                                       RegUser^.cloak:=StrToBool(tokens[5],false);

                                       WriteUserData(RegUser);
                                       SendLine(PM_PROFILE,SC_EDIT,EC_NOERROR,'');
                                     end;
                         SC_DELETE  :begin
                                       if (LoggedIn(PM_PROFILE)=false)or(RegUser=nil) then Exit;

                                       if tokens[0]<>IntToStr(RegUser^.pwd) then
                                         begin
                                           SendLine(PM_PROFILE,SC_DELETE,EC_WRONGPWD,'');
                                           Exit;
                                         end;

                                       stat:=Char(RegUser^.chatop);

                                       RegUser^.nick:='';
                                       WriteUserData(RegUser);
                                       Dispose(RegUser);
                                       RegUser:=nil;

                                       i:=RegUsers.IndexOf(Nick);
                                       RegUsers[i]:='';

                                       if Boolean(stat) then
                                         begin
                                           for i:=0 to Rooms.Count-1 do
                                             begin
                                               room:=TRoom(Rooms.Objects[i]);
                                               room.RoomAction(RA_RIGHTS,SC_LOST_COP,nil,Nick+#1+UserStatus(room,true));
                                             end;
                                           UpdateUserInfo;
                                         end;

                                       SendLine(PM_PROFILE,SC_DELETE,EC_NOERROR,'');
                                     end;
                       end;
                     end;
      PM_GETUSERINFO:begin
                       if LoggedIn(PM_GETUSERINFO)=false then Exit;

                       i:=ActUsers.IndexOf(st);
                       if i>-1 then au:=TActUser(ActUsers.Objects[i]) else au:=nil;

                       i:=RegUsers.IndexOf(st);
                       if i>-1 then ru:=PRegUser(RegUsers.Objects[i]) else ru:=nil;

                       if (au=nil)and(ru=nil) then
                         begin
                           SendLine(PM_GETUSERINFO,SC_NORMAL,EC_USERNOTFOUND,st);
                           Exit;
                         end;

                       tokens.Clear;
                       for i:=1 to 10 do tokens.Add('');

                       if au<>nil then
                         begin
                           tokens[0]:=au.Nick;
                           tokens[1]:=au.Color;
                           tokens[2]:=BS[au.Away];
                           tokens[3]:=au.AwayReason;

                           try
                             tokens[4]:=IntToStr(Round((Now-au.Lastact)/1.15740740740741E-5));
                           except
                             Writeln('Fatal error 915: Please contact alcomp''s support at support@alcomp.net');
                             Writeln('Additionally information: '+FloatToStr(au.Lastact)+':'+FloatToStr(Now));
                             tokens[4]:='0';
                           end;

                           if (RegUser<>nil)and(RegUser^.chatop) then tokens[5]:=inet_ntoa(au.IP);
                         end;

                       if ru<>nil then
                         begin
                           tokens[0]:=ru^.nick;
                           tokens[1]:=Format('%.6x',[ru^.color]);
                           tokens[6]:=ru^.email;
                           tokens[7]:=ru^.hp;
                           tokens[8]:=ru^.note;
                           tokens[9]:=BS[ru^.chatop];
                         end;

                       SendLine(PM_GETUSERINFO,SC_NORMAL,EC_NOERROR,tokens[0]+#1+tokens[1]+#1+tokens[2]+#1+tokens[3]+#1+tokens[4]+#1+tokens[5]+#1+tokens[6]+#1+tokens[7]+#1+tokens[8]+#1+tokens[9]);
                     end;
      PM_GETROOMINFO:begin
                       i:=Rooms.IndexOf(st);
                       if (LoggedIn(PM_GETROOMINFO)=false)or(i=-1) then Exit;

                       room:=TRoom(Rooms.Objects[i]);
                       SendLine(PM_GETROOMINFO,BS[not(room.System or (UserStatus(room,false)=US_NOOP))],EC_NOERROR,room.RoomInfo);
                     end;
      PM_SETROOMINFO:begin
                       if LoggedIn(PM_SETROOMINFO)=false then Exit;

                       DivUp(st,#1,tokens,6,6);
                       i:=Rooms.IndexOf(tokens[0]);
                       if i=-1 then Exit;

                       room:=TRoom(Rooms.Objects[i]);
                       if (room.System)or(UserStatus(room,false)=US_NOOP) then
                         begin
                           SendLine(PM_SETROOMINFO,SC_NORMAL,EC_FORBIDDENCMD,tokens[0]);
                           Exit;
                         end;

                       if Byte(stat) and RI_TOPIC<>0 then room.Topic:=tokens[1];
                       if (Byte(stat) and RI_COLOR<>0)and(StrToIntDef('$'+tokens[2],-1)>-1)and(Length(tokens[2])=6) then room.BgCol:=tokens[2];
                       if Byte(stat) and RI_USERS<>0 then room.MaxUsers:=StrToIntDef(tokens[3],0);
                       if Byte(stat) and RI_LOCKED<>0 then room.Closed:=StrToBool(tokens[4],not room.Closed);
                       if Byte(stat) and RI_HIDDEN<>0 then
                         begin
                           room.Hidden:=StrToBool(tokens[5],not room.Hidden);
                           if room.Hidden then for i:=0 to ActUsers.Count-1 do TActUser(ActUsers.Objects[i]).SendLine(PM_ROOMLIST,SC_REMOVE,EC_NOERROR,room.Name);
                         end;

                       room.RoomAction(RA_ROOMINFO,stat,self,room.RoomInfo);
                       room.UpdateRoomInfo;
                     end;
      PM_DIRCON     :begin
                       if LoggedIn(PM_DIRCON)=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_DIRCON,self,'');
                           au.UserAction(UA_DIRCON,SC_NORMAL,self,inet_ntoa(IP)+#1+tokens[1]);
                         end else SendLine(PM_DIRCON,SC_NORMAL,EC_USERNOTFOUND,tokens[0]);
                     end;
    end;
  end;

function TActUser.LoggedIn(msg:Char):Boolean;
  begin
    Result:=Nick[1]<>' ';
    if Result=false then SendLine(msg,SC_NORMAL,EC_NOTLOGGEDIN,'');
  end;

procedure TActUser.SendLine(cmd,stat,err:Char;msg:string);
  begin
    Send(cmd+stat+err+msg);
  end;

procedure TActUser.UpdateUserInfo;
var i:Integer;st:string;
  begin
    if Hidden then Exit;

    st:=Nick+#1+Color+#1+UserStatus(nil,true);
    for i:=0 to ActUsers.Count-1 do TActUser(ActUsers.Objects[i]).SendLine(PM_USERLIST,SC_ADD,EC_NOERROR,st);
  end;

procedure TActUser.UserAction(action,status:Char;user:TActUser;msg:string);
  begin
    SendLine(PM_USERACTION,action,EC_NOERROR,status+user.Nick+#1+user.Color+#1+msg);
  end;

function TActUser.UserStatus(room:Pointer;showaway:Boolean):Char;
  begin
    Result:=US_NOOP;
    if room<>nil then
      begin
        if TRoom(room).ROPS.IndexOf(self)>-1 then Result:=US_ROOMOP;
        if TRoom(room).Owner=self then Result:=US_ROOMOWNER;
      end;
    if (RegUser<>nil)and(RegUser^.chatop) then Result:=US_CHATOP;
    if (Away)and(showaway) then Result:=US_AWAY;
  end;

end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -