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/Maildir.pyo
�
��Vc@s-ddlZddlZddlZddlZddlmZddlmZddlm	Z	yddl
mZWn!ek
r�ddlmZnXye
Wn!ek
r�ddlmZ
nXddlmZmZejd	�Zejd
�Ziae	�add�Zdefd
��YZdS(i����N(texc_infoi(t
BaseFolder(tLock(tmd5(tSet(tOfflineImapErrort	emailutils,U=(\d+)s(\d+)cCs{tj�z_|dkr.ttj��}ntj|�rPt|cd7<n
dt|<|t|fSWdtj�XdS(Nii(ttimelocktacquiretNonetlongttimettimehashthas_keytrelease(tdate((s>/usr/lib/python2.7/site-packages/offlineimap/folder/Maildir.pyt_gettimeseq,s

t
MaildirFoldercBs�eZd�Zd�Zd�Zd�Zd�Zddd�Zd�Z	d�Z
ddd�Zd	�Zd
�Z
d�Ze�dd�Zd
�Zd�Zd�Zd�Zd�Zd�Zed�ZRS(cCs||_tt|�j||�|jjddt�|_||_i|_	|jjd|j
dt�|_|jr�dnd|_
tjd|j
�|_tjd|j
d	�|_t|j��j�|_tjj|j�|j��|_dS(
NtgeneraltfsyncsAccount smaildir-windows-compatiblet!t:s	%s2,(\w*)s([^s,]*)(tseptsuperRt__init__tconfigtgetdefaultbooleantTruetdofsynctroottmessagelisttaccountnametFalset
wincompatibletinfoseptretcompiletre_flagmatchtre_prefixmatchRtgetvisiblenamet	hexdigestt
_foldermd5tostpathtjointgetroottgetnamet	_fullname(tselfRtnameRt
repository((s>/usr/lib/python2.7/site-packages/offlineimap/folder/Maildir.pyR;s				cCs|jS(sBReturn the absolute file path to the Maildir folder (sans cur|new)(R/(R0((s>/usr/lib/python2.7/site-packages/offlineimap/folder/Maildir.pytgetfullnamePscCsdS(s�Retrieve the current connections UIDVALIDITY value

        Maildirs have no notion of uidvalidity, so we just return a magic
        token.i*((R0((s>/usr/lib/python2.7/site-packages/offlineimap/folder/Maildir.pytget_uidvalidityUscCsRtj|�}|stS|j�}t|�}|tj|�krJtStSdS(s�Check to see if the given message is newer than date (a
        time_struct) according to the maildir name which should begin
        with a timestamp.N(tre_timestampmatchtsearchRtgroupR
RtmktimeR (R0tmessagenameRttimestampmatchttimestampstrt
timestamplong((s>/usr/lib/python2.7/site-packages/offlineimap/folder/Maildir.pyt
_iswithintime\scCs�dddt�f\}}}}|jj|�}|rK|jd�}nd|j}||k}|r�tj|�}	|	r�t|	jd��}q�n|j	j|�}
|
r�td�|
jd�D��}n||||fS(s�Returns a messages file name components

        Receives the file name (without path) of a msg.  Usual format is
        '<%d_%d.%d.%s>,U=<%d>,FMD5=<%s>:2,<FLAGS>' (pointy brackets
        denoting the various components).

        If FMD5 does not correspond with the current folder MD5, we will
        return None for the UID & FMD5 (as it is not valid in this
        folder).  If UID or FMD5 can not be detected, we return `None`
        for the respective element.  If flags are empty or cannot be
        detected, we return an empty flags list.

        :returns: (prefix, UID, FMD5, flags). UID is a numeric "long"
            type. flags is a set() of Maildir flags.
        is,FMD5=%scss|]}|VqdS(N((t.0tc((s>/usr/lib/python2.7/site-packages/offlineimap/folder/Maildir.pys	<genexpr>�sN(
R	tsetR&tmatchR7R)tre_uidmatchR6R
R%(R0tfilenametprefixtuidtfmd5tflagstprefixmatcht	folderstrtfoldermatchtuidmatcht	flagmatch((s>/usr/lib/python2.7/site-packages/offlineimap/folder/Maildir.pyt_parse_filenameks!
"cs�|j�}i}g}d}xUddgD]G�tjj|j���}|j�fd�tj|�D��q+Wi}x�|D]�\�}	|	jd�r�q�ntjj�|	�}
|r�tjjtjj|j�|
��|kr�q�n|j	|	�\}}}
}|dkr,|}|d8}nCtj|	�}d}|sZ|}|d8}nt
|jd��}|dkr�|dkr�||kr�q�n|dkr�|j|	|�r�|j|�||<|||d<|
||d	<q�|j|�||<|||d<|
||d	<q�W|dkr�td
�|�}|r�t|�}x4|j�D]#}||krZ||||<qZqZWq�n|S(s!Cache the message list from a Maildir.

        If min_date is set, this finds the min UID of all messages newer than
        min_date and uses it as the real cutoff for considering messages.
        This handles the edge cases where the date is much earlier than messages
        with similar UID's (e.g. the UID was reassigned much later).

        Maildir flags are: R (replied) S (seen) T (trashed) D (draft) F
        (flagged), plus lower-case letters for custom flags.
        :returns: dict that can be used as self.messagelist.
        i����tnewtcurc3s|]}�|fVqdS(N((R>RC(tdirannex(s>/usr/lib/python2.7/site-packages/offlineimap/folder/Maildir.pys	<genexpr>�st.iiRGRCcSs
|dkS(Ni((RE((s>/usr/lib/python2.7/site-packages/offlineimap/folder/Maildir.pyt<lambda>�sN(t
getmaxsizeR*R+R,R3textendtlistdirt
startswithtgetsizeRMR	RBR6R
R7R=tmsglist_item_initializertfiltertmintkeys(R0tmin_datetmin_uidtmaxsizetretvaltfilestnouidcountertfulldirnametdate_excludeesRCtfilepathRDRERFRGRKt
positive_uids((RPs>/usr/lib/python2.7/site-packages/offlineimap/folder/Maildir.pyt_scanfolder�sV


$	cCslt|j��t|j��kr(tSx=|j�j�D])\}}|d|j|�kr;tSq;WtS(sdReturns True if the Maildir has changed

        Assumes cachemessagelist() has already been called RG(tsortedtgetmessageuidlistRtgetmessagelistt	iteritemstgetmessageflagsR (R0tstatusfolderREtmessage((s>/usr/lib/python2.7/site-packages/offlineimap/folder/Maildir.pytquickchanged�scCsit�d6dd6S(NRGs/no-dir/no-such-file/RC(R@(R0RE((s>/usr/lib/python2.7/site-packages/offlineimap/folder/Maildir.pyRX�scCsc|j�r_|jj|j|�|jd|d|�|_|jj|j||j��ndS(NR\R](tismessagelistemptytuitloadmessagelistR2RfRtmessagelistloadedtgetmessagecount(R0R\R]((s>/usr/lib/python2.7/site-packages/offlineimap/folder/Maildir.pytcachemessagelist�s
cCs|jS(N(R(R0((s>/usr/lib/python2.7/site-packages/offlineimap/folder/Maildir.pyRi�scCsa|j|d}tjj|j�|�}t|d�}|j�}|j�|jdd�S(s"Return the content of the message.RCtrts
s
(	RR*R+R,R3topentreadtclosetreplace(R0RERCRdtfileR_((s>/usr/lib/python2.7/site-packages/offlineimap/folder/Maildir.pyt
getmessage�s
cCs<|j|d}tjj|j�|�}tjj|�S(NRC(RR*R+R,R3tgetmtime(R0RERCRd((s>/usr/lib/python2.7/site-packages/offlineimap/folder/Maildir.pytgetmessagetime	scCsSt|�\}}d||tj�tj�||j|jdjt|��fS(s�Creates a new unique Maildir filename

        :param uid: The UID`None`, or a set of maildir flags
        :param flags: A set of maildir flags
        :returns: String containing unique message filenames%d_%d.%d.%s,U=%d,FMD5=%s%s2,%st(	RR*tgetpidtsockettgethostnameR)R"R,Rg(R0RERGRttimevalttimeseq((s>/usr/lib/python2.7/site-packages/offlineimap/folder/Maildir.pytnew_message_filenamescCsJtjjd|�}d}x�|r�|d}y@tjtjj|j�|�tjtjBtjBd�}PWqtk
r�}t	|d�s��n|j
|jkr�|r�tj
d�qntjj}td||�d
t�d�q��qXqWtj|d	�}|j|�|j�|jr<tj|�n|j�|S(sSaves given content to the named temporary file in the
        'tmp' subdirectory of $CWD.

        Arguments:
        - filename: name of the temporary file;
        - content: data to be saved.

        Returns: relative path to the temporary file
        that was created.ttmpiii�tEEXISTgq=
ףp�?s"Unique filename %s already exists.itwtN(R*R+R,RvR3tO_EXCLtO_CREATtO_WRONLYtOSErrorthasattrterrnoR�RtsleepRtERRORtMESSAGER	RtfdopentwritetflushRRRx(R0RCtcontentttmpnamettriestfdtetseverity((s>/usr/lib/python2.7/site-packages/offlineimap/folder/Maildir.pytsave_to_tmp_files4	



	
cCs{|jjd|||�|dkr)|S||jkrL|j||�|Stjj|j�d�}d}|j	ry7t
j|d�}|dkr�t
j|d�}nWqddlm
}ddlm}	|�j|t�jd�}
|	�}|jd	||
|f�qXn|j||d
|�}
|j|
|�}|jryPt
j|d�}|dk	r�tjtjj|j�|�||f�nWqtk
r}ddlm
}ddlm}	|�j|t�jd�}
|	�}|jd||
|f�qXn|j|�|j|<||j|d<||j|d
<|j||�|jjdd|�|S(s�Writes a new message, with the specified uid.

        See folder/Base for detail. Note that savemessage() does not
        check against dryrun settings, so you need to ensure that
        savemessage is never called in a dryrun mode.tmaildiriR�tDates
Delivery-datei����(tParser(tgetglobaluisIUID %d has invalid date %s: %s
Not using message timestamp as file prefixRsBUID %d has invalid date %s: %s
Not changing file modification timeRGRCssavemessage: returning uid %dN(RptsavemessageRtsavemessageflagsR*R+R,R3R	t_filename_use_mail_timestampRtget_message_datetemail.ParserR�tofflineimap.uiR�tparsestrRtgettwarnR�R�tutime_from_headertutimet	ExceptionRXtdebug(R0RER�RGtrtimettmpdirtmessage_timestampRR�R�tdatestrRpR�R9R�((s>/usr/lib/python2.7/site-packages/offlineimap/folder/Maildir.pyR�IsR						cCs|j|dS(NRG(R(R0RE((s>/usr/lib/python2.7/site-packages/offlineimap/folder/Maildir.pyRk�sc
Cs�|j|d}tjj|�\}}d|kr;dnd}||j|dkr�|jj|�}|r�|t|j�� }nd|jdj	t
|��f}||7}ntjj	||�}||kr�y>tjtjj	|j�|�tjj	|j�|��WnFt
k
r`}	td|||	d	ftjj�dt�d
�nX||j|d<||j|d<ndS(s6Sets the specified message's flags to the given set.

        This function moves the message to the cur or new subdir,
        depending on the 'S'een flag.

        Note that this function does not check against dryrun settings,
        so you need to ensure that it is never called in a
        dryrun mode.RCtSRORNRGs%s2,%sR~s"Can't rename file '%s' to '%s': %siiN(RR*R+tsplitR%R6tlenR7R"R,RgtrenameR3R�RR�tFOLDERR	R(
R0RERGtoldfilenamet
dir_prefixRCt	infomatchtinfostrtnewfilenameR�((s>/usr/lib/python2.7/site-packages/offlineimap/folder/Maildir.pyR��s*"
 cCs�||jkr"td|��n||kr2dS|j|d}tjj|�\}}|j|�}tjj||j||��}tjtjj|j	�|�tjj|j	�|��|j||j|<||j|d<|j|=dS(sPChange the message from existing uid to new_uid

        This will not update the statusfolder UID, you need to do that yourself.
        :param new_uid: (optional) If given, the old UID will be changed
                        to a new UID. The Maildir backend can implement this as
                        an efficient rename.
        s$Cannot change unknown Maildir UID %sNRC(
RRR*R+R�RkR,R�R�R3(R0REtnew_uidR�R�RCRGR�((s>/usr/lib/python2.7/site-packages/offlineimap/folder/Maildir.pytchange_message_uid�s	cCs�|j|d}tjj|j�|�}ytj|�Wnbtk
r�|j�}||kr�||d}tjj|j�|�}tj|�q�nX|j|=dS(s�Unlinks a message file from the Maildir.

        :param uid: UID of a mail message
        :type uid: String
        :return: Nothing, or an Exception if UID but no corresponding file
                 found.
        RCN(RR*R+R,R3tunlinkR�Rf(R0RERCRdt
newmsglist((s>/usr/lib/python2.7/site-packages/offlineimap/folder/Maildir.pyt
deletemessage�s
c
Cs�t|j�j�}|j�}xm|j�D]_\}}tjj|j�|d�}t	j
d|�}|dkr�|jj
dd|�q.|jd�|krR|jjd||jf�|s�|jd|jd�d|j�}ytj||�WqOtk
rK}	td|||	dftjj�dt�d	�qOXq�q.|jd�|jkr.|jjd
|||jf�q.q.WdS(s�Migrate FMD5 hashes from versions prior to 6.3.5

        :param dryrun: Run in dry run mode
        :type fix: Boolean
        :return: None
        RCsFMD5=([a-fA-F0-9]+)R�s'File `%s' doesn't have an FMD5 assignedis Migrating file `%s' to FMD5 `%s'sFMD5=s"Can't rename file '%s' to '%s': %sis<Inconsistent FMD5 for file `%s': Neither `%s' nor `%s' foundN(RR1R(RfRjR*R+R,R3R#R6R	RpR�R7tinfoR)RyR�R�RR�R�RR�(
R0tdryruntoldfmd5tmsglisttmkeytmvalueRCRAR�R�((s>/usr/lib/python2.7/site-packages/offlineimap/folder/Maildir.pytmigratefmd5�s2 &N(t__name__t
__module__RR3R4R=RMR	RfRnRXRtRiR{R}R@R�R�R�RkR�R�R�R R�(((s>/usr/lib/python2.7/site-packages/offlineimap/folder/Maildir.pyR:s(					"O				
	
	.	D		)		(R�RR#R*tsysRtBaseRt	threadingRthashlibRtImportErrorR@t	NameErrortsetsRtofflineimapRRR$RBR5RRR	RR(((s>/usr/lib/python2.7/site-packages/offlineimap/folder/Maildir.pyt<module>s*

	

Spamworldpro Mini