ó
    ×›‘h%  ã                   óÊ   • S r SSKJr  SSKJr  SSKJrJr  SSKJ	r	  SSK
Jr  SSKJr  SSKJrJr   " S	 S
5      r " S S5      r " S S5      r " S S\	R(                  5      rg)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                   óN   • \ rS rSrS rS rS rS rS rS\	4S jr
S\	4S	 jrS
rg)ÚAbstractGroupé   c                 ó   • Xl         X l        g ©N)ÚnameÚaccount)Úselfr   r   s      Ú`C:\Users\psant\Downloads\Noiseback\school\venv\Lib\site-packages\twisted/words/im/basesupport.pyÚ__init__ÚAbstractGroup.__init__   s   € ØŒ	Ø�ó    c                 ó   • [        U S5      $ )zsfinds group commands

these commands are methods on me that start with imgroup_; they are
called with no arguments
Úimgroup_r	   ©r   s    r   ÚgetGroupCommandsÚAbstractGroup.getGroupCommands   s   € ô ˜t ZÓ0Ð0r   c                 ó   • [        U S5      $ )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   ÚgetTargetCommandsÚAbstractGroup.getTargetCommands#   s   € ô ˜t [Ó1Ð1r   c                 ó¤   • U R                   R                  (       d  [        eU R                   R                  R                  U R                  5        g r   )r   Úclientr   Ú	joinGroupr   r   s    r   ÚjoinÚAbstractGroup.join.   s1   € Ø�|‰|×"×"ÜÐØ�‰×Ñ×%Ñ% d§i¡iÕ0r   c                 ó¤   • U R                   R                  (       d  [        eU R                   R                  R                  U R                  5        g r   )r   r$   r   Ú
leaveGroupr   r   s    r   ÚleaveÚAbstractGroup.leave3   s1   € Ø�|‰|×"×"ÜÐØ�‰×Ñ×&Ñ& t§y¡yÕ1r   Úreturnc                 ó>   • SU R                    SU R                  < S3$ )NÚ<Ú Ú>)Ú	__class__r   r   s    r   Ú__repr__ÚAbstractGroup.__repr__8   s    € Ø�4—>‘>Ð" ! D§I¡I¡=°Ð2Ð2r   c                 óL   • U R                    SU R                  R                   3$ ©NÚ@©r   r   ÚaccountNamer   s    r   Ú__str__ÚAbstractGroup.__str__;   ó"   € Ø—)‘)�˜A˜dŸl™l×6Ñ6Ð7Ð8Ð8r   )r   r   N)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__r   r   r!   r&   r*   Ústrr2   r9   Ú__static_attributes__© r   r   r   r      s3   † òò1ò	2ò1ò
2ð
3˜#ô 3ð9˜÷ 9r   r   c                   óB   • \ rS rSrS rS rS rS\4S jrS\4S jr	Sr
g	)
ÚAbstractPersoné?   c                 ó2   • Xl         X l        [        U l        g r   )r   r   r   Ústatus)r   r   ÚbaseAccounts      r   r   ÚAbstractPerson.__init__@   s   € ØŒ	Ø"ŒÜˆ�r   c                 ó   • [        U S5      $ )zufinds person commands

these commands are methods on me that start with imperson_; they are
called with no arguments
Ú	imperson_r	   r   s    r   ÚgetPersonCommandsÚ AbstractPerson.getPersonCommandsE   s   € ô ˜t [Ó1Ð1r   c                 ó   • g)z
Returns a string.
z--rB   r   s    r   ÚgetIdleTimeÚAbstractPerson.getIdleTimeM   s   € ð r   r,   c                 óX   • SU R                    SU R                  < SU R                   S3$ )Nr.   r/   Ú/r0   )r1   r   rG   r   s    r   r2   ÚAbstractPerson.__repr__S   s*   € Ø�4—>‘>Ð" ! D§I¡I¡=°°$·+±+°¸aÐ@Ð@r   c                 óL   • U R                    SU R                  R                   3$ r5   r7   r   s    r   r9   ÚAbstractPerson.__str__V   r;   r   )r   r   rG   N)r<   r=   r>   r?   r   rL   rO   r@   r2   r9   rA   rB   r   r   rD   rD   ?   s+   † òò
2òðA˜#ô Að9˜÷ 9r   rD   c                   óX   • \ rS rSr% SrSr\\   \S'   S r	S r
\4S\SS4S	 jjrS
 rSrg)ÚAbstractClientMixinéZ   zŠ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                 ó²   • U R                   R                   H*  n[        U[        5      (       d  M  X@R                   l          O    Xl        X l        X0l        g r   )r1   Ú	__bases__Ú
issubclassr   rY   r   ÚchatÚ_logonDeferred)r   r   ÚchatuiÚlogonDeferredÚbases        r   r   ÚAbstractClientMixin.__init__d   sE   € Ø—N‘N×,Ô,ˆDÜ˜$¤×)Ó)Ø,0—‘Ô)Ùñ -ð
 ØŒØŒ	Ø+Õr   c                 ó:   • U R                   R                  U 5        g r   )rY   ÚconnectionMader   s    r   rd   Ú"AbstractClientMixin.connectionMadeo   s   € Ø�‰×&Ñ& tÕ,r   Úreasonr,   c                 óŽ   • U R                   R                  X5        U R                  5         U R                  R	                  X5      $ r   )r   Ú_clientLostÚunregisterAsAccountClientrY   ÚconnectionLost©r   rf   s     r   rj   Ú"AbstractClientMixin.connectionLostr   s5   € Ø�‰× Ñ  Ô.Ø×&Ñ&Ô(Ø�‰×-Ñ-¨dÓ;Ð;r   c                 ó:   • U R                   R                  U 5        g)z*Tell the chat UI that I have `signed off'.N)r]   ÚunregisterAccountClientr   s    r   ri   Ú-AbstractClientMixin.unregisterAsAccountClientw   s   € à�	‰	×)Ñ)¨$Õ/r   )r^   r   r]   )r<   r=   r>   r?   Ú__doc__rY   r   r   Ú__annotations__r   rd   r   r   rj   ri   rA   rB   r   r   rW   rW   Z   s>   ‡ ñð "&€J��X‘Ó%ò	,ò-ð 0>ñ < Wð <À$õ <õ
