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

Class: Net_SmartIRC_base

Source Location: /Net_SmartIRC-1.0.0/SmartIRC.php

Class Overview


main SmartIRC class


Author(s):

Version:

  • 0.5.5

Variables

Methods


Child classes:

Net_SmartIRC_irccommands
$Id: irccommands.php,v 1.1.2.1 2003/10/10 20:20:58 meebey Exp $

Inherited Variables

Inherited Methods


Class Details

[line 60]
main SmartIRC class


[ Top ]


Class Variables

$channel =

[line 331]

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 318]

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

Type:   array


[ Top ]

$replycodes =

[line 309]

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

Type:   array


[ Top ]



Method Detail

Net_SmartIRC_base (Constructor)   [line 340]

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 828]

void 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 896]

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 ]

getMotd   [line 804]

array getMotd( )

Returns the full motd.
  • Access: public

[ Top ]

getUsermode   [line 815]

string getUsermode( )

Returns the usermode.
  • Access: public

[ Top ]

isBanned   [line 1108]

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 2196]

void isError( mixed $object)


[ Top ]

isJoined   [line 1020]

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 ]

isOpped   [line 1048]

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 1078]

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 1135]

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 1156]

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 ]

log   [line 741]

void log( integer $level, string $entry, [mixed $file = null], [mixed $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

[ Top ]

login   [line 981]

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 ]

objListenFor   [line 1182]

array objListenFor( 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. This special version of listenFor() stores the whole ircdata object, not just the message!

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

Parameters:

integer   $messagetype     see in the documentation 'Message Types'

[ Top ]

reconnect   [line 940]

void reconnect( )

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

[ Top ]

registerActionhandler   [line 1210]

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

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
  • Access: public
  • See: example.php

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

[ Top ]

registerTimehandler   [line 1318]

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

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
  • Access: public
  • See: example7.php

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

[ Top ]

setAutoReconnect   [line 614]

void setAutoReconnect( boolean $boolean)

Enables/disables autoreconnecting.
  • Access: public

Parameters:

boolean   $boolean     

[ Top ]

setAutoRetry   [line 630]

void setAutoRetry( boolean $boolean)

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

Parameters:

boolean   $boolean     

[ Top ]

setBenchmark   [line 445]

void setBenchmark( boolean $boolean)

Enables/disables the benchmark engine.
  • Access: public

Parameters:

boolean   $boolean     

[ Top ]

setChannelSynching   [line 462]

void setChannelSynching( boolean $boolean)

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

Parameters:

boolean   $boolean     

[ Top ]

setChannelSyncing   [line 478]

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 500]

void setCtcpVersion( string $versionstring)

Sets the CTCP version reply string.
  • Access: public

Parameters:

string   $versionstring     

[ Top ]

setDebug   [line 433]

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 558]

void setDisconnecttime( integer $milliseconds)

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

Parameters:

integer   $milliseconds     

[ Top ]

setLogdestination   [line 520]

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 546]

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 ]

setReceivedelay   [line 578]

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 649]

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 ]

setSenddelay   [line 598]

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 668]

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 ]

setUseSockets   [line 378]

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 711]

void showBenchmark( )

Shows the benchmark result.
  • Access: public

[ Top ]

startBenchmark   [line 683]

void startBenchmark( )

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

[ Top ]

stopBenchmark   [line 695]

void stopBenchmark( )

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

[ Top ]

throwError   [line 2200]

void &throwError( mixed $message)


[ Top ]

unregisterActionhandler   [line 1242]

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

unregisters an existing actionhandler
  • Access: public

Parameters:

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

[ Top ]

unregisterActionid   [line 1283]

boolean unregisterActionid( integer $id)

unregisters an existing actionhandler via the id
  • Access: public

Parameters:

integer   $id     

[ Top ]

unregisterTimeid   [line 1347]

boolean unregisterTimeid( integer $id)

unregisters an existing timehandler via the id

Parameters:

integer   $id     

[ Top ]


Documentation generated on Fri, 27 May 2005 19:50:24 -0400 by phpDocumentor 1.2.3. PEAR Logo Copyright © PHP Group 2004.