%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3/dist-packages/twisted/words/im/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3/dist-packages/twisted/words/im/__pycache__/pbsupport.cpython-312.pyc

�

Ϫ�f�%���dZddlmZddlmZmZddlmZddlm	Z	ddl
mZddlm
Z
mZddlmZmZmZGd	�d
e
j&�Zeej*�Gd�de
j,��ZGd
�dej0e
j2�Zedd�Zeej8�Gd�de
j:��Zy)z2
L{twisted.words} support for Instance Messenger.
�)�implementer)�defer�error)�log)�Failure)�pb)�basesupport�
interfaces)�AWAY�OFFLINE�ONLINEc�4�eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	y)	�TwistedWordsPersonzHI a facade for a person you can talk to through a twisted.words service.c�\�tjj|||�t|_y�N)r	�AbstractPerson�__init__r�status)�self�name�wordsAccounts   �</usr/lib/python3/dist-packages/twisted/words/im/pbsupport.pyrzTwistedWordsPerson.__init__s!���"�"�+�+�D�$��E����c�R�|jtk(xs|jtk(Sr)rr
r�rs r�isOnlinezTwistedWordsPerson.isOnlines�����v�%�?�4�;�;�$�+>�?rc��|jSr)rrs r�	getStatuszTwistedWordsPerson.getStatuss���{�{�rc�4�|r\|jjjj|j||�}|j|jd|z�|S|jjjjd|j|�S)zReturn a deferred...�* �
directMessage)�account�client�perspectiver!r�
addErrback�metadataFailed�
callRemote�r�text�metadata�ds    r�sendMessagezTwistedWordsPerson.sendMessage!sx������#�#�/�/�=�=�d�i�i��x�X�A�
�L�L��,�,�d�T�k�:��H��<�<�&�&�2�2�=�=�����D��
rc��td|d|�|jjjj	|j
|�S)N�result:�text:)�printr"r#r$r!r�r�resultr)s   rr&z!TwistedWordsPerson.metadataFailed,s7��
�i���$�/��|�|�"�"�.�.�<�<�T�Y�Y��M�Mrc�d�||_|jj�j|�yr)r�chat�getContactsList�setContactStatus)rrs  r�	setStatuszTwistedWordsPerson.setStatus0s$������	�	�!�!�#�4�4�T�:rN)
�__name__�
__module__�__qualname__�__doc__rrrr,r&r7�rrrrs%��R��@��	�N�;rrc�8�eZdZd�Zd	d�Zd�Zd�Zd�Zd�Zd�Z	y)
�TwistedWordsGroupc�T�tjj|||�d|_y�Nr)r	�
AbstractGroupr�joined)rr�wordsClients   rrzTwistedWordsGroup.__init__7s!���!�!�*�*�4��{�C���rNc�6�|r]|jjjjd|j||�}|j|jd|z�|S|jjjjd|j|�S)zReturn a deferred.�groupMessager )r"r#r$r'rr%r&r(s    r�sendGroupMessagez"TwistedWordsGroup.sendGroupMessage;s�������#�#�/�/�:�:���	�	�4���A�
�L�L��,�,�d�T�k�:��H��<�<�&�&�2�2�=�=���	�	�4��
rc��|jjjjd||jjd�|j�y)N�setGroupMetadata)�topic�topic_author�r"r#r$r'r)rr)s  r�setTopiczTwistedWordsGroup.setTopicIs<�������'�'�2�2���D�K�K�,<�,<�=��I�I�	
rc��td|d|�|jjjj	d|j
|�S)Nr.r/rE)r0r"r#r$r'rr1s   rr&z TwistedWordsGroup.metadataFailedPs>��
�i���$�/��|�|�"�"�.�.�9�9��D�I�I�t�
�	
rc��d|_y)N��rBrs r�joiningzTwistedWordsGroup.joiningV�	����rc��d|_yr@rPrs r�leavingzTwistedWordsGroup.leavingYrRrc�v�|jjjjd|j�S�N�
leaveGrouprKrs r�leavezTwistedWordsGroup.leave\s)���|�|�"�"�.�.�9�9�,��	�	�R�Rrr)
r8r9r:rrFrLr&rQrTrXr<rrr>r>5s&����
�
���Srr>c��eZdZdZdd�Zd�Zd�Zd�Zd�Zd�Z	dd	�Z
d
�Zd�Zd�Z
dd
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zy)�TwistedWordsClientz�In some cases, this acts as an Account, since it a source of text
    messages (multiple Words instances may be on a single PB connection)
    Nc��dj|j||�|_||_td||�||_||_||_y)Nz
{} ({}:{})zHELLO I AM A PB SERVICE)�format�accountNamerr0r4r"�_logonDeferred)r�acct�serviceName�perspectiveName�chatuir^s      rrzTwistedWordsClient.__init__esP��'�.�.������
���
$��	�
�'��o�F���	����,��rc�:�|jj||�Sr)r4�	getPerson�rrs  rrdzTwistedWordsClient.getPersonqs���y�y�"�"�4��.�.rc�:�|jj||�Sr)r4�getGroupres  rrgzTwistedWordsClient.getGroupts���y�y�!�!�$��-�-rc�V�|jj|j|��Sr)r4�getGroupConversationrgres  rriz'TwistedWordsClient.getGroupConversationws ���y�y�-�-�d�m�m�D�.A�B�Brc�<�|jjd|�y)N�
addContact)r$r'res  rrkzTwistedWordsClient.addContactzs�����#�#�L�$�7rc�^�td||�|j|�j|�y)Nzreceived group members:)r0ri�setGroupMembers)r�names�groups   r�remote_receiveGroupMembersz-TwistedWordsClient.remote_receiveGroupMembers}s(��
�'���6��!�!�%�(�8�8��?rc�f�td||||�|j|�j|||�y)Nzreceived a group message)r0ri�showGroupMessage)r�senderro�messager*s     r�remote_receiveGroupMessagez-TwistedWordsClient.remote_receiveGroupMessage�s0��
�(�&�%��(�K��!�!�%�(�9�9�&�'�8�Trc�^�td||�|j|�j|�y)Nz
member joined)r0ri�memberJoined�r�memberros   r�remote_memberJoinedz&TwistedWordsClient.remote_memberJoined�s'��
�o�v�u�-��!�!�%�(�5�5�f�=rc�Z�td�|j|�j|�y)Nzmember left)r0ri�
memberLeftrxs   r�remote_memberLeftz$TwistedWordsClient.remote_memberLeft�s#��
�m���!�!�%�(�3�3�F�;rc�Z�|jj||�j|�yr�r4rdr7)rrrs   r�remote_notifyStatusChangedz-TwistedWordsClient.remote_notifyStatusChanged�s!���	�	���D�$�'�1�1�&�9rc��|jj|jj||��j||�yr)r4�getConversationrd�showMessage)rrrtr*s    r�remote_receiveDirectMessagez.TwistedWordsClient.remote_receiveDirectMessage�s5���	�	�!�!�$�)�)�"5�"5�d�D�"A�B�N�N��X�	
rc�n�|D]0\}}|jj||�j|��2yrr)r�clistrrs    r�remote_receiveContactListz,TwistedWordsClient.remote_receiveContactList�s4��!�	>�L�D�&��I�I����d�+�5�5�f�=�	>rc�v�d|vr5|j|�j|d|jdd��yy)NrIrJ)rirL�get)r�dict_�	groupNames   r�remote_setGroupMetadataz*TwistedWordsClient.remote_setGroupMetadata�s<���e���%�%�i�0�9�9��g���	�	�.�$� ?�
�rc��|j|�j�|jjd|�j	|j
|�S)N�	joinGroup)rgrQr$r'�addCallback�_cbGroupJoinedres  rr�zTwistedWordsClient.joinGroup�sH���
�
�d��#�#�%����*�*�;��=�I�I�����
�	
rc��|j|�j�|jjd|�j	|j
|�SrV)rgrTr$r'r��_cbGroupLeftres  rrWzTwistedWordsClient.leaveGroup�sH���
�
�d��#�#�%����*�*�<��>�J�J����t�
�	
rc��|jj|j|��}|jdd�|jjd|�y)N�sysz
you joined�getGroupMembers)r4rirgrrr$r'�rr2r�	groupConvs    rr�z!TwistedWordsClient._cbGroupJoined�sF���I�I�2�2�4�=�=��3F�G�	��"�"�5�,�7����#�#�$5�t�<rc��td|�|jj|j|�d�}|j	dd�y)N�leftrOr�zyou left)r0r4rirgrrr�s    rr�zTwistedWordsClient._cbGroupLeft�s;��
�f�d���I�I�2�2�4�=�=��3F��J�	��"�"�5�*�5rc��td|�|j�|jj|�||_|jj�y)NzConnected Words Client!)r0r^�callbackr$r4r5)rr$s  r�	connectedzTwistedWordsClient.connected�sE��
�'��5����*����(�(��.�&����	�	�!�!�#rr)r8r9r:r;rrdrgrirkrprurzr}r�r�r�r�r�rWr�r�r�r<rrrZrZ`sd���
-�/�.�C�8�@�U�>�<�:�
�
>��
�
�=�
6�
$rrZN)�
twisted.wordsztwisted.realityc�F�eZdZdZeZeZ	d
d�Zd�Z	d�Z
d�Zd�Zd�Z
d	�Zy)�	PBAccount�PBNc	���tjj|||||||�g|_|sdd|fg}|D]+\}}	}
|jj	t
||	|
g��-y)z_
        @param username: The name of your PB Identity.
        @type username: string
        r�N)r	�AbstractAccountr�services�append�pbFrontEnds)rr]�	autoLogin�username�password�host�portr��serviceTyper`ras           rrzPBAccount.__init__�sy��	�#�#�,�,��+�y�(�H�d�D�	
���
��(�/�8�D�E�H�9A�	�5�K��o��M�M� � ��[�)�;��H�
�	rc�����jsX�jsLd�_�j��}|j�j���fd�}|j|�|St
jd��)z
        @returns: this breaks with L{interfaces.IAccount}
        @returntype: DeferredList of L{interfaces.IClient}s
        rOc���|D]?\}}|r#�j|��j|��+tj|��Ayr)�registerAccountClient�	_cb_logOnr�err)�results�successr2rbrs   ��r�registerManyz%PBAccount.logOn.<locals>.registerMany�s>���'.�(�O�G�V���4�4�V�<����v�.������(rzConnection in progress)�
_isConnecting�	_isOnline�_startLogOnr%�_loginFailedr�r�ConnectionError)rrbr+r�s``  r�logOnzPBAccount.logOn�sh����"�"�T�^�^�!"�D��� � ��(�A�
�L�L��*�*�+�
(�
�M�M�,�'��H��'�'�(@�A�Arc��yrr<rs r�logOffzPBAccount.logOff�s��rc���tdd��tj|j|j�}|j|j|j|f��|S)Nz
Connecting...� ��end��callbackArgs)r0r�getObjectAtr�r��addCallbacks�_cbConnected�_ebConnected)rrbr+s   rr�zPBAccount._startLogOn�sI��
�o�3�'��N�N�4�9�9�d�i�i�0��	���t�(�(�$�*;�*;�6�)��T��rc���td�tdd��tj||j|j�}|j|j|j|f��|S)Nz
Connected!zIdentifying...r�r�r�)r0r�authIdentityr�r�r��_cbIdentr�)r�rootrbr+s    rr�zPBAccount._cbConnected�sR��
�l��
��C�(��O�O�D�$�-�-����?��	���t�}�}�d�&7�&7�v�i��P��rc��|s.td�|jttd���Std�g}|jD]d\}}}tj�}|j|�||||||�}|jd|||�j|j��ftj|�S)Nzfalsely identified.zusername or password incorrectzIdentified!�attach)r0r�r�	Exceptionr�r�Deferredr�r'r�r��DeferredList)	r�identrb�dl�handlerClass�sname�pnamer+�handlers	         rr�zPBAccount._cbIdents�����'�(��$�$��	�"B�C�D��
�	�m��
��*.�-�-�	�&�L�%����� �A��I�I�a�L�"�4���v�q�A�G����X�u�e�W�=�I�I��!�!�
�		��!�!�"�%�%rc��td�|S)NzNot connected.)r0)rrs  rr�zPBAccount._ebConnecteds��
����rr)r8r9r:�gatewayTyper>�
_groupFactoryr�_personFactoryrr�r�r�r�r�r�r<rrr�r��s<���K�%�M�'�N�PT��$B�4
���&�"rr�)r;�zope.interfacer�twisted.internetrr�twisted.pythonr�twisted.python.failurer�twisted.spreadr�twisted.words.imr	r
�twisted.words.im.localsrrr
rr�IGrouprAr>�
Referenceable�AbstractClientMixinrZr��IAccountr�r�r<rr�<module>r�s���
�
'�)��*��4�9�9�;��3�3�;�B
�Z�
�
��'S��1�1�'S� �'S�TZ$��)�)�;�+J�+J�Z$�z!3�t�L��
�Z�
 �
 �!�U��+�+�U�"�Ur

Zerion Mini Shell 1.0