Net_SmartIRC
[ class tree: Net_SmartIRC ] [ index: Net_SmartIRC ] [ all elements ]

Class: Net_SmartIRC_base

Source Location: /Net_SmartIRC-1.0.2/SmartIRC.php

Class Overview


main SmartIRC class


Author(s):

Version:

  • 0.6.0-dev

Variables

Methods


Child classes:

Net_SmartIRC_irccommands
$Id: irccommands.php 241047 2007-08-10 15:10:30Z amir $

Inherited Variables

Inherited Methods


Class Details

[line 58]
main SmartIRC class
  • Author: Mirco 'meebey' Bauer <mail@meebey.net>
  • Version: 0.6.0-dev
  • Access: public


[ Top ]


Class Variables

$channel =

[line 388]

Stores all channels in this array where we are joined, works only if channelsyncing is activated.

Eg. for accessing a user, use it like this: (in this example the SmartIRC object is stored in $irc) $irc->channel['#test']->users['meebey']->nick;


Type:   array


[ Top ]

$nreplycodes =

[line 375]

All numeric IRC replycodes, the index is the numeric replycode.
  • See: $SMARTIRC_nreplycodes
  • Access: public

Type:   array


[ Top ]

$replycodes =

[line 366]

All IRC replycodes, the index is the replycode name.
  • See: $SMARTIRC_replycodes
  • Access: public

Type:   array


[ Top ]

$user =

[line 400]

Stores all users that had/have contact with us (channel/query/notice etc.), works only if usersyncing is activated.

Eg. for accessing a user, use it like this: (in this example the SmartIRC object is stored in $irc) $irc->user['meebey']->host;


Type:   array


[ Top ]



Method Detail

Net_SmartIRC_base (Constructor)   [line 409]

void Net_SmartIRC_base( )

Constructor. Initiales the messagebuffer and "links" the replycodes from global into properties. Also some PHP runtime settings are configured.
  • Access: public

[ Top ]

connect   [line 1029]

boolean connect( string $address, integer $port)

Creates the sockets and connects to the IRC server on the given port.
  • Access: public

Parameters:

string   $address     
integer   $port     

[ Top ]

disconnect   [line 1095]

boolean disconnect( [boolean $quickdisconnect = false])

Disconnects from the IRC server nicely with a QUIT or just destroys the socket.

Disconnects from the IRC server in the given quickness mode. $quickdisconnect: true, just close the socket false, send QUIT and wait $_disconnectime before closing the socket

  • Access: public

Parameters:

boolean   $quickdisconnect     default: false

[ Top ]

getChannel   [line 985]

object &getChannel( string $channelname)

Returns a reference to the channel object of the specified channelname.
  • Access: public

Parameters:

string   $channelname     

[ Top ]

getMotd   [line 962]

array getMotd( )

Returns the full motd.
  • Access: public

[ Top ]

getUser   [line 1007]

object &getUser( string $channelname, string $username)

Returns a reference to the user object for the specified username and channelname.
  • Access: public

Parameters:

string   $channelname     
string   $username     

[ Top ]

getUsermode   [line 973]

string getUsermode( )

Returns the usermode.
  • Access: public

[ Top ]

isBanned   [line 1329]

boolean isBanned( string $channel, string $hostmask)

Checks if the hostmask is on the specified channel banned and returns the result.

ChannelSyncing is required for this.


Parameters:

string   $channel     
string   $hostmask     

[ Top ]

isError   [line 2577]

void isError( $object)


Parameters:

   $object     

[ Top ]

isJoined   [line 1241]

boolean isJoined( string $channel, [string $nickname = null])

checks if we or the given user is joined to the specified channel and returns the result ChannelSyncing is required for this.

Parameters:

string   $channel     
string   $nickname     

[ Top ]

isMe   [line 1222]

boolean isMe( string $nickname)

checks if the passed nickname is our own nickname
  • Access: public

Parameters:

string   $nickname     

[ Top ]

isOpped   [line 1269]

boolean isOpped( string $channel, [string $nickname = null])

