%PDF- %PDF-
Mini Shell

Mini Shell

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

�

Ϫ�f����^�dZddlmZmZddlmZddlmZddlmZm	Z
mZddlm
Z
mZddlmZmZmZddlmZdd	lmZdd
lmZmZddlmZeej8�Gd�d
��Zeej<�Gd�d��ZdZ eejB�Gd�dejD��Z#Gd�dejH�Z%Gd�dejL�Z'eejB�Gd�dejP��Z)ejTe'e)�Gd�dejL�Z+eej8�Gd�dejP��Z,ejTe+e,�Gd�dejL�Z-eejB�Gd�d ejL��Z.ee.ej<ej^�Gd!�d"ejP�Z0ejTe.e0�eejbejd�Gd#�d$��Z3Gd%�d&e3�Z4gd'�Z5y())a
A module that needs a better name.

Implements new cred things for words.

How does this thing work?

  - Network connection on some port expecting to speak some protocol

  - Protocol-specific authentication, resulting in some kind of credentials object

  - twisted.cred.portal login using those credentials for the interface
    IUser and with something implementing IChatClient as the mind

  - successful login results in an IUser avatar the protocol can call
    methods on, and state added to the realm such that the mind will have
    methods called on it as is necessary

  - protocol specific actions lead to calls onto the avatar; remote events
    lead to calls onto the mind

  - protocol specific hangup, realm is notified, user is removed from active
    play, the end.
�)�ctime�time)�implementer)�	copyright)�credentials�error�portal)�defer�protocol)�failure�log�reflect)�registerAdapter)�pb)�ewords�iwords)�ircc�D�eZdZd�Zd�Zd�Zd�Zdd�Zd�Zd�Z	d	�Z
d
�Zy)�Groupc�4�||_i|_ddd�|_y)N�)�topic�topic_author)�name�users�meta��selfrs  �7/usr/lib/python3/dist-packages/twisted/words/service.py�__init__zGroup.__init__.s����	���
���
��	�c�@�tjt||��S�N)r�Failure�	Exception)r�err�ps   r�_ebUserCallzGroup._ebUserCall6s�����y��C�0�1�1r!c�|�|D]7\}}|r�	|j\}}|j||j���9yr#)�value�remove�getErrorMessage)r�results�success�result�userr&s      r�_cbUserCallzGroup._cbUserCall9s<��&�	9�O�G�V��"�L�L�	��c����D�#�"5�"5�"7�8�	9r!c�>�tjj|�sJdj|���|j|j
vr�g}||j
|j<|j
j
�D]V}||us�tj|j||�}|j|j|��|j|��Xtj|�j|j�tj d�S)Nz{!r} is not a chat client�r')r�IChatClient�
providedBy�formatrr�valuesr
�
maybeDeferred�
userJoined�
addErrbackr(�append�DeferredList�addCallbackr1�succeed)rr0�	additionsr'�ds     r�addz	Group.add?s����!�!�,�,�T�2�	
�4O�4V�4V��5
�	
�2��9�9�D�J�J�&��I�$(�D�J�J�t�y�y�!��Z�Z�&�&�(�
(���D�=��+�+�A�L�L�$��E�A��L�L��!1�!1�Q�L�7��$�$�Q�'�	
(�

���y�)�5�5�d�6F�6F�G��}�}�T�"�"r!Nc���	|j|j=g}|jj�D]W}||us�tj|j
|||�}|j
|j|��|j|��Ytj|�j|j�tjd�S#t$rY� wxYw�Nr3)rrr7r
r8�userLeftr:r(r;r<r=r1�KeyErrorr>)rr0�reason�removalsr'r@s      rr+zGroup.removeNs���	G��
�
�4�9�9�%��H��Z�Z�&�&�(�
'���D�=��+�+�A�J�J��d�F�K�A��L�L��!1�!1�Q�L�7��O�O�A�&�	
'�

���x�(�4�4�T�5E�5E�F��}�}�T�"�"���	��	�s�C�	C�Cc�R�tjt|j��Sr#)r
r>�lenr�rs r�sizez
Group.size]s���}�}�S����_�-�-r!c��||usJ�g}|jj�D]W}||us�tj|j|||�}|j|j|��|j|��Ytj|�j|j�tjd�SrC)rr7r
r8�receiver:r(r;r<r=r1r>)r�sender�	recipient�message�receivesr'r@s       rrMz
Group.receive`s����D� � � ������"�"�$�	#�A�����'�'��	�	�6�4��I�����T�-�-���3�����"�		#�
	���8�$�0�0��1A�1A�B��}�}�T�"�"r!c�v�||_g}|jj�D]Q}tj|j
||�}|j
|j|��|j|��Stj|�j|j�tjd�SrC)
rrr7r
r8�groupMetaUpdater:r(r;r<r=r1r>)rr�setsr'r@s     r�setMetadatazGroup.setMetadataks�����	������"�"�$�	�A��#�#�A�$5�$5�t�T�B�A�
�L�L��)�)�Q�L�/��K�K��N�	�	���4� �,�,�T�-=�-=�>��}�}�T�"�"r!c�H�t|jj��Sr#)�iterrr7rJs r�	iteruserszGroup.iterusersus���D�J�J�%�%�'�(�(r!r#)�__name__�
__module__�__qualname__r r(r1rAr+rKrMrUrX�r!rrr,s/��
�2�9�
#�
#�.�	#�#�)r!rc�@�eZdZdZdZd�Zd�Zd�Zd	d�Zd�Z	d�Z
d�Zy)
�UserNc�>�||_g|_t�|_yr#)r�groupsr�lastMessagers  rr z
User.__init__s����	�����6��r!c�>�||_||_t�|_yr#)�realm�mindr�signOn)rrcrds   r�loggedInz
User.loggedIn�s����
���	��f��r!c�f�����fd�}�j�j�j|�S)Nc�>���jj��|Sr#)r`r;�r/�grouprs ��r�cbJoinzUser.join.<locals>.cbJoin������K�K���u�%��Mr!)rArdr=)rrjrks`` r�joinz	User.join�s(���	��y�y����#�/�/��7�7r!c�h�����fd�}�j�j|�j|�S)Nc�>���jj��|Sr#)r`r+ris ��r�cbLeavezUser.leave.<locals>.cbLeave�rlr!)r+rdr=)rrjrFrps``  r�leavez
User.leave�s*���	��|�|�D�I�I�v�.�:�:�7�C�Cr!c�Z�t�|_|j|j||�Sr#)rrarMrd)rrOrPs   r�sendz	User.send�s%���6���� � ����I�w�?�?r!c�,�t|j�Sr#)rWr`rJs r�
itergroupszUser.itergroups�s���D�K�K� � r!c�N�|jddD]}|j|��yr#)r`rq)r�gs  r�logoutzUser.logout�s$�����Q��	�A��J�J�q�M�	r!r#)rYrZr[rcrdr rfrmrqrsrurxr\r!rr^r^zs1���E��D�"�
�
8�D�@�!�r!r^zNickServ!NickServ@servicesc��eZdZdZdZdZdZdZdZd�Z	d�Z
d�Zd�Zd-d�Z
d	�Zd
�ZdZdZd�Zd�Zd
�Zd�Zd�Zej0dfej2dfej4dfej6dfgZej:dfej<dfgZd�Z d�Z!d�Z"d�Z#d-d�Z$d-d�Z%d�Z&d�Z'd�Z(d�Z)d �Z*d!�Z+d"�Z,d#�Z-d$�Z.d%�Z/d&�Z0d'�Z1d(�Z2d)�Z3d*�Z4d+�Z5d,�Z6y).�IRCUserzM
    Protocol instance representing an IRC user connected to the server.
    N�utf-8c��|j|_|jj|_|jj|_yr#)�irc_NICKSERV_PRIVMSG�irc_PRIVMSG�factoryrcr�hostnamerJs r�connectionMadezIRCUser.connectionMade�s0���4�4����\�\�'�'��
