Exemple #1
0
static int mailimap_id_params_list_send(mailstream * fd, struct mailimap_id_params_list * list)
{
  int r;

  if ((list == NULL) || (clist_count(list->idpa_list) == 0)) {
    r = mailimap_token_send(fd, "NIL");
    if (r != MAILIMAP_NO_ERROR)
      return r;
    return MAILIMAP_NO_ERROR;
  }

  r = mailimap_oparenth_send(fd);
  if (r != MAILIMAP_NO_ERROR)
    return r;
  
  r = mailimap_struct_spaced_list_send(fd, list->idpa_list,
  				  (mailimap_struct_sender *)
				  mailimap_id_param_send);
  if (r != MAILIMAP_NO_ERROR)
    return r;
  
  r = mailimap_cparenth_send(fd);
  if (r != MAILIMAP_NO_ERROR)
    return r;
  
  return MAILIMAP_NO_ERROR;
}
Exemple #2
0
int
mailimap_sort_send(mailstream * fd, const char * charset,
                   struct mailimap_sort_key * key, struct mailimap_search_key * searchkey)
{
  int r;
  
  r = mailimap_token_send(fd, "SORT");
  if (r != MAILIMAP_NO_ERROR)
    return r;
  
  r = mailimap_space_send(fd);
  if (r != MAILIMAP_NO_ERROR)
    return r;
  
  r = mailimap_oparenth_send(fd);
  if (r != MAILIMAP_NO_ERROR)
    return r;
  
  r = mailimap_sort_key_send(fd, key);
  if (r != MAILIMAP_NO_ERROR)
    return r;
  
  r = mailimap_cparenth_send(fd);
  if (r != MAILIMAP_NO_ERROR)
    return r;
  
  if (charset != NULL) {
    r = mailimap_space_send(fd);
    if (r != MAILIMAP_NO_ERROR)
      return r;
    r = mailimap_astring_send(fd, charset);
    if (r != MAILIMAP_NO_ERROR)
      return r;
  }
  
  r = mailimap_space_send(fd);
  if (r != MAILIMAP_NO_ERROR)
    return r;
  
  if (searchkey != NULL) {
    r = mailimap_search_key_send(fd, searchkey);
    if (r != MAILIMAP_NO_ERROR)
      return r;
  }
  
  
  return MAILIMAP_NO_ERROR;
}
Exemple #3
0
static int send_fetch_param(mailstream * fd, uint64_t mod_sequence_value, int vanished)
{
  int r;
  
  if (mod_sequence_value == 0)
    return MAILIMAP_NO_ERROR;
  
  r = mailimap_space_send(fd);
  if (r != MAILIMAP_NO_ERROR)
    return r;
  
  r = mailimap_oparenth_send(fd);
  if (r != MAILIMAP_NO_ERROR)
    return r;
  
  r = mailimap_token_send(fd, "CHANGEDSINCE");
  if (r != MAILIMAP_NO_ERROR)
    return r;
  
  r = mailimap_space_send(fd);
  if (r != MAILIMAP_NO_ERROR)
    return r;
  
  r = mailimap_mod_sequence_value_send(fd, mod_sequence_value);
  if (r != MAILIMAP_NO_ERROR)
    return r;
  
  if (vanished) {
    r = mailimap_space_send(fd);
    if (r != MAILIMAP_NO_ERROR)
      return r;
    r = mailimap_token_send(fd, "VANISHED");
    if (r != MAILIMAP_NO_ERROR)
      return r;
  }
  
  r = mailimap_cparenth_send(fd);
  if (r != MAILIMAP_NO_ERROR)
    return r;
  
  return MAILIMAP_NO_ERROR;
}
static int mailimap_id_params_list_send(mailstream * fd, struct mailimap_id_params_list * list)
{
  int r;
  
  r = mailimap_oparenth_send(fd);
  if (r != MAILIMAP_NO_ERROR)
    return r;
  
  r = mailimap_struct_spaced_list_send(fd, list->idpa_list,
  				  (mailimap_struct_sender *)
				  mailimap_id_param_send);
  if (r != MAILIMAP_NO_ERROR)
    return r;
  
  r = mailimap_cparenth_send(fd);
  if (r != MAILIMAP_NO_ERROR)
    return r;
  
  return MAILIMAP_NO_ERROR;
}
Exemple #5
0
static int mailimap_msg_att_xgmlabels_send(mailstream * fd, struct mailimap_msg_att_xgmlabels * labels)
{
  int r;
  
  r = mailimap_oparenth_send(fd);
  if (r != MAILIMAP_NO_ERROR)
    return r;
  
  if (labels->att_labels != NULL) {
    r = mailimap_struct_spaced_list_send(fd, labels->att_labels,
                                         (mailimap_struct_sender *) mailimap_astring_send);
    if (r != MAILIMAP_NO_ERROR)
      return r;
  }
  
  r = mailimap_cparenth_send(fd);
  if (r != MAILIMAP_NO_ERROR)
    return r;
  
  return MAILIMAP_NO_ERROR;
}
Exemple #6
0
int mailimap_select_qresync_send(mailstream * fd, const char * mb,
  uint32_t uidvalidity, uint64_t modseq_value,
  struct mailimap_set * known_uids,
  struct mailimap_set * seq_match_data_sequences,
  struct mailimap_set * seq_match_data_uids)
{
  int r;
  
