Spamworldpro Mini Shell
Spamworldpro


Server : Apache/2.4.52 (Ubuntu)
System : Linux webserver 6.8.0-49-generic #49~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Wed Nov 6 17:42:15 UTC 2 x86_64
User : www-data ( 33)
PHP Version : 8.1.2-1ubuntu2.21
Disable Function : NONE
Directory :  /lib/python3/dist-packages/twisted/words/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //lib/python3/dist-packages/twisted/words/__pycache__/service.cpython-310.pyc
o

�b���@sdZddlmZmZddlmZddlmZddlmZm	Z
mZddlm
Z
mZddlmZmZmZddlmZdd	lmZdd
lmZmZddlmZeej�Gdd
�d
��Zeej�Gdd�d��ZdZ eej!�Gdd�dej"��Z#Gdd�dej$�Z%Gdd�dej&�Z'eej!�Gdd�dej(��Z)e�*e'e)�Gdd�dej&�Z+eej�Gdd�dej(��Z,e�*e+e,�Gdd�dej&�Z-eej!�Gdd �d ej&��Z.ee.ejej/�Gd!d"�d"ej(�Z0e�*e.e0�eej1ej2�Gd#d$�d$��Z3Gd%d&�d&e3�Z4gd'�Z5d(S))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@sVeZdZdd�Zdd�Zdd�Zdd�Zdd
d�Zdd
�Zdd�Z	dd�Z
dd�Zd	S)�GroupcCs||_i|_ddd�|_dS)N�)�topic�topic_author)�name�users�meta��selfr�r�7/usr/lib/python3/dist-packages/twisted/words/service.py�__init__.s
�zGroup.__init__cCst�t||��S�N)r�Failure�	Exception)r�err�prrr�_ebUserCall6�zGroup._ebUserCallcCs0|D]\}}|s|j\}}|�||���qdSr)�value�remove�getErrorMessage)r�results�success�result�userr"rrr�_cbUserCall9s
��zGroup._cbUserCallcCs�tj�|�s
Jd�|���|j|jvrEg}||j|j<|j��D]}||ur;t�|j	||�}|j
|j|d�|�|�q t�
|��|j�t�d�S)Nz{!r} is not a chat client�r#)r�IChatClient�
providedBy�formatrr�valuesr	�
maybeDeferred�
userJoined�
addErrbackr$�append�DeferredList�addCallbackr-�succeed)rr,�	additionsr#�drrr�add?s�
�
z	Group.addNcCs�z|j|j=Wn	tyYn.wg}|j��D]}||ur4t�|j|||�}|j|j|d�|�	|�qt�
|��|j�t�
d�S�Nr.)rr�KeyErrorr2r	r3�userLeftr5r$r6r7r8r-r9)rr,�reason�removalsr#r;rrrr'Ns�
�
zGroup.removecCst�t|j��Sr)r	r9�lenr�rrrr�size]r%z
Group.sizecCsp||usJ�g}|j��D]}||ur)t�|j|||�}|j|j|d�|�|�q
t�|��	|j
�t�d�Sr=)rr2r	r3�receiver5r$r6r7r8r-r9)r�sender�	recipient�message�receivesr#r;rrrrE`s
�
z
Group.receivecCs`||_g}|j��D]}t�|j||�}|j|j|d�|�|�q
t�	|��
|j�t�d�Sr=)
rrr2r	r3�groupMetaUpdater5r$r6r7r8r-r9)rr�setsr#r;rrr�setMetadataks
zGroup.setMetadatacCst|j���Sr)�iterrr2rCrrr�	iterusersuszGroup.iterusersr)�__name__�
__module__�__qualname__rr$r-r<r'rDrErLrNrrrrr,s

rc@sNeZdZdZdZdd�Zdd�Zdd�Zddd	�Zd
d�Z	dd
�Z
dd�ZdS)�UserNcCs||_g|_t�|_dSr)r�groupsr�lastMessagerrrrr�z
User.__init__cCs||_||_t�|_dSr)�realm�mindr�signOn)rrVrWrrr�loggedIn�rUz
User.loggedIncs ��fdd�}���j��|�S)Nc��j���|Sr)rSr6�r+��grouprrr�cbJoin��zUser.join.<locals>.cbJoin)r<rWr8)rr]r^rr\r�join�sz	User.joincs"��fdd�}���j|��|�S)NcrZr)rSr'r[r\rr�cbLeave�r_zUser.leave.<locals>.cbLeave)r'rWr8)rr]r@rarr\r�leave�sz
User.leavecCst�|_|�|j||�Sr)rrTrErW)rrGrHrrr�send�sz	User.sendcCs
t|j�Sr)rMrSrCrrr�
itergroups��
zUser.itergroupscCs"|jdd�D]}|�|�qdSr)rSrb)r�grrr�logout�s�zUser.logoutr)rOrPrQrVrWrrYr`rbrcrdrgrrrrrRzs
rRzNickServ!NickServ@servicesc@s�eZdZdZdZdZdZdZdZdd�Z	dd�Z
dd	�Zd
d�ZdPdd
�Z
dd�Zdd�ZdZdZdd�Zdd�Zdd�Zdd�Zdd�ZejdfejdfejdfejdfgZejd fejd!fgZd"d#�Z d$d%�Z!d&d'�Z"d(d)�Z#dPd*d+�Z$dPd,d-�Z%d.d/�Z&d0d1�Z'd2d3�Z(d4d5�Z)d6d7�Z*d8d9�Z+d:d;�Z,d<d=�Z-d>d?�Z.d@dA�Z/dBdC�Z0dDdE�Z1dFdG�Z2dHdI�Z3dJdK�Z4dLdM�Z5dNdO�Z6dS)Q�IRCUserzM
    Protocol instance representing an IRC user connected to the server.
    N�utf-8cCs |j|_|jj|_|jj|_dSr)�irc_NICKSERV_PRIVMSG�irc_PRIVMSG�factoryrVr�hostnamerCrrr�connectionMade�s
