From Stealth Client

Jump to: navigation, search

Work with IRC

Description

In Stealth 7.2.0 added IRC protocol support.

Abilities:

  • Private message sending
  • Channel joining (included channel with password), send messages to channel.
  • Receiving messages from channel\from private messages.
  • "Raw" text sending - you can use any irc protocol commands.

Nick must be set before start connect to server, otherwise some server can drop your connection!

IRC Event - IrcMsgHandler, one param - String.


Script example:

 program test;
 
 procedure IrcMsgHandler(Msg : String);
 begin
   AddToJournal('IrcMsg: "' + Msg + '"');
 end; 
 
 begin 
 if not IRCConnected then
   begin        
     IRCSetNickName('Vizzz');
     IRCConnect('irc.quakenet.org',6667);
     while not IRCConnected do
       wait(300);
   end;   
   if IRCConnected then
     IRCSay('some1', 'New test from Vizzzz');
   if IRCConnected then
     IRCJoin('#uos');
   if IRCConnected then
     IRCSay('#uos', 'CH test from Vizzzz');    
 
   while True do 
     Wait(500);
 end.


IRC script methods

IRC

IRCConnect

procedure IRCConnect(Host : String;Port : Word);

Connect to IRC server, host&port set in params.


Example:

 if not IRCConnected then
  begin        
    IRCSetNickName('Vizzz');
    IRCConnect('irc.quakenet.org',6667);
    while not IRCConnected do
      wait(300);
  end;   

IRCConnected

function IRCConnected : Boolean;

Status of connection to IRC-Server: True - connected, False - disconnected

Example:

if IRCConnected then
    IRCSay('some1', 'New test from Vizzzz');

IRCDisconnect

procedure IRCDisconnect;

Disconnect from IRC server


Example:

 if not IRCConnected then
  IRCDisconnect;   

IRCJoin

procedure IRCJoin(AChannel : String; AKey : String = '' );

Connect to channel with AChannel name (prefix # is required). Akey is optional param with channel key(password)

Example:

if IRCConnected then
  IRCJoin('#uos');

IRCRaw

procedure IRCRaw(ALine: String);

Send "raw" text to server, including command.

Format: COMAND_NAME value_text

Example of AWAY status

if IRCConnected then
    IRCRaw('AWAY :Games');

Example of channel leaving:

if IRCConnected then
    IRCRaw('PART #uos');

IRCSay

procedure IRCSay(ATarget : String; AMsg : String);

Send channel to user(nick)\channel.

User nickname without prefix, for channel use prefix #

Example of private message:

if IRCConnected then
    IRCSay('some1', 'New test from Vizzzz');


Example of message to channel:

if IRCConnected then
    IRCSay('#uos', 'CH test from Vizzzz');

IRCSetNickName

procedure IRCSetNickName(NickName : String);

Change\set nickname.

Nick must be set before start connect to server, otherwise some server can drop your connection!

Example:

 if not IRCConnected then
  begin        
    IRCSetNickName('Vizzz');
    IRCConnect('irc.quakenet.org',6667);
    while not IRCConnected do
      wait(300);
  end;