Example #1
0
class AbstractClientMixin:
    """Designed to be mixed in to a Protocol implementing class.

    Inherit from me first.

    @ivar _logonDeferred: Fired when I am done logging in.
    """
    def __init__(self, account, chatui, logonDeferred):
        for base in self.__class__.__bases__:
            if issubclass(base, Protocol):
                self.__class__._protoBase = base
                break
        else:
            pass
        from dreamIRCTools import MessagePipe
        self.pipe = MessagePipe()
        self.account = account
        self.chat = chatui
        self._logonDeferred = logonDeferred

    def connectionMade(self):
        self.pipe.add(_("Connected to IRC server"))
        self._protoBase.connectionMade(self)

    def connectionLost(self, reason):
        self.account._clientLost(self, reason)
        self.unregisterAsAccountClient()
        self.pipe.add("Uuuups... Connection lost... %s" % reason)
        return self._protoBase.connectionLost(self, reason)

    def unregisterAsAccountClient(self):
        """Tell the chat UI that I have `signed off'.
        """
        self.chat.unregisterAccountClient(self)
class AbstractClientMixin:
    """Designed to be mixed in to a Protocol implementing class.

    Inherit from me first.

    @ivar _logonDeferred: Fired when I am done logging in.
    """
    def __init__(self, account, chatui, logonDeferred):
        for base in self.__class__.__bases__:
            if issubclass(base, Protocol):
                self.__class__._protoBase = base
                break
        else:
            pass
        from dreamIRCTools import MessagePipe 
        self.pipe = MessagePipe()
        self.account = account
        self.chat = chatui
        self._logonDeferred = logonDeferred

    def connectionMade(self):
        self.pipe.add(_("Connected to IRC server"))
        self._protoBase.connectionMade(self)

    def connectionLost(self, reason):
        self.account._clientLost(self, reason)
        self.unregisterAsAccountClient()
        self.pipe.add("Uuuups... Connection lost... %s" % reason)
        return self._protoBase.connectionLost(self, reason)

    def unregisterAsAccountClient(self):
        """Tell the chat UI that I have `signed off'.
        """
        self.chat.unregisterAccountClient(self)
Example #3
0
 def __init__(self, account, chatui, logonDeferred):
     for base in self.__class__.__bases__:
         if issubclass(base, Protocol):
             self.__class__._protoBase = base
             break
     else:
         pass
     from dreamIRCTools import MessagePipe
     self.pipe = MessagePipe()
     self.account = account
     self.chat = chatui
     self._logonDeferred = logonDeferred
 def __init__(self, account, chatui, logonDeferred):
     for base in self.__class__.__bases__:
         if issubclass(base, Protocol):
             self.__class__._protoBase = base
             break
     else:
         pass
     from dreamIRCTools import MessagePipe 
     self.pipe = MessagePipe()
     self.account = account
     self.chat = chatui
     self._logonDeferred = logonDeferred