'Called by the XmlStream when the stream has started.
This extends L{Authenticator.streamStarted} to extract further
information from the stream headers from C{rootElement}.'

def streamStarted(self, rootElement):

    Authenticator.streamStarted(self, rootElement)
    self.xmlstream.namespace = rootElement.defaultUri
    if rootElement.hasAttribute('to'):
        self.xmlstream.thisEntity = jid.internJID(rootElement['to'])
    self.xmlstream.prefixes = {}
    for (prefix, uri) in iteritems(rootElement.localPrefixes):
        self.xmlstream.prefixes[uri] = prefix
    self.xmlstream.sid = hexlify(randbytes.secureRandom(8)).decode('ascii')