zIRCUser.connectionMadecCs |jdur|��d|_dSdSr)rg�avatar�rr@rrr�connectionLost�s

�zIRCUser.connectionLostcOs�d|vr	|j|d<d|vr|j�|j�|d<|||dgt|�}g}|D]}t|t�r1|�d�}|�|�q%t	j
j|i|��dS)N�prefix�tori)rmr�encode�encoding�list�
isinstance�bytes�decoder6r�IRC�sendMessage)r�command�parameter_list�kw�arglist�arglistUnicode�argrrrr{�s


zIRCUser.sendMessagecCs,|�|j�d|j�d|j��d|j�dS)N�!�@�#)r`rrm�rr]r,rrrr4�s,zIRCUser.userJoinedcCs2|�|j�d|j�d|j��d|j|pd�dS)Nr�r�r��leaving)�partrrm�rr]r,r@rrrr?�s
�zIRCUser.userLeftcCs`tj�|�rd|j}n|j}|�dd�}|��D]}|�|j�d|j�d|j��||�qdS)Nr��textz<an unrepresentable message>r�r�)r�IGroupr0r�get�
splitlines�privmsgrm)rrFrGrH�
recipientNamer��LrrrrE�s��zIRCUser.receivec
CsNd|vr%|d}|�dd�}|�|jd|j||�d|�d|j���dSdS)Nrrrr�r�r�)r�rrrm)rr]rr�authorrrrrJ�s��zIRCUser.groupMetaUpdatecC�|d|_dS)z�
        Password message -- Register a password.

        Parameters: <password>

        [REQUIRED]

        Note that IRC requires the client send this *before* NICK
        and USER.
        ���N)�password�rrr�paramsrrr�irc_PASSszIRCUser.irc_PASScCs�|d}z
t|t�r|�|j�}Wnty)|�tt|�d�|j�	�YdSw||_
||_|jD]\}}|�
|||jj�q3|jdurP|�t|d�dS|j}d|_|�||�dS)zh
        Nick message -- Set your nickname.

        Parameters: <nickname>

        [REQUIRED]
        rz;Your nickname cannot be decoded. Please use ASCII or UTF-8.Nz	Password?)rwrxryru�UnicodeDecodeErrorr��NICKSERV�repr�	transport�loseConnection�nicknamer�
_motdMessagesr{rl�_serverInfor��logInAs)rrrr�r��coder�r�rrr�irc_NICK
s.
��
�	
zIRCUser.irc_NICKcCr�)zk
        User message -- Set your realname.

        Parameters: <user> <mode> <unused> <realname>
        r�N)�realnamer�rrr�irc_USER/s	zIRCUser.irc_USERcCsd|d}|d}|jdur|j��dS|��dkr$|�t|jd�dS|j}d|_|�||�dS)�^
        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�)rrrr��targetr�r�rrrrj:s
�zIRCUser.irc_NICKSERV_PRIVMSGcCs6|jj�t�||�|tj�}|j|j|j	|fd�dS)N)�errbackArgs)
rlr�loginr�UsernamePasswordr�IUser�addCallbacks�_cbLogin�_ebLogin)rr�r�r;rrrr�Qs�zIRCUser.logInAsz: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.cCsZ|\}}}|tjusJd|����|`||_||_|jD]\}}|�|||jj�qdS)NzRealm is buggy, got )	rr�rkrorg�_welcomeMessagesr{rlr�)rr+�ifacerorgr�r�rrrr�ns
�zIRCUser._cbLogincCsh|�tj�r|�t|d�n|�tj�r|�t|d�nt�d�t�	|�|�t|d�|j
��dS)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�rrrr�zs�

