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/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //lib/python2.7/site-packages/offlineimap/accounts.pyo
�
��Vc@s'ddlmZmZddlmZddlZddlZddlmZddl	Z	ddl
mZmZm
Z
ddl
mZddlmZddlmZdd	lmZyddlZWnnXd
�Zd�Zd�Zd
ejfd��YZdefd��YZd�ZdS(i����(tPopentPIPE(tEventN(texc_info(tmbnamestCustomConfigtOfflineImapError(tglobals(t
Repository(tgetglobalui(tInstanceLimitedThreadcCs
|jd�S(NtAccount(tgetsectionlist(tcustomconfig((s8/usr/lib/python2.7/site-packages/offlineimap/accounts.pytgetaccountlist$scCs&gt|�D]}t||�^q
S(sCReturns a list of instanciated Account class, one per account name.(RR(R
taccountname((s8/usr/lib/python2.7/site-packages/offlineimap/accounts.pytAccountListGenerator)scCs1i}x$t|�D]}|||j�<qW|S(sNReturns a dict of instanciated Account class with the account name as
    key.(Rtgetname(R
tretvaltitem((s8/usr/lib/python2.7/site-packages/offlineimap/accounts.pytAccountHashGenerator0sRcBs�eZdZe�Ze�Zd�Zd�Zd�Zd�Z	d�Z
d�Zd�Ze
d��Zd	�Zd
�Zd�ZRS(s�Represents an account (ie. 2 repositories) to sync.

    Most of the time you will actually want to use the derived
    :class:`accounts.SyncableAccount` which contains all functions used
    for syncing an account.cCs�||_||_|j�|_|j�|_t�|_|jdd�|_	|jj
dd�|_d|_|j	dkr�d|_	ndS(s
        :param config: Representing the offlineimap configuration file.
        :type config: :class:`offlineimap.CustomConfig.CustomConfigParser`

        :param name: A (str) string denoting the name of the Account
                     as configured.
        tautorefreshgtgeneralsdry-runiN(tconfigtnametgetmetadatadirtmetadatadirtgetlocalevalt	localevalR	tuitgetconffloatt
refreshperiodt
getbooleantdryruntquicknumtNone(tselfRR((s8/usr/lib/python2.7/site-packages/offlineimap/accounts.pyt__init__Fs				cCs|jS(N(R(R$((s8/usr/lib/python2.7/site-packages/offlineimap/accounts.pyR\scCs|jS(N(R(R$((s8/usr/lib/python2.7/site-packages/offlineimap/accounts.pyt	getconfig`scCs|jS(N(R(R$((s8/usr/lib/python2.7/site-packages/offlineimap/accounts.pyRcscCs|jS(N(R(R$((s8/usr/lib/python2.7/site-packages/offlineimap/accounts.pyt__str__fscCstjj|jd|j�S(NsAccount-(tostpathtjoinRR(R$((s8/usr/lib/python2.7/site-packages/offlineimap/accounts.pytgetaccountmetaiscCsd|j�S(NsAccount (R(R$((s8/usr/lib/python2.7/site-packages/offlineimap/accounts.pyt
getsectionmscCsy|dkr=xft|�D]}|jd|dd�qWn8|dkrY|jj�n|dkru|jj�ndS(sYSet skip sleep/abort event for all accounts.

        If we want to skip a current (or the next) sleep, or if we want
        to abort an autorefresh loop, the main thread can use
        set_abort_event() to send the corresponding signal. Signum = 1
        implies that we want all accounts to abort or skip the current
        or next sleep phase. Signum = 2 will end the autorefresh loop,
        ie all accounts will return after they finished a sync. signum=3
        means, abort NOW, e.g. on SIGINT or SIGTERM.

        This is a class method, it will send the signal to all accounts.
        isAccount t	skipsleept1iiN(Rtsettabort_soon_signaltabort_NOW_signal(tclsRtsignumtacctsection((s8/usr/lib/python2.7/site-packages/offlineimap/accounts.pytset_abort_eventpscCsY|jdd�}|r7|jj|j�dd�n|pXtjj�pXtjj�S(svChecks if an abort signal had been sent.

        If the 'skipsleep' config option for this account had been set,
        with `set_abort_event(config, 1)` it will get cleared in this
        function. Ie, we will only skip one sleep and not all.

        :returns: True, if the main thread had called
            :meth:`set_abort_event` earlier, otherwise 'False'.
        R-it0(tgetconfbooleanRR/R,RR0tis_setR1(R$R-((s8/usr/lib/python2.7/site-packages/offlineimap/accounts.pytget_abort_event�s
cCs�|js
dSg}t|d�r5|j|j�nt|d�rW|j|j�nx|D]}|j�q^Wt|jd�}|jj||�}x|D]}|j	�q�W|r�t
jj�s�t
j
j�r�dSd|_dSdS(s�Sleep if the account is set to autorefresh.

        :returns: 0:timeout expired, 1: canceled the timer,
                  2:request to abort the program,
                  100: if configured to not sleep at all.
        idt
localrepostremotereposi<iii(RthasattrtappendR:R;tstartkeepalivetintRtsleept
stopkeepaliveRR0R8R1R"(R$tkaobjsRRtsleepresult((s8/usr/lib/python2.7/site-packages/offlineimap/accounts.pyt_sleeper�s(	

	cCsHt|d�}t|d�}|jj|d�|jj|d�dS(s1Output diagnostics for all involved repositories.tremotetlocaltRemotetLocalN(RRtserverdiagnostics(R$tremote_repot
local_repo((s8/usr/lib/python2.7/site-packages/offlineimap/accounts.pyRI�s(t__name__t
__module__t__doc__RR0R1R%RR&RR'R+R,tclassmethodR5R9RDRI(((s8/usr/lib/python2.7/site-packages/offlineimap/accounts.pyR:s											$tSyncableAccountcBsMeZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	RS(s�A syncable email account connecting 2 repositories.

    Derives from :class:`accounts.Account` but contains the additional
    functions :meth:`syncrunner`, :meth:`sync`, :meth:`syncfolders`,
    used for syncing.cOsEtj|||�d|_tjj|jj�d|�|_	dS(Ns%s.lock(
RR%R#t_lockfdR(R)R*RRt
_lockfilepath(R$targstkwargs((s8/usr/lib/python2.7/site-packages/offlineimap/accounts.pyR%�s		cCs�t|jd�|_y!tj|jtjtjB�WnTtk
rInDtk
r�|jj	�t
d|t
jj�dt�d�nXdS(s@Lock the account, throwing an exception if it is locked already.twsBCould not lock account %s. Is another instance using this account?iN(topenRRRQtfcntltlockftLOCK_EXtLOCK_NBt	NameErrortIOErrortcloseRtERRORtREPOR#R(R$((s8/usr/lib/python2.7/site-packages/offlineimap/accounts.pyt__lock�s!


cCsR|jrN|jjrN|jj�ytj|j�WqNtk
rJqNXndS(s*Unlock the account, deleting the lock fileN(RQtclosedR]R(tunlinkRRtOSError(R$((s8/usr/lib/python2.7/site-packages/offlineimap/accounts.pyt_unlock�s

cCs |jj|�yk|j�}tjj|�sDtj|d�nt|d�|_t|d�|_	t|d�|_
WnItk
r�}|jj|t
�d�|jtjjkr��ndSXd}xL|r|jj|�z�y|j�|j�Wn�ttfk
r�n�tk
r�}|jtjjkrr|rT|d8}n|jtjjkrr�qrn|jj|t
�d�nItk
r�}|jj|t
�ddd	|�nX|jr�d}nWd|jj|�|j�|r|j�dkrd
}nXq�WdS(Ni�RERFtstatusiiitmsgs%While attempting to sync account '%s'i(RtregisterthreadR+R(R)texiststmkdirRR;R:tstatusreposRterrorRtseverityR^tCRITICALtacctt_SyncableAccount__lockt_SyncableAccount__synctKeyboardInterruptt
SystemExitR_t	ExceptionRtacctdoneRdRD(R$taccountmetadatatetlooping((s8/usr/lib/python2.7/site-packages/offlineimap/accounts.pyt
syncrunner�sL	

		

cCs4|jj|j�j|jj�|jj���S(s?Return the corresponding local folder for a given remotefolder.(R:t	getfoldertgetvisiblenametreplaceR;tgetsep(R$tremotefolder((s8/usr/lib/python2.7/site-packages/offlineimap/accounts.pytget_local_folders	c
Cs�g}|jdd�}|j|�|jdd�}|dkrLt}n[|dkr�|jdksv|j|kr�d|_t}q�|jd|_t}nt}y�|j}|j}|j}|j	�|j	�|j
||�|jdt�s|jj
||�nx|j	�D]}tjj�r7Pn|jsc|jjdd||f�qn|j|�}	|	js�|jjdd|	|	jf�qntjjstdd	|jj�d
tdd|j�|fd
|||f�}
|
j�|j|
�qt|||�qWx|D]}|j�q)W|jsVt j!t�n|j"�|j"�Wn|j#�|j#��nX|j$�|j$�|jdd�}|j|�dS(s�Synchronize the account once, then return.

        Assumes that `self.remoterepos`, `self.localrepos`, and
        `self.statusrepos` has already been populated, so it should only
        be called from the :meth:`syncrunner` function.tpresynchookttquickiitreadonlys$Not syncing filtered folder '%s'[%s]tinstancenametFOLDER_ttargetRsFolder %s [acc: %s]RStpostsynchookN(%tgetconftcallhookt
getconfinttTrueR"tFalseR;R:Rjt
getfolderstsync_folder_structureR7RtsyncfoldersRR1R8t	sync_thistdebugR~t
repositoryRtoptionstsinglethreadingR
Rt
syncfoldertgetexplainednametstartR=R*R!Rtwritet
forgetfolderstdropconnectionstholdordropconnections(R$t
folderthreadsthooktquickconfigR�R;R:RjR}tlocalfoldertthreadtthr((s8/usr/lib/python2.7/site-packages/offlineimap/accounts.pyt__sync&sr
							

		

	




cCs�tjj�rdS|sdSy�|jjd|�|jrAdSt|dtdtdtdtdt�}|j	�}|jjd|�|jjd|j
�WnLttfk
r��n3t
k
r�}|jj|t�d	d
d�nXdS(NsCalling hook: tshelltstdintstdouttstderrt	close_fdssHook stdout: %s
Hook stderr:%s
sHook return code: %diRfsCalling hook(RR1R8RR�R!RR�Rtcommunicatet
returncodeRqRrRsRkR(R$tcmdtptrRv((s8/usr/lib/python2.7/site-packages/offlineimap/accounts.pyR�|s$		(
RLRMRNR%RoRdRxR~RpR�(((s8/usr/lib/python2.7/site-packages/offlineimap/accounts.pyRP�s				.		Vc
	sF��fd��d����fd�}�fd�}|j}|j�|j}t���j|�z�y�|j|�}tj|j|j	��j
��|j|j�j
|j�|j����|j�d	kr��j�n�j��j||�|�|j�}|j�}	|j�}
|d	k|	d	k|
d	kdkrtdtjj�d	t�d�n|d	ks�|	s�|
r�|r��jd�n|d	kr�||||�n�|	d	kr�||||	��||��n�|
d	kr*||||
��||��nh|j�|rx|j��rx|j��rx�j|��j�d	Sn�||��|j��jd
t�s��j ||�|�|j!|��n�j"dd�j	��|jd
t�s"�j �|||�|j!|��n�j"d
d|j	���j#��j�Wn�t$t%fk
rm�n�tk
r�}|j&tjj'kr��q�j(|t�ddd||f�n?t)k
r�}�j(|dd||j�t*j+�f�nXWd	x:dddgD])}|t,�krt,�|j-�qqWXd	S(s�Synchronizes given remote folder for the specified account.

    Filtered folders on the remote side will not invoke this function.cs�|j�dks$|j�dkrx|j�sN�j|�|jj�dS|j�s��j|��j�dSn|j�|j�dS(Ni(tgetmessagecounttcheck_uidvaliditytvalidityproblemR�t
restore_atimetsave_uidvalidity(R�R}tstatusfolder(R:R(s8/usr/lib/python2.7/site-packages/offlineimap/accounts.pytcheck_uid_validity�s$




cSs@|j�}t|d�}|jt|�d�|j�dS(Ntwts
(tget_min_uid_fileRVR�tstrR](tfoldertmin_uidtuidfiletfd((s8/usr/lib/python2.7/site-packages/offlineimap/accounts.pytsave_min_uid�scs�|jd|��||��td�|j��}t|�dkrc|jdt|��n&|jdtjtj|�d	��dS(
sC Returns messages with uid > min(uids of messages newer than date).tmin_datecSs
|dkS(Ni((tuid((s8/usr/lib/python2.7/site-packages/offlineimap/accounts.pyt<lambda>�siR�ii<Ni�i�Q(tcachemessagelisttfiltertgetmessageuidlisttlentminttimetgmtimetmktime(R�R}tdatet
positive_uids(R�R�(s8/usr/lib/python2.7/site-packages/offlineimap/accounts.pytcachemessagelists_upto_date�s	cs�|j�|j�}|dkr�t|j��dkrhtd|jj|jjftjj	��q�|jd|�t
d�|jj��}t|�dkr�t
|�}nd}�||�n|jd|�dS(s� Retrieve messagelists when startdate has been set for
        the folder 'partial'.

        Idea: suppose you want to clone the messages after date in one
        account (partial) to a new one (new). If new is empty, then copy
        messages in partial newer than date to new, and keep track of the
        min uid. On subsequent syncs, sync all the messages in new against
        those after that min uid in partial. This is a partial replacement
        for maxage in the IMAP-IMAP sync case, where maxage doesn't work:
        the UIDs of the messages in localfolder might not be in the same
        order as those of corresponding messages in remotefolder, so if L in
        local corresponds to R in remote, the ranges [L, ...] and [R, ...]
        might not correspond. But, if we're cloning a folder into a new one,
        [min_uid, ...] does correspond to [1, ...].

        This is just for IMAP-IMAP. For Maildir-IMAP, use maxage instead.
        is>To use startdate on Repository %s, Repository %s must be emptyR�cSs
|dkS(Ni((R�((s8/usr/lib/python2.7/site-packages/offlineimap/accounts.pyR��siR�N(R�tretrieve_min_uidR#R�R�RR�RR^tMESSAGER�tmessagelisttkeysR�(tnewtpartialR�R�R�(R�(s8/usr/lib/python2.7/site-packages/offlineimap/accounts.pytcachemessagelists_startdate�s
isuYou can set at most one of the following: maxage, startdate (for the local folder), startdate (for the remote folder)isTQuick syncs (-q) not supported in conjunction with maxage or startdate; ignoring -q.NR�timaps(Not syncing to read-only repository '%s'R�Rfs&Aborting sync, folder '%s' [acc: '%s']s(ERROR in syncfolder for %s folder %s: %sR�R�R}(.R;R:RjR	RgR~RtaddRRtgetlocalrootRyRzR{R|tget_uidvalidityR#tdeletemessagelistR�t
syncingfoldert	getmaxagetgetstartdateRR^R_RtwarntquickchangedtskippingfolderR�R7R�tsyncingmessagestsyncmessagestoR�tsaveRqRrRltFOLDERRkRst	tracebackt
format_exctlocalstdropmessagelistcache(
taccountR}R�R�R�R;RjR�tmaxaget
localstarttremotestartRvR�((R�R:R�R�Rs8/usr/lib/python2.7/site-packages/offlineimap/accounts.pyR��s�	+				



&		




%(t
subprocessRRt	threadingRR(R�tsysRR�tofflineimapRRRRtofflineimap.repositoryRtofflineimap.uiR	tofflineimap.threadutilR
RWRRRtConfigHelperMixinRRPR�(((s8/usr/lib/python2.7/site-packages/offlineimap/accounts.pyt<module>s(			
��

Spamworldpro Mini