www.pudn.com > oicqspysrc.zip > robot.pas


unit robot; 
 
interface 
 
uses 
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, 
  Db, DBF, ExtCtrls, Grids, DBGrids, StdCtrls, Mask, DBCtrls; 
 
type 
  TBotCfgDlg = class(TForm) 
    AutoUserTable: TDBF; 
    AutoUserDS: TDataSource; 
    DBGrid1: TDBGrid; 
    Panel1: TPanel; 
    AutoUserTableUSERID: TFloatField; 
    AutoUserTableGREETMSG: TStringField; 
    AutoUserTableBYEMSG: TStringField; 
    Label1: TLabel; 
    DBEdit1: TDBEdit; 
    DBEdit2: TDBEdit; 
    DBEdit3: TDBEdit; 
    DBNavigator1: TDBNavigator; 
    Label2: TLabel; 
    Label3: TLabel; 
    Label4: TLabel; 
  private 
    { Private declarations } 
  public 
    { Public declarations } 
    function GetGreetMsg(const UserId:string;var Msg:string):Boolean; 
    function GetByeMsg(const UserId:string;var Msg:string):Boolean; 
  end; 
 
var 
  BotCfgDlg: TBotCfgDlg; 
 
implementation 
 
{$R *.DFM} 
 
{ TBotCfgDlg } 
 
function TBotCfgDlg.GetByeMsg(const UserId: string; 
  var Msg: string): Boolean; 
begin 
with AutoUserTable do 
  begin 
  First; 
  while not Eof do 
    begin 
    if(FieldByName('UserId').AsString=UserId)then 
      begin 
      Msg:=FieldByName('ByeMsg').AsString; 
      Result:=True; 
      Break; 
      end 
    else if(FieldByName('UserId').AsString='0')then 
      begin 
      Msg:=FieldByName('ByeMsg').AsString; 
      Result:=True; 
      end; 
    Next; 
    end; 
  end; 
end; 
 
function TBotCfgDlg.GetGreetMsg(const UserId: string; 
  var Msg: string): Boolean; 
begin 
with AutoUserTable do 
  begin 
  First; 
  while not Eof do 
    begin 
    if(FieldByName('UserId').AsString=UserId)then 
      begin 
      Msg:=FieldByName('GreetMsg').AsString; 
      Result:=True; 
      Break; 
      end 
    else if(FieldByName('UserId').AsString='0')then 
      begin 
      Msg:=FieldByName('GreetMsg').AsString; 
      Result:=True; 
      end; 
    Next; 
    end; 
  end; 
end; 
 
end.