Package lacewing :: Module client :: Class ClientProtocol
[frames] | no frames]

Class ClientProtocol

source code

twisted.internet.protocol.BaseProtocol --+        
                                         |        
        twisted.internet.protocol.Protocol --+    
                                             |    
                         protocol.BaseProtocol --+
                                                 |
                                                ClientProtocol

The client protocol.

Instance Methods
 
connectionMade(self)
Sends a connection acceptance request to the server after the connection has been made.
source code
 
loaderReceived(self, loader, isDatagram=False)
Called when a packet is received.
source code
 
sendLoader(self, loader, asDatagram=False)
Sends a packetloader to the server
source code
 
requestChannelList(self)
Request a channel list from the server.
source code
 
sendMessage(self, message, subchannel, typeName=None, asObject=False, asDatagram=False)
Send a message directly to the server.
source code
 
joinChannel(self, channelName, hidden=False, autoClose=False)
Join a channel by name.
source code
 
leaveChannel(self, channel)
Leave a channel.
source code
 
setName(self, name)
Request a name change.
source code
 
serverGreeted(self, welcome)
Called when the server has responded to our welcome.
source code
 
connectionAccepted(self)
Called when the server has accepted the requested connection.
source code
 
loginAccepted(self, name)
Called when the server has accepted the requested name (or has specified one itself).
source code
 
nameChanged(self, name)
Called when the server has accepted name change (or has given the client a new one).
source code
 
serverDenied(self, response)
Called when the server disconnects or when the server denies an client request.
source code
 
messageReceived(self, message)
Called when a server message arrives.
source code
 
channelMessageReceived(self, channel, user, message)
Called when a message from a channel arrives.
source code
 
privateMessageReceived(self, channel, sender, message)
Called when a private message has been received
source code
 
channelJoined(self, channel)
Called when the server has accepted a channel join request.
source code
 
channelLeft(self, channel)
Called when the server has accepted a channel leave request.
source code
 
channelUserJoined(self, channel, client)
Called when a client has joined the channel.
source code
 
channelUserExists(self, channel, client)
Called when a client exists in the channel.
source code
 
channelUserLeft(self, channel, client)
Called when a client has left the channel.
source code
 
channelUserChanged(self, channel, client)
Called when a client in the channel has changed name.
source code
 
pingReceived(self)
Called when a server ping has been received.
source code

Inherited from protocol.BaseProtocol: dataReceived, validName

Inherited from twisted.internet.protocol.Protocol: connectionLost

Inherited from twisted.internet.protocol.BaseProtocol: __providedBy__, makeConnection

Class Variables
  udpTimeout = 3000

Inherited from protocol.BaseProtocol: revision, udpEnabled

Inherited from twisted.internet.protocol.Protocol: __implemented__, __provides__

Inherited from twisted.internet.protocol.BaseProtocol: connected, transport

Instance Variables
  datagram = None
The ClientDatagram protocol this connection is using for UDP handling

Inherited from protocol.BaseProtocol: channels, id, isAccepted, loggedIn, name, privateAllowed

Method Details

connectionMade(self)

source code 

Sends a connection acceptance request to the server after the connection has been made.

Overrides: twisted.internet.protocol.BaseProtocol.connectionMade

loaderReceived(self, loader, isDatagram=False)

source code 

Called when a packet is received.

Parameters:
  • isDatagram - True if the message recieved was sent using UDP.
Overrides: protocol.BaseProtocol.loaderReceived
(inherited documentation)

sendLoader(self, loader, asDatagram=False)

source code 

Sends a packetloader to the server

Parameters:
  • loader - The packetloader to send.
Overrides: protocol.BaseProtocol.sendLoader

requestChannelList(self)

source code 

Request a channel list from the server.

Returns:
A deferred that will fire with a list of ChannelList objects

sendMessage(self, message, subchannel, typeName=None, asObject=False, asDatagram=False)

source code 

Send a message directly to the server.

Parameters:
  • message (str/number/ByteReader) - The message to send.
  • subchannel - A subchannel in the range 0-256
  • typeName - If not specified, the type will be automatically detected (see lacewing.packetloaders.common.DATA_TYPES for possible values)

joinChannel(self, channelName, hidden=False, autoClose=False)

source code 

Join a channel by name.

Parameters:
  • hidden - If this connection is creating the channel, this will hide the channel from channel listing
  • autoClose - If this connection is creating the channel and if master rights are enabled on the server, this will close the channel when the client leaves

leaveChannel(self, channel)

source code 

Leave a channel.

Parameters:
  • channel (str, number, or OChannel object) - The channel to leave.

setName(self, name)

source code 

Request a name change.

Parameters:
  • name (str) - The name to request.

loginAccepted(self, name)

source code 

Called when the server has accepted the requested name (or has specified one itself).

Parameters:
  • name (str object) - The name of the client.

nameChanged(self, name)

source code 

Called when the server has accepted name change (or has given the client a new one).

Parameters:
  • name (str) - The new name for the client.

serverDenied(self, response)

source code 

Called when the server disconnects or when the server denies an client request.

Parameters:
  • response - The response of the action.

messageReceived(self, message)

source code 

Called when a server message arrives.

Parameters:

channelMessageReceived(self, channel, user, message)

source code 

Called when a message from a channel arrives.

Parameters:

privateMessageReceived(self, channel, sender, message)

source code 

Called when a private message has been received

Parameters:

channelJoined(self, channel)

source code 

Called when the server has accepted a channel join request.

Parameters:
  • channel - The channel the client has joined.

channelLeft(self, channel)

source code 

Called when the server has accepted a channel leave request.

Parameters:
  • channel - The channel the client has left.

channelUserJoined(self, channel, client)

source code 

Called when a client has joined the channel.

Parameters:
  • channel - The channel the client has joined.

channelUserExists(self, channel, client)

source code 

Called when a client exists in the channel.

Parameters:
  • channel - The channel the client exists in.

channelUserLeft(self, channel, client)

source code 

Called when a client has left the channel.

Parameters:
  • channel - The channel the client has left.

channelUserChanged(self, channel, client)

source code 

Called when a client in the channel has changed name.

Parameters:
  • channel - The channel the client resides in.