commit fb2a2e9b1cb1bfca824316633e2c18b7447d19a2
parent df8ffff19c2a6b84019a9eb888b4400652d24746
Author: Christoph Lohmann <20h@r-36.net>
Date: Sat, 4 Feb 2017 12:37:12 +0100
Debug info and real IPv6 support.
Diffstat:
4 files changed, 23 insertions(+), 6 deletions(-)
diff --git a/imap.c b/imap.c
@@ -324,7 +324,7 @@ imap_cmd(imap_t *imap, char *cmd, ...)
}
va_end(ap);
- /* fprintf(stderr, "req: %s %s\n", tag, req); */
+ //printf("%s %s\n", tag, req);
net_printf(imap->fd, "%s %s\r\n", tag, req);
free(tag);
free(req);
diff --git a/mime.c b/mime.c
@@ -1212,8 +1212,8 @@ mime_decodepartencoding(mime_t *mime, int *len)
{
char *ret;
- //printf("ct = %s\n", mime->ct);
- //printf("cte = %s\n", mime->cte);
+ //printf("ct = \"%s\"\n", mime->ct);
+ //printf("cte = \"%s\"\n", mime->cte);
ret = NULL;
if (!strcasecmp(mime->cte, "base64")) {
*len = mime->bodylen;
diff --git a/net.c b/net.c
@@ -168,7 +168,7 @@ net_connecttcp(net_t *net)
* Anyone knowing a real check for IPv6, instead of failing
* everything, should contact me.
*/
- hints.ai_family = AF_INET;
+ hints.ai_family = AF_UNSPEC;
hints.ai_socktype = SOCK_STREAM;
hints.ai_protocol = IPPROTO_TCP;
if (getaddrinfo(net->addr, net->service, &hints, &ai))
diff --git a/parser.c b/parser.c
@@ -54,10 +54,18 @@ parser_free(parser_t *parser)
int
parser_read(parser_t *parser, char *buf, int len)
{
+ //int r;
+
switch(parser->type) {
case PARSER_NET:
+ //r = net_read((net_t *)parser->struc, buf, len);
+ //printf(buf);
+ //return r;
return net_read((net_t *)parser->struc, buf, len);
case PARSER_STRING:
+ //r = strio_read((strio_t *)parser->struc, buf, len);
+ //printf(buf);
+ //return r;
return strio_read((strio_t *)parser->struc, buf, len);
default:
break;
@@ -69,11 +77,19 @@ parser_read(parser_t *parser, char *buf, int len)
int
parser_readall(parser_t *parser, char *buf, int len)
{
+ int r;
+
switch(parser->type) {
case PARSER_NET:
- return net_readall((net_t *)parser->struc, buf, len);
+ r = net_readall((net_t *)parser->struc, buf, len);
+ printf(buf);
+ return r;
+ //return net_readall((net_t *)parser->struc, buf, len);
case PARSER_STRING:
- return strio_readall((strio_t *)parser->struc, buf, len);
+ r = strio_readall((strio_t *)parser->struc, buf, len);
+ printf(buf);
+ return r;
+ //return strio_readall((strio_t *)parser->struc, buf, len);
default:
break;
}
@@ -189,6 +205,7 @@ parsestructagain:
i = 1;
if (parser_read(parser, buf, 1) <= 0)
return NULL;
+ //printf("%s", buf);
switch (buf[0]) {
case '{':
for (; parser_read(parser, &buf[i], 1) > 0 && i < sizeof(buf);