Checks if we or the given user is opped on the specified channel and returns the result.

ChannelSyncing is required for this.


Parameters:

string   $channel     
string   $nickname     

[ Top ]

isVoiced   [line 1299]

boolean isVoiced( string $channel, [string $nickname = null])

Checks if we or the given user is voiced on the specified channel and returns the result.

ChannelSyncing is required for this.


Parameters:

string   $channel     
string   $nickname     

[ Top ]

listen   [line 1356]

boolean listen( )

goes into receive mode

Goes into receive and idle mode. Only call this if you want to "spawn" the bot. No further lines of PHP code will be processed after this call, only the bot methods!

  • Access: public

[ Top ]

listenFor   [line 1404]

array listenFor( integer $messagetype)

waits for a special message type and puts the answer in $result

Creates a special actionhandler for that given TYPE and returns the answer. This will only receive the requested type, immediately quit and disconnect from the IRC server. Made for showing IRC statistics on your homepage, or other IRC related information.

  • Return: answer from the IRC server for this $messagetype
  • Access: public

Parameters:

integer   $messagetype     see in the documentation 'Message Types'

[ Top ]

listenOnce   [line 1374]

boolean listenOnce( )

goes into receive mode _only_ for one pass

Goes into receive mode. It will return when one pass is complete. Use this when you want to connect to multiple IRC servers.

  • Access: public

[ Top ]

loadModule   [line 1592]

void loadModule( $name)


Parameters:

   $name     

[ Top ]

log   [line 899]

void log( integer $level, string $entry, [ $file = null], [ $line = null])

Adds an entry to the log.

Adds an entry to the log with Linux style log format. Possible $level constants (can also be combined with "|"s) SMARTIRC_DEBUG_NONE SMARTIRC_DEBUG_NOTICE SMARTIRC_DEBUG_CONNECTION SMARTIRC_DEBUG_SOCKET SMARTIRC_DEBUG_IRCMESSAGES SMARTIRC_DEBUG_MESSAGETYPES SMARTIRC_DEBUG_ACTIONHANDLER SMARTIRC_DEBUG_TIMEHANDLER SMARTIRC_DEBUG_MESSAGEHANDLER SMARTIRC_DEBUG_CHANNELSYNCING SMARTIRC_DEBUG_MODULES SMARTIRC_DEBUG_USERSYNCING SMARTIRC_DEBUG_ALL


Parameters:

integer   $level     bit constants (SMARTIRC_DEBUG_*)
string   $entry     the new log entry
   $file     
   $line     

[ Top ]

login   [line 1186]

void login( string $nick, string $realname, [integer $usermode = 0], [string $username = null], [string $password = null])

login and register nickname on the IRC network

Registers the nickname and user information on the IRC network.

  • Access: public

Parameters:

string   $nick     
string   $realname     
integer   $usermode     
string   $username     
string   $password     

[ Top ]

reconnect   [line 1145]

void reconnect( )

Reconnects to the IRC server with the same login info, it also rejoins the channels
  • Access: public

[ Top ]

registerActionhandler   [line 1432]

integer registerActionhandler( integer $handlertype, string $regexhandler, &$object, string $methodname, object $object)

registers a new actionhandler and returns the assigned id

Registers an actionhandler in Net_SmartIRC for calling it later. The actionhandler id is needed for unregistering the actionhandler.

  • Return: assigned actionhandler id
  • See: example.php
  • Access: public

Parameters:

integer   $handlertype     bits constants, see in this documentation Message Types
string   $regexhandler     the message that has to be in the IRC message in regex syntax
object   $object     a reference to the objects of the method
string   $methodname     the methodname that will be called when the handler happens
   &$object     

[ Top ]

registerTimehandler   [line 1540]

integer registerTimehandler( integer $interval, &$object, string $methodname, object $object)

registers a timehandler and returns the assigned id

Registers a timehandler in Net_SmartIRC, which will be called in the specified interval. The timehandler id is needed for unregistering the timehandler.

  • Return: assigned timehandler id
  • See: example7.php
  • Access: public

