rem: new_presence_tuple(&p_contact, expires, presentity, &tuple);
add: new_presence_tuple(&p_contact, expires, presentity, &tuple, 1);
context: int fifo_pa_location_contact(FILE *fifo, char *response_file){     char pdomain_s[MAX_P_URI];     char p_uri_s[MAX_P_URI];     char p_contact_s[MAX_P_URI];     char location_s[MAX_LOCATION];     char priority_s[MAX_LOCATION];     char expires_s[MAX_LOCATION];     pdomain_t *pdomain = NULL;     presentity_t *presentity = NULL;     presence_tuple_t *tuple = NULL;     str pdomain_name, p_uri, p_contact, location, priority_str, expires_str;     time_t expires;     double priority;     int changed = 0;     char *msg = "no error";     if (!read_line(pdomain_s, MAX_PDOMAIN, fifo, &pdomain_name.len) || pdomain_name.len == 0) {	  fifo_reply(response_file,		     "400 pa_location_contact: pdomain expected\n");	  LOG(L_ERR, "ERROR: pa_location_contact: pdomain expected\n");	  return 1;     }     pdomain_name.s = pdomain_s;     if (!read_line(p_uri_s, MAX_P_URI, fifo, &p_uri.len) || p_uri.len == 0) {	  fifo_reply(response_file,		     "400 pa_location_contact: p_uri expected\n");	  LOG(L_ERR, "ERROR: pa_location_contact: p_uri expected\n");	  return 1;     }     p_uri.s = p_uri_s;     if (!read_line(p_contact_s, MAX_P_URI, fifo, &p_contact.len) || p_contact.len == 0) {	  fifo_reply(response_file,		     "400 pa_location_contact: p_contact expected\n");	  LOG(L_ERR, "ERROR: pa_location_contact: p_contact expected\n");	  return 1;     }     p_contact.s = p_contact_s;     if (!read_line(location_s, MAX_LOCATION, fifo, &location.len) || location.len == 0) {	  fifo_reply(response_file,		     "400 pa_location_contact: location expected\n");	  LOG(L_ERR, "ERROR: pa_location_contact: location expected\n");	  return 1;     }     location.s = location_s;     if (!read_line(priority_s, MAX_LOCATION, fifo, &priority_str.len) || priority_str.len == 0) {	  fifo_reply(response_file,		     "400 pa_location_contact: priority expected\n");	  LOG(L_ERR, "ERROR: pa_location_contact: priority expected\n");	  return 1;     }     priority = strtod(priority_s, NULL);     if (!read_line(expires_s, MAX_LOCATION, fifo, &expires_str.len) || expires_str.len == 0) {	  fifo_reply(response_file,		     "400 pa_location_contact: expires expected\n");	  LOG(L_ERR, "ERROR: pa_location_contact: expires expected\n");	  return 1;     }     expires = strtoul(expires_s, NULL, 0);     register_pdomain(pdomain_s, &pdomain);     if (!pdomain) {	  fifo_reply(response_file, "400 could not register pdomain\n");	  LOG(L_ERR, "ERROR: pa_location_contact: could not register pdomain %.*s\n",	      pdomain_name.len, pdomain_name.s);	  return 1;     }     lock_pdomain(pdomain);     find_presentity(pdomain, &p_uri, &presentity);     if (!presentity) {	  new_presentity(pdomain, &p_uri, &presentity);	  add_presentity(pdomain, presentity);	  changed = 1;     }     if (!presentity) {	  msg = "400 could not find presentity\n";	  LOG(L_ERR, "ERROR: pa_location_contact: could not find presentity %.*s\n",	      p_uri.len, p_uri.s);	  return 1;     }     find_presence_tuple(&p_contact, presentity, &tuple);     if (!tuple && new_tuple_on_publish) {       new_presence_tuple(&p_contact, expires, presentity, &tuple);       add_presence_tuple(presentity, tuple);       tuple->state = PS_ONLINE;       changed = 1;     }     if (!tuple) {	  LOG(L_ERR, "publish_presentity: no tuple for %.*s\n", 	      presentity->uri.len, presentity->uri.s);	  msg = "400 could not find presence tuple\n";	  goto error;     }     changed = 1;     if (1 || (tuple->location.loc.len && str_strcasecmp(&tuple->location.room, &location) != 0)) {       changed = 1;       LOG(L_ERR, "Setting room of contact=%.*s to %.*s\n",	   tuple->contact.len, tuple->contact.s,	   tuple->location.room.len, tuple->location.room.s);       strncpy(tuple->location.room.s, location.s, location.len);       tuple->location.room.len = location.len;       strncpy(tuple->location.loc.s, location.s, location.len);       tuple->location.loc.len = location.len;     }     if (tuple->priority != priority) {       tuple->priority = priority;       changed = 1;     }     if (expires < 7*24*3600) {       /* must be seconds */       get_act_time();       expires = act_time + expires;     }     if (tuple->expires != expires) {       tuple->expires = expires;       changed = 1;     }     if (changed) {	  presentity->flags |= PFLAG_PRESENCE_CHANGED;     }     db_update_presentity(presentity);     unlock_pdomain(pdomain);     fifo_reply(response_file, "200 published\n",		"(%.*s %.*s)\n",		p_uri.len, ZSW(p_uri.s),		location.len, ZSW(location.s));     return 1; error:     unlock_pdomain(pdomain);     fifo_reply(response_file, msg);     return 1;}