��
�
����
r!c�L�|j�|j�d|_yyr#)rx�avatar�rrFs  r�connectionLostzIRCUser.connectionLost�s!���;�;�"��K�K�M��D�K�#r!c�^�d|vr|j|d<d|vr(|jj|j�|d<|||dgt	|�z}g}|D]4}t|t�r|jd�}|j|��6tjj|i|��y)N�prefix�tor{)r�r�encode�encoding�list�
isinstance�bytes�decoder;r�IRC�sendMessage)r�command�parameter_list�kw�arglist�arglistUnicode�args       rr�zIRCUser.sendMessage�s����2���=�=�B�x�L��r�>��y�y�'�'��
�
�6�B�t�H���"�T�(�+�d�>�.B�B�����	'�C��#�u�%��j�j��)���!�!�#�&�	'�	�����^�2�r�2r!c��|j|j�d|j�d|j��d|jz�y)N�!�@�#)rmrr��rrjr0s   rr9zIRCUser.userJoined�s6���	�	�T�Y�Y�K�q�����1�T�]�]�O�<�c�E�J�J�>N�Or!c��|j|j�d|j�d|j��d|jz|xsd�y)Nr�r�r��leaving)�partrr��rrjr0rFs    rrDzIRCUser.userLeft�sB���	�	��y�y�k��4�9�9�+�Q�t�}�}�o�6��%�*�*��
�
 �y�	
r!c�:�tjj|�rd|jz}n|j}|j	dd�}|j�D];}|j
|j�d|j�d|j��||��=y)Nr��textz<an unrepresentable message>r�r�)r�IGroupr5r�get�
splitlines�privmsgr�)rrNrOrP�
recipientNamer��Ls       rrMzIRCUser.receive�s����=�=�#�#�I�.��)�.�.�0�M�%�N�N�M��{�{�6�#A�B�����"�	�A��L�L��;�;�-�q����
�Q�t�}�}�o�>���
�	r!c
��d|vrU|d}|jdd�}|j|jd|jz||�d|�d|j���yy)Nrrrr�r�r�)r�rrr�)rrjrr�authors     rrSzIRCUser.groupMetaUpdate�sa���d�?���M�E��X�X�n�b�1�F��J�J��	�	��e�j�j� ���(�!�F�8�1�T�]�]�O�4�	
�r!c��|d|_y)z�
        Password message -- Register a password.

        Parameters: <password>

        [REQUIRED]

        Note that IRC requires the client send this *before* NICK
        and USER.
        ���N)�password�rr��paramss   r�irc_PASSzIRCUser.irc_PASSs���r�
��
r!c� �|d}	t|t�r|j|j�}||_
||_|jD].\}}|j|||jjz��0|j �|jt|d�y|j }d|_|j#||�y#t$r=|jtt|�d�|jj�YywxYw)zh
        Nick message -- Set your nickname.

        Parameters: <nickname>

        [REQUIRED]
        rz;Your nickname cannot be decoded. Please use ASCII or UTF-8.Nz	Password?)r�r�r�r��UnicodeDecodeErrorr��NICKSERV�repr�	transport�loseConnection�nicknamer�
_motdMessagesr�r�_serverInfor��logInAs)rr�r�r��coder�r�s       r�irc_NICKzIRCUser.irc_NICK
s����!�9��
	��(�E�*�#�?�?�4�=�=�9��!��
���	��,�,�	D�J�D�$����T�4�$�,�,�*B�*B�#B�C�	D��=�=� ��L�L��8�[�9��}�}�H� �D�M��L�L��8�,��)"�	��L�L���X��M�
�

�N�N�)�)�+��	�s�+C�AD
�D
c��|d|_y)zk
        User message -- Set your realname.

        Parameters: <user> <mode> <unused> <realname>
        r�N)�realnamer�s   r�irc_USERzIRCUser.irc_USER/s���r�
��
r!c��|d}|d}|j�|jj�y|j�dk7r"|j	t
|jd�y|j}d|_|j
||�y)�^
        Send a (private) message.

        Parameters: <msgtarget> <text to be sent>
        rr�N�nickservz1Denied.  Please send me (NickServ) your password.)r�r�r��lowerr�r�r�)rr�r��targetr�r�s      rr}zIRCUser.irc_NICKSERV_PRIVMSG:sw�������"�:���=�=� ��N�N�)�)�+�
�\�\�^�z�
)��L�L���
�
�C�
��}�}�H� �D�M��L�L��8�,r!c���|jjjtj||�|t
j�}|j|j|j|f��y)N)�errbackArgs)
rr	�loginr�UsernamePasswordr�IUser�addCallbacks�_cbLogin�_ebLogin)rr�r�r@s    rr�zIRCUser.logInAsQsR���L�L���%�%��(�(��8�<�d�F�L�L�
��	
���t�}�}�d�m�m�(���Mr!z:connected to Twisted IRCzA:Your host is %(serviceName)s, running version %(serviceVersion)sz,:This server was created on %(creationDate)sz&%(serviceName)s %(serviceVersion)s w nz(:- %(serviceName)s Message of the Day - z:End of /MOTD command.c���|\}}}|tjus
Jd|����|`||_||_|j
D].\}}|j
|||jjz��0y)NzRealm is buggy, got )	rr�r~r�rx�_welcomeMessagesr�rr�)rr/�ifacer�rxr�r�s       rr�zIRCUser._cbLoginns}��"(���������$�F�(<�U�I�&F�F�$�
���������/�/�	D�J�D�$����T�4�$�,�,�*B�*B�#B�C�	Dr!c��|jtj�r|jt|d�nx|jt
j�r|jt|d�nAtjd�tj|�|jt|d�|jj�y)Nz*Already logged in.  No pod people allowed!zLogin failed.  Goodbye.zUnhandled error during login:z"Server error during login.  Sorry.)�checkr�AlreadyLoggedInr�r��ecred�UnauthorizedLoginr
�msgr&r�r�)rr&r�s   rr�zIRCUser._ebLoginzs����9�9�V�+�+�,��L�L��(�$P�
��Y�Y�u�.�.�
/��L�L��8�-F�G��G�G�3�4��G�G�C�L��L�L��8�-Q�R����%�%�'r!c�V�|j�|jd|j�yy)zK
        Ping message

        Parameters: <server1> [ <server2> ]
        N�PONG)rcr�r�r�s   r�irc_PINGzIRCUser.irc_PING�s'���:�:�!����V�T�]�]�3�"r!c�8�|jj�y)z>
        Quit

        Parameters: [ <Quit Message> ]
        N)r�r�r�s   r�irc_QUITzIRCUser.irc_QUIT�s��	
���%�%�'r!c��|r!|jtjd�y|j|jd|jzd�y)N�:Unknown MODE flag.r��+)r�r�ERR_UNKNOWNMODE�channelModer)rrj�modes�argss    r�_channelModezIRCUser._channelMode�s;������S�0�0�2G�H����T�Y�Y��e�j�j�(8�#�>r!c���|r!|jtjd�y||jur!|jtjd�y|jtj
d�y)Nr�r�z(:You can't look at someone else's modes.)r�rr�r��RPL_UMODEIS�ERR_USERSDONTMATCH)rr0r�s   r�	_userModezIRCUser._userMode�sV������S�0�0�2G�H�
�T�[�[�
 ����S�_�_�c�2�����&�&�(R�
r!c	�$���	�d}t|t�r|j�j�}|jd�rO��fd�}�jj|dd�}|j�j|t�dd���y�fd�}�jj|�}|j�j|t�dd���y#t$r'�jtj�dd�YywxYw)	z�
        User mode message

        Parameters: <nickname>
        *( ( "+" / "-" ) *( "i" / "w" / "o" / "O" / "r" ) )

        rz2:No such nickname (could not decode your unicode!)Nr�c���|jtj��jtj
�dd�y)Nr�:That channel doesn't exist.��trapr�NoSuchGroupr�r�ERR_NOSUCHCHANNEL�r&r�rs ��r�ebGroupz!IRCUser.irc_MODE.<locals>.ebGroup�s5�������+�+�,�� � ��)�)�6�!�9�6T�r!�)�callbackArgsc�F���jtjd�y)Nz:No such nickname.�r�r�ERR_NOSUCHNICK)r&rs �r�ebUserz IRCUser.irc_MODE.<locals>.ebUser�s���� � ��!3�!3�5I�Jr!)r�r�r�r�r�r�rr��
startswithrc�lookupGroupr�r��tuple�
lookupUserr�)rr�r��
channelOrUserr�r@r�s` `    r�irc_MODEzIRCUser.irc_MODE�s����
	�"�1�I�M��-��/� -� 4� 4�T�]�]� C�
��#�#�C�(�
��
�
�&�&�}�Q�R�'8�9�A�
�N�N�4�,�,�g�E�&�QR�QS�*�DU�N�V�
K��
�
�%�%�m�4�A�
�N�N�4�>�>�6��f�Q�R�j�@Q�N�R��1"�	�����"�"��q�	�D�
�

�
	�s�0C�-D�Dc��y)zl
        Userhost message

        Parameters: <nickname> *( SPACE <nickname> )

        [Optional]
        Nr\r�s   r�irc_USERHOSTzIRCUser.irc_USERHOST�s��	
r!c������	|d�t�t�r�j�j��|d��jd�r�jj�dd�}n+�jj��jd��}��fd�}��fd	�}|j||�y#t$r'�jtj|dd�YywxYw)
r�rz6:No such nick/channel (could not decode your unicode!)Nr�r�r�c��|jSr#)rd)r0s r�<lambda>z%IRCUser.irc_PRIVMSG.<locals>.<lambda>�s
��T�Y�Y�r!c�F��|��jj|d�i�Sy)Nr�)r�rs)�targ�messageTextrs ��r�cbTargetz%IRCUser.irc_PRIVMSG.<locals>.cbTarget�s*������{�{�'�'��v�{�.C�D�D� r!c�H���jtj�d�y)Nz:No such nick/channel.r�)r&r�
targetNames ��r�ebTargetz%IRCUser.irc_PRIVMSG.<locals>.ebTarget�s������S�/�/��=U�Vr!)r�r�r�r�r�r�rr�r�rcr�r�r=r�)rr�r�r�rrrrs`     @@rr~zIRCUser.irc_PRIVMSG�s����
	����J��*�e�,�'�.�.�t�}�}�=�
��R�j��� � ��%��Z�Z�+�+�J�q�r�N�;�F��Z�Z�*�*�:�6�B�B�&��F�	E�	W�	���H�h�/��/"�	�����"�"��q�	�H�
�

�
	�s�0B4�4-C$�#C$c�h���	|d�t�t�r�j�j���jd�r�dd��fd�}��fd�}�jj��j||�y#t$r'�jtj|dd�YywxYw)zm
        Join message

        Parameters: ( <channel> *( "," <channel> ) [ <key> *( "," <key> ) ] )
        r�1:No such channel (could not decode your unicode!)Nr�r�c�f�����fd�}�jj��j|�S)Nc����j����j�jd�jz�j�D�cgc]}|j��c}��j	��ycc}w�Nr�)r9�namesrrX�
_sendTopic)�ignr0rjrs  ��rrkz1IRCUser.irc_JOIN.<locals>.cbGroup.<locals>.cbJoins\�������t�,��
�
��I�I��%�*�*�$�+0�?�?�+<�=�4�T�Y�Y�=��
����&��>s�
A6�r�rmr=)rjrkrs` �r�cbGroupz!IRCUser.irc_JOIN.<locals>.cbGroups*���
'��;�;�#�#�E�*�6�6�v�>�>r!c�N���jtjd�zd�y)Nr�z:No such channel.)r�rr��r&�	groupNamers ��rr�z!IRCUser.irc_JOIN.<locals>.ebGroups#�������%�%�s�Y��8K�
r!)r�r�r�r�r�r�rr�r�rc�getGroupr�)rr�r�rr�rs`    @r�irc_JOINzIRCUser.irc_JOIN�s����
	��q�	�I��)�U�+�%�,�,�T�]�]�;�	�����$�!�!�"�
�I�
	?�	�
	
�
�
���I�&�3�3�G�W�E��9"�	�����%�%��q�	�C�
�

�
	���0B�-B1�0B1c������	|d�t|dt�r|dj�j���jd�r�dd�t|�dkDr'|d�t�t�r�jd��nd���fd�}��fd�}�jj��j||�y#t$r'�jtj|dd�YywxYw)	zc
        Part message

        Parameters: <channel> *( "," <channel> ) [ <Part Message> ]
        rz:Could not decode your unicode!Nr�r�r{c�j������fd�}�jj���j|�S)Nc�,���j����yr#)rD)r/rjrFrs ���rrpz2IRCUser.irc_PART.<locals>.cbGroup.<locals>.cbLeave@s����
�
�e�T�6�2r!)r�rqr=)rjrprFrs` ��rrz!IRCUser.irc_PART.<locals>.cbGroup?s,���
3��;�;�$�$�U�F�3�?�?��H�Hr!c���|jtj��jtj
d�zd|j
�z�y)Nr��:)r�rr�r�r�ERR_NOTONCHANNELr,rs ��rr�z!IRCUser.irc_PART.<locals>.ebGroupEsB����H�H�V�'�'�(�����$�$�c�I�o�s�S�=P�=P�=R�7R�
r!)
r�r�r�r�r�r�rrr�rIrcr�r�)rr�r�rr�rrFs`    @@r�irc_PARTzIRCUser.irc_PART%s����	��q�	�I��&��)�U�+�"�1�I�,�,�T�]�]�;�	�����$�!�!�"�
�I��v�;��?��A�Y�F��&�%�(����w�/���F�	I�	�	
�
�
���y�)�6�6�w��H��9"�	�����$�$�f�Q�i�1R�
�
�		�s�6C�-C0�/C0c�h���	|d�t�t�r�j�j���jd�r�dd��fd�}��fd�}�jj��j||�y#t$r'�jtj|dd�YywxYw)zb
        Names message

        Parameters: [ <channel> *( "," <channel> ) [ <target> ] ]
        r�rNr�r�c����j�jd|jz|j�D�cgc]}|j��c}�ycc}wr)rrrX)rjr0rs  �rrz"IRCUser.irc_NAMES.<locals>.cbGroupes<����J�J��	�	�3����+�E�O�O�DU�-V�D�d�i�i�-V�
��-Vs�Ac���|jtj��j�jd�zg�yr)r�rr�rr�r&�channelrs ��rr�z"IRCUser.irc_NAMES.<locals>.ebGroupjs-����H�H�V�'�'�(��J�J�t�y�y�#��-��4r!)r�r�r�r�r�r�rr�r�rcr�r�)rr�r�rr�r"s`    @r�	irc_NAMESzIRCUser.irc_NAMESMs����
	��R�j�G��'�5�)�!�.�.����7�����c�"��a�b�k�G�	�
	5�
	
�
�
���w�'�4�4�W�g�F��+"�	�����%�%��r�
�C�
�

�
	�rc�`�	|d}t|dt�r|j|j�}|jd�r|dd}t|�dkDr|j||d�y|j|�y#t$r#|jtjd�YywxYw)zJ
        Topic message

        Parameters: <channel> [ <topic> ]
        rz<:That channel doesn't exist (could not decode your unicode!)Nr�r�)r�r�r�r�r�r�rr�r�rI�	_setTopic�	_getTopic)rr�r�r"s    r�	irc_TOPICzIRCUser.irc_TOPICqs���		��Q�i�G��&��)�U�+�!�.�.����7�����c�"��a�b�k�G��v�;��?��N�N�7�F�1�I�.��N�N�7�#��"�	�����%�%�N�
�
�	�s�3B�)B-�,B-c�`�|jjd�}|r�|jjd�xsd}|jjdd�}|j|jd|jz|�|j	|jd|jz||�yy)zP
        Send the topic of the given group to this user, if it has one.
        rrz<noone>�
topic_daterr�N)rr�rr�topicAuthor)rrjrr��dates     rr
zIRCUser._sendTopic�s����
�
���w�'����Z�Z�^�^�N�3�@�y�F��:�:�>�>�,��2�D��J�J�t�y�y�#��
�
�"2�E�:����T�Y�Y��e�j�j�(8�&�$�G�	r!c�~�����fd�}�jj��j�j|�y)Nc���|jtj��jtj
d�d�y�N�=r�r�r!s ��rr�z"IRCUser._getTopic.<locals>.ebGroup��3����H�H�V�'�'�(�����%�%�s�G�5S�
r!)rcr�r�r
)rr"r�s`` rr&zIRCUser._getTopic�s-���	�	
�
�
���w�'�4�4�T�_�_�g�Nr!c�x������fd�}��fd�}�jj��j||�y)Nc������jj�}�|d<�j|d<tt	��|d<��fd�}�j|�j
|�S)Nrrr)c�b���jtjd�jzd�y)Nr�z.:You need to be a channel operator to do that.)r�r�ERR_CHANOPRIVSNEEDEDr)r&rjrs ��r�ebSetz1IRCUser._setTopic.<locals>.cbGroup.<locals>.ebSet�s)���� � ��,�,��%�*�*�$�D�r!)r�copyr�intrrUr:)rj�newMetar5rrs`  ��rrz"IRCUser._setTopic.<locals>.cbGroup�s^����j�j�o�o�'�G�$�G�G��&*�i�i�G�N�#�$'���K�G�L�!�
��$�$�W�-�8�8��?�?r!c���|jtj��jtj
d�d�yr.r�r!s ��rr�z"IRCUser._setTopic.<locals>.ebGroup�r0r!)rcr�r�)rr"rrr�s```  rr%zIRCUser._setTopic�s/���
	@�	�	
�
�
���w�'�4�4�W�g�Fr!c��|D]4\}}}|jtj|t|�d|z��6|jtjd�y)z�
        Send a group of LIST response lines

        @type channels: C{list} of C{(str, int, str)}
        @param channels: Information about the channels being sent:
            their name, the number of participants, and their topic.
        rz
:End of /LISTN)r�r�RPL_LIST�str�RPL_LISTEND)r�channelsrrKrs     rr�zIRCUser.list�sP��"*�	I��D�$�����S�\�\�4��T��C�%�K�H�	I�������/�:r!c�:��|r�	|d}t|t�r|j�j�}|j	d�}g}|D]B}|jd�r|dd}|j�jj|���Dtj|d��}|jd	��n�jj!�}�fd
�}|j|�y#t
$r'�j
tj|dd�YywxYw)z�
        List query

        Return information about the indicated channels, or about all
        channels if none are specified.

        Parameters: [ <channel> *( "," <channel> ) [ <target> ] ]
        r�,rNr�r�T)�
consumeErrorsc�>�|D��cgc]
\}}|s�	|��c}}Scc}}wr#r\)�gs�s�rs   rr�z"IRCUser.irc_LIST.<locals>.<lambda>�s��2�*C��!�Q��1�*C���*Cs�
�c	����d�}tj|D�cgc]"}|j�j||���$c}�}|j�fd��|Scc}w)Nc�R�|j||jjd�fS)Nr)rrr�)rKrjs  r�gotSizez3IRCUser.irc_LIST.<locals>.cbGroups.<locals>.gotSize�s ���z�z�4�������)@�@�@r!c�^���j|D��cgc]
\}}|s�	|��c}}�Scc}}wr#)r�)r-rDrErs   �rr�z4IRCUser.irc_LIST.<locals>.cbGroups.<locals>.<lambda>�s%���$�)�)�W�4R�6�A�q�PQ�Q�4R�*S���4Rs�
)
�)
)r
r<rKr=)r`rHrjr@rs    �r�cbGroupsz"IRCUser.irc_LIST.<locals>.cbGroups�sV���
A��"�"�GM�N�e�����)�)�'�5�9�N��A�
�M�M�S�T��H��Os�'A)r�r�r�r��splitr�r�rr�r�r;rcr�r
r<r=ru)rr�r��allChannelsr>r`�chrJs`       r�irc_LISTzIRCUser.irc_LIST�s����
�$�Q�i���k�5�1�"-�"4�"4�T�]�]�"C�K�&�,�,�S�1���F��
:���=�=��%��A�B��B��
�
�d�j�j�4�4�R�8�9�
:�
�'�'��d�C�F����C�D��Z�Z�*�*�,�F�	�	���8�$��=&�
�� � ��)�)��1�I�G��
�

�s�AC*�*-D�Dc� �|j|jd|jz|j�D�cgc]G}|j|j|jj|jdd|jf��Ic}�ycc}w)Nr��Hr)�whorrXr�rc)rrj�ms   r�_channelWhozIRCUser._channelWho�sl������I�I��%�*�*�����*�
���������
�
�������a����P�
�	
��
s�ABc�D�|jtjd�y)Nz:User /WHO not implemented)r�r�RPL_ENDOFWHO�rr0s  r�_userWhozIRCUser._userWhos������)�)�+G�Hr!c�4���|s!�jtjd�y	|d�t�t�r�j�j���jd�rA��fd�}�jj�dd�}|j�j|�y��fd�}�jj��}|j�j|�y#t$r'�jtj|dd�YywxYw)	zC
        Who query

        Parameters: [ <mask> [ "o" ] ]
        z:/WHO not supported.Nrz2:End of /WHO list (could not decode your unicode!)r�c���|jtj��jtj
�d�y�Nz:End of /WHO list.)r�rr�r�rrU�r&r�rs ��rr�z IRCUser.irc_WHO.<locals>.ebGroup*s.�������+�+�,�� � ��!1�!1�=�BV�Wr!r�c���|jtj��jtj
�d�yrZ)r�r�
NoSuchUserr�rrUr[s ��rr�zIRCUser.irc_WHO.<locals>.ebUser2s.�������*�*�+�� � ��!1�!1�=�BV�Wr!)r�rrUr�r�r�r�r�r�rcr�r�rSr�rW)rr�r�r�r@r�r�s`     @r�irc_WHOzIRCUser.irc_WHO	s��������S�-�-�/E�F��
	�"�1�I�M��-��/� -� 4� 4�T�]�]� C�
��#�#�C�(�
X��
�
�&�&�}�Q�R�'8�9�A�
�N�N�4�+�+�W�5�
X��
�
�%�%�m�4�A�
�N�N�4�=�=�&�1��/"�	����� � ��q�	�D�
�

�
	�s�0C'�'-D�Dc�<����fd�}��fd�}	�d}t|t�r|j�j�}�jj|�j||�y#t$r'�jtj�dd�YywxYw)zV
        Whois query

        Parameters: [ <target> ] <mask> *( "," <mask> )
        c����j�j|j|j�jj|j�jjddtt	�|j
z
�|j|j�D�cgc]}d|jz��c}�ycc}w)NzHi mom!Fr�)�whoisrrcr7rrareru)r0rjrs  �r�cbUserz!IRCUser.irc_WHOIS.<locals>.cbUser@s�����J�J��	�	��	�	��	�	��
�
����	�	��
�
������D�F�T�-�-�-�.����/3���/@�A�e��u�z�z�!�A�
��Bs�!B?c���|jtj��jtj
�dd�y)Nr�:No such nick/channel)r�rr]r�rr�r�s ��rr�z!IRCUser.irc_WHOIS.<locals>.ebUserOs2����H�H�V�&�&�'����S�/�/����<S�Tr!rrdN)r�r�r�r�r�r�rr�rcr�r�)rr�r�rbr�r0s` `   r�	irc_WHOISzIRCUser.irc_WHOIS9s����
	�	U�	��!�9�D��$��&��{�{�4�=�=�1��
	
�
�
���d�#�0�0���@��	"�	����S�/�/����<S�T��	�s�0A+�+-B�Bc�D�|jtjd�y)zE
        Oper message

        Parameters: <name> <password>
        z:O-lines not applicableN)r�r�ERR_NOOPERHOSTr�s   r�irc_OPERzIRCUser.irc_OPER^s��	
����+�+�-F�Gr!r#)7rYrZr[�__doc__r`rxr�rcr�r�r�r�r9rDrMrSr�r�r�r�r�r}r�r�RPL_WELCOME�RPL_YOURHOST�RPL_CREATED�
RPL_MYINFOr��
RPL_MOTDSTART�
RPL_ENDOFMOTDr�r�r�r�r�r�r�r�r�r~rrr#r'r
r&r%r�rNrSrWr^rerhr\r!rrzrz�sl���
�F��F��F�
�E��H�(�
�3�P�
��"	��H��H�#� -�D	#�-�.N�

���5�6����O�	
�

���H�I�

�N�N�
5�		
���&

�	�	�F�G�	�	�	�4�5��M�

D�(�4�(�?��$S�L
�!0�F&F�P&I�P"G�H$�2	H�
O�G�6
;�2%�h
�I�.2�`"A�JHr!rzc��eZdZdZeZd�Zy)�
IRCFactorya
    IRC server that creates instances of the L{IRCUser} protocol.

    @ivar _serverInfo: A dictionary mapping:
        "serviceName" to the name of the server,
        "serviceVersion" to the copyright version,
        "creationDate" to the time that the server was started.
    c��||_||_|jjtjt�d�|_y)N)�serviceName�serviceVersion�creationDate)rcr	rr�versionrr�)rrcr	s   rr zIRCFactory.__init__ss3����
�����:�:�?�?�'�/�/�!�G�
��r!N)rYrZr[rirzrr r\r!rrqrqgs����H�
r!rqc�0�eZdZd�Zd�Zd�Zd�Zd�Zd�Zy)�PBMindc��yr#r\rJs rr zPBMind.__init__~���r!c��tjt�}t|t�r|jd�}||jj|�fS�Nr{)r�qualrxr�r<r��invoker�registerReference�r�jellierr}s   r�jellyForzPBMind.jellyFor�sB���|�|�F�#���d�C� ��;�;�w�'�D��W�_�_�6�6�t�<�<�<r!c��yr#r\)rr0rjs   r�remote_userJoinedzPBMind.remote_userJoined�rzr!c��yr#r\)rr0rjrFs    r�remote_userLeftzPBMind.remote_userLeft�rzr!c��yr#r\�rrNrOrPs    r�remote_receivezPBMind.remote_receive�rzr!c��yr#r\�rrjrs   r�remote_groupMetaUpdatezPBMind.remote_groupMetaUpdate�rzr!N)	rYrZr[r r�r�r�r�r�r\r!rrxrx}s ��
�=�
�
�
�
r!rxc�*�eZdZdZd�Zd�Zd�Zdd�Zy)�PBMindReferencerc�,�tjj|�r"t|j|j
|�}n!t
|j|j
|�}|jdt
|j|j
|�||�S)NrM)rr�r5�PBGrouprcr��PBUser�
callRemote)rrNrOrP�recs     rrMzPBMindReference.receive�sk���=�=�#�#�I�.��$�*�*�d�k�k�9�=�C�����T�[�[�)�<�C�����v�d�j�j�$�+�+�v�>��W�
�	
r!c�f�|jdt|j|j|�|�S)NrS)r�r�rcr�r�s   rrSzPBMindReference.groupMetaUpdate�s+������w�t�z�z�4�;�;��F��
�	
r!c	��|jdt|j|j|�t	|j|j|��S)Nr9�r�r�rcr�r�r�s   rr9zPBMindReference.userJoined�s>�������D�J�J����U�3��4�:�:�t�{�{�D�1�
�	
r!Nc	��|jdt|j|j|�t	|j|j|�|�S)NrDr�r�s    rrDzPBMindReference.userLeft�sA�������D�J�J����U�3��4�:�:�t�{�{�D�1��	
�	
r!r#)rYrZr[rrMrSr9rDr\r!rr�r��s��
�D�
�
�

�
r!r�c�,�eZdZd�Zd�Zd�Zdd�Zd�Zy)r�c�.�||_||_||_yr#)rcr�rj)rrcr�rjs    rr zPBGroup.__init__�s����
������
r!c��t|jj|jj|jjf�Sr#)�hashrcrr�rjrJs r�processUniqueIDzPBGroup.processUniqueID�s.���T�Z�Z�_�_�d�k�k�&6�&6��
�
���H�I�Ir!c�,�tj|j�}t|t�r|jd�}|jj}t|t�r|jd�}|||jj|�fSr|)
rr}�	__class__r�r<r�rjrr~r)rr�r}rjs    rr�zPBGroup.jellyFor�sm���|�|�D�N�N�+���d�C� ��;�;�w�'�D��
�
�����e�S�!��L�L��)�E��U�G�O�O�=�=�d�C�C�Cr!Nc�N�|jj|j|�Sr#)r�rqrjr�s  r�remote_leavezPBGroup.remote_leave�s���{�{� � ����V�4�4r!c�N�|jj|j|�Sr#)r�rsrj�rrPs  r�remote_sendzPBGroup.remote_send�s���{�{����
�
�G�4�4r!r#)rYrZr[r r�r�r�r�r\r!rr�r��s���
J�D�5�5r!r�c�F�eZdZd�Zdd�Zd�Zd�Zd�Zd�Zdd�Z	d	�Z
d
�Zy)�PBGroupReferencec���|\}}}||_ttk7r:t|jt�r |jj	d�|_t
jj||||g�Sr|)rr�r<r�r�r�RemoteReference�
unjellyFor)r�	unjellier�unjellyList�clsNamer�refs      rr�zPBGroupReference.unjellyFor�s^��(����s���	��C�<�J�t�y�y�%�8��	�	�(�(��1�D�I��!�!�,�,�T�9�w��n�M�Mr!Nc�&�|jd|�S)Nrq�r�r�s  rrqzPBGroupReference.leave�s�����w��/�/r!c�&�|jd|�S)Nrsr�r�s  rrszPBGroupReference.send�s�����v�w�/�/r!c��yr#r\rVs  rrAzPBGroupReference.add����r!c��yr#r\rJs rrXzPBGroupReference.iterusers�r�r!c��yr#r\r�s    rrMzPBGroupReference.receive�r�r!c��yr#r\)rr0rFs   rr+zPBGroupReference.remove�r�r!c��yr#r\)rrs  rrUzPBGroupReference.setMetadata�r�r!c��yr#r\rJs rrKzPBGroupReference.size�r�r!r#)rYrZr[r�rqrsrArXrMr+rUrKr\r!rr�r��s0��N�0�0�
�
�
�
�
�
r!r�c��eZdZd�Zd�Zy)r�c�.�||_||_||_yr#)rcr�r0)rrcr�r0s    rr zPBUser.__init__�s����
������	r!c��t|jj|jj|jjf�Sr#)r�rcrr�r0rJs rr�zPBUser.processUniqueIDs.���T�Z�Z�_�_�d�k�k�&6�&6��	�	���G�H�Hr!N)rYrZr[r r�r\r!rr�r��s
���
Ir!r�c�l�eZdZd�Zd�Zd�Zed��Zejd��Zd�Z	d�Z
d�Zdd
�Zy	)�
ChatAvatarc��||_yr#)r�)rr�s  rr zChatAvatar.__init__	s	����r!c��tj|j�}t|t�r|jd�}||jj|�fSr|)rr}r�r�r<r�r~rr�s   rr�zChatAvatar.jellyForsF���|�|�D�N�N�+���d�C� ��;�;�w�'�D��W�_�_�6�6�t�<�<�<r!c�~���fd�}�jjj|�}|j|�|S)Nc�n�����fd�}�jj��}|j|�|S)Nc�Z��t�jj�j��Sr#)r�r�rc)�ignoredrjrs ��rrkz7ChatAvatar.remote_join.<locals>.cbGroup.<locals>.cbJoins ����t�{�{�0�0�$�+�+�u�E�Er!r)rjrkr@rs`  �rrz'ChatAvatar.remote_join.<locals>.cbGroups0���
F���� � ��'�A�
�M�M�&�!��Hr!)r�rcrr=)rrrr@s`   r�remote_joinzChatAvatar.remote_joins5���	�
�K�K���&�&�y�1��	�
�
�g���r!c��yr#r\rJs rrzChatAvatar.name���	
r!c��yr#r\)rr*s  rrzChatAvatar.name$r�r!c��yr#r\r�s   rrSzChatAvatar.groupMetaUpdate)r�r!c��yr#r\r�s    rrMzChatAvatar.receive-r�r!c��yr#r\r�s   rr9zChatAvatar.userJoined1r�r!Nc��yr#r\r�s    rrDzChatAvatar.userLeft5r�r!r#)
rYrZr[r r�r��propertyr�setterrSrMr9rDr\r!rr�r�sQ���=���
��
�
�[�[�
��
�
�
�
�
r!r�c��eZdZd�Zd�Zy)�AvatarReferencec�&�|jd|�S)Nrmr�)rrs  rrmzAvatarReference.join>s�����v�y�1�1r!c���tj��|jj�fd��|jjj��S)Nc�&���jd�Sr#)�callback)r@s�rr�z&AvatarReference.quit.<locals>.<lambda>Cs���q�z�z�$�/?�r!)r
�Deferred�broker�notifyOnDisconnectr�r�)rr@s @r�quitzAvatarReference.quitAs=����N�N������&�&�'?�@������,�,�.��r!N)rYrZr[rmr�r\r!rr�r�=s��2�r!r�c�l�eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	dZ
d	Zd
�Zd�Z
d�Zd
�Zd�Zd�Zd�Zd�Zy)�
WordsRealmr{c��||_yr#)rrs  rr zWordsRealm.__init__Os	����	r!c��t|�Sr#)r^rs  r�userFactoryzWordsRealm.userFactoryRs���D�z�r!c��t|�Sr#)rrs  r�groupFactoryzWordsRealm.groupFactoryUs���T�{�r!c������fd�}|S)Nc�H��t�dd���dx�_�_y)Nrxc��yr#r\r\r!rr�z:WordsRealm.logoutFactory.<locals>.logout.<locals>.<lambda>[s�r!)�getattrrcrd)r��facets��rrxz(WordsRealm.logoutFactory.<locals>.logoutYs"���2�G�E�8�\�2�4�)-�-�F�L�6�;r!r\)rr�r�rxs `` r�
logoutFactoryzWordsRealm.logoutFactoryXs���	.�
�
r!c������t�t�r�j�j������fd�}�j	��j|�S)Nc���|j�tj���D]K}||d�}|��|j�����_��_|�_||�j
||�fcSt����r#)rcrr�rfrr�r��NotImplementedError)r�r�r��avatarId�
interfacesrdrs   ����r�	gotAvatarz+WordsRealm.requestAvatar.<locals>.gotAvatards�����|�|�'��,�,�.�.�#�
K���f�d�+���$��O�O�D�$�/� (�D�I�!%�D�J�"(�D�K� �%��);�);�F�E�)J�J�J�
K�&�d�J�7�7r!)r�r�r��	_encoding�getUserr=)rr�rdr�r�s```` r�
requestAvatarzWordsRealm.requestAvatar`s@����h��&����t�~�~�6�H�	8��|�|�H�%�1�1�)�<�<r!c��yr#r\rJs rruzWordsRealm.itergroupssr�r!FTc��t�r#�r�rs  rr�zWordsRealm.lookupUser{���!�!r!c��t�r#r��rrjs  rr�zWordsRealm.lookupGroup~r�r!c��t�)a�
        Add the given user to this service.

        This is an internal method intended to be overridden by
        L{WordsRealm} subclasses, not called by external code.

        @type user: L{IUser}

        @rtype: L{twisted.internet.defer.Deferred}
        @return: A Deferred which fires with L{None} when the user is
        added, or which fails with
        L{twisted.words.ewords.DuplicateUser} if a user with the
        same name exists already.
        r�rVs  r�addUserzWordsRealm.addUser�s
��"�!r!c��t�)aY
        Add the given group to this service.

        @type group: L{IGroup}

        @rtype: L{twisted.internet.defer.Deferred}
        @return: A Deferred which fires with L{None} when the group is
        added, or which fails with
        L{twisted.words.ewords.DuplicateGroup} if a group with the
        same name exists already.
        r�r�s  r�addGroupzWordsRealm.addGroup�s
��"�!r!c�����jr&��fd�}�j��j|�S�j��S)Nc�d��|jtj��j��Sr#)r�r�DuplicateGroupr��r&rrs ��rr�z$WordsRealm.getGroup.<locals>.ebGroup�s&�������.�.�/��'�'��-�-r!)�createGroupOnRequest�createGroupr:r�)rrr�s`` rrzWordsRealm.getGroup�s@����$�$�
.��#�#�D�)�4�4�W�=�=�����%�%r!c�����jr&��fd�}�j��j|�S�j��S)Nc�d��|jtj��j��Sr#)r�r�
DuplicateUserr�r�s ��rr�z"WordsRealm.getUser.<locals>.ebUser�s$�������-�-�.����t�,�,r!)�createUserOnRequest�
createUserr:r�)rrr�s`` rr�zWordsRealm.getUser�s<����#�#�
-��?�?�4�(�3�3�F�;�;����t�$�$r!c�����fd�}��fd�}�j���j��}|j||�|j�j�|S)Nc�T��tjtj���Sr#)rr$rr�)r0rs �r�cbLookupz'WordsRealm.createUser.<locals>.cbLookup�s����?�?�6�#7�#7��#=�>�>r!c�d��|jtj��j��Sr#)r�rr]r�r�s ��r�ebLookupz'WordsRealm.createUser.<locals>.ebLookup�s&����H�H�V�&�&�'��#�#�D�)�)r!)r�r�r�r=r��rrrrr@s``   rrzWordsRealm.createUser�sK���	?�	*��z�z�|���O�O�D�!��	���x��*�	�
�
�d�l�l�#��r!c�����fd�}��fd�}�j���j��}|j||�|j�j�|S)Nc�T��tjtj���Sr#)rr$rr�)rjrs �rrz(WordsRealm.createGroup.<locals>.cbLookup�s����?�?�6�#8�#8��#>�?�?r!c�d��|jtj��j��Sr#)r�rr�r�r�s ��rrz(WordsRealm.createGroup.<locals>.ebLookup�s&����H�H�V�'�'�(��$�$�T�*�*r!)r�r�r�r=r�rs``   rr�zWordsRealm.createGroup�sN���	@�	+��z�z�|�����T�"��	���x��*�	�
�
�d�m�m�$��r!N)rYrZr[r�r r�r�r�r�rur�r�r�r�r�r�rr�rr�r\r!rr�r�Ks[���I�����=�&
�
!����"�"�"�""�&�%��r!r�c�<��eZdZ�fd�Zd�Zd�Zd�Zd�Zd�Z�xZ	S)�InMemoryWordsRealmc�@��t�|�|i|��i|_i|_yr#)�superr rr`)r�ar�r�s   �rr zInMemoryWordsRealm.__init__�s#���
���!�"�r�"���
���r!c�\�tj|jj��Sr#)r
r>r`r7rJs rruzInMemoryWordsRealm.itergroups�s���}�}�T�[�[�/�/�1�2�2r!c��|j|jvr:tjt	j
t
j���S||j|j<tj|�Sr#)	rrr
�failrr$rr�r>rVs  rr�zInMemoryWordsRealm.addUser�sT���9�9��
�
�"��:�:�g�o�o�f�.B�.B�.D�E�F�F� $��
�
�4�9�9���}�}�T�"�"r!c��|j|jvr:tjt	j
t
j���S||j|j<tj|�Sr#)	rr`r
rrr$rr�r>r�s  rr�zInMemoryWordsRealm.addGroup�sT���:�:����$��:�:�g�o�o�f�.C�.C�.E�F�G�G�"'����E�J�J���}�}�U�#�#r!c��|j�}	|j|}tj|�S#t$r>tj
t
jtj|���cYSwxYwr#)
r�rr
r>rErrr$rr])rrr0s   rr�zInMemoryWordsRealm.lookupUser�sg���z�z�|��	'��:�:�d�#�D��=�=��&�&���	H��:�:�g�o�o�f�.?�.?��.E�F�G�G�	H���6�AA=�<A=c��|j�}	|j|}tj|�S#t$r>tj
t
jtj|���cYSwxYwr#)
r�r`r
r>rErrr$rr�)rrrjs   rr�zInMemoryWordsRealm.lookupGroup�sg���z�z�|��	(��K�K��%�E��=�=��'�'���	I��:�:�g�o�o�f�.@�.@��.F�G�H�H�	I�r)
rYrZr[r rur�r�r�r��
__classcell__)r�s@rrr�s!����
3�#�$�'�(r!r)rr^r�rN)6rirr�zope.interfacer�twistedr�twisted.credrrr�r	�twisted.internetr
r�twisted.pythonrr
r�twisted.python.componentsr�twisted.spreadr�
twisted.wordsrr�twisted.words.protocolsrr�rr�r^r�r4r�rz�
ServerFactoryrq�
Referenceablerxr�r��setUnjellyableForClassr�r�r�r��IPerspectiver��IRealm�IChatServicer�r�__all__r\r!r�<module>r's'��
�2�&��<�<�,�0�0�5��(�'�
�V�]�]��J)�J)��J)�Z
�V�\�\��%�%��%�P(��
�V�
�
� �}
H�c�g�g�}
H�!�}
H�@
��'�'�
�,
�R�
�
�
�.
�V�
�
� �
�b�(�(�
�!�
�B����&�/�2�5�b���5�2
�V�]�]��$
�r�)�)�$
��$
�N����'�#3�4�I�R�
�
�I�
�V�
�
� �/
��!�!�/
�!�/
�d�
�F�L�L�"�/�/�:��b�(�(������*�o�6�
�V�]�]�F�/�/�0�B�B�1�B�J%(��%(�P�r!

Zerion Mini Shell 1.0