Parameters:

integer   $interval     interval time in milliseconds
object   $object     a reference to the objects of the method
string   $methodname     the methodname that will be called when the handler happens
   &$object     

[ Top ]

send   [line 1711]

boolean send( string $data, [integer $priority = SMARTIRC_MEDIUM])

sends an IRC message

Adds a message to the messagequeue, with the optional priority. $priority: SMARTIRC_CRITICAL SMARTIRC_HIGH SMARTIRC_MEDIUM SMARTIRC_LOW

  • Access: public

Parameters:

string   $data     
integer   $priority     must be one of the priority constants

[ Top ]

setAutoReconnect   [line 725]

void setAutoReconnect( boolean $boolean)

Enables/disables autoreconnecting.
  • Access: public

Parameters:

boolean   $boolean     

[ Top ]

setAutoRetry   [line 741]

void setAutoRetry( boolean $boolean)

Enables/disables autoretry for connecting to a server.
  • Access: public

Parameters:

boolean   $boolean     

[ Top ]

setAutoRetryMax   [line 758]

void setAutoRetryMax( integer $autoretrymax)

Sets the maximum number of attempts to connect to a server before giving up.
  • Access: public

Parameters:

integer   $autoretrymax     

[ Top ]

setBenchmark   [line 514]

void setBenchmark( boolean $boolean)

Enables/disables the benchmark engine.
  • Access: public

Parameters:

boolean   $boolean     

[ Top ]

setChannelSynching   [line 531]

void setChannelSynching( boolean $boolean)

Deprecated, use setChannelSyncing() instead!
  • Deprecated:
  • Access: public

Parameters:

boolean   $boolean     

[ Top ]

setChannelSyncing   [line 547]

void setChannelSyncing( boolean $boolean)

Enables/disables channel syncing.

Channel syncing means, all users on all channel we are joined are tracked in the channel array. This makes it very handy for botcoding.

  • Access: public

Parameters:

boolean   $boolean     

[ Top ]

setCtcpVersion   [line 594]

void setCtcpVersion( string $versionstring)

Sets the CTCP version reply string.
  • Access: public

Parameters:

string   $versionstring     

[ Top ]

setDebug   [line 502]

void setDebug( integer $level)

Sets the level of debug messages.

Sets the debug level (bitwise), useful for testing/developing your code. Here the list of all possible debug levels: SMARTIRC_DEBUG_NONE SMARTIRC_DEBUG_NOTICE SMARTIRC_DEBUG_CONNECTION SMARTIRC_DEBUG_SOCKET SMARTIRC_DEBUG_IRCMESSAGES SMARTIRC_DEBUG_MESSAGETYPES SMARTIRC_DEBUG_ACTIONHANDLER SMARTIRC_DEBUG_TIMEHANDLER SMARTIRC_DEBUG_MESSAGEHANDLER SMARTIRC_DEBUG_CHANNELSYNCING SMARTIRC_DEBUG_MODULES SMARTIRC_DEBUG_USERSYNCING SMARTIRC_DEBUG_ALL

Default: SMARTIRC_DEBUG_NOTICE


Parameters:

integer   $level     

[ Top ]

setDisconnecttime   [line 652]

void setDisconnecttime( integer $milliseconds)

Sets the delaytime before closing the socket when disconnect.
  • Access: public

Parameters:

integer   $milliseconds     

[ Top ]

setLogdestination   [line 614]

void setLogdestination( integer $type)

Sets the destination of all log messages.

Sets the destination of log messages. $type can be: SMARTIRC_FILE for saving the log into a file SMARTIRC_STDOUT for echoing the log to stdout SMARTIRC_SYSLOG for sending the log to the syslog Default: SMARTIRC_STDOUT


Parameters:

integer   $type     must be on of the constants

[ Top ]

setLogfile   [line 640]

void setLogfile( string $file)

Sets the file for the log if the destination is set to file.

Sets the logfile, if logdestination is set to SMARTIRC_FILE. This should be only used with full path!

  • Access: public