zIRCUser._ebLogincCs |jdur|�d|j�dSdS)zK
        Ping message

        Parameters: <server1> [ <server2> ]
        N�PONG)rVr{rmr�rrr�irc_PING�s
�zIRCUser.irc_PINGcCs|j��dS)z>
        Quit

        Parameters: [ <Quit Message> ]
        N)r�r�r�rrr�irc_QUIT�szIRCUser.irc_QUITcGs0|r|�tjd�dS|�|jd|jd�dS)N�:Unknown MODE flag.r��+)r{r�ERR_UNKNOWNMODE�channelModer)rr]�modes�argsrrr�_channelMode�szIRCUser._channelModecCsD|r|�tjd�dS||jur|�tjd�dS|�tjd�dS)Nr�r�z(:You can't look at someone else's modes.)r{rr�ro�RPL_UMODEIS�ERR_USERSDONTMATCH)rr,r�rrr�	_userMode�s
�zIRCUser._userModecs�z�d}t|t�r|��j�}Wnty%��tj�dd�YdSw|�d�rM��fdd�}�j	�
|dd��}|j�j|t
�dd��d�dS�fd	d
�}�j	�|�}|j�j|t
�dd��d�dS)z�
        User mode message

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

        rz2:No such nickname (could not decode your unicode!)Nr�c�$|�tj���tj�dd�dS)Nr�:That channel doesn't exist.��trapr�NoSuchGroupr{r�ERR_NOSUCHCHANNEL�r"�r�rrr�ebGroup�s�z!IRCUser.irc_MODE.<locals>.ebGroup�)�callbackArgscs��tjd�dS)Nz:No such nickname.�r{r�ERR_NOSUCHNICKr�rCrr�ebUser��z IRCUser.irc_MODE.<locals>.ebUser)rwrxryrur�r{rr��
startswithrV�lookupGroupr�r��tuple�
lookupUserr�)rrrr��
channelOrUserr�r;r�rr�r�irc_MODE�s(
���
""zIRCUser.irc_MODEcCsdS)zl
        Userhost message

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

        [Optional]
        Nrr�rrr�irc_USERHOST�szIRCUser.irc_USERHOSTcs�z|d�t�t�r���j��Wnty%��tj|dd�YdSw|d���d�r:�j	�
�dd��}n�j	����dd��}��fd	d
�}��fdd�}|�
||�dS)
r�rz6:No such nick/channel (could not decode your unicode!)Nr�r�r�cSs|jSr)rW�r,rrr�<lambda>�sz%IRCUser.irc_PRIVMSG.<locals>.<lambda>cs|dur
�j�|d�i�SdS)Nr�)rorc)�targ)�messageTextrrr�cbTarget�s�z%IRCUser.irc_PRIVMSG.<locals>.cbTargetcs��tj�d�dS)Nz:No such nick/channel.r�r�)r�
targetNamerr�ebTarget��z%IRCUser.irc_PRIVMSG.<locals>.ebTarget)rwrxryrur�r{rr�r�rVr�r�r8r�)rrrr�r�r�r�r)r�rr�rrk�s,
���
�zIRCUser.irc_PRIVMSGc�z|d�t�t�r���j��Wnty%��tj|dd�YdSw��d�r1�dd���fdd�}��fdd	�}�j	�
���||�dS)
zm
        Join message

        Parameters: ( <channel> *( "," <channel> ) [ <key> *( "," <key> ) ] )
        r�1:No such channel (could not decode your unicode!)Nr�r�cs ��fdd�}�j����|�S)Ncs>��������jd�jdd����D������dS)Nr�cS�g|]}|j�qSr�r��.0r,rrr�
