dinhvh / libetpan

Mail Framework for C Language
www.etpan.org
Other
612 stars 283 forks source link

msvc 2019 issue with libetpan.h (latest) #347

Closed raniervf closed 4 years ago

raniervf commented 4 years ago

msvc 2019 (32 bits) libetpan latest

mail.c:

include

include

include

include

include <openssl/ssl.h>

include <openssl/err.h>

include <libetpan/libetpan.h>

C:\usr\include\libetpan/mailimap_types.h(3344): error C2061: erro de sintaxe: identificador 'mailimap_msg_body_handler' C:\usr\include\libetpan/mailimap_types.h(3344): error C2059: erro de sintaxe: ';' C:\usr\include\libetpan/mailimap_types.h(3344): error C2059: erro de sintaxe: '' C:\usr\include\libetpan/mailimap_types.h(3386): error C2061: erro de sintaxe: identificador 'mailimap_msg_body_handler' C:\usr\include\libetpan/mailimap_types.h(3397): error C2059: erro de sintaxe: '}' C:\usr\include\libetpan/mailimap_types.h(3462): warning C4214: extensao nao padrao usada: tipos de campo de bits diferentes de int C:\usr\include\libetpan/mailimap_types.h(3463): warning C4214: extensao nao padrao usada: tipos de campo de bits diferentes de int C:\usr\include\libetpan/mailimap_types.h(3583): error C2061: erro de sintaxe: identificador 'mailimap_msg_body_handler' C:\usr\include\libetpan/mailimap_types.h(3587): error C2061: erro de sintaxe: identificador 'msg_body_parse_in_progress' C:\usr\include\libetpan/mailimap_types.h(3587): error C2059: erro de sintaxe: ';' C:\usr\include\libetpan/mailimap_types.h(3588): error C2059: erro de sintaxe: '}' C:\usr\include\libetpan/mailimap.h(836): error C2143: erro de sintaxe: ')' ausente antes de '' C:\usr\include\libetpan/mailimap.h(836): error C2081: 'mailimap_msg_body_handler': nome inv lido na lista de parƒmetros formais C:\usr\include\libetpan/mailimap.h(836): error C2143: erro de sintaxe: '{' ausente antes de '' C:\usr\include\libetpan/mailimap.h(836): warning C4431: faltando especificador de tipo - int assumido. Observa‡ao: C nao suporta mais default-int C:\usr\include\libetpan/mailimap.h(837): error C2059: erro de sintaxe: 'tipo' C:\usr\include\libetpan/mailimap.h(837): error C2059: erro de sintaxe: ')'

Any idea?

dinhvh commented 4 years ago

Do you know what the message is in english?

raniervf commented 4 years ago

Circular dependency? Syntax error: identifier mailimap_msg_body_handler

raniervf commented 4 years ago

from msvc docs: "The compiler found an identifier where it was not expected. Make sure identifier is declared before using it."

raniervf commented 4 years ago

My app can't connect with gmail.com:

is fail here: src/low_level/smtp/mailsmtp.c int mailesmtp_starttls(mailsmtp * session) { int r; if (!(session->esmtp & MAILSMTP_ESMTP_STARTTLS)) return MAILSMTP_ERROR_STARTTLS_NOT_SUPPORTED;

session->estmp is false (0); response from gmail.com: smtp.gmail.com at your service, [xxx.xxx.xxx.xxx].SIZE 35882577.8BITMIME.AUTH LOGIN PLAIN XOAUTH2 PLAIN-CLIENTTOKEN OAUTHBEARER XOAUTH.ENHANCEDSTATUSCODES.PIPELINING.CHUNKING.SMTPUTF8.

Where am I wrong? int m_smtp_message_send(const smtp_ctx_t const smtp_ctx, const char const data, const size_t size, const char * rcpts) { const mailsmtp smtp = NULL; const char ** r; int smtp_tls = 0; int esmtp = 0; int ret;

if ((smtp = mailsmtp_new(0, NULL)) == NULL) {
    fprintf(stderr, "mailsmtp_new failed: \n");
    goto error;
}

/* first open the stream */
if (smtp_ctx->connection_type == ConnectionTypeTLS) {
   ret = mailsmtp_ssl_connect(smtp, 
          (smtp_ctx->hostname != NULL ? smtp_ctx->hostname : "localhost"), smtp_ctx->port);
   smtp_tls = 1;
} else {
   ret = mailsmtp_socket_connect(smtp, 
          (smtp_ctx->hostname != NULL ? smtp_ctx->hostname : "localhost"), smtp_ctx->port);
   smtp_tls = 0;
}
if (ret != MAILSMTP_NO_ERROR) {
   fprintf(stderr, "mailsmtp_socket_connect: %s\n", mailsmtp_strerror(ret));
   goto error;
}

/* then introduce ourselves */
if (smtp_ctx->lmtp == 'Y') {
    ret = mailesmtp_lhlo(smtp, "lmtp-test");
} else if (smtp_ctx->esmtp == 'Y' && (ret = mailesmtp_ehlo(smtp)) == MAILSMTP_NO_ERROR) {
    esmtp = 1;
} else if (smtp_ctx->esmtp == 'N' || ret == MAILSMTP_ERROR_NOT_IMPLEMENTED) {
    ret = mailsmtp_helo(smtp);
}
if (ret != MAILSMTP_NO_ERROR) {
    fprintf(stderr, "mailsmtp_helo: %s\n", mailsmtp_strerror(ret));
    goto error;
}

if (esmtp && smtp_tls &&
    (ret = mailsmtp_socket_starttls(smtp)) != MAILSMTP_NO_ERROR) { // FAIL HERE!
    fprintf(stderr, "mailsmtp_starttls: %s\n", mailsmtp_strerror(ret));
    goto error;
}

if (esmtp && smtp_tls) {
    /* introduce ourselves again */
    if (smtp_ctx->lmtp == 'Y') {
        ret = mailesmtp_lhlo(smtp, "lmtp-test");
    } else if (smtp_ctx->esmtp == 'Y' && (ret = mailesmtp_ehlo(smtp)) == MAILSMTP_NO_ERROR) {
        esmtp = 1;
    } else if (smtp_ctx->esmtp != 'Y' || ret == MAILSMTP_ERROR_NOT_IMPLEMENTED) {
        ret = mailsmtp_helo(smtp);
    }
    if (ret != MAILSMTP_NO_ERROR) {
        fprintf(stderr, "mailsmtp_helo: %s\n", mailsmtp_strerror(ret));
        goto error;
    }
}

if (esmtp && smtp_ctx->user != NULL) {
   ret = mailsmtp_auth(smtp, smtp_ctx->user, (smtp_ctx->password != NULL) ? smtp_ctx->password : "");
   if (ret != MAILSMTP_NO_ERROR) {
      fprintf(stderr, "mailsmtp_auth: %s: %s\n", smtp_ctx->user, mailsmtp_strerror(ret));
      goto error;
   }
}

/* source */
if ((ret = (esmtp ?
        mailesmtp_mail(smtp, smtp_ctx->from, 1, "etPanSMTPTest") :
        mailsmtp_mail(smtp, smtp_ctx->from))) != MAILSMTP_NO_ERROR) {
   fprintf(stderr, "mailsmtp_mail: %s, %s\n", smtp_ctx->from, mailsmtp_strerror(ret));
   goto error;
}

/* recipients */
for(r = rcpts; *r != NULL; ++r) {
   if ((ret = (esmtp ?
      mailesmtp_rcpt(smtp, *r, MAILSMTP_DSN_NOTIFY_FAILURE | MAILSMTP_DSN_NOTIFY_DELAY, NULL) : 
      mailsmtp_rcpt(smtp, *r))) != MAILSMTP_NO_ERROR) {
      fprintf(stderr, "mailsmtp_rcpt: %s: %s\n", *r, mailsmtp_strerror(ret));
      goto error;
   }
}

/* message */
if ((ret = mailsmtp_data(smtp)) != MAILSMTP_NO_ERROR) {
   fprintf(stderr, "mailsmtp_data: %s\n", mailsmtp_strerror(ret));
   goto error;
}

if ((ret = mailsmtp_data_message(smtp, data, size)) != MAILSMTP_NO_ERROR) {
   fprintf(stderr, "mailsmtp_data_message: %s\n", mailsmtp_strerror(ret));
   goto error;
}
mailsmtp_quit(smtp);
mailsmtp_free(smtp);
return 0;

error: if (smtp != NULL) { mailsmtp_free(smtp); } return -1; }