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

📄 idirc.pas

📁 Indy控件的使用源代码
💻 PAS
📖 第 1 页 / 共 5 页
字号:
{ $HDR$}
{**********************************************************************}
{ Unit archived using Team Coherence                                   }
{ Team Coherence is Copyright 2002 by Quality Software Components      }
{                                                                      }
{ For further information / comments, visit our WEB site at            }
{ http://www.TeamCoherence.com                                         }
{**********************************************************************}
{}
{ $Log:  10227: IdIRC.pas 
{
{   Rev 1.0    2002.11.12 10:43:38 PM  czhower
}
unit IdIRC;

{
  TIRCClient component for Borland Delphi 5.0 or above
  by Steve 'Sly' Williams (stevewilliams@kromestudios.com)    
  ported to Indy by Daaron Dwyer (ddwyer@ncic.com)

  File:       IRCClient.pas
  Version:    1.06
  Objects:    TIRCClient, TUser, TUsers, TChannel, TChannels, TIdIRCReplies
  Requires:   Indy9

  Provides a simple, high-level interface to the IRC network.  Set the
  properties and write event handlers for the events you wish to respond to.
  Any events that do not have a specific event handler will continue normal
  processing (ie. reply to a request, ignore a message, etc).

  I have tried to keep the TIRCClient object as independent as possible from
  the user interface implementation.  This is so the user interface is not
  constrained by any inherent limitations placed upon it by the implementation
  of the TIRCClient object itself, thus leaving the user interface to be as
  standard or as non-standard as the designer wishes.

  This is a non-visual component, and should be placed either on the main form
  or in a data module, where all units can easily access the component.

  The command numerics and server operation are based on RFC1459, the original
  specification for IRC.  Any change from the specification is due to the
  differences that have been noted from practical experience.  There may be
  some IRC networks that operate differently and therefore do not operate with
  this TIRCClient object in the correct manner.  If you do have any information
  that would make the TIRCClient object more compatible with current or planned
  IRC networks, then e-mail me so that I may add these features to the next
  release.

  History:
  1.00    Initial release
  1.01    1/03/1999
          - Changed SocketDataAvailable to handle lines ending with either CRLF
            (within spec) or a single LF (breaks spec).  It seems a few servers
            break the rules.  Also added check for a non-zero Error parameter.
  1.02    5/04/1999
          - Added SocksServer and SocksPort properties as requested by Joe
            (cybawiz@softhome.net).
  1.03    13/05/1999
          - Moved the creation of the TWSocket to the overridden Loaded
            procedure to get rid of the annoying "A device attached to the
            system is not functioning" error when recompiling the package.
  1.04    28/11/1999
          - If Suppress in the OnRaw event was set to True, the User object
            would not have been released.
          - Uncommented the OnJoin and OnPart events.  Not sure why I had them
            commented out.
  1.05    02/12/1999
          - Fixed the Replies property and made it published.  The TIdIRCReplies
            object had to descend from TPersistent, not TObject.  Oops.
          - Fixed the Client property of TUser, TUsers, TChannel and TChannels.
            Made a forward declaration of TIRCClient and used that as the type.
  1.06    25/05/2000
          - Fixed TUsers.Destroy and TChannels.Destroy.  The list items were not
            being deleted after the objects were freed.  Silly error on my part.
  1.061   27/07/2001 - Daaron Dwyer (ddwyer@ncic.com)
          - Modified component to use Indy TCPClient control rather than ICS
  1.062   10/11/2001 - J. Peter Mugaas
          - added ACmd Integer parameter to TIdIRCOnSystem as suggested by Andrew P.Rybin
          - added Channel to OnNames event as suggested by Sven Orro

  TUser object
  -------------------------------------

  Properties:
    Nick                  The user's nickname.
    Address               The full address of the user.
    Count                 Count of the number of objects referencing this
                          user.  This user is removed when the reference
                          count drops to zero.
    Data                  A reference to an object defined by the client.
                          Usually references the message window for this user.

  Methods:
    Say                   Send a message to this user.


  TUsers object
  -------------------------------------

  Properties:
    none

  Methods:
    Add                   Increments the reference count for this user.  If the
                          user does not exist, then a new user is created with
                          a reference count of one.  Returns the TUser object
                          for the user.
    Remove                Decrement the reference count for this user.  The
                          user is only deleted if the reference count becomes
                          zero.
    Address               Return the address of a specified nick.
    Find                  Returns the index of the user if the nick is found.
    Get                   Returns the user object if the nick is found.
    Nick                  Change the nick of an existing user.


  TChannel object
  -------------------------------------

  Properties:
    Name                  Channel name.
    Topic                 Current topic of the channel (if set).
    Mode                  Set of channel modes.
    Limit                 Set if a limit is set to the number of users in a
                          channel.
    Key                   Set if a password key is set for the channel.
    ModeChange            True if mode changes are being compiled.
    Data                  A reference to an object defined by the client.
                          Usually references the message window for this
                          channel.

  Methods:
    Say                   Send a message to the channel.
    Part                  Part the channel.
    Kick                  Kick a nick from the channel.
    Topic                 Set the channel topic.
    BeginMode             Compile but do not send mode changes until the
                          EndMode method is called.
    EndMode               Compile all mode changes since BeginMode and send to
                          the server.
    Op                    Give a user channel operator status.
    Deop                  Remove channel operator status from a user.
    Voice                 Give a voice to a user in a moderated channel.
    Devoice               Remove the voice from a user in a moderated channel.
    Ban                   Ban a user from the channel.
    Unban                 Remove a ban from the channel.
    TopicChanged          Call to change the topic without sending a topic
                          command (ie. when another user changes the topic).
    ModeChanged           Call to change the channel mode without sending a
                          mode command (ie. when another user changes the
                          mode).
    LimitChanged          Call to change the channel limit without sending a
                          mode command (ie. when another user changes the
                          limit).
    KeyChanged            Call to change the channel key without sending a
                          mode command (ie. when another user changes the
                          key).
    AddUser               Add a user to the channel.
    RemoveUser            Remove a user from the channel.

  TChannels object
  -------------------------------------

  Properties:
    none

  Methods:
    Add                   Add a new channel to the list.
    Remove                Remove a channel from the list.
    Find                  Find a channel name, if it exists.
    Get                   Returns the channel object for the name given.


  TIRCClient component
  -------------------------------------

  Design-time properties:
    Nick                  The primary nick to be used.  Defaults to 'Nick'.
    AltNick               Another nick to use if the primary nick is already
                          in use.  Defaults to 'OtherNick'.
    UserName              Your username (for the system you are using).
    RealName              The information you want displayed in your whois
                          response.
    Server                Address of the IRC server to connect to.
    Port                  Server port number to connect to.  Defaults to
                          '6667'.
    Password              Password to connect (if required).
    UserMode              Set of user modes.  Defaults to an empty set.
                          umInvisible, umOperator, umServerNotices, umWallops.
    SocksServer           Address of the SOCKS server to connect through.
    SocksPort             Port number of the SOCKS server to connect through.

  Run-time properties:
    Connected             Returns True if currently connected to the IRC
                          network.
    Away                  Set to True if you are marked as away.
    Notify                List of nicknames/addresses to be notified of when
                          they join/leave IRC.
    State                 The current connection state.
    Channels              The list of channel objects.
    Replies
      Finger              Standard CTCP reply for FINGER requests.
      Version             Standard CTCP reply for VERSION requests.
      UserInfo            Standard CTCP reply for USERINFO requests.
      ClientInfo          Standard CTCP reply for CLIENTINFO requests.

  Events:
    OnConnect             Connected to the IRC network.
    OnDisconnect          Disconnected from the IRC network.
    OnChannelMessage      Received a channel message.
    OnChannelNotice       Received a channel notice.
    OnChannelAction       Received a channel action.
    OnPrivateMessage      Received a private message.
    OnPrivateNotice       Received a private notice.
    OnPrivateAction       Received a private action.
    OnJoin                A user joined a channel.
    OnJoined              You joined a channel.
    OnPart                A user parted a channel.
    OnParted              You parted a channel.
    OnKick                A user kicked another user from a channel.
    OnKicked              You were kicked from a channel by a user.
    OnNickChange          A user changed their nick.
    OnNickChanged         Your nick was changed.
    OnTopic               The topic of the channel was changed.
    OnQuit                A user quit IRC.
    OnNames               Received a list of names of people in a channel.
    OnInvite              A user has invited you to a channel.
    OnInviting            You invited a user to a channel.
    OnPingPong            Received a server ping (PONG response sent
                          automatically).
    OnError               Error message from server.
    OnAway                Received an away message for a user.
    OnNowAway             You are marked as being away.
    OnUnAway              You are no longer marked as being away.
    OnWallops             Received a wallops message.
    OnSystem              Any response from the server not handled by a
                          specific event handler.
    OnRaw                 Every command from the IRC server goes through this
                          handler first.  Normal processing can be suppressed
                          by setting the Suppress parameter to True.
    OnOp                  A user was oped in a channel.
    OnDeop                A user was deoped in a channel.
    OnBan                 A user was banned in a channel.
    OnUnban               A user was unbanned in a channel.
    OnVoice               A user was given a voice in a channel.
    OnDevoice             A user's voice was taken away in a channel.
    OnChannelMode         The channel mode was changed.
    OnChannelModeChanged  Called after the channel mode change has been parsed
                          and the mode was changed.
    OnUserMode            Your user mode was changed.
    OnUserModeChanged     Called after the user mode change has been parsed
                          and the mode was changed.
    OnKill                A user was killed.
    OnUnknownCommand      An unknown command was received from the server.
    OnStateChange         Called when the current state of the IRC connection
                          changes.
    OnSend                Called for every command sent to the IRC server.
                          Useful for displaying in a raw output window.
    OnReceive             Called for every command is received from the IRC
                          server.  Useful for displaying in a raw output
                          window.
    OnNicksInUse          Called during the registration process when both Nick
                          and AltNick are in use.
    OnSocketError         An error occurred in the TCP/IP socket.
    OnNoTopic             There is no topic for this channel.
    OnChannelMode         The channel mode is now set.
    OnLinks               Results from a /LINK command
    OnList                Results from a /LIST command

  The following CTCP query event handlers can suppress the standard response by
  setting the Suppress parameter to True.
    OnCTCPQuery           A user sent you a CTCP query.
    OnCTCPReply           Received a reply from a CTCP query.

  Events to be added later:
    OnOped                You were oped in a channel.
    OnDeoped              You were deoped in a channel.
    OnBanned              You were banned in a channel.
    OnUnbanned            You were unbanned in a channel.
    OnVoiced              You were given a voice in a channel.
    OnDevoiced            Your voice was taken away in a channel.
    OnKilled              You were killed.
    OnNotify              A person on your notify list has joined IRC.
    OnDenotify            A person on your notify list has left IRC.
    OnLag                 Update on the current lag time.

  DCC events to be added later
    OnChat                Someone wants to initiate a DCC chat.
    OnChatClosed          The DCC chat was closed.
    OnFileReceive         Someone wants to send you a file.
    OnFileReceived        The file was received successfully.
    OnFileSend            A file is offered to someone.
    OnFileSent            The file was sent successfully.
    OnFileError           There was an error during file transfer.
    OnDCC                 General DCC event handler.

  *TEMPDCC EVENTS UNTIL ABOVE ARE DONE*:
    OnDCCChat             Someone wants to DCC Chat
    OnDCCSend             Someone wants to Send you a File Via DCC
    OnDCCResume           Someone is requesting a DCC File RESUME
    OnDCCAccept           Someone has ACCEPTED your DCC File RESUME request


  Set the Accept parameter to True to accept the DCC.  Set the Resume
  parameter to True to resume a DCC file transfer.  Set the Filename parameter
  to the full path and name of the place to store the received file.

  Methods:
    Connect               Connect to the IRC network.
    Disconnect            Force a disconnect from the IRC network.
    Raw                   Send the command directly to the IRC server.
    Say                   Send a message to a user/channel.
    Notice                Send a notice to a user/channel.
    Join                  Join channel/s with given key/s.

⌨️ 快捷键说明

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