/usr/lib/python3/dist-packages/twisted/words/protocols/jabber/__pycache__
Edit: /usr/lib/python3/dist-packages/twisted/words/protocols/jabber/__pycache__/component.cpython-310.pyc (16242B)
o
bj; @ s d Z ddlmZ ddlmZ ddlmZ ddlmZ ddl m
Z
mZmZm
Z
ddlmZ ddlmZ d Zd
d ZG dd
d
ZG dd de
jZG dd de
jZeejG dd dejZG dd dejZdd ZG dd dZG dd de
j Z!dS )a
External server-side components.
Most Jabber server implementations allow for add-on components that act as a
separate entity on the Jabber network, but use the server-to-server
functionality of a regular Jabber IM server. These so-called 'external
components' are connected to the Jabber server using the Jabber Component
Protocol as defined in U{JEP-0114
}.
This module allows for writing external server-side component by assigning one
or more services implementing L{ijabber.IService} up to L{ServiceManager}. The
ServiceManager connects to the Jabber server and is responsible for the
corresponding XML stream.
)implementer)service)defer)log)errorijabber jstrports xmlstream) internJID)domishzjabber:component:acceptc C s t | |}t|S )z
XML stream factory for external server-side components.
@param componentid: JID of the component.
@type componentid: L{unicode}
@param password: password used to authenticate to the server.
@type password: C{str}
)ConnectComponentAuthenticatorr XmlStreamFactory)componentidpassworda r J/usr/lib/python3/dist-packages/twisted/words/protocols/jabber/component.pycomponentFactory! s
r c @ s( e Zd ZdZdd Zdd Zdd ZdS ) ComponentInitiatingInitializerz
External server-side component authentication initializer for the
initiating entity.
@ivar xmlstream: XML stream between server and component.
@type xmlstream: L{xmlstream.XmlStream}
c C s || _ d | _d S N)r _deferredselfxsr r r __init__7 s
z'ComponentInitiatingInitializer.__init__c C s` | j }t| j jdf}t |j|jj}|t | |
d| j || t
| _| jS )N handshakez
/handshake)r r Element namespacehashPasswordsid
authenticatorr
addContentstraddOnetimeObserver_cbHandshakesendr Deferredr )r r hsdigestr r r
initialize; s
z)ComponentInitiatingInitializer.initializec C s | j j| j _| jd d S r )r otherEntity
thisEntityr callback)r _r r r r$ G s z+ComponentInitiatingInitializer._cbHandshakeN)__name__
__module____qualname____doc__r r) r$ r r r r r . s
r c @ s$ e Zd ZdZeZdd Zdd ZdS )r z
Authenticator to permit an XmlStream to authenticate against a Jabber
server as an external component (where the Authenticator is initiating the
stream).
c C s t j| | || _dS )z
@type componentjid: C{str}
@param componentjid: Jabber ID that this component wishes to bind to.
@type password: C{str}
@param password: Password/secret this component uses to authenticate.
N)r ConnectAuthenticatorr r )r componentjidr r r r r W s
z&ConnectComponentAuthenticator.__init__c C s$ d|_ tj| | t|g|_d S )Nr r )versionr r2 associateWithStreamr initializersr r r r r6 c s z1ConnectComponentAuthenticator.associateWithStreamN)r. r/ r0 r1 NS_COMPONENT_ACCEPTr r r6 r r r r r N s
r c @ s<