Example #1
0
/**
 * Expires all the contacts for the given public id
 * @param public_id - public identity to expire contacts for
 */
void r_public_expire(str public_id)
{	
	int expire;
	r_public *r_pub;
	r_contact * r_cont ;
	
	r_act_time();
	expire = time_now;
	
	r_pub	=	get_r_public(public_id);
	if (!r_pub){
		LOG(L_ERR,"ERR:"M_NAME":set_expires: identity not found in registrar <%.*s>\n",public_id.len,public_id.s);
		return;
	}
	r_cont = r_pub->head;
	
	while(r_cont!=NULL){
		r_cont->expires = expire;
		r_cont=r_cont->next;
	}
	
	r_unlock(r_pub->hash);
	print_r(L_ALERT);
}
Example #2
0
int main (int argc, char **argv) {
  char str[1024];
  const char *res;
  int r;
  int ri;

  if (CFG_OK != CFG_OpenFile(filename, &config )) {
    printf("OK: %s does not exist\n", filename);
    if (CFG_OK != CFG_OpenFile(NULL, &config )) {
      printf("ERROR: failed to open NULL file\n");
      exit(1);
    }
    else {
      printf("OK: opened NULL file\n");
    }
  }
  else {
    printf("OK: %s opened\n", filename);
  }

  CFG_SelectGroup("mygroup1", true);
  printf("OK: select mygroup1\n");

  res=CFG_ReadText("mydata", "default value");
  printf("OK: res: %s\n", res);

  CFG_SelectGroup("mygroup2", true);
  printf("OK: select mygroup2\n");

  res=CFG_ReadText("mydata", "default value");
  printf("OK: res: %s\n", res);

  CFG_SelectGroup("mygroup3", true);
  printf("OK: select mygroup2\n");

  res=CFG_ReadText("mydata", "default value");
  printf("OK: res: %s\n");


  CFG_SelectGroup("mygroup3", true);
  printf("OK: select mygroup3\n");
  r=CFG_WriteInt("mydata", 123);
  printf("write mydata, 123: "); print_r(r);
  r=CFG_WriteInt("mydata", 321);
  printf("write mydata, 312: "); print_r(r);

  CFG_SaveFile(NULL, CFG_SORT_ORIGINAL, CFG_COMPRESS_OUTPUT);
  printf("OK: saved file\n");
  CFG_CloseFile(NULL);
  printf("OK: closed file\n");


  if (CFG_OK != CFG_OpenFile(filename, &config2)) {
    printf("ERROR: %s does not exist!!\n", filename);
    exit(1);
  }
  else {
    printf("OK: %s opened\n", filename);
  }


  CFG_SelectGroup("mygroup1", true);
  printf("OK: select mygroup1\n");

  res=CFG_ReadText("mydata", "default value");
  printf("res: %s\n", res);

  CFG_SelectGroup("mygroup2", true);
  printf("OK: select mygroup2\n");

  res=CFG_ReadText("mydata", "default value");
  printf("res: %s\n", res);

  CFG_SelectGroup("mygroup3", true);
  printf("OK: select mygroup3\n");

  ri=CFG_ReadInt("mydata", 666);
  printf("res: %d\n", ri);

  CFG_CloseFile(NULL);


}