예제 #1
0
/* Message envelope */
static int
message_envelope_date (mu_envelope_t envelope, char *buf, size_t len,
		       size_t *pnwrite)
{
  mu_message_t msg = mu_envelope_get_owner (envelope);
  time_t t;
  size_t n;

  if (msg == NULL)
    return EINVAL;

  /* FIXME: extract the time from "Date:".  */

  if (buf == NULL || len == 0)
    {
      n = MU_DATETIME_FROM_LENGTH;
    }
  else
    {
      char tmpbuf[MU_DATETIME_FROM_LENGTH+1];
      t = time (NULL);
      n = mu_strftime (tmpbuf, sizeof tmpbuf, 
                       MU_DATETIME_FROM, gmtime (&t));
      n = mu_cpystr (buf, tmpbuf, len);
    }
  if (pnwrite)
    *pnwrite = n;
  return 0;
}
예제 #2
0
int
mu_pop3_get_response (mu_pop3_t pop3, char *buf, size_t len, size_t *plen)
{
  size_t size;
  
  if (pop3 == NULL)
    return EINVAL;
  if (!MU_POP3_FISSET (pop3, MU_POP3_ACK))
    return MU_ERR_NOENT;
  
  if (buf)
    size = mu_cpystr (buf, pop3->ackbuf, len);
  if (plen)
    *plen = size;
  return 0;
}