0r   rW   c                   ó€   • \ rS rSrSrSrSrSr\r	\
rSrS rS rS rS	 rS
 rS rS rS rS rS rS rS\4S jrSrg)ÚAbstractAccounté|   aÌ  Base 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:
r   Né   c                 óh   • Xl         X l        X0l        X@l        XPl        X`l        0 U l        0 U l        g r   )r8   Ú	autoLoginÚusernameÚpasswordÚhostÚportÚ_groupsÚ_persons)r   r8   rw   rx   ry   rz   r{   s          r   r   ÚAbstractAccount.__init__Ÿ   s/   € Ø&ÔØ"ŒØ ŒØ ŒØŒ	ØŒ	àˆŒØˆ�r   c                 óR   • S H!  n[        X5      (       a  M  [        X0 5        M#     g )N)r|   r}   )ÚhasattrÚsetattr)r   Úks     r   ÚupgrateToVersion2Ú!AbstractAccount.upgrateToVersion2ª   s!   € ã(ˆAÜ˜4×#Ó#Ü˜ Ö$ò )r   c                 ó~   • [         R                  R                  U 5      nS H  n X	 M     U$ ! [         a     M  f = f)N)r$   Ú	_isOnlineÚ_isConnecting)r   Ú	VersionedÚ__getstate__ÚKeyError)r   Ústater‚   s      r   r‰   ÚAbstractAccount.__getstate__°   sG   € Ü× Ñ ×-Ñ-¨dÓ3ˆÛ9ˆAðØ’Hñ :ð
 ˆøô ó Úðús   ¦.®
<»<c                 ó   • U R                   $ r   )r†   r   s    r   ÚisOnlineÚAbstractAccount.isOnline¹   s   € Ø�~‰~Ðr   c                 óH  • U R                   (       d|  U R                  (       dk  SU l         U R                  U5      nUR                  U R                  5        UR                  UR
                  5        UR                  U R                  5        U$ [        R                  " S5      e)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}
é   zConnection in progress)
r‡   r†   Ú_startLogOnÚaddCallbackÚ	_cb_logOnÚregisterAccountClientÚ
addErrbackÚ_loginFailedr   ÚConnectError)r   r_   Úds      r   ÚlogOnÚAbstractAccount.logOn¼   sx   € ð ×"×"¨T¯^¯^Ø!"ˆDÔØ× Ñ  Ó(ˆAØ�M‰M˜$Ÿ.™.Ô)ð �M‰M˜&×6Ñ6Ô7Ø�L‰L˜×*Ñ*Ô+ØˆHä×$Ò$Ð%=Ó>Ð>r   c                 ó€   • U R                   R                  U5      nUc  U R                  X5      nX R                   U'   U$ )zSGroup factory.

@param name: Name of the group on this account.
@type name: string
)r|   ÚgetÚ_groupFactory)r   r   Úgroups      r   ÚgetGroupÚAbstractAccount.getGroupÓ   s>   € ð —‘× Ñ  Ó&ˆØ‰=Ø×&Ñ& tÓ2ˆEØ!&�L‰L˜ÑØˆr   c                 ó€   • U R                   R                  U5      nUc  U R                  X5      nX R                   U'   U$ )zUPerson factory.

@param name: Name of the person on this account.
@type name: string
)r}   r�   Ú_personFactory)r   r   Úpersons      r   Ú	getPersonÚAbstractAccount.getPersonß   s>   € ð —‘×"Ñ" 4Ó(ˆØ‰>Ø×(Ñ(¨Ó4ˆFØ"(�M‰M˜$ÑØˆr   c                 ó   • [        5       e)zcStart the sign on process.

Factored out of L{logOn}.

@returntype: Deferred L{interfaces.IClient}
)ÚNotImplementedError)r   r_   s     r   r’   ÚAbstractAccount._startLogOnë   s   € ô "Ó#Ð#r   c                 ó.   • SU l         SU l        Xl        U$ )Nr   r‘   )r‡   r†   r$   )r   r$   s     r   r”   ÚAbstractAccount._cb_logOnô   s   € ØˆÔØˆŒØŒØˆr   c                 ó"   • SU l         SU l        U$ )zˆErrorback for L{logOn}.

@type reason: Failure

@returns: I{reason}, for further processing in the callback chain.
@returntype: Failure
r   )r‡   r†   rk   s     r   r—   ÚAbstractAccount._loginFailedú   s   € ð ˆÔØˆŒØˆr   c                 ó0   • S U l         SU l        SU l        U$ )Nr   )r$   r‡   r†   )r   r$   rf   s      r   rh   ÚAbstractAccount._clientLost  s   € ØˆŒØˆÔØˆŒØˆr   r,   c                 ó�   • SR                  U R                  U R                  U R                  U R                  U R
                  5      $ )Nz<{}: {} ({}@{}:{})>)Úformatr1   r8   rx   rz   r{   r   s    r   r2   ÚAbstractAccount.__repr__  s:   € Ø$×+Ñ+Ø�N‰NØ×ÑØ�M‰MØ�I‰IØ�I‰Ió
ð 	
r   )r|   r‡   r†   r}   r8   rw   r$   rz   ry   r{   rx   )r<   r=   r>   r?   rp   r†   r‡   r$   r   rž   rD   r£   ÚpersistanceVersionr   rƒ   r‰   rŽ   rš   r    r¥   r’   r”   r—   rh   r@   r2   rA   rB   r   r   rs   rs   |   sk   † ñð2 €IØ€MØ€Fà!€MØ#€NàÐò	ò%òòò?ò.
ò
ò$òò
òð
˜#÷ 
r   rs   N)rp   Útypingr   Útwisted.internetr   Útwisted.internet.protocolr   r   Útwisted.persistedr   Útwisted.python.failurer   Útwisted.python.reflectr
   Útwisted.words.im.localsr   r   r   rD   rW   rˆ   rs   rB   r   r   Ú<module>r»      sU   ðñõ å "ß >Ý $Ý *Ý 2ß 9÷
&9ñ &9÷R9ñ 9÷60ñ 0ôDW
�f×&Ñ&õ W
r   