Added a new server_connect() method to portalsessionhandler, in preparation for shifting irc/imc2/rss into the portal.
This commit is contained in:
parent
59328c9d43
commit
077f44980a
2 changed files with 32 additions and 96 deletions
|
|
@ -4,6 +4,7 @@ Sessionhandler for portal sessions
|
|||
import time
|
||||
from src.server.sessionhandler import SessionHandler, PCONN, PDISCONN
|
||||
|
||||
_MOD_IMPORT = None
|
||||
|
||||
#------------------------------------------------------------
|
||||
# Portal-SessionHandler class
|
||||
|
|
@ -67,6 +68,32 @@ class PortalSessionHandler(SessionHandler):
|
|||
self.portal.amp_protocol.call_remote_ServerAdmin(sessid,
|
||||
operation=PDISCONN)
|
||||
|
||||
|
||||
def server_connect(self, protocol_class_path):
|
||||
"""
|
||||
Called by server to force the initialization of a new
|
||||
protocol instance. Server wants this instance to get
|
||||
a unique sessid and to be connected back as normal. This
|
||||
is used to initiate irc/imc2/rss etc connections.
|
||||
|
||||
protocol_class_path - full python path to the class factory
|
||||
for the protocol used, eg
|
||||
'src.server.portal.irc.IRCClient'
|
||||
The given class will be instantiated with this handler
|
||||
in a property sessionhandler. It must have a
|
||||
connectionMade() method, responsible for configuring
|
||||
itself and then calling self.sessionhandler.connect(self)
|
||||
like any other protocol.
|
||||
"""
|
||||
global _MOD_IMPORT
|
||||
if not _MOD_IMPORT:
|
||||
from src.utils.utils import variable_from_module as _MOD_IMPORT
|
||||
path, clsname = protocol_class_path.rsplit(".", 1)
|
||||
cls = _MOD_IMPORT(path, clsname)
|
||||
protocol = cls()
|
||||
protocol.sessionhandler = self
|
||||
protocol.connectionMade()
|
||||
|
||||
def server_disconnect(self, sessid, reason=""):
|
||||
"""
|
||||
Called by server to force a disconnect by sessid
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue