Exemple #1
0
int mailimap_acl_rights_parse(mailstream * fd,
    MMAPString *buffer, struct mailimap_parser_context * parser_ctx, size_t * indx,
    char ** result, size_t progr_rate,
    progress_function * progr_fun)
{
  return mailimap_astring_parse(fd, buffer, parser_ctx, indx, result,
      progr_rate, progr_fun);
}
Exemple #2
0
int
mailimap_acl_identifier_parse(mailstream * fd,
    MMAPString *buffer, size_t * indx,
    char ** result, size_t progr_rate,
    progress_function * progr_fun)
{
  return mailimap_astring_parse(fd, buffer, indx, result,
      progr_rate, progr_fun);
}
Exemple #3
0
static int fetch_data_xgmmsgid_parse(mailstream * fd,
                                      MMAPString * buffer, size_t * indx,
                                      uint64_t * result, size_t progr_rate, progress_function * progr_fun)
{
    size_t cur_token;
    uint64_t msgid;
    uint32_t uid;
    char  *msgid_str;
    int r;
    
    cur_token = * indx;
    
    r = mailimap_number_parse(fd, buffer, &cur_token, &uid);
    if (r != MAILIMAP_NO_ERROR)
        return r;

    r = mailimap_space_parse(fd, buffer, &cur_token);
    if (r != MAILIMAP_NO_ERROR)
        return r;
    
    r = mailimap_token_case_insensitive_parse(fd, buffer,
                                              &cur_token, "FETCH");
    if (r != MAILIMAP_NO_ERROR)
        return r;

    r = mailimap_space_parse(fd, buffer, &cur_token);
    if (r != MAILIMAP_NO_ERROR)
        return r;
    
    r = mailimap_oparenth_parse(fd, buffer, &cur_token);
    if (r != MAILIMAP_NO_ERROR)
        return r;
    
    r = mailimap_token_case_insensitive_parse(fd, buffer,
                                              &cur_token, "X-GM-MSGID");
    if (r != MAILIMAP_NO_ERROR)
        return r;
    
    r = mailimap_space_parse(fd, buffer, &cur_token);
    if (r != MAILIMAP_NO_ERROR)
        return r;
    
    r = mailimap_astring_parse(fd, buffer, &cur_token, &msgid_str, progr_rate, progr_fun);
    if (r != MAILIMAP_NO_ERROR)
        return r;
    
    msgid = atol(msgid_str);
    
    r = mailimap_cparenth_parse(fd, buffer, &cur_token);
    if (r != MAILIMAP_NO_ERROR)
        return r;
    
    * indx = cur_token;
    * result = msgid;
    
    return MAILIMAP_NO_ERROR;
}
Exemple #4
0
int
mailimap_quota_quotaroot_response_parse(mailstream * fd, MMAPString *buffer,
    size_t * indx, struct mailimap_quota_quotaroot_data ** result,
    size_t progr_rate, progress_function * progr_fun)
{
  size_t cur_token;
  char * mailbox;
  char * quotaroot;
  clist * quotaroot_list;
  struct mailimap_quota_quotaroot_data * quotaroot_data;
  int r;
  int res;

  cur_token = * indx;

  r = mailimap_token_case_insensitive_parse(fd, buffer,
					    &cur_token, "QUOTAROOT");
  if (r != MAILIMAP_NO_ERROR) {
    res = r;
    goto err;
  }

  r = mailimap_space_parse(fd, buffer, &cur_token);
  if (r != MAILIMAP_NO_ERROR) {
    res = r;
    goto err;
  }

  r = mailimap_mailbox_parse(fd, buffer, &cur_token, &mailbox,
          progr_rate, progr_fun);
  if (r != MAILIMAP_NO_ERROR) {
    res = r;
    goto err;
  }

  quotaroot_list = clist_new();
  if (!quotaroot_list) {
    res = MAILIMAP_ERROR_MEMORY;
    goto mailbox_free;
  }

  for (;;) {
    r = mailimap_space_parse(fd, buffer, &cur_token);
    if (r == MAILIMAP_ERROR_PARSE) {
      break;
    } else if (r != MAILIMAP_NO_ERROR) {
      res = r;
      goto quotaroot_list_free;
    }

    r = mailimap_astring_parse(fd, buffer, &cur_token, &quotaroot,
        progr_rate, progr_fun);
    if (r != MAILIMAP_NO_ERROR) {
      res = r;
      goto quotaroot_list_free;
    }

    if (clist_append(quotaroot_list, quotaroot) < 0) {
      mailimap_astring_free(quotaroot);
      res = MAILIMAP_ERROR_MEMORY;
      goto quotaroot_list_free;
    }
  }

  quotaroot_data = mailimap_quota_quotaroot_data_new(mailbox,
      quotaroot_list);
  if (quotaroot_data == NULL) {
    res = MAILIMAP_ERROR_MEMORY;
    goto quotaroot_list_free;
  }

  * result = quotaroot_data;
  * indx = cur_token;

  return MAILIMAP_NO_ERROR;

 quotaroot_list_free:
  clist_foreach(quotaroot_list,
      (clist_func) &mailimap_astring_free, NULL);
  clist_free(quotaroot_list);
 mailbox_free:
  mailimap_mailbox_free(mailbox);
 err:
  return res;
}
Exemple #5
0
int
mailimap_quota_quota_response_parse(mailstream * fd, MMAPString *buffer,
    size_t * indx, struct mailimap_quota_quota_data ** result,
    size_t progr_rate, progress_function * progr_fun)
{
  size_t cur_token;
  char * quotaroot;
  clist * quota_list;
  struct mailimap_quota_quota_data * quota_data;
  int r;
  int res;

  cur_token = * indx;

  r = mailimap_token_case_insensitive_parse(fd, buffer,
					    &cur_token, "QUOTA");
  if (r != MAILIMAP_NO_ERROR) {
    res = r;
    goto err;
  }

  r = mailimap_space_parse(fd, buffer, &cur_token);
  if (r != MAILIMAP_NO_ERROR) {
    res = r;
    goto err;
  }

  r = mailimap_astring_parse(fd, buffer, &cur_token, &quotaroot,
          progr_rate, progr_fun);
  if (r != MAILIMAP_NO_ERROR) {
    res = r;
    goto err;
  }

  r = mailimap_space_parse(fd, buffer, &cur_token);
  if (r != MAILIMAP_NO_ERROR) {
    res = r;
    goto quotaroot_free;
  }

  r = mailimap_quota_quota_list_parse(fd, buffer, &cur_token,
      &quota_list, progr_rate, progr_fun);
  if (r != MAILIMAP_NO_ERROR) {
    res = r;
    goto quotaroot_free;
  }

  quota_data = mailimap_quota_quota_data_new(quotaroot, quota_list);
  if (quota_data == NULL) {
    res = MAILIMAP_ERROR_MEMORY;
    goto quota_list_free;
  }

  * result = quota_data;
  * indx = cur_token;

  return MAILIMAP_NO_ERROR;

 quota_list_free:
  clist_foreach(quota_list,
      (clist_func) &mailimap_quota_quota_resource_free, NULL);
  clist_free(quota_list);
 quotaroot_free:
  mailimap_astring_free(quotaroot);
 err:
  return res;
}