1 /* vim: set textwidth=80 tabstop=4: */
2 
3 /*
4  * Claws Mail -- a GTK+ based, lightweight, and fast e-mail client
5  * Copyright (C) 1999-2018 Michael Rasmussen and the Claws Mail Team
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 #ifndef __LIBARCHIVE_ARCHIVE_H__
23 #define __LIBARCHIVE_ARCHIVE_H__
24 
25 #include <glib.h>
26 #include "folder.h"
27 
28 #include <archive.h>
29 
30 typedef enum _COMPRESS_METHOD COMPRESS_METHOD;
31 enum _COMPRESS_METHOD {
32 		GZIP,
33 		BZIP2,
34         COMPRESS,
35 #if ARCHIVE_VERSION_NUMBER >= 2006990
36 		LZMA,
37 		XZ,
38 #endif
39 #if ARCHIVE_VERSION_NUMBER >= 3000000
40 		LZIP,
41 #endif
42 #if ARCHIVE_VERSION_NUMBER >= 3001000
43 		LRZIP,
44 		LZOP,
45 		GRZIP,
46 #endif
47 #if ARCHIVE_VERSION_NUMBER >= 3001900
48 		LZ4,
49 #endif
50         NO_COMPRESS
51 };
52 
53 typedef enum _ARCHIVE_FORMAT ARCHIVE_FORMAT;
54 enum _ARCHIVE_FORMAT {
55 		NO_FORMAT,
56 		TAR,
57 		SHAR,
58 		PAX,
59 		CPIO
60 };
61 
62 typedef struct _MsgTrash MsgTrash;
63 struct _MsgTrash {
64     FolderItem* item;
65     /* List of MsgInfos* */
66     GSList* msgs;
67 };
68 
69 MsgTrash* new_msg_trash(FolderItem* item);
70 void archive_free_archived_files();
71 void archive_add_msg_mark(MsgTrash* trash, MsgInfo* msg);
72 void archive_add_file(gchar* path);
73 GSList* archive_get_file_list();
74 void archive_free_file_list(gboolean md5, gboolean rename);
75 const gchar* archive_create(const char* archive_name, GSList* files,
76 				COMPRESS_METHOD method, ARCHIVE_FORMAT format);
77 gboolean before_date(time_t msg_mtime, const gchar* before);
78 void archiver_set_tooltip(GtkWidget* widget, gchar* text);
79 
80 #ifdef _TEST
81 void archive_set_permissions(int perm);
82 const gchar* archive_extract(const char* archive_name, int flags);
83 void archive_scan_folder(const char* dir);
84 #endif
85 
86 #endif
87