<listcomp>�zEIRCUser.irc_JOIN.<locals>.cbGroup.<locals>.cbJoin.<locals>.<listcomp>)r4�namesrrN�
_sendTopic)�ignr\rrr^s�z1IRCUser.irc_JOIN.<locals>.cbGroup.<locals>.cbJoin�ror`r8)r]r^rC�r]r�cbGroups	z!IRCUser.irc_JOIN.<locals>.cbGroupcs��tjd�d�dS)Nr�z:No such channel.)r{rr�r���	groupNamerrrr�s�z!IRCUser.irc_JOIN.<locals>.ebGroup)rwrxryrur�r{rr�r�rV�getGroupr��rrrr�r�r�rr�r�irc_JOIN�s$
���
zIRCUser.irc_JOINcs�z|d�t|dt�r|d��j��Wnty)��tj|dd�YdSw��d�r5�dd��t	|�dkrJ|d�t�t�rI��d��nd���fdd�}��fd	d
�}�j
����||�dS)zc
        Part message

        Parameters: <channel> *( "," <channel> ) [ <Part Message> ]
        rz:Could not decode your unicode!Nr�r�rics$���fdd�}�j�����|�S)Ncs������dSr)r?r[)r]r@rrrra@r�z2IRCUser.irc_PART.<locals>.cbGroup.<locals>.cbLeave)rorbr8)r]ra)r@rr�rr�?sz!IRCUser.irc_PART.<locals>.cbGroupcs,|�tj���tjd�d|���dS)Nr��:)r�rr�r{r�ERR_NOTONCHANNELr(r�r�rrr�Es�z!IRCUser.irc_PART.<locals>.ebGroup)
rwrxryrur�r{rr�r�rBrVr�r�r�r)r�r@rr�irc_PART%s,���


�zIRCUser.irc_PARTcr�)
zb
        Names message

        Parameters: [ <channel> *( "," <channel> ) [ <target> ] ]
        r�r�Nr�r�cs(���jd|jdd�|��D��dS)Nr�cSr�rr�r�rrrr�gr�z6IRCUser.irc_NAMES.<locals>.cbGroup.<locals>.<listcomp>)r�rrNr�rCrrr�es�z"IRCUser.irc_NAMES.<locals>.cbGroupcs$|�tj����jd�g�dS)Nr�)r�rr�r�rr���channelrrrr�jsz"IRCUser.irc_NAMES.<locals>.ebGroup)rwrxryrur�r{rr�r�rVr�r�r�rr�r�	irc_NAMESMs$	
���
zIRCUser.irc_NAMEScCs�z|d}t|dt�r|�|j�}Wnty$|�tjd�YdSw|�d�r0|dd�}t	|�dkr@|�
||d�dS|�|�dS)zJ
        Topic message

        Parameters: <channel> [ <topic> ]
        rz<:That channel doesn't exist (could not decode your unicode!)Nr�r�)rwrxryrur�r{rr�r�rB�	_setTopic�	_getTopic)rrrr�r�rrr�	irc_TOPICqs"���
zIRCUser.irc_TOPICcCsd|j�d�}|r0|j�d�pd}|j�dd�}|�|jd|j|�|�|jd|j||�dSdS)zP
        Send the topic of the given group to this user, if it has one.
        rrz<noone>�
topic_daterr�N)rr�rr�topicAuthor)rr]rr��daterrrr��s�zIRCUser._sendTopiccs(��fdd�}�j�����j|�dS)Nc�"|�tj���tjd�d�dS�N�=r�r�r�r�rrr���
�z"IRCUser._getTopic.<locals>.ebGroup)rVr�r�r�)rr�r�rr�rr��szIRCUser._getTopiccs4��fdd�}��fdd�}�j����||�dS)NcsH�j��}�|d<�j|d<tt��|d<��fdd�}��|��|�S)Nrrr�cs��tjd�jd�dS)Nr�z.:You need to be a channel operator to do that.)r{r�ERR_CHANOPRIVSNEEDEDrr�r\rr�ebSet�s
�z1IRCUser._setTopic.<locals>.cbGroup.<locals>.ebSet)r�copyr�intrrLr5)r]�newMetar)rrr�rr��s

z"IRCUser._setTopic.<locals>.cbGroupcrrr�r�r�rrr��rz"IRCUser._setTopic.<locals>.ebGroup)rVr�r�)rr�rr�r�r)r�rrrr��szIRCUser._setTopiccCs<|D]\}}}|�tj|t|�d|�q|�tjd�dS)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.
        r�z
:End of /LISTN)r{r�RPL_LIST�str�RPL_LISTEND)r�channelsrrDrrrrrv�szIRCUser.listcs�|rWz|d}t|t�r|��j�}|�d�}Wnty,��tj|dd�YdSwg}|D]}|�	d�r>|dd�}|�
�j�|��q1t
j|dd�}|�d	d
��n�j��}�fdd�}|�|�dS)
z�
        List query

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

        Parameters: [ <channel> *( "," <channel> ) [ <target> ] ]
        r�,r�Nr�r�T)�
consumeErrorscSsdd�|D�S)NcS�g|]\}}|r|�qSrr�r��s�rrrrr���z6IRCUser.irc_LIST.<locals>.<lambda>.<locals>.<listcomp>r)�gsrrrr��sz"IRCUser.irc_LIST.<locals>.<lambda>cs6dd��t��fdd�|D��}|��fdd��|S)NcSs|j||j�d�fS)Nr)rrr�)rDr]rrr�gotSize�r�z3IRCUser.irc_LIST.<locals>.cbGroups.<locals>.gotSizecsg|]
}|����|��qSr)rDr8�r�r]�rrrr��sz6IRCUser.irc_LIST.<locals>.cbGroups.<locals>.<listcomp>cs��dd�|D��S)NcSrrrrrrrr��rzHIRCUser.irc_LIST.<locals>.cbGroups.<locals>.<lambda>.<locals>.<listcomp>)rv)r)rCrrr��sz4IRCUser.irc_LIST.<locals>.cbGroups.<locals>.<lambda>)r	r7r8)rSr;rCrr�cbGroups�s�z"IRCUser.irc_LIST.<locals>.cbGroups)rwrxryru�splitr�r{rr�r�r6rVr�r	r7r8rd)rrrr��allChannelsrrS�chrrrCr�irc_LIST�s0

��


zIRCUser.irc_LISTcs,���jd|j�fdd�|��D��dS)Nr�c	s*g|]}|j�j�jj|jdd|jf�qS)�Hr)rrmrV)r��mrCrrr�s��z'IRCUser._channelWho.<locals>.<listcomp>)�whorrN�rr]rrCr�_channelWho�s
��zIRCUser._channelWhocCs|�tjd�dS)Nz:User /WHO not implemented)r{r�RPL_ENDOFWHO�rr,rrr�_userWhor�zIRCUser._userWhocs�|s��tjd�dSz|d�t�t�r���j��Wnty0��tj|dd�YdSw��d�rP��fdd�}�j	�
�dd��}|��j|�dS��fd	d
�}�j	�
��}|��j|�dS)zC
        Who query

        Parameters: [ <mask> [ "o" ] ]
        z:/WHO not supported.Nrz2:End of /WHO list (could not decode your unicode!)r�c� |�tj���tj�d�dS�Nz:End of /WHO list.)r�rr�r{rr"r��r�rrrr�*�z IRCUser.irc_WHO.<locals>.ebGroupr�cr%r&)r�r�
NoSuchUserr{rr"r�r'rrr�2r(zIRCUser.irc_WHO.<locals>.ebUser)r{rr"rwrxryrur�r�rVr�r�r!r�r$)rrrr�r�r;r�rr'r�irc_WHO	s.
���
zIRCUser.irc_WHOcs~�fdd�}��fdd�}z�d}t|t�r|��j�}Wnty2��tj�dd�YdSw�j�	|��
||�dS)zV
        Whois query

        Parameters: [ <target> ] <mask> *( "," <mask> )
        csN���j|j|j�jj|j�jjddtt�|j�|jdd�|��D��dS)NzHi mom!FcSsg|]}d|j�qS)r�r�rrrrr�Lsz5IRCUser.irc_WHOIS.<locals>.cbUser.<locals>.<listcomp>)�whoisrrVrrrTrXrdr�rCrr�cbUser@s�z!IRCUser.irc_WHOIS.<locals>.cbUsercr�)Nr�:No such nick/channel)r�rr)r{rr�r�r�rrr�Osz!IRCUser.irc_WHOIS.<locals>.ebUserrr-N)rwrxryrur�r{rr�rVr�r�)rrrr�r,r�r,rr�r�	irc_WHOIS9s
��zIRCUser.irc_WHOIScCs|�tjd�dS)zE
        Oper message

        Parameters: <name> <password>
        z:O-lines not applicableN)r{r�ERR_NOOPERHOSTr�rrr�irc_OPER^szIRCUser.irc_OPERr)7rOrPrQ�__doc__rSrgrorVrurnrqr{r4r?rErJr�r�r�r�r�rjr�r�RPL_WELCOME�RPL_YOURHOST�RPL_CREATED�
RPL_MYINFOr��
RPL_MOTDSTART�
RPL_ENDOFMOTDr�r�r�r�r�r�r�r�r�rkr�r�r�r�r�r�r�rvrr!r$r*r.r0rrrrrh�sp

"����	


&
#(($4
0%rhc@seZdZdZeZdd�ZdS)�
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.
    cCs&||_||_|jjtjt�d�|_dS)N)�serviceName�serviceVersion�creationDate)rVrrr�versionrr�)rrVrrrrrss�zIRCFactory.__init__N)rOrPrQr1rhr
rrrrrr8gs	r8c@s<eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
S)�PBMindcC�dSrrrCrrrr~�zPBMind.__init__cCs.t�t�}t|t�r|�d�}||j�|�fS�Nri)r
�qualr=rwr
rt�invoker�registerReference�r�jellierrArrr�jellyFor�s


zPBMind.jellyForcCr>rr)rr,r]rrr�remote_userJoined�r?zPBMind.remote_userJoinedcCr>rr)rr,r]r@rrr�remote_userLeft�r?zPBMind.remote_userLeftcCr>rr�rrFrGrHrrr�remote_receive�r?zPBMind.remote_receivecCr>rr�rr]rrrr�remote_groupMetaUpdate�r?zPBMind.remote_groupMetaUpdateN)	rOrPrQrrFrGrHrJrLrrrrr=}sr=c@s2eZdZdZdd�Zdd�Zdd�Zdd	d
�ZdS)�PBMindReferencercCsJtj�|�rt|j|j|�}nt|j|j|�}|�dt|j|j|�||�S)NrE)rr�r0�PBGrouprVro�PBUser�
callRemote)rrFrGrH�recrrrrE�s�zPBMindReference.receivecCs|�dt|j|j|�|�S)NrJ)rPrNrVrorKrrrrJ�s�zPBMindReference.groupMetaUpdatecCs&|�dt|j|j|�t|j|j|��S)Nr4�rPrNrVrorOr�rrrr4�s
�zPBMindReference.userJoinedNcCs(|�dt|j|j|�t|j|j|�|�S)Nr?rRr�rrrr?�s�zPBMindReference.userLeftr)rOrPrQrrErJr4r?rrrrrM�s	rMc@s6eZdZdd�Zdd�Zdd�Zddd	�Zd
d�ZdS)
rNcC�||_||_||_dSr)rVror])rrVror]rrrr��
zPBGroup.__init__cC�t|jj|jj|jjf�Sr)�hashrVrror]rCrrr�processUniqueID��zPBGroup.processUniqueIDcCsNt�|j�}t|t�r|�d�}|jj}t|t�r|�d�}|||j�	|�fSr@)
r
rA�	__class__rwr
rtr]rrBrC)rrErAr]rrrrF�s



zPBGroup.jellyForNcC�|j�|j|�Sr)rorbr]rprrr�remote_leave�r%zPBGroup.remote_leavecCrZr)rorcr]�rrHrrr�remote_send�r%zPBGroup.remote_sendr)rOrPrQrrWrFr[r]rrrrrN�s
	rNc@sXeZdZdd�Zddd�Zdd�Zdd	�Zd
d�Zdd
�Zddd�Z	dd�Z
dd�ZdS)�PBGroupReferencecCsF|\}}}||_ttkrt|jt�r|j�d�|_tj�||||g�Sr@)rrxr
rwryr�RemoteReference�
unjellyFor)r�	unjellier�unjellyList�clsNamer�refrrrr`�s

