o
    b!                     @   s   d Z ddlmZmZ G dd deZG dd deZG dd deZG d	d
 d
eZG dd deZG dd deZ	G dd deZ
dS )z
Pan-protocol chat client.
    )	Attribute	Interfacec                   @   sP   e Zd ZdZedZedZdd Zdd Zdd	 Z	d
d Z
dd Zdd ZdS )IAccountz;
    I represent a user's account with a chat service.
    z<The L{IClient} currently connecting to this account, if any.z;A C{str} that identifies the protocol used by this account.c                 C      dS )a  
        @type accountName: string
        @param accountName: A name to refer to the account by locally.
        @type autoLogin: boolean
        @type username: string
        @type password: string
        @type host: string
        @type port: integer
        N )accountName	autoLoginusernamepasswordhostportr   r   =/usr/lib/python3/dist-packages/twisted/words/im/interfaces.py__init__       zIAccount.__init__c                   C   r   )z7
        Am I online?

        @rtype: boolean
        Nr   r   r   r   r   isOnline*   r   zIAccount.isOnlinec                 C   r   )z
        Go on-line.

        @type chatui: Implementor of C{IChatUI}

        @rtype: L{Deferred} with an eventual L{IClient} result.
        Nr   )chatuir   r   r   logOn1   r   zIAccount.logOnc                   C   r   )z
        Sign off.
        Nr   r   r   r   r   logOff:   r   zIAccount.logOffc                 C   r   )z*
        @rtype: L{Group<IGroup>}
        Nr   	groupNamer   r   r   getGroup?   r   zIAccount.getGroupc                 C   r   )z,
        @rtype: L{Person<IPerson>}
        Nr   )
personNamer   r   r   	getPersonD   r   zIAccount.getPersonN)__name__
__module____qualname____doc__r   clientgatewayTyper   r   r   r   r   r   r   r   r   r   r      s    	r   c                   @   s>   e Zd ZedZdd Zdd Zdd Zdd	d
Zdd Z	dS )IClientz!The L{IAccount} I am a Client forc                 C   r   )z
        @type account: L{IAccount}
        @type chatui: L{IChatUI}
        @param logonDeferred: Will be called back once I am logged on.
        @type logonDeferred: L{Deferred<twisted.internet.defer.Deferred>}
        Nr   )accountr   logonDeferredr   r   r   r   N   r   zIClient.__init__c                 C   r   )zb
        @param groupName: The name of the group to join.
        @type groupName: string
        Nr   r   r   r   r   	joinGroupV   r   zIClient.joinGroupc                 C   r   )zc
        @param groupName: The name of the group to leave.
        @type groupName: string
        Nr   r   r   r   r   
leaveGroup\   r   zIClient.leaveGroupr   c                 C      d S Nr   )namehider   r   r   getGroupConversationb      zIClient.getGroupConversationc                 C   r$   r%   r   )r&   r   r   r   r   e   r)   zIClient.getPersonNr   )
r   r   r   r   r    r   r"   r#   r(   r   r   r   r   r   r   J   s    
r   c                   @   s6   e Zd Zdd Zdd Zdd Zdd Zdd
dZd	S )IPersonc                 C   r   )z
        Initialize me.

        @param name: My name, as the server knows me.
        @type name: string
        @param account: The account I am accessed through.
        @type account: I{Account}
        Nr   r&   r    r   r   r   r   j   r   zIPerson.__init__c                   C   r   )zA
        Am I online right now?

        @rtype: boolean
        Nr   r   r   r   r   r   t   r   zIPerson.isOnlinec                   C   r   )zS
        What is my on-line status?

        @return: L{locals.StatusEnum}
        Nr   r   r   r   r   	getStatus{   r   zIPerson.getStatusc                   C   r   )z;
        @rtype: string (XXX: How about a scalar?)
        Nr   r   r   r   r   getIdleTime   r   zIPerson.getIdleTimeNc                 C   r   )zi
        Send a message to this person.

        @type text: string
        @type metadata: dict
        Nr   textmetadatar   r   r   sendMessage   r   zIPerson.sendMessager%   )r   r   r   r   r   r-   r.   r2   r   r   r   r   r+   i   s    
r+   c                   @   sJ   e Zd ZdZedZedZdd Zdd Zdd	d
Z	dd Z
dd ZdS )IGroupz
    A group which you may have a conversation with.

    Groups generally have a loosely-defined set of members, who may
    leave and join at any time.
    z'My C{str} name, as the server knows me.z/The L{Account<IAccount>} I am accessed through.c                 C   r   )z
        Initialize me.

        @param name: My name, as the server knows me.
        @type name: str
        @param account: The account I am accessed through.
        @type account: L{Account<IAccount>}
        Nr   r,   r   r   r   r      r   zIGroup.__init__c                 C   r   )zR
        Set this Groups topic on the server.

        @type text: string
        Nr   )r0   r   r   r   setTopic   r   zIGroup.setTopicNc                 C   r   )a  
        Send a message to this group.

        @type text: str

        @type metadata: dict
        @param metadata: Valid keys for this dictionary include:

            - C{'style'}: associated with one of:
                - C{'emote'}: indicates this is an action
        Nr   r/   r   r   r   sendGroupMessage   r   zIGroup.sendGroupMessagec                   C   r   )z"
        Join this group.
        Nr   r   r   r   r   join   r   zIGroup.joinc                   C   r   )z$
        Depart this group.
        Nr   r   r   r   r   leave   r   zIGroup.leaver%   )r   r   r   r   r   r&   r    r   r4   r5   r6   r7   r   r   r   r   r3      s    

