Package lacewing :: Package moo :: Module server :: Class MooServerProtocol
[frames] | no frames]

Class MooServerProtocol

source code

twisted.internet.protocol.BaseProtocol --+        
                                         |        
        twisted.internet.protocol.Protocol --+    
                                             |    
                          protocol.MooProtocol --+
                                                 |
                                                MooServerProtocol

Instance Methods
 
connectionMade(self)
Called when a connection is made.
source code
 
connectionLost(self, reason)
Called when the connection is shut down.
source code
 
loaderReceived(self, loader)
Called upon receiving a packet from the other end.
source code
 
acceptConnection(self)
Return False to stop the server from sending a welcome to the client
source code
 
acceptNameChange(self, oldName, newName)
Return False to decline the client to change it's name (after setting the inital name)
source code
 
acceptChannelJoin(self, channelName)
Return False to stop the client from joining the specified channel
source code
 
acceptChannelMessage(self, channel, message, subchannel)
Return False to stop the channel message from being sent to the other channel members
source code
 
acceptPrivateMessage(self, channel, connection, message, subchannel)
Return False to stop the private message from reaching the recipient
source code
 
acceptChannelLeave(self, channel)
Return False to stop the client from leaving the specified channel
source code
 
connectionAccepted(self)
Called when the connection has been accepted, and the client notified.
source code
 
nameSet(self, name)
Called after the name has been set
source code
 
nameChanged(self, oldName, newName)
Called when the client has changed name
source code
 
messageReceived(self, message, subchannel)
Called upon receiving a client message.
source code
 
channelJoined(self, channel)
Called when the client has been let into a channel
source code
 
channelMessageReceived(self, channel, message, subchannel)
Called after a channel message has been relayed.
source code
 
privateMessageReceived(self, channel, player, message, subchannel)
Called after a private message has been relayed.
source code
 
channelLeft(self, channel)
Called when the client has left a channel
source code
 
getHost(self)
This method returns the IP address of the connection.
source code
 
changeName(self, name) source code
 
sendMessage(value, subchannel, type=None)
Sends a message to the other end
source code
 
sendChannelMessage(self, channel, *arg, **kw) source code
 
joinChannel(self, channelName) source code
 
leaveChannel(self, channel) source code

Inherited from protocol.MooProtocol: __init__, dataReceived, sendLoader

Inherited from twisted.internet.protocol.Protocol: __provides__

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

Class Variables

Inherited from protocol.MooProtocol: channels, id, isAccepted, name

Inherited from twisted.internet.protocol.Protocol: __implemented__

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

Method Details

connectionMade(self)

source code 

Called when a connection is made.

This may be considered the initializer of the protocol, because it is called when the connection is completed. For clients, this is called once the connection to the server has been established; for servers, this is called after an accept() call stops blocking and a socket has been received. If you need to send any greeting or initial message, do it here.

Overrides: twisted.internet.protocol.BaseProtocol.connectionMade
(inherited documentation)

connectionLost(self, reason)

source code 

Called when the connection is shut down.

Clear any circular references here, and any external references to this Protocol. The connection has been closed.

Overrides: twisted.internet.protocol.Protocol.connectionLost
(inherited documentation)

loaderReceived(self, loader)

source code 

Called upon receiving a packet from the other end.

Overrides: protocol.MooProtocol.loaderReceived
(inherited documentation)

messageReceived(self, message, subchannel)

source code 

Called upon receiving a client message.

Parameters:

channelMessageReceived(self, channel, message, subchannel)

source code 

Called after a channel message has been relayed.

Parameters:
  • message (lacewing.moo.packetloaders.message.Message object)

privateMessageReceived(self, channel, player, message, subchannel)

source code 

Called after a private message has been relayed.

Parameters:
  • message (lacewing.moo.packetloaders.message.Message object)

getHost(self)

source code 

This method returns the IP address of the connection. Override if you would like to hide/edit the IP