DeBot Framework


DeBot\Connection
core/Server.php at line 14

Class Connection

Connection

public class Connection

DeBot Core - Server Created by dab ??? ?? 2009 Last Edited: Aug 15 2010 Our average socket is stored here along with some other things. We manage the whole connection here so no one gets hurt and loses a socket!

Author:
David (dab)
Version:
v1.0

Method Summary
boolean

Check()

This performs the check for new info.

boolean

Connect()

Connect to the server.

boolean

Disconnect(string sQuitMsg)

We must disconnect from this server.

void

Killed()

Um, the server doesn't like us.

void

__construct(array aInfo, mixed sName, string sServer, integer iPort, string sBind, boolean bSSL, string The)

Our construct.

void

getSock()

void

mode(string sWhere, string sMode, string sParam)

A shortcut method to sending a mode change to the server through Raw

void

msg(string sTo, string sMsg)

A shortcut method to sending a privmsg to the server through Raw

void

notice(string sTo, string sMsg)

A shortcut method to sending a notice to the server through Raw

boolean

raw(string msg)

As I knew would happen, we don't want to do fwrite() everywhere.

Method Detail

core/Server.php at line 231

Check

public boolean Check()

This performs the check for new info. As said in Bot.php, IRC has a tendancy to group lines, so we split them up and send as individual.

Returns:
Parse success?

core/Server.php at line 118

Connect

public boolean Connect()

Connect to the server. Due to socket_ nature, I could not use it for creating SSL connections so a fsock_open and fwrite and such was required. so I had to change this file a bit to support SSL. Buuut it's sexy. Not only can you bind on an IP, but you can connect SSL. It's a sexy thing. Anyway I do a bunch of magic to make my connection socket easy to connect with. I combine stuff based on settings and such.

Returns:
Connected or not?

core/Server.php at line 214

Disconnect

public boolean Disconnect(string sQuitMsg)

We must disconnect from this server. The default message is the VERSION. I'd appreciate it if you left this as it is. It's like this for a reason. :(

Parameters:
sQuitMsg - The quit message to send upon disconnecting.
Returns:
Work or not?

core/Server.php at line 200

Killed

public void Killed()

Um, the server doesn't like us. This is called when that happens (timeout, gline, etc)


core/Server.php at line 83

__construct

public void __construct(array aInfo, mixed sName, string sServer, integer iPort, string sBind, boolean bSSL, string The)

Our construct. DOES NOT auto connect. You must call Server->Connect

Parameters:
aInfo - The info for the bot to use (ident, user, real name, nick )
The - name of the bot iirc.
sServer - The URL/IP of the server to connect
iPort - the port to connect upon.
sBind - Should we bind to an IP? For multiple IPs.
bSSL - Should we connect via SSL?

core/Server.php at line 335

getSock

public void getSock()

core/Server.php at line 322

mode

public void mode(string sWhere, string sMode, string sParam)

A shortcut method to sending a mode change to the server through Raw

Parameters:
sWhere - The location to send the mode to.
sMode - The modes to send
sParam - The params to send

core/Server.php at line 299

msg

public void msg(string sTo, string sMsg)

A shortcut method to sending a privmsg to the server through Raw

Parameters:
sTo - The location to send the message to.
sMsg - The message to send

core/Server.php at line 310

notice

public void notice(string sTo, string sMsg)

A shortcut method to sending a notice to the server through Raw

Parameters:
sTo - The location to send the message to.
sMsg - The message to send

core/Server.php at line 277

raw

public boolean raw(string msg)

As I knew would happen, we don't want to do fwrite() everywhere. If we wanted to change the socket type, or even changed from sockets to say, MySQL, we would have to update the script EVERYWHERE. This allows us to only edit this 1 method, and the whole bot uses this new setup. Very useful for say, making the bot Use fsocket instead of socket_.

Parameters:
msg - The message to send to the server
Returns:
Sent?

DeBot Framework