zPBGroupReference.unjellyForNcC�|�d|�S)Nrb�rPrprrrrb��zPBGroupReference.leavecCre)Nrcrfr\rrrrc�rgzPBGroupReference.sendcCr>rrr#rrrr<��zPBGroupReference.addcCr>rrrCrrrrN�rhzPBGroupReference.iteruserscCr>rrrIrrrrE�rhzPBGroupReference.receivecCr>rr)rr,r@rrrr'�rhzPBGroupReference.removecCr>rr)rrrrrrL�rhzPBGroupReference.setMetadatacCr>rrrCrrrrD�rhzPBGroupReference.sizer)rOrPrQr`rbrcr<rNrEr'rLrDrrrrr^�s

r^c@�eZdZdd�Zdd�ZdS)rOcCrSr)rVror,)rrVror,rrrr�rTzPBUser.__init__cCrUr)rVrVrror,rCrrrrWrXzPBUser.processUniqueIDN)rOrPrQrrWrrrrrO�srOc@s`eZdZdd�Zdd�Zdd�Zedd��Zejd	d��Zd
d�Z	dd
�Z
dd�Zddd�ZdS)�
ChatAvatarcC�
||_dSr)ro)rrorrrr
rezChatAvatar.__init__cCs0t�|j�}t|t�r|�d�}||j�|�fSr@)r
rArYrwr
rtrBrCrDrrrrF
s

zChatAvatar.jellyForcs(�fdd�}�jj�|�}|�|�|S)Ncs(��fdd�}�j���}|�|�|S)Ncst�jj�j��Sr)rNrorV)�ignoredr\rrr^r�z7ChatAvatar.remote_join.<locals>.cbGroup.<locals>.cbJoinr�)r]r^r;rCr�rr�s
z'ChatAvatar.remote_join.<locals>.cbGroup)rorVr�r8)rr�r�r;rrCr�remote_joins
zChatAvatar.remote_joincCr>rrrCrrrr �zChatAvatar.namecCr>rr)rr&rrrr%rncCr>rrrKrrrrJ*rhzChatAvatar.groupMetaUpdatecCr>rrrIrrrrE.rhzChatAvatar.receivecCr>rrr�rrrr42rhzChatAvatar.userJoinedNcCr>rrr�rrrr?6rhzChatAvatar.userLeftr)
rOrPrQrrFrm�propertyr�setterrJrEr4r?rrrrrjs

rjc@ri)�AvatarReferencecCre)Nr`rf)rr�rrrr`?rgzAvatarReference.joincs,t���|j��fdd��|jj���S)Ncs
��d�Sr)�callbackr�r;rrr�Ds
z&AvatarReference.quit.<locals>.<lambda>)r	�Deferred�broker�notifyOnDisconnectr�r�rCrrsr�quitBszAvatarReference.quitN)rOrPrQr`rwrrrrrq>srqc@s�eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dZ
dZdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zdd�Zd S)!�
WordsRealmricCrkrr�rrrrrPrezWordsRealm.__init__cC�t|�Sr)rRrrrr�userFactoryS�zWordsRealm.userFactorycCryr)rrrrr�groupFactoryVr{zWordsRealm.groupFactorycs��fdd�}|S)Ncs"t�ddd���d�_�_dS)NrgcSr>rrrrrrr�\sz:WordsRealm.logoutFactory.<locals>.logout.<locals>.<lambda>)�getattrrVrWr�ro�facetrrrgZsz(WordsRealm.logoutFactory.<locals>.logoutr)rrorrgrr~r�
logoutFactoryYszWordsRealm.logoutFactorycs8t�t�r���j������fdd�}�����|�S)Ncsl|jdur	t����D]%}||d�}|dur0|������_��_|�_||��||�fSqt����r)rVrr�rYrror��NotImplementedError)ror�r��avatarId�
interfacesrWrrr�	gotAvatares

