コード例 #1
0
ファイル: util.c プロジェクト: BackupTheBerlios/mutt-ng-svn
void imap_keepalive (void)
{
  CONNECTION *conn;
  CONTEXT *ctx = NULL;
  IMAP_DATA *idata;

  conn = mutt_socket_head ();
  while (conn) {
    if (conn->account.type == M_ACCT_TYPE_IMAP) {
      idata = (IMAP_DATA *) conn->data;

      if (idata->state >= IMAP_AUTHENTICATED
          && time (NULL) >= idata->lastread + ImapKeepalive) {
        if (idata->ctx)
          ctx = idata->ctx;
        else {
          ctx = mem_calloc (1, sizeof (CONTEXT));
          ctx->data = idata;
        }
        imap_check_mailbox (ctx, NULL, 1);
        if (!idata->ctx)
          mem_free (&ctx);
      }
    }

    conn = conn->next;
  }
}
コード例 #2
0
ファイル: util.c プロジェクト: hww3/pexts
void imap_keepalive (void)
{
  CONTEXT *ctx = Context;
  
  if (ctx == NULL || ctx->magic != M_IMAP || CTX_DATA->ctx != ctx)
    return;

  imap_check_mailbox (ctx, NULL);
}
コード例 #3
0
ファイル: util.c プロジェクト: jakobmatthes/mutt-debian
void imap_keepalive (void)
{
  CONNECTION *conn;
  CONTEXT *ctx = NULL;
  IMAP_DATA *idata;

  conn = mutt_socket_head ();
  while (conn)
  {
    if (conn->account.type == M_ACCT_TYPE_IMAP)
    {
      int need_free = 0;

      idata = (IMAP_DATA*) conn->data;

      if (idata->state >= IMAP_AUTHENTICATED
	  && time(NULL) >= idata->lastread + ImapKeepalive)
      {
	if (idata->ctx)
	  ctx = idata->ctx;
	else
	{
	  ctx = safe_calloc (1, sizeof (CONTEXT));
	  ctx->data = idata;
	  /* imap_close_mailbox will set ctx->iadata->ctx to NULL, so we can't
	   * rely on the value of iadata->ctx to determine if this placeholder
	   * context needs to be freed.
	   */
	  need_free = 1;
	}
	/* if the imap connection closes during this call, ctx may be invalid
	 * after this point, and thus should not be read.
	 */
	imap_check_mailbox (ctx, NULL, 1);
	if (need_free)
	  FREE (&ctx);
      }
    }

    conn = conn->next;
  }
}