Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • message.c

    r9a7b4f2 r66a8cd6  
    1010#include <time.h>
    1111#include "owl.h"
    12 #include "filterproc.h"
    1312
    1413static owl_fmtext_cache fmtext_cache[OWL_FMTEXT_CACHE_SIZE];
     
    839838  owl_free(tmp);
    840839
     840#ifdef OWL_ENABLE_ZCRYPT
    841841  /* if zcrypt is enabled try to decrypt the message */
    842842  if (owl_global_is_zcrypt(&g) && !strcasecmp(n->z_opcode, "crypt")) {
    843     const char *argv[] = {
    844       "zcrypt",
    845       "-D",
    846       "-c", owl_message_get_class(m),
    847       "-i", owl_message_get_instance(m),
    848       NULL
    849     };
    850     char *out;
    851     int rv;
    852     int status;
    853     char *zcrypt;
    854 
    855     zcrypt = owl_sprintf("%s/zcrypt", owl_get_bindir());
    856 
    857     rv = call_filter(zcrypt, argv, owl_message_get_body(m), &out, &status);
    858     owl_free(zcrypt);
    859 
    860     if(!rv && !status) {
    861       int len = strlen(out);
    862       if(len >= 8 && !strcmp(out + len - 8, "**END**\n")) {
    863         out[len - 8] = 0;
    864       }
     843    char *out = owl_zcrypt_decrypt(owl_message_get_body(m), owl_message_get_class(m), owl_message_get_instance(m));
     844    if (out) {
    865845      owl_message_set_body(m, out);
    866846      owl_free(out);
    867     } else if(out) {
    868       owl_free(out);
    869847    }
    870848  }
     849#endif 
    871850}
    872851#else
Note: See TracChangeset for help on using the changeset viewer.