�
z+WordsRealm.requestAvatar.<locals>.gotAvatar)rwrxry�	_encoding�getUserr8)rr�rWr�r�rr�r�
requestAvataras

zWordsRealm.requestAvatarcCr>rrrCrrrrdtrhzWordsRealm.itergroupsFTcC�t�r�r�rrrrr�|r?zWordsRealm.lookupUsercCr�rr�r rrrr�r?zWordsRealm.lookupGroupcCr�)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�r#rrr�addUser�szWordsRealm.addUsercCr�)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 rrr�addGroup�szWordsRealm.addGroupc�.�jr��fdd�}�����|�S����S)Nc�|�tj�����Sr)r�r�DuplicateGroupr�r��rrrrr���
z$WordsRealm.getGroup.<locals>.ebGroup)�createGroupOnRequest�createGroupr5r�)rrr�rr�rr���
zWordsRealm.getGroupcr�)Ncr�r)r�r�
DuplicateUserr�r�r�rrr��r�z"WordsRealm.getUser.<locals>.ebUser)�createUserOnRequest�
createUserr5r�)rrr�rr�rr��r�zWordsRealm.getUserc�H�fdd�}��fdd�}��������}|�||�|��j�|S)Nc�t�t����Sr)rr rr�r�r�rr�cbLookup�r%z'WordsRealm.createUser.<locals>.cbLookupcr�r)r�rr)rzr�r�rr�ebLookup�r�z'WordsRealm.createUser.<locals>.ebLookup)r�r�r�r8r��rrr�r�r;rr�rr���
zWordsRealm.createUsercr�)Ncr�r)rr rr�r�r�rrr��r%z(WordsRealm.createGroup.<locals>.cbLookupcr�r)r�rr�r|r�r�rrr��r�z(WordsRealm.createGroup.<locals>.ebLookup)r�r�r�r8r�r�rr�rr��r�zWordsRealm.createGroupN)rOrPrQr�rrzr|r�r�rdr�r�r�r�r�r�r�r�r�r�rrrrrxLs$

