X-Git-Url: http://git.madism.org/?p=apps%2Fmadmutt.git;a=blobdiff_plain;f=compress.c;h=7362c551f5367393406c1bdb743c8dce9c0510e8;hp=1ac83553d5ee9821df57b8a5ed6dc302c6f676c3;hb=3ea753c6005292b3e3153ac7e1f7b7d2363955c9;hpb=df70e07e24add1869bcc9b7af2277d9d0c09a281 diff --git a/compress.c b/compress.c index 1ac8355..7362c55 100644 --- a/compress.c +++ b/compress.c @@ -1,19 +1,10 @@ /* + * Copyright notice from original mutt: * Copyright (C) 1997 Alain Penders * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * This file is part of mutt-ng, see http://www.muttng.org/. + * It's licensed under the GNU General Public License, + * please see the file GPL in the top level source directory. */ #include "mutt.h" @@ -21,9 +12,14 @@ #ifdef USE_COMPRESSED #include "mx.h" -#include "mailbox.h" +#include "mbox.h" #include "mutt_curses.h" +#include "lib/mem.h" +#include "lib/intl.h" +#include "lib/str.h" +#include "lib/debug.h" + #include #include #include @@ -134,7 +130,7 @@ static void set_path (CONTEXT * ctx) /* Uncompress to /tmp */ mutt_mktemp (tmppath); - ctx->path = safe_malloc (strlen (tmppath) + 1); + ctx->path = safe_malloc (mutt_strlen (tmppath) + 1); strcpy (ctx->path, tmppath); } @@ -235,7 +231,7 @@ int mutt_open_read_compressed (CONTEXT * ctx) cmd = get_compression_cmd (ci->open, ctx); if (cmd == NULL) return (-1); - dprint (2, (debugfile, "DecompressCmd: '%s'\n", cmd)); + debug_print (2, ("DecompressCmd: '%s'\n", cmd)); if ((fp = fopen (ctx->realpath, "r")) == NULL) { mutt_perror (ctx->realpath); @@ -323,8 +319,7 @@ int mutt_open_append_compressed (CONTEXT * ctx) /* close a compressed mailbox */ void mutt_fast_close_compressed (CONTEXT * ctx) { - dprint (2, (debugfile, "mutt_fast_close_compressed called on '%s'\n", - ctx->path)); + debug_print (2, ("called on '%s'\n", ctx->path)); if (ctx->compressinfo) { if (ctx->fp) @@ -373,7 +368,7 @@ int mutt_sync_compressed (CONTEXT * ctx) return (-1); } - dprint (2, (debugfile, "CompressCommand: '%s'\n", cmd)); + debug_print (2, ("CompressCommand: '%s'\n", cmd)); endwin (); fflush (stdout); @@ -405,8 +400,7 @@ int mutt_slow_close_compressed (CONTEXT * ctx) char *cmd; COMPRESS_INFO *ci = (COMPRESS_INFO *) ctx->compressinfo; - dprint (2, (debugfile, "mutt_slow_close_compressed called on '%s'\n", - ctx->path)); + debug_print (2, ("called on '%s'\n", ctx->path)); if (!(ctx->append && ((append = get_append_command (ctx->realpath, ctx)) || (append = ci->close)))) { /* if we can not or should not append, @@ -447,7 +441,7 @@ int mutt_slow_close_compressed (CONTEXT * ctx) return (-1); } - dprint (2, (debugfile, "CompressCmd: '%s'\n", cmd)); + debug_print (2, ("CompressCmd: '%s'\n", cmd)); endwin (); fflush (stdout); @@ -482,4 +476,15 @@ int mutt_slow_close_compressed (CONTEXT * ctx) return (0); } +mx_t* compress_reg_mx (void) { + mx_t* fmt = safe_calloc (1, sizeof (mx_t)); + fmt->type = M_COMPRESSED; + fmt->local = 1; + fmt->mx_is_magic = mbox_is_magic; + fmt->mx_check_empty = mbox_check_empty; + fmt->mx_access = access; + fmt->mx_open_mailbox = mutt_open_read_compressed; + return (fmt); +} + #endif /* USE_COMPRESSED */