Пример #1
0
/***********************************************************************
 *
 * imap_perform()
 *
 * This is the actual DO function for IMAP. Get a file/directory according to
 * the options previously setup.
 */
static CURLcode imap_perform(struct connectdata *conn, bool *connected,
                             bool *dophase_done)
{
  /* This is IMAP and no proxy */
  CURLcode result = CURLE_OK;

  DEBUGF(infof(conn->data, "DO phase starts\n"));

  if(conn->data->set.opt_no_body) {
    /* Requested no body means no transfer */
    struct FTP *imap = conn->data->state.proto.imap;
    imap->transfer = FTPTRANSFER_INFO;
  }

  *dophase_done = FALSE; /* not done yet */

  /* Start the first command in the DO phase */
  result = imap_select(conn);
  if(result)
    return result;

  /* Run the state-machine */
  if(conn->data->state.used_interface == Curl_if_multi)
    result = imap_multi_statemach(conn, dophase_done);
  else {
    result = imap_easy_statemach(conn);
    *dophase_done = TRUE; /* with the easy interface we are done here */
  }
  *connected = conn->bits.tcpconnect[FIRSTSOCKET];

  if(*dophase_done)
    DEBUGF(infof(conn->data, "DO phase is complete\n"));

  return result;
}
Пример #2
0
void try_imap4(void)
{
	char user_account[80];

	imap_connect( "", 0 );	/* connect to default server */
	if (imapi) {		/* connection successful? */
		imap_capability();
		if (get_password_dialog( user_password )) {
		/*	show_status( ErrMsg(EM_LogonValidate) ); */
			strcpy( user_account, prefs.account_name );
			if (user_account[0]=='\0') {
				strcpy( user_account, prefs.email_address );
				strtok( user_account, "@" );
			}
			imap_login( user_account, user_password );
			imap_select( "INBOX" );
			imap_noop();
			imap_logout();
			while (imap_deque_unsolicited( header, (int)sizeof(header) );
		}
	}
}
Пример #3
0
/*
 * Open mailbox in read-write mode.
 */
int
request_select(const char *server, const char *port, const char *user,
    const char *mbox)
{
	int r;
	session *s;
	const char *m;

	if (!(s = session_find(server, port, user)))
		return -1;

	m = apply_namespace(mbox, s->ns.prefix, s->ns.delim);

	if ((r = response_select(s, imap_select(s, m))) == -1)
		goto fail;

	return r;
fail:
	close_connection(s);
	session_destroy(s);

	return -1;
}