r3   c                   @   s@   e Zd ZdZdd Zdd Zdd Zdd	 Zd
d Zdd Z	dS )IConversationz0
    A conversation with a specific person.
    c                 C   r   )z*
        @type person: L{IPerson}
        Nr   )personr   r   r   r   r      r   zIConversation.__init__c                   C   r   zA
        doesn't seem like it belongs in this interface.
        Nr   r   r   r   r   show   r   zIConversation.showc                   C   r   z#
        nor this neither.
        Nr   r   r   r   r   r'      r   zIConversation.hidec                 C   r$   r%   r   r/   r   r   r   sendText   r)   zIConversation.sendTextc                 C   r$   r%   r   r/   r   r   r   showMessage   r)   zIConversation.showMessagec                 C   r   )zR
        @param person: XXX Shouldn't this always be Conversation.person?
        Nr   )r9   newnickr   r   r   changedNick   r   zIConversation.changedNickN)
r   r   r   r   r   r;   r'   r=   r>   r@   r   r   r   r   r8      s    r8   c                   @   sT   e Zd Zdd Zdd Zdd Zdd Zd	d
 Zdd Zdd Z	dd Z
dd ZdS )IGroupConversationc                   C   r   r:   r   r   r   r   r   r;      r   zIGroupConversation.showc                   C   r   r<   r   r   r   r   r   r'      r   zIGroupConversation.hidec                 C   r$   r%   r   r/   r   r   r   r=      r)   zIGroupConversation.sendTextc                 C   r$   r%   r   )senderr0   r1   r   r   r   showGroupMessage   r)   z#IGroupConversation.showGroupMessagec                 C   r   )zT
        Sets the list of members in the group and displays it to the user.
        Nr   )membersr   r   r   setGroupMembers   r   z"IGroupConversation.setGroupMembersc                 C   r   )z
        Displays the topic (from the server) for the group conversation window.

        @type topic: string
        @type author: string (XXX: Not Person?)
        Nr   )topicauthorr   r   r   r4      r   zIGroupConversation.setTopicc                 C   r   )z
        Adds the given member to the list of members in the group conversation
        and displays this to the user,

        @type member: string (XXX: Not Person?)
        Nr   memberr   r   r   memberJoined  r   zIGroupConversation.memberJoinedc                 C   r   )z
        Changes the oldnick in the list of members to C{newnick} and displays this
        change to the user,

        @type oldnick: string (XXX: Not Person?)
        @type newnick: string
        Nr   oldnickr?   r   r   r   memberChangedNick
  r   z$IGroupConversation.memberChangedNickc                 C   r   )z
        Deletes the given member from the list of members in the group
        conversation and displays the change to the user.

        @type member: string (XXX: Not Person?)
        Nr   rH   r   r   r   
memberLeft  r   zIGroupConversation.memberLeftN)r   r   r   r;   r'   r=   rC   rE   r4   rJ   rM   rN   r   r   r   r   rA      s    	rA   c                   @   sP   e Zd Zdd Zdd Zdd Zddd	Zdd
dZdd Zdd Z	dd Z
dS )IChatUIc                 C   r   )zp
        Notifies user that an account has been signed on to.

        @type client: L{Client<IClient>}
        Nr   r   r   r   r   registerAccountClient  r   zIChatUI.registerAccountClientc                 C   r   )z~
        Notifies user that an account has been signed off or disconnected.

        @type client: L{Client<IClient>}
        Nr   rP   r   r   r   unregisterAccountClient$  r   zIChatUI.unregisterAccountClientc                   C   r   )z)
        @rtype: L{ContactsList}
        Nr   r   r   r   r   getContactsList+  r   zIChatUI.getContactsListr   c                 C   r   )aT  
        For the given person object, returns the conversation window
        or creates and returns a new conversation window if one does not exist.

        @type person: L{Person<IPerson>}
        @type Class: L{Conversation<IConversation>} class
        @type stayHidden: boolean

        @rtype: L{Conversation<IConversation>}
        Nr   )r9   Class
stayHiddenr   r   r   getConversation3  r   zIChatUI.getConversationc                 C   r   )a  
        For the given group object, returns the group conversation window or
        creates and returns a new group conversation window if it doesn't exist.

        @type group: L{Group<interfaces.IGroup>}
        @type Class: L{Conversation<interfaces.IConversation>} class
        @type stayHidden: boolean

        @rtype: L{GroupConversation<interfaces.IGroupConversation>}
        Nr   )grouprT   rU   r   r   r   r(   ?  r   zIChatUI.getGroupConversationc                 C   r   )z
        Get a Person for a client.

        Duplicates L{IAccount.getPerson}.

        @type name: string
        @type client: L{Client<IClient>}

        @rtype: L{Person<IPerson>}
        Nr   r&   r   r   r   r   r   K  r   zIChatUI.getPersonc                 C   r   )z
        Get a Group for a client.

        Duplicates L{IAccount.getGroup}.

        @type name: string
        @type client: L{Client<IClient>}

        @rtype: L{Group<IGroup>}
        Nr   rX   r   r   r   r   W  r   zIChatUI.getGroupc                 C   r   )z
        For the given person, changes the person's name to newnick, and
        tells the contact list and any conversation windows with that person
        to change as well.

        @type oldnick: string
        @type newnick: string
        Nr   rK   r   r   r   contactChangedNickc  r   zIChatUI.contactChangedNickNr*   )r   r   r   rQ   rR   rS   rV   r(   r   r   rY   r   r   r   r   rO     s    

rO   N)r   zope.interfacer   r   r   r   r+   r3   r8   rA   rO   r   r   r   r   <module>   s   5'4 8