rxcsDeZdZ�fdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Z�Z	S)
�InMemoryWordsRealmcs"t�j|i|��i|_i|_dSr)�superrrrS)r�ar~�rYrrr�s
zInMemoryWordsRealm.__init__cCst�|j���Sr)r	r9rSr2rCrrrrd�r%zInMemoryWordsRealm.itergroupscC�6|j|jvrt�t�t����S||j|j<t�|�Sr)	rrr	�failrr rr�r9r#rrrr���
zInMemoryWordsRealm.addUsercCr�r)	rrSr	r�rr rr�r9r rrrr��r�zInMemoryWordsRealm.addGroupc
C�J|��}z|j|}Wntyt�t�t�|���YSwt�	|�Sr)
r�rr>r	r�rr rr)r9)rrr,rrrr����
zInMemoryWordsRealm.lookupUserc
Cr�r)
r�rSr>r	r�rr rr�r9)rrr]rrrr��r�zInMemoryWordsRealm.lookupGroup)
rOrPrQrrdr�r�r�r��
__classcell__rrr�rr��s	r�)rrRrxr�N)6r1rr�zope.interfacer�twistedr�twisted.credrrr�r�twisted.internetr	r
�twisted.pythonrrr
�twisted.python.componentsr�twisted.spreadr�
twisted.wordsrr�twisted.words.protocolsrr�rr�rRr�r/rzrh�
ServerFactoryr8�
Referenceabler=r_rM�setUnjellyableForClassrNr^rOrj�IPerspectiverq�IRealm�IChatServicerxr��__all__rrrr�<module>sVM(E"'
2(

Spamworldpro Mini