  /*
  select-param        =  "QRESYNC" SP "(" uidvalidity SP
  mod-sequence-value [SP known-uids]
  [SP seq-match-data] ")"
  */
  
  r = mailimap_token_send(fd, "SELECT");
  if (r != MAILIMAP_NO_ERROR)
    return r;
  r = mailimap_space_send(fd);
  if (r != MAILIMAP_NO_ERROR)
    return r;
  r = mailimap_mailbox_send(fd, mb);
  if (r != MAILIMAP_NO_ERROR)
    return r;
  r = mailimap_space_send(fd);
  if (r != MAILIMAP_NO_ERROR)
    return r;
	r = mailimap_token_send(fd, "QRESYNC");
	if (r != MAILIMAP_NO_ERROR)
		return r;
  r = mailimap_space_send(fd);
  if (r != MAILIMAP_NO_ERROR)
    return r;
	r = mailimap_oparenth_send(fd);
	if (r != MAILIMAP_NO_ERROR)
		return r;
  r = mailimap_number_send(fd, uidvalidity);
	if (r != MAILIMAP_NO_ERROR)
		return r;
  r = mailimap_space_send(fd);
  if (r != MAILIMAP_NO_ERROR)
    return r;
  r = mailimap_mod_sequence_value_send(fd, modseq_value);
	if (r != MAILIMAP_NO_ERROR)
		return r;
	if (known_uids != NULL) {
    r = mailimap_space_send(fd);
    if (r != MAILIMAP_NO_ERROR)
      return r;
    r = mailimap_set_send(fd, known_uids);
    if (r != MAILIMAP_NO_ERROR)
      return r;
  }
  if ((seq_match_data_sequences != NULL) && (seq_match_data_uids != NULL)) {
    r = mailimap_space_send(fd);
    if (r != MAILIMAP_NO_ERROR)
      return r;
    /* seq-match-data      =  "(" known-sequence-set SP known-uid-set ")" */
  	r = mailimap_oparenth_send(fd);
  	if (r != MAILIMAP_NO_ERROR)
  		return r;
    r = mailimap_set_send(fd, seq_match_data_sequences);
    if (r != MAILIMAP_NO_ERROR)
      return r;
    r = mailimap_space_send(fd);
    if (r != MAILIMAP_NO_ERROR)
      return r;
    r = mailimap_set_send(fd, seq_match_data_uids);
    if (r != MAILIMAP_NO_ERROR)
      return r;
  	r = mailimap_cparenth_send(fd);
  	if (r != MAILIMAP_NO_ERROR)
  		return r;
  }
	r = mailimap_cparenth_send(fd);
	if (r != MAILIMAP_NO_ERROR)
		return r;
	
  return MAILIMAP_NO_ERROR;
}