o b!@sdZddlmZmZGdddeZGdddeZGdddeZGd d d eZGd d d eZGd ddeZ GdddeZ dS)z Pan-protocol chat client. ) Attribute Interfacec@sPeZdZdZedZedZddZddZdd Z d d Z d d Z ddZ dS)IAccountz; I represent a user's account with a chat service. z} Nr groupNamerrr getGroup?rzIAccount.getGroupcCr)z, @rtype: L{Person} Nr) personNamerrr getPersonDrzIAccount.getPersonN) __name__ __module__ __qualname____doc__rclient gatewayTyperrrrrrrrrr rs   rc@s>eZdZedZddZddZddZdd d Zd d Z d S)IClientz!The L{IAccount} I am a Client forcCr)z @type account: L{IAccount} @type chatui: L{IChatUI} @param logonDeferred: Will be called back once I am logged on. @type logonDeferred: L{Deferred} Nr)accountr logonDeferredrrr rNrzIClient.__init__cCr)zb @param groupName: The name of the group to join. @type groupName: string Nrrrrr joinGroupVrzIClient.joinGroupcCr)zc @param groupName: The name of the group to leave. @type groupName: string Nrrrrr leaveGroup\rzIClient.leaveGrouprcCdSNr)namehiderrr getGroupConversationbzIClient.getGroupConversationcCr$r%r)r&rrr rer)zIClient.getPersonNr) rrrrr rr"r#r(rrrrr rJs  rc@s6eZdZddZddZddZddZd d d Zd S) IPersoncCr)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} Nrr&r rrr rjrzIPerson.__init__cCr)zA Am I online right now? @rtype: boolean Nrrrrr rtrzIPerson.isOnlinecCr)zS What is my on-line status? @return: L{locals.StatusEnum} Nrrrrr getStatus{rzIPerson.getStatuscCr)z; @rtype: string (XXX: How about a scalar?) Nrrrrr getIdleTimerzIPerson.getIdleTimeNcCr)zi Send a message to this person. @type text: string @type metadata: dict Nrtextmetadatarrr sendMessagerzIPerson.sendMessager%)rrrrrr-r.r2rrrr r+is  r+c@sJeZdZdZedZedZddZddZdd d Z d d Z d dZ dS)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} I am accessed through.cCr)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} Nrr,rrr rrzIGroup.__init__cCr)zR Set this Groups topic on the server. @type text: string Nr)r0rrr setTopicrzIGroup.setTopicNcCr)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 Nrr/rrr sendGroupMessagerzIGroup.sendGroupMessagecCr)z" Join this group. Nrrrrr joinrz IGroup.joincCr)z$ Depart this group. Nrrrrr leaverz IGroup.leaver%) rrrrrr&r rr4r5r6r7rrrr r3s  r3c@s@eZdZdZddZddZddZdd Zd d Zd d Z dS) IConversationz0 A conversation with a specific person. cCr)z* @type person: L{IPerson} Nr)personrrrr rrzIConversation.__init__cCrzA doesn't seem like it belongs in this interface. Nrrrrr showrzIConversation.showcCrz# nor this neither. Nrrrrr r'rzIConversation.hidecCr$r%rr/rrr sendTextr)zIConversation.sendTextcCr$r%rr/rrr showMessager)zIConversation.showMessagecCr)zR @param person: XXX Shouldn't this always be Conversation.person? Nr)r9newnickrrr changedNickrzIConversation.changedNickN) rrrrrr;r'r=r>r@rrrr r8s r8c@sTeZdZddZddZddZddZd d Zd d Zd dZ ddZ ddZ dS)IGroupConversationcCrr:rrrrr r;rzIGroupConversation.showcCrr<rrrrr r'rzIGroupConversation.hidecCr$r%rr/rrr r=r)zIGroupConversation.sendTextcCr$r%r)senderr0r1rrr showGroupMessager)z#IGroupConversation.showGroupMessagecCr)zT Sets the list of members in the group and displays it to the user. Nr)membersrrr setGroupMembersrz"IGroupConversation.setGroupMemberscCr)z Displays the topic (from the server) for the group conversation window. @type topic: string @type author: string (XXX: Not Person?) Nr)topicauthorrrr r4rzIGroupConversation.setTopiccCr)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?) Nrmemberrrr memberJoinedrzIGroupConversation.memberJoinedcCr)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 Nroldnickr?rrr memberChangedNick rz$IGroupConversation.memberChangedNickcCr)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?) NrrHrrr memberLeftrzIGroupConversation.memberLeftN) rrrr;r'r=rCrEr4rJrMrNrrrr rAs rAc@sPeZdZddZddZddZddd Zdd d Zd d ZddZ ddZ dS)IChatUIcCr)zp Notifies user that an account has been signed on to. @type client: L{Client} Nrrrrr registerAccountClientrzIChatUI.registerAccountClientcCr)z~ Notifies user that an account has been signed off or disconnected. @type client: L{Client} NrrPrrr unregisterAccountClient$rzIChatUI.unregisterAccountClientcCr)z) @rtype: L{ContactsList} Nrrrrr getContactsList+rzIChatUI.getContactsListrcCr)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} @type Class: L{Conversation} class @type stayHidden: boolean @rtype: L{Conversation} Nr)r9Class stayHiddenrrr getConversation3rzIChatUI.getConversationcCr)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} @type Class: L{Conversation} class @type stayHidden: boolean @rtype: L{GroupConversation} Nr)grouprTrUrrr r(?rzIChatUI.getGroupConversationcCr)z Get a Person for a client. Duplicates L{IAccount.getPerson}. @type name: string @type client: L{Client} @rtype: L{Person} Nrr&rrrr rKrzIChatUI.getPersoncCr)z Get a Group for a client. Duplicates L{IAccount.getGroup}. @type name: string @type client: L{Client} @rtype: L{Group} NrrXrrr rWrzIChatUI.getGroupcCr)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 NrrKrrr contactChangedNickcrzIChatUI.contactChangedNickNr*) rrrrQrRrSrVr(rrrYrrrr rOs    rON) rzope.interfacerrrrr+r3r8rArOrrrr s 5'4 8