

def streamStarted(self, rootElement):
    '\n        Called by the stream when it has started.\n\n        This examines the default namespace of the incoming stream and whether\n        there is a requested hostname for the component. Then it generates a\n        stream identifier, sends a response header and adds an observer for\n        the first incoming element, triggering L{onElement}.\n        '
    xmlstream.ListenAuthenticator.streamStarted(self, rootElement)
    if (rootElement.defaultUri != self.namespace):
        exc = error.StreamError('invalid-namespace')
        self.xmlstream.sendStreamError(exc)
        return
    if (not self.xmlstream.thisEntity):
        exc = error.StreamError('improper-addressing')
        self.xmlstream.sendStreamError(exc)
        return
    self.xmlstream.sendHeader()
    self.xmlstream.addOnetimeObserver('/*', self.onElement)

dataset/ETHPy150Open kuri65536/python-for-android/python-modules/twisted/twisted/words/protocols/jabber/component.py ListenComponentAuthenticator.streamStarted/original