dmc

dynamic mail client
git clone git://git.suckless.org/dmc
Log | Files | Refs | README | LICENSE

commit e5855f41a42b4f4b7b4aa93508b017a287f5e701
parent 634157b7472e17505d3b19e78d40fa34886a6b80
Author: pancake <nopcode.org>
Date:   Wed,  5 May 2010 01:17:10 +0200

* Oops. Fix SSL support
* Fix dmc -e default account template
Diffstat:
dmc.c | 15++++++++-------
sock.c | 5++---
2 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/dmc.c b/dmc.c @@ -90,7 +90,7 @@ static char *gethdr(const char *path, const char *file, const char *hdr) { /* server */ static int dmcstart(const char *name) { char a0[512], a1[32]; - char *host, *port, *prot; + char *host, *port, *prot, *ssl; pipe (dmc_in); pipe (dmc_out); pipe (dmc_err); @@ -116,10 +116,12 @@ static int dmcstart(const char *name) { host = cfgget ("HOST="); port = cfgget ("PORT="); prot = cfgget ("PROTOCOL="); + ssl = cfgget ("SSL="); + ssl = ssl? atoi (ssl)? "1": NULL: NULL; snprintf (a0, sizeof (a0), PREFIX"/bin/dmc-%s", prot); snprintf (a1, sizeof (a1), "dmc-%s", prot); printf ("(%s)\n", a0); - execl (a0, a1, host, port, NULL); + execl (a0, a1, host, port, ssl, NULL); free (host); free (port); exit (1); @@ -163,7 +165,7 @@ static char *dmccmd(const char *cmd, char *err, int errlen) { int ret, nfd; if (dmc_pid == -1) { - printf ("Use 'start' or '?'\n"); + printf ("Use 'on' or '?'\n"); return NULL; } for (;;) { @@ -289,7 +291,7 @@ static int dmcsend(const char *file) { "dmc-pack `ls %s.d/* 2>/dev/null` < %s " "| msmtp --user=\"%s\" --from=\"%s\" \"%s\"", file, file, user, mail, to); - // printf ("%s\n", line); + //printf ("LINE: %s\n", line); if (system (line) != 0) { fprintf (stderr, "Error ocurred while sending %s\n", file); return 0; @@ -313,7 +315,7 @@ static int dmcline(const char *line) { } else if (!strcmp (line, "on")) { dmcstart (acc[0]); - ptr = dmccmd ("on", err, sizeof (err)); + ptr = dmccmd (NULL, err, sizeof (err)); } else if (!strcmp (line, "off")) { dmcstop (); @@ -476,12 +478,11 @@ int main(int argc, char **argv) { FILE *fd = fopen (file, "w"); if (fd) { fprintf (fd, - "NAME=test\n" - "SSL=0\n" "LIMIT=50 # get only 50 mails for each folder\n" "PROTOCOL=pop3 # imap4\n" "HOST=serverhost.com\n" "PORT=110\n" + "SSL=0\n" "#SEND=acc-name\n" "SEND=!msmtp\n" "MAIL=username@domain.com\n" diff --git a/sock.c b/sock.c @@ -100,11 +100,10 @@ int sock_read (char *buf, int len) { int ret; memset (buf, 0, len+1); #if HAVE_SSL - if (ssl) - ret = SSL_read (sfd, buf, len); + if (ssl) ret = SSL_read (sfd, buf, len); else #endif - ret = read (fd, buf, len); + ret = read (fd, buf, len); if (ret>0) buf[ret] = '\0'; return ret;