§
    Žpma  ã                   ó^   — d Z ddlZddlmZ ddlmZ ddlmZ ddlm	Z	  G d„ de¦  «        Z
dS )	a!  
Local status cache repository support
Copyright (C) 2002-2017 John Goerzen & contributors

   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; either version 2 of the License, or
   (at your option) any later version.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with this program; if not, write to the Free Software
   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
é    N)ÚLocalStatusFolder)ÚLocalStatusSQLiteFolder)ÚBaseRepository)ÚOfflineImapErrorc                   óH   — e Zd ZdZd„ Zd„ Zd„ Zd„ Zd„ Zd„ Z	d„ Z
d	„ Zd
„ ZdS )ÚLocalStatusRepositoryzG
    Local Status Repository Class, child of Base Repository Class
    c                 óp  — t          j        | ||¦  «         i | _        t          t          j                             |                     ¦   «         d¦  «        dœ| j        d<   t          t          j                             |                     ¦   «         d¦  «        dœ| j        d<   | j	         
                    dd ¦  «        �t          dt          j        j        ¦  «        ‚|                      d¦  «         t          j                             | j        ¦  «        st	          j        | j        d¦  «         i | _        d S )	NzLocalStatus-sqlite)ÚclassÚrootÚsqliteÚLocalStatusÚplainÚstatus_backendzmthe 'status_backend' configuration option is not supported anymore; please, remove this configuration option.iÀ  )r   Ú__init__Úbackendsr   ÚosÚpathÚjoinÚgetaccountmetar   ÚaccountÚgetconfr   ÚERRORÚREPOÚsetup_backendÚexistsr   ÚmkdirÚ_folders)ÚselfÚ	reposnamer   s      ú=/usr/share/offlineimap3/offlineimap/repository/LocalStatus.pyr   zLocalStatusRepository.__init__   s  € ÝÔ  i°Ñ9Ô9Ð9ð ˆŒå,Ý”G—L’L ×!7Ò!7Ñ!9Ô!9Ð;OÑPÔPð#
ð #
ˆŒ�hÑõ
 'Ý”G—L’L ×!7Ò!7Ñ!9Ô!9¸=ÑIÔIð"
ð "
ˆŒ�gÑð
 Œ<×ÒÐ 0°$Ñ7Ô7ÐCÝ"ðFå Ô&Ô+ñô ð ð 	×Ò˜8Ñ$Ô$Ð$åŒw�~Š~˜dœiÑ(Ô(ð 	'ÝŒH�T”Y Ñ&Ô&Ð&ð ˆŒˆˆó    c                 ó.   — |                       || ¦  «        S )N)ÚLocalStatusFolderClass)r   Ú
foldernames     r    Ú_instanciatefolderz(LocalStatusRepository._instanciatefolder<   s   € Ø×*Ò*¨:°tÑ<Ô<Ð<r!   c                 óÈ   — |t          | j                             ¦   «         ¦  «        v r9|| _        | j        |         d         | _        | j        |         d         | _        dS dS )zo
        Setup the backend.

        Args:
            backend: backend to use

        Returns: None

        r   r
   N)Úlistr   ÚkeysÚ_backendr   r#   )r   Úbackends     r    r   z#LocalStatusRepository.setup_backend?   sa   € ð •d˜4œ=×-Ò-Ñ/Ô/Ñ0Ô0Ð0Ð0Ø#ˆDŒMØœ gÔ.¨vÔ6ˆDŒIØ*.¬-¸Ô*@ÀÔ*IˆDÔ'Ð'Ð'ð 1Ð0r!   c                 ó  — t          | j                             ¦   «         ¦  «        D ]å\  }}|d         t          |¦  «        k    rŒt	          | j        | j        ¦  «        }|                     |¦  «          |d         |j        |¦  «        }|                     ¦   «         sl| j	         
                    d|›d| j        ›d| j        ›d|j        ›�¦  «         |                     ¦   «          |j        |_        |                     ¦   «           dS ŒædS )zh
        Import other backend

        Args:
            folder: folder

        Returns: None

        r
   z!Migrating LocalStatus cache from z to z status folder for ú:N)r'   r   ÚitemsÚtyper   Únamer   r   ÚisnewfolderÚuiÚ_msgr)   ÚcachemessagelistÚmessagelistÚsaveall)r   ÚfolderÚbkendÚdicÚrepobkÚfolderbks         r    Úimport_other_backendz*LocalStatusRepository.import_other_backendN   s  € õ ˜tœ}×2Ò2Ñ4Ô4Ñ5Ô5ð 	ð 	‰JˆE�3à�7Œ|�t F™|œ|Ò+Ð+Øå*¨4¬9°d´lÑCÔCˆFØ× Ò  Ñ'Ô'Ð'Ø#�s˜7”| F¤K°Ñ8Ô8ˆHð ×'Ò'Ñ)Ô)ð Ø”—’�à#˜e˜e T¤] ] ]°D´I°I°I¸v¼{¸{ðLñ Mô Mð Mð ×)Ò)Ñ+Ô+Ð+Ø%-Ô%9�Ô"Ø—’Ñ Ô Ð Ø��ðð	ð 	r!   c                 ó   — dS )Nú.© ©r   s    r    ÚgetsepzLocalStatusRepository.getsepl   s   € Øˆsr!   c                 ó  — | j         j        rdS |                      |¦  «        }|                     ¦   «          |                     ¦   «          |                     ¦   «          |                     ¦   «          |                      ¦   «          dS )zCreate a LocalStatus Folder.N)r   Údryrunr%   ÚpurgeÚ	openfilesÚsaveÚ
closefilesÚforgetfolders©r   r$   r6   s      r    Ú
makefolderz LocalStatusRepository.makefoldero   s…   € ð Œ<Ôð 	ØˆFð ×(Ò(¨Ñ4Ô4ˆð 	�Š‰ŒˆØ×ÒÑÔÐØ�Š‰ŒˆØ×ÒÑÔÐð 	×ÒÑÔÐÐÐr!   c                 óÂ   — || j         v r| j         |         S |                      |¦  «        }|                     ¦   «         r|                      |¦  «         || j         |<   |S )zlReturn the Folder() object for a foldername.

        Caller must call closefiles() on the folder when done.)r   r%   r0   r;   rH   s      r    Ú	getfolderzLocalStatusRepository.getfolder‚   sl   € ð
 ˜œÐ&Ð&Ø”= Ô,Ð,à×(Ò(¨Ñ4Ô4ˆð ×ÒÑÔð 	.Ø×%Ò% fÑ-Ô-Ð-à$*ˆŒ�jÑ!Øˆr!   c                 ó   — dS )a  Returns a list of all cached folders.

        Does nothing for this backend. We mangle the folder file names
        (see getfolderfilename) so we can not derive folder names from
        the file names that we have available. TODO: need to store a
        list of folder names somehow?Nr>   r?   s    r    Ú
getfoldersz LocalStatusRepository.getfolders“   s   € € € r!   c                 ó   — i | _         dS )zTForgets the cached list of folders, if any.  Useful to run
        after a sync run.N)r   r?   s    r    rG   z#LocalStatusRepository.forgetfolders›   s   € ð ˆŒˆˆr!   N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r%   r   r;   r@   rI   rK   rM   rG   r>   r!   r    r   r      s¨   € € € € € ðð ðð ð ð:=ð =ð =ðJð Jð Jðð ð ð<ð ð ðð ð ð&ð ð ð")ð )ð )ðð ð ð ð r!   r   )rR   r   Úofflineimap.folder.LocalStatusr   Ú$offlineimap.folder.LocalStatusSQLiter   Úofflineimap.repository.Baser   Úofflineimap.errorr   r   r>   r!   r    ú<module>rW      s    ððð ð$ 
€	€	€	à <Ð <Ð <Ð <Ð <Ð <Ø HÐ HÐ HÐ HÐ HÐ HØ 6Ð 6Ð 6Ð 6Ð 6Ð 6Ø .Ð .Ð .Ð .Ð .Ð .ðDð Dð Dð Dð D˜Nñ Dô Dð Dð Dð Dr!   