add: db_update_presentity(presentity);
context: int fifo_pa_presence(FILE *fifo, char *response_file){	char pdomain_s[MAX_P_URI];	char p_uri_s[MAX_P_URI];	char presence_s[MAX_PRESENCE];	pdomain_t *pdomain = NULL;	presentity_t *presentity = NULL;	str pdomain_name, p_uri, presence;	int origstate, newstate;	int allocated_presentity = 0;	if (!read_line(pdomain_s, MAX_PDOMAIN, fifo, &pdomain_name.len) || pdomain_name.len == 0) {		fifo_reply(response_file,			   "400 ul_add: pdomain expected\n");		LOG(L_ERR, "ERROR: ul_add: 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 ul_add: p_uri expected\n");		LOG(L_ERR, "ERROR: ul_add: p_uri expected\n");		return 1;	}	p_uri.s = p_uri_s;	if (!read_line(presence_s, MAX_PRESENCE, fifo, &presence.len) || presence.len == 0) {		fifo_reply(response_file,			   "400 ul_add: presence expected\n");		LOG(L_ERR, "ERROR: ul_add: presence expected\n");		return 1;	}	presence.s = presence_s;	register_pdomain(pdomain_s, &pdomain);	if (!pdomain) {		fifo_reply(response_file, "400 could not register pdomain\n");		LOG(L_ERR, "ERROR: pa_location: could not register pdomain %.*s\n",		    pdomain_name.len, pdomain_name.s);		return 1;	}	find_presentity(pdomain, &p_uri, &presentity);	if (!presentity) {		new_presentity(&p_uri, &presentity);		allocated_presentity = 1;	}	if (!presentity) {		fifo_reply(response_file, "400 could not find presentity %s\n", p_uri_s);		LOG(L_ERR, "ERROR: pa_location: could not find presentity %.*s\n",		    p_uri.len, p_uri.s);		return 1;	}	origstate = presentity->state;	presentity->state = newstate =		(strcmp(presence_s, "online") == 0) ? PS_ONLINE : PS_OFFLINE;	if (origstate != newstate || allocated_presentity) {		notify_watchers(presentity);	}	fifo_reply(response_file, "200 published\n",		   "(%.*s %.*s)\n",		   p_uri.len, ZSW(p_uri.s),		   presence.len, ZSW(presence.s));	return 1;}