%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__/basesupport.cpython-312.pyc

�

Ϫ�f%����dZddlmZddlmZddlmZmZddlm	Z	ddl
mZddlm
Z
ddlmZmZGd	�d
�ZGd�d�ZGd
�d�ZGd�de	j(�Zy)zyInstance Messenger base classes for protocol support.

You will find these useful if you're adding a new protocol to IM.
�)�Type)�error)�Protocol�connectionDone)�styles)�Failure��prefixedMethods)�OFFLINE�OfflineErrorc�B�eZdZd�Zd�Zd�Zd�Zd�Zdefd�Z	defd�Z
y	)
�
AbstractGroupc� �||_||_y�N)�name�account)�selfrrs   �>/usr/lib/python3/dist-packages/twisted/words/im/basesupport.py�__init__zAbstractGroup.__init__s����	����c��t|d�S)z�finds group commands

        these commands are methods on me that start with imgroup_; they are
        called with no arguments
        �imgroup_r	�rs r�getGroupCommandszAbstractGroup.getGroupCommandss���t�Z�0�0rc��t|d�S)a(finds group commands

        these commands are methods on me that start with imgroup_; they are
        called with a user present within this room as an argument

        you may want to override this in your group in order to filter for
        appropriate commands on the given user
        �	imtarget_r	)r�targets  r�getTargetCommandszAbstractGroup.getTargetCommands#s���t�[�1�1rc��|jjst�|jjj|j�yr)r�clientr�	joinGrouprrs r�joinzAbstractGroup.join.s1���|�|�"�"��������%�%�d�i�i�0rc��|jjst�|jjj|j�yr)rr r�
leaveGrouprrs r�leavezAbstractGroup.leave3s1���|�|�"�"��������&�&�t�y�y�1r�returnc�<�d|j�d|j�d�S)N�<� �>)�	__class__rrs r�__repr__zAbstractGroup.__repr__8s ���4�>�>�"�!�D�I�I�=��2�2rc�L�|j�d|jj��S�N�@�rr�accountNamers r�__str__zAbstractGroup.__str__;�"���)�)��A�d�l�l�6�6�7�8�8rN)�__name__�
__module__�__qualname__rrrr"r%�strr,r2�rrrrs3���1�	2�1�
2�
3�#�3�9��9rrc�6�eZdZd�Zd�Zd�Zdefd�Zdefd�Zy)�AbstractPersonc�6�||_||_t|_yr)rrr�status)rr�baseAccounts   rrzAbstractPerson.__init__@s����	�"�����rc��t|d�S)z�finds person commands

        these commands are methods on me that start with imperson_; they are
        called with no arguments
        �	imperson_r	rs r�getPersonCommandsz AbstractPerson.getPersonCommandsEs���t�[�1�1rc��y)z#
        Returns a string.
        z--r8rs r�getIdleTimezAbstractPerson.getIdleTimeMs��rr&c�V�d|j�d|j�d|j�d�S)Nr(r)�/r*)r+rr<rs rr,zAbstractPerson.__repr__Ss*���4�>�>�"�!�D�I�I�=��$�+�+��a�@�@rc�L�|j�d|jj��Sr.r0rs rr2zAbstractPerson.__str__Vr3rN)	r4r5r6rr@rBr7r,r2r8rrr:r:?s+���
2��A�#�A�9��9rr:c�L�eZdZUdZdZeeed<d�Zd�Z	e
fdeddfd�Zd	�Z
y)
�AbstractClientMixinz�Designed to be mixed in to a Protocol implementing class.

    Inherit from me first.

    @ivar _logonDeferred: Fired when I am done logging in.
    N�
_protoBasec��|jjD]%}t|t�s�||j_n	||_||_||_yr)r+�	__bases__�
issubclassrrHr�chat�_logonDeferred)rr�chatui�
logonDeferred�bases     rrzAbstractClientMixin.__init__dsO���N�N�,�,�	�D��$��)�,0����)��	�

������	�+��rc�:�|jj|�yr)rH�connectionMaders rrRz"AbstractClientMixin.connectionMadeos�����&�&�t�,r�reasonr&c��|jj||�|j�|jj	||�Sr)r�_clientLost�unregisterAsAccountClientrH�connectionLost�rrSs  rrWz"AbstractClientMixin.connectionLostrs9����� � ��v�.��&�&�(����-�-�d�F�;�;rc�:�|jj|�y)z*Tell the chat UI that I have `signed off'.N)rL�unregisterAccountClientrs rrVz-AbstractClientMixin.unregisterAsAccountClientws���	�	�)�)�$�/r)r4r5r6�__doc__rHrr�__annotations__rrRrrrWrVr8rrrGrGZs>���"&�J��X��%�	,�-�0>�<�W�<�$�<�
0rrGc�v�eZdZdZdZdZdZeZe	Z
dZd�Zd�Z
d�Zd�Zd	�Zd
�Zd�Zd�Zd
�Zd�Zd�Zdefd�Zy)�AbstractAccountaBase class for Accounts.

    I am the start of an implementation of L{IAccount<interfaces.IAccount>}, I
    implement L{isOnline} and most of L{logOn}, though you'll need to implement
    L{_startLogOn} in a subclass.

    @cvar _groupFactory: A Callable that will return a L{IGroup} appropriate
        for this account type.
    @cvar _personFactory: A Callable that will return a L{IPerson} appropriate
        for this account type.

    @type _isConnecting: boolean
    @ivar _isConnecting: Whether I am in the process of establishing a
    connection to the server.
    @type _isOnline: boolean
    @ivar _isOnline: Whether I am currently on-line with the server.

    @ivar accountName:
    @ivar autoLogin:
    @ivar username:
    @ivar password:
    @ivar host:
    @ivar port:
    rN�c�t�||_||_||_||_||_||_i|_i|_yr)r1�	autoLogin�username�password�host�port�_groups�_persons)rr1rarbrcrdres       rrzAbstractAccount.__init__�s;��&���"��� ��
� ��
���	���	������
rc�F�dD]}t||�r�t||i��y)N)rfrg)�hasattr�setattr)r�ks  r�upgrateToVersion2z!AbstractAccount.upgrateToVersion2�s'��(�	%�A��4��#���a��$�	%rc�x�tjj|�}dD]}	||=�|S#t$rY�wxYw)N)r �	_isOnline�
_isConnecting)r�	Versioned�__getstate__�KeyError)r�staterks   rrqzAbstractAccount.__getstate__�sN��� � �-�-�d�3��9�	�A�
��!�H�	�
����
��
�s�-�	9�9c��|jSr)rnrs r�isOnlinezAbstractAccount.isOnline�s���~�~�rc�2�|jsw|jskd|_|j|�}|j|j�|j|j
�|j
|j�|Stjd��)a=Log on to this account.

        Takes care to not start a connection if a connection is
        already in progress.  You will need to implement
        L{_startLogOn} for this to work, and it would be a good idea
        to override L{_loginFailed} too.

        @returntype: Deferred L{interfaces.IClient}
        �zConnection in progress)
rorn�_startLogOn�addCallback�	_cb_logOn�registerAccountClient�
addErrback�_loginFailedr�ConnectError)rrN�ds   r�logOnzAbstractAccount.logOn�sx���"�"�T�^�^�!"�D��� � ��(�A�
�M�M�$�.�.�)�
�M�M�&�6�6�7�
�L�L��*�*�+��H��$�$�%=�>�>rc��|jj|�}|�!|j||�}||j|<|S)zkGroup factory.

        @param name: Name of the group on this account.
        @type name: string
        )rf�get�
_groupFactory)rr�groups   r�getGroupzAbstractAccount.getGroup�sB����� � ��&���=��&�&�t�T�2�E�!&�D�L�L����rc��|jj|�}|�!|j||�}||j|<|S)zmPerson factory.

        @param name: Name of the person on this account.
        @type name: string
        )rgr��_personFactory)rr�persons   r�	getPersonzAbstractAccount.getPerson�sB�����"�"�4�(���>��(�(��t�4�F�"(�D�M�M�$���
rc��t��)z{Start the sign on process.

        Factored out of L{logOn}.

        @returntype: Deferred L{interfaces.IClient}
        )�NotImplementedError)rrNs  rrxzAbstractAccount._startLogOn�s
��"�#�#rc�0�d|_d|_||_|S)Nrrw)rornr )rr s  rrzzAbstractAccount._cb_logOn�s������������
rc�"�d|_d|_|S)z�Errorback for L{logOn}.

        @type reason: Failure

        @returns: I{reason}, for further processing in the callback chain.
        @returntype: Failure
        r)rornrXs  rr}zAbstractAccount._loginFailed�s���������
rc�0�d|_d|_d|_|S)Nr)r rorn)rr rSs   rrUzAbstractAccount._clientLosts������������
rr&c��dj|j|j|j|j|j
�S)Nz<{}: {} ({}@{}:{})>)�formatr+r1rbrdrers rr,zAbstractAccount.__repr__s:��$�+�+��N�N�����M�M��I�I��I�I�
�	
r)r4r5r6r[rnror rr�r:r��persistanceVersionrrlrqrur�r�r�rxrzr}rUr7r,r8rrr^r^|sk���2�I��M�
�F�!�M�#�N���	�%���?�.
�
�$��
��
�#�
rr^N)r[�typingr�twisted.internetr�twisted.internet.protocolrr�twisted.persistedr�twisted.python.failurer�twisted.python.reflectr
�twisted.words.im.localsrrrr:rGrpr^r8rr�<module>r�sU����"�>�$�*�2�9�
&9�&9�R9�9�60�0�DW
�f�&�&�W
r

Zerion Mini Shell 1.0