Parameters:

string   $file     

[ Top ]

setModulepath   [line 812]

void setModulepath( integer $path)

Sets the paths for the modules.
  • Access: public

Parameters:

integer   $path     

[ Top ]

setReceivedelay   [line 689]

void setReceivedelay( integer $milliseconds)

Sets the delay for receiving data from the IRC server.

Sets the delaytime between messages that are received, this reduces your CPU load. Don't set this too low (min 100ms). Default: 100

  • Access: public

Parameters:

integer   $milliseconds     

[ Top ]

setReceiveTimeout   [line 777]

void setReceiveTimeout( integer $seconds)

Sets the receive timeout.

If the timeout occurs, the connection will be reinitialized Default: 300 seconds

  • Access: public

Parameters:

integer   $seconds     

[ Top ]

setReconnectdelay   [line 669]

void setReconnectdelay( integer $milliseconds)

Sets the delaytime before attempting reconnect.

Value of 0 disables the delay entirely.

  • Access: public

Parameters:

integer   $milliseconds     

[ Top ]

setRunAsDaemon   [line 825]

void setRunAsDaemon( boolean $boolean)

Sets wheter the script should be run as a daemon or not ( actually disables/enables ignore_user_abort() )
  • Access: public

Parameters:

boolean   $boolean     

[ Top ]

setSenddelay   [line 709]

void setSenddelay( integer $milliseconds)

Sets the delay for sending data to the IRC server.

Sets the delaytime between messages that are sent, because IRC servers doesn't like floods. This will avoid sending your messages too fast to the IRC server. Default: 250

  • Access: public

Parameters:

integer   $milliseconds     

[ Top ]

setTransmitTimeout   [line 796]

void setTransmitTimeout( integer $seconds)

Sets the transmit timeout.

If the timeout occurs, the connection will be reinitialized Default: 300 seconds

  • Access: public

Parameters:

integer   $seconds     

[ Top ]

setUserSyncing   [line 572]

void setUserSyncing( boolean $boolean)

Enables/disables user syncing.

User syncing means, all users we have or had contact with through channel, query or notice are tracked in the $irc->user array. This is very handy for botcoding.

  • Access: public

Parameters:

boolean   $boolean     

[ Top ]

setUseSockets   [line 447]

void setUseSockets( bool $boolean)

Enables/disables the usage of real sockets.

Enables/disables the usage of real sockets instead of fsocks (works only if your PHP build has loaded the PHP socket extension) Default: false

  • Access: public

Parameters:

bool   $boolean     

[ Top ]

showBenchmark   [line 869]

void showBenchmark( )

Shows the benchmark result.
  • Access: public

[ Top ]

startBenchmark   [line 841]

void startBenchmark( )

Starts the benchmark (sets the counters).
  • Access: public

[ Top ]

stopBenchmark   [line 853]

void stopBenchmark( )

Stops the benchmark and displays the result.
  • Access: public

[ Top ]

throwError   [line 2582]

void &throwError( $message)


Parameters:

   $message     

[ Top ]

unloadModule   [line 1660]

void unloadModule( $name)


Parameters:

   $name     

[ Top ]

unregisterActionhandler   [line 1464]

boolean unregisterActionhandler( integer $handlertype, string $regexhandler, &$object, string $methodname, object $object)

unregisters an existing actionhandler
  • Access: public

Parameters:

integer   $handlertype     
string   $regexhandler     
object   $object     
string   $methodname     
   &$object     

[ Top ]

unregisterActionid   [line 1505]

boolean unregisterActionid( integer $id)

unregisters an existing actionhandler via the id
  • Access: public

Parameters:

integer   $id     

[ Top ]

unregisterTimeid   [line 1569]

boolean unregisterTimeid( integer $id)

unregisters an existing timehandler via the id

Parameters:

integer   $id     

[ Top ]


Documentation generated on Mon, 25 Oct 2010 14:30:13 +0000 by phpDocumentor 1.4.3. PEAR Logo Copyright © PHP Group 2004.