Пример #1
0
int mailimap_fetch_envelope(mailimap * session,
    uint32_t first, uint32_t last,
    clist ** result)
{
  int r;
  clist * fetch_list;
  struct mailimap_fetch_att * fetch_att;
  struct mailimap_fetch_type * fetch_type;
  struct mailimap_set * set;

  fetch_att = mailimap_fetch_att_new_envelope();
  fetch_type = mailimap_fetch_type_new_fetch_att(fetch_att);
  set = mailimap_set_new_interval(first, last);

  r = mailimap_fetch(session, set, fetch_type, &fetch_list);

  mailimap_set_free(set);
  mailimap_fetch_type_free(fetch_type);

  if (r != MAILIMAP_NO_ERROR)
    return r;

  * result = fetch_list;

  return MAILIMAP_NO_ERROR;
}
Пример #2
0
static void fetch_messages(struct mailimap * imap)
{
	struct mailimap_set * set;
	struct mailimap_fetch_type * fetch_type;
	struct mailimap_fetch_att * fetch_att;
	clist * fetch_result;
	clistiter * cur;
	int r;
	
	/* as improvement UIDVALIDITY should be read and the message cache should be cleaned
	   if the UIDVALIDITY is not the same */
	
	set = mailimap_set_new_interval(1, 0); /* fetch in interval 1:* */
	fetch_type = mailimap_fetch_type_new_fetch_att_list_empty();
	fetch_att = mailimap_fetch_att_new_uid();
	mailimap_fetch_type_new_fetch_att_list_add(fetch_type, fetch_att);

	r = mailimap_fetch(imap, set, fetch_type, &fetch_result);
	check_error(r, "could not fetch");
	
  /* for each message */
	for(cur = clist_begin(fetch_result) ; cur != NULL ; cur = clist_next(cur)) {
		struct mailimap_msg_att * msg_att;
		uint32_t uid;
		
		msg_att = clist_content(cur);
		uid = get_uid(msg_att);
		if (uid == 0)
			continue;

		fetch_msg(imap, uid);
	}

	mailimap_fetch_list_free(fetch_result);
}
Пример #3
0
LIBETPAN_EXPORT
struct mailimap_set * mailimap_set_new_single(uint32_t indx)
{
  return mailimap_set_new_interval(indx, indx);
}