--- imapfilter/account.c 2003/08/08 00:18:45 1.4 +++ imapfilter/account.c 2004/02/11 00:03:46 1.8 @@ -3,6 +3,7 @@ #include #include #include +#include /* IEEE Std 1003.1-2001 non-conformance. */ #include #include "config.h" @@ -11,6 +12,7 @@ #include "struct.h" +extern opts_t opts; extern unsigned int flags; account_t *accounts = NULL; /* First node of accounts linked list. */ @@ -65,9 +67,7 @@ strncat(node->key, line + m[1].rm_so, min(m[1].rm_eo - m[1].rm_so, KEY_LEN - 1)); -#ifdef DEBUG - fprintf(stderr, "debug: ACCOUNT: '%s'\n", node->key); -#endif + debug("ACCOUNT: '%s'\n", node->key); if (m[3].rm_so != -1) { strncat(node->username, line + m[3].rm_so, @@ -80,9 +80,7 @@ if (string_decode(node->username)) return ERROR_CONFIG_PARSE; -#ifdef DEBUG - fprintf(stderr, "debug: USERNAME: '%s'\n", node->username); -#endif + debug("USERNAME: '%s'\n", node->username); if (m[4].rm_so != -1) { strncat(node->password, line + m[4].rm_so, @@ -91,28 +89,24 @@ if (string_decode(node->password)) return ERROR_CONFIG_PARSE; node->passwdattr = PASSWORD_PLAIN; + if (opts.debug == 1) + debug("PASSWORD: *\n"); + else + debug("PASSWORD: '%s'\n", node->password); } else flags |= FLAG_BLANK_PASSWORD; -#ifdef DEBUG - fprintf(stderr, "debug: PASSWORD: '%s'\n", node->password); -#endif - strncat(node->server, line + m[6].rm_so, min(m[6].rm_eo - m[6].rm_so, SERVER_LEN - 1)); -#ifdef DEBUG - fprintf(stderr, "debug: SERVER: '%s'\n", node->server); -#endif + debug("SERVER: '%s'\n", node->server); if (m[7].rm_so != -1) { n = min(m[7].rm_eo - m[7].rm_so - 1, 5); xstrncpy(p, line + m[7].rm_so + 1, n); p[n] = '\0'; node->port = strtoul(p, NULL, 10); -#ifdef DEBUG - fprintf(stderr, "debug: PORT: %d\n", node->port); -#endif + debug("PORT: %d\n", node->port); } if (m[8].rm_so != -1) { if (m[7].rm_so == -1) @@ -186,9 +180,7 @@ strncat(node->key, line + m[1].rm_so, min(m[1].rm_eo - m[1].rm_so, KEY_LEN - 1)); -#ifdef DEBUG - fprintf(stderr, "debug: FOLDER: '%s'\n", node->key); -#endif + debug("FOLDER: '%s'\n", node->key); strncat(mboxs, line + m[2].rm_so, min(m[2].rm_eo - m[2].rm_so, LINE_MAX - 1)); @@ -261,9 +253,7 @@ strncat(node->name, s, MBOX_NAME_LEN - 1); -#ifdef DEBUG - fprintf(stderr, "debug: MBOX: '%s'\n", node->name); -#endif + debug("MBOX: '%s'\n", node->name); APPEND_LINKED_LIST(cur_acct->mboxes, node, mbox); @@ -331,9 +321,7 @@ while ((c = strchr(c, '/'))) *(c++) = delim; -#ifdef DEBUG - fprintf(stderr, "debug: MAILBOX: '%s'\n", m); -#endif + debug("MAILBOX: '%s'\n", m); return m; }