Skip to content

Commit

Permalink
Merge pull request #220 from smilechaser/feature-login_disconnect
Browse files Browse the repository at this point in the history
Fix for #219
  • Loading branch information
nickelpro committed Mar 23, 2016
2 parents 2787cca + 92149bb commit 2cbebd1
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions spockbot/plugins/core/net.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ class NetPlugin(PluginBase):
'SOCKET_ERR': 'handle_err',
'SOCKET_HUP': 'handle_hup',
'PLAY<Disconnect': 'handle_disconnect',
'LOGIN<Disconnect': 'handle_login_disconnect',
'HANDSHAKE>Handshake': 'handle_handshake',
'LOGIN<Login Success': 'handle_login_success',
'LOGIN<Set Compression': 'handle_comp',
Expand Down Expand Up @@ -259,6 +260,13 @@ def handle_disconnect(self, name, packet):
logger.debug("NETPLUGIN: Disconnected: %s", packet.data['reason'])
self.event.emit('net_disconnect', packet.data['reason'])

def handle_login_disconnect(self, name, packet):

reason = packet.data.get('json_data', {}).get('text', '???')

logger.debug("NETPLUGIN: Disconnected: %s", reason)
self.event.emit('net_disconnect', reason)

# Kill event - Try to shutdown the socket politely
def handle_kill(self, name, data):
if self.net.connected:
Expand Down

0 comments on commit 2cbebd1

Please sign in to comment.