662 |
|
|
663 |
static int |
static int |
664 |
_env_msg_sender (envelope_t envelope, char *buf, size_t len, size_t *pnwrite) |
_env_msg_sender (envelope_t envelope, char *buf, size_t len, size_t *pnwrite) |
665 |
{ |
{ |
666 |
message_t msg = envelope_get_owner (envelope); |
message_t msg = envelope_get_owner (envelope); |
667 |
struct msg_envelope *env = message_get_owner (msg); |
struct msg_envelope *env = message_get_owner (msg); |
668 |
|
|
669 |
if (!env || !env->from) |
if (!env || !env->from) |
670 |
return EINVAL; |
return EINVAL; |
671 |
strncpy (buf, env->from, len); |
strncpy (buf, env->from, len); |
672 |
buf[len-1] = 0; |
buf[len-1] = 0; |
673 |
return 0; |
return 0; |
674 |
} |
} |
675 |
|
|
676 |
message_t |
message_t |
677 |
mh_stream_to_message (stream_t instream) |
mh_stream_to_message (stream_t instream) |
683 |
restore_envelope (instream, &mp); |
restore_envelope (instream, &mp); |
684 |
if (message_create (&msg, mp)) |
if (message_create (&msg, mp)) |
685 |
return NULL; |
return NULL; |
686 |
|
|
687 |
message_set_stream (msg, instream, mp); |
message_set_stream (msg, instream, mp); |
688 |
|
|
689 |
if (envelope_create (&env, msg)) |
if (envelope_create (&env, msg)) |
811 |
fclose (fp); |
fclose (fp); |
812 |
} |
} |
813 |
free (ctx); |
free (ctx); |
814 |
|
asprintf (&ctx, "%s/inbox", mhdir); |
815 |
|
if (mh_check_folder (ctx, !automode)) |
816 |
|
exit (1); |
817 |
|
free (ctx); |
818 |
free (mhdir); |
free (mhdir); |
|
/* FIXME: create inbox? */ |
|
819 |
} |
} |
820 |
|
|
821 |
void |
void |