Spamworldpro Mini Shell
Spamworldpro


Server : Apache/2.4.62 (Unix) OpenSSL/1.0.2k-fips
System : Linux server1.richineiserver.com 3.10.0-1160.119.1.el7.x86_64 #1 SMP Tue Jun 4 14:43:51 UTC 2024 x86_64
User : fdshops ( 1003)
PHP Version : 8.2.21
Disable Function : NONE
Directory :  /lib/python2.7/site-packages/offlineimap/folder/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //lib/python2.7/site-packages/offlineimap/folder/Gmail.pyo
�
��Vc@sxddlZddlmZddlmZmZddlmZddlZddlm	Z	de	fd��YZ
dS(	i����N(texc_info(timaputiltOfflineImapError(timaplibutili(t
IMAPFoldertGmailFoldercBs�eZdZd�Zd�Zd�Zd�Zddd�Zd�Z	d�Z
d�Zd	�Zd
�Z
dd�Zd
�ZRS(s�Folder implementation to support features of the Gmail IMAP server.

    Removing a message from a folder will only remove the "label" from
    the message and keep it in the "All mails" folder. To really delete
    a message it needs to be copied to the Trash folder. However, this
    is dangerous as our folder moves are implemented as a 1) delete in
    one folder and 2) append to the other. If 2 comes before 1, this
    will effectively delete the message from all folders. So we cannot
    do that until we have a smarter folder move mechanism.

    For more information on the Gmail IMAP server:
      http://mail.google.com/support/bin/answer.py?answer=77657&topic=12815
      https://developers.google.com/google-apps/gmail/imap_extensions
    cCs
tt|�j|||�|j|�|_|j|j�g|_|jjj	dd�|_
|jjjdt�|_
|j
r�|jjdd�|jjd|jf�n|jjj	dd�}tgtjd	|�D]}t|�r�|^q��|_dS(
Ntlabelsheaders
X-Keywordst
synclabelsisX-GM-LABELSssyncing labelstignorelabelsts\s*,\s*(tsuperRt__init__tgettrashfolderttrash_foldert
getspamfoldertreal_delete_folderst
repositorytaccounttgetconfRtgetconfbooleantFalseRt
imap_querytinserttsyncmessagesto_passestappendtsyncmessagesto_labelstsettretsplittlenR(tselft
imapservertnameRRtl((s</usr/lib/python2.7/site-packages/offlineimap/folder/Gmail.pyR-s	c	Cs\|jt|�d�}|ddjdd�}|jr�tjd|dd�}|r�tgtj|j	d��D]}tj
|�^qw�}n	t�}||j}tj|j
t|��}|j||j
�}|j|d|j
|�}nt|�dkr5dt|�d	 t|�d
f}n|}|jjdd||f�|S(
s=Retrieve message with UID from the IMAP server (incl body).  Also
           gets Gmail labels and embeds them into the message.

        :returns: the message body or throws and OfflineImapError
                  (probably severity MESSAGE) if e.g. no message with
                  this UID could be found.
        iiis
s
sX-GM-LABELS\s*\(([^\)]*)\)i�s%s...%si�i���timaps&Returned object from fetching %d: '%s'(t_fetch_from_imaptstrtreplaceRRtsearchRRt	imapsplittgrouptdequoteRtformat_labels_stringRtsortedtdeletemessageheaderstaddmessageheaderRtuitdebug(	Rtuidtdatatbodytmtlbtlabelst
labels_strt
dbg_output((s</usr/lib/python2.7/site-packages/offlineimap/folder/Gmail.pyt
getmessageCs"	=	
'cCs-d|j|kr"|j|dSt�SdS(NR5(tmessagelistR(RR0((s</usr/lib/python2.7/site-packages/offlineimap/folder/Gmail.pytgetmessagelabelskscCs&i|d6t�d6t�d6dd6S(NR0tflagsR5ittime(R(RR0((s</usr/lib/python2.7/site-packages/offlineimap/folder/Gmail.pytmsglist_item_initializerrscCsV|js(tt|�jd|d|�Si|_|jjd|�|jj	�}z�|j
|d|d|�}|s{dS|jd|d�\}}|dkr�td|j
�|fd||ftjj�dt�d�nWd|jj|�XxT|D]L}|dkrqn|jd	d
�d
}tj|�}d|krn|jjdt|�d
d
�qt|d�}	|j|	�|j|	<tj|d�}
tjd|d�}|rtgtj|jd
��D]}tj|�^q��}
n	t�}
|
|j }
t!j"|�}i|	d6|
d6|
d6|d6|j|	<qWdS(Ntmin_datetmin_uids'%s's(FLAGS X-GM-LABELS UID)tOKs'FETCHING UIDs in folder [%s]%s failed. sServer responded '[%s] %s'it itUIDs!No UID in message with options %stminortFLAGSs\(([^\)]*)\)sX-GM-LABELSR0R;R5R<(#RR
RtcachemessagelistR9R.tcollectingdatatNoneRtacquireconnectiont_msgs_to_fetchtfetchRt
getrepositorytERRORtFOLDERRtreleaseconnectionRRt
flags2hashtwarnR$tlongR=tflagsimap2maildirRR&RR'R(R)RRtInternaldate2epoch(RR>R?timapobjtmsgsToFetchtres_typetresponset
messagestrtoptionsR0R;R3R4R5trtime((s</usr/lib/python2.7/site-packages/offlineimap/folder/Gmail.pyRExsN	
	



=	
cCs�|js(tt|�j||||�St�}x9|j||j�D]"}|jtj	|j|��qGWtt|�j||||�}|j
||�|S(sSave the message on the Server

        This backend always assigns a new uid, so the uid arg is ignored.

        This function will update the self.messagelist dict to contain
        the new message after sucessfully saving it, including labels.

        See folder/Base for details. Note that savemessage() does not
        check against dryrun settings, so you need to ensure that
        savemessage is never called in a dryrun mode.

        :param rtime: A timestamp to be used as the mail date
        :returns: the UID of the new message as assigned by the server. If the
                  message is saved, but it's UID can not be found, it will
                  return 0. If the message can't be written (folder is
                  read-only for example) it will return -1.(RR
RtsavemessageRtgetmessageheaderlistRtupdateRtlabels_from_headertsavemessagelabels(RR0tcontentR;RZR5thstrtret((s</usr/lib/python2.7/site-packages/offlineimap/folder/Gmail.pyR[�s		 !cCsY||j}g|D]}|dkr|^q}t|�dkrU|jj�}z�y^ddjg|D]}tj|�^qi�d}tj|�}|j||||�}	Wn+|j	k
r�|j
j|||�dSXWd|jj
|�X|	rUtjtj|	�d�d}
tgtj|
�D]}tj|�^q0�}
|
SndS(s5Common code to savemessagelabels and addmessagelabelsit(RAt)NisX-GM-LABELS(RRRRHtjoinRtquotetuid_sequencet_store_to_imaptreadonlyR.tlabelstoreadonlyRGRNROR'RR)(RtargtuidlistR5R0RTR4R6tuid_strtresultt	retlabels((s</usr/lib/python2.7/site-packages/offlineimap/folder/Gmail.pyt_messagelabels_aux�s$
%3	 1cCs�||jkr6d|j|kr6|j|d}n	t�}||j}|||j@B}||kr�|jd|g|�}|r�||j|d<q�||j|d<ndS(s�Change a message's labels to `labels`.

        Note that this function does not check against dryrun settings,
        so you need to ensure that it is never called in a dryrun mode.R5sX-GM-LABELSN(R9RRRp(RR0R5t	oldlabelst	newlabelsRn((s</usr/lib/python2.7/site-packages/offlineimap/folder/Gmail.pyR_�s"	
cCs`||j}|jd||�}|r\x1|D]&}|j|d|B|j|d<q/WndS(s�Add `labels` to all messages in uidlist.

        Note that this function does not check against dryrun settings,
        so you need to ensure that it is never called in a dryrun mode.s+X-GM-LABELSR5N(RRpR9(RRlR5RnR0((s</usr/lib/python2.7/site-packages/offlineimap/folder/Gmail.pytaddmessageslabels�s


cCs`||j}|jd||�}|r\x1|D]&}|j|d||j|d<q/WndS(s�Delete `labels` from all messages in uidlist.

        Note that this function does not check against dryrun settings,
        so you need to ensure that it is never called in a dryrun mode.s-X-GM-LABELSR5N(RRpR9(RRlR5RnR0((s</usr/lib/python2.7/site-packages/offlineimap/folder/Gmail.pytdeletemessageslabelss


icCs�|dko|j|�}tt|�j||||�|r�|jr�y8|j|�}|j|�}|j||d|�Wq�tk
r�dSXndS(sCopies a message from self to dst if needed, updating the status

        Note that this function does not check against dryrun settings,
        so you need to ensure that it is never called in a
        dryrun mode.

        :param uid: uid of the message to be copied.
        :param dstfolder: A BaseFolder-derived instance
        :param statusfolder: A LocalStatusFolder instance
        :param register: whether we should register a new thread."
        :returns: Nothing on success, or raises an Exception.itmtimeN(	t	uidexistsR
Rt
copymessagetoRtgetmessagemtimeR:R_tNotImplementedError(RR0t	dstfoldertstatusfoldertregistertrealcopyRuR5((s</usr/lib/python2.7/site-packages/offlineimap/folder/Gmail.pyRws
cCsg}y�x�|j�D]�}tjjjj�r5Pn|dks|j|�rWqn|j|�|j}|j|�r�|j|�|j}n	t	�}||kr|j
|�qqWi}i}xt|�D]�\}	}tjjjj�r�Pn|j|�|j}|j|�r:|j|�|j}n	t	�}||kr�|jj
||	dt|�t|�|�|jjjr�q�n|j||d|j�|j|�}
|
||<|||<q�q�W|j|�|j|�Wn!tk
r|jjd�nXdS(shPass 4: Label Synchronization (Gmail only)

        Compare label mismatches in self with those in statusfolder. If
        msg has a valid UID and exists on dstfolder (has not e.g. been
        deleted there), sync the labels change to both dstfolder and
        statusfolder.

        This function checks and protects us from action in dryrun mode.
        iiRsPCan't sync labels. You need to configure a local repository of type GmailMaildirN(tgetmessageuidlisttofflineimaptaccountstAccounttabort_NOW_signaltis_setRvR:RRRt	enumerateR.t
settinglabelsRR+RRtdryrunR_RxtsavemessageslabelsbulktsavemessagesmtimebulkRyRP(RRzR{RlR0t
selflabelststatuslabelstmtimesR5tiRu((s</usr/lib/python2.7/site-packages/offlineimap/folder/Gmail.pyR-sD
		,


N(t__name__t
__module__t__doc__RR8R:R=RGRER[RpR_RsRtRwR(((s</usr/lib/python2.7/site-packages/offlineimap/folder/Gmail.pyRs		(		6					(RtsysRRRRRtofflineimap.accountstIMAPRR(((s</usr/lib/python2.7/site-packages/offlineimap/folder/Gmail.pyt<module>s

Spamworldpro Mini