Skip to content

How to enable debug with mailcore2 and etpan

Andrei edited this page Apr 22, 2019 · 3 revisions
#import <libetpan/libetpan.h>

/* direction is 1 for send, 0 for receive, -1 when it does not apply */
void mailcore_logger(int direction, const char * str, size_t size) {
    char *str2 = (char*) malloc(size+1);
    strncpy(str2,str,size);
    str2[size] = 0;
    if (direction == 1) {
        printf("%s\n", str2);
    }
    else if (direction == 0) {
        printf("%s\n", str2);
    }
    else {
        printf("%s\n", str2);
    }
    free(str2);
}

extern int MCLogEnabled;
extern int mailstream_debug;

MCLogEnabled = 1;
mailstream_debug = 1;
mailstream_logger = mailcore_logger;
Clone this wiki locally