comparison src/spool.c @ 414:309935f59820

Minor refactoring and added a newline to the debug output.
author markus schnalke <meillo@marmaro.de>
date Wed, 29 Feb 2012 14:23:16 +0100
parents b27f66555ba8
children 0430194f7ef8
comparison
equal deleted inserted replaced
413:7c5e51c53f72 414:309935f59820
71 static address* 71 static address*
72 spool_scan_rcpt(gchar *line) 72 spool_scan_rcpt(gchar *line)
73 { 73 {
74 address *rcpt = NULL; 74 address *rcpt = NULL;
75 75
76 if (line[3] != '\0') { 76 if (!line[3]) {
77 if (line[4] != '|') { 77 return NULL;
78 rcpt = create_address(&(line[4]), TRUE); 78 }
79 } else { 79 if (line[4] == '|') {
80 rcpt = create_address_pipe(&(line[4])); 80 rcpt = create_address_pipe(line+4);
81 } 81 } else {
82 if (line[3] == 'X') { 82 rcpt = create_address(line+4, TRUE);
83 addr_mark_delivered(rcpt); 83 }
84 } else if (line[3] == 'F') { 84 if (line[3] == 'X') {
85 addr_mark_failed(rcpt); 85 addr_mark_delivered(rcpt);
86 } 86 } else if (line[3] == 'F') {
87 addr_mark_failed(rcpt);
87 } 88 }
88 return rcpt; 89 return rcpt;
89 } 90 }
90 91
91 gboolean 92 gboolean
145 while ((len = read_line(in, buf, MAX_DATALINE)) > 0) { 146 while ((len = read_line(in, buf, MAX_DATALINE)) > 0) {
146 if (buf[0] == '\n') { 147 if (buf[0] == '\n') {
147 break; 148 break;
148 } else if (strncasecmp(buf, "MF:", 3) == 0) { 149 } else if (strncasecmp(buf, "MF:", 3) == 0) {
149 msg->return_path = create_address(&(buf[3]), TRUE); 150 msg->return_path = create_address(&(buf[3]), TRUE);
150 DEBUG(3) debugf("spool_read: MAIL FROM: %s", msg->return_path->address); 151 DEBUG(3) debugf("spool_read: MAIL FROM: %s\n",
152 msg->return_path->address);
151 } else if (strncasecmp(buf, "RT:", 3) == 0) { 153 } else if (strncasecmp(buf, "RT:", 3) == 0) {
152 address *addr; 154 address *addr;
153 addr = spool_scan_rcpt(buf); 155 addr = spool_scan_rcpt(buf);
154 if (addr_is_delivered(addr) || addr_is_failed(addr)) { 156 if (addr_is_delivered(addr) || addr_is_failed(addr)) {
155 msg->non_rcpt_list = g_list_append(msg->non_rcpt_list, addr); 157 msg->non_rcpt_list = g_list_append(msg->non_rcpt_list, addr);