rem: print_all_pdomains(stdout);
context: int subscribe(struct sip_msg* _m, char* _s1, char* _s2){	struct pdomain* d;	struct presentity *p;	struct watcher* w;	str* user;	paerrno = PA_OK;	if (parse_message(_m) < 0) {		LOG(L_ERR, "subscribe(): Error while parsing message header\n");		goto error;	}	if (check_message(_m) < 0) {		LOG(L_ERR, "subscribe(): Error while checking message\n");		goto error;	}	d = (struct pdomain*)_s1;	if (_m->new_uri.s) {		user = &_m->new_uri;	} else {		user = &_m->first_line.u.request.uri;	}		if (extract_username(user) < 0) {		paerrno = PA_EXTRACT_USER;		LOG(L_ERR, "subscribe(): Error while extracting username from R-URI\n");		goto error;	}	lock_pdomain(d);	if (find_presentity(d, user, &p) > 0) {		if (create_presentity(_m, d, user, &p, &w) < 0) {			LOG(L_ERR, "subscribe(): Error while creating new presentity\n");			unlock_pdomain(d);			goto error;		}	} else {		if (update_presentity(_m, d, p, &w) < 0) {			LOG(L_ERR, "subscribe(): Error while updating presentity\n");			unlock_pdomain(d);			goto error;		}	}	print_all_pdomains(stdout);	if (send_reply(_m) < 0) return -1;	if (p && w) {		if (send_notify(p, w) < 0) {			LOG(L_ERR, "subscribe(): Error while sending notify\n");			unlock_pdomain(d);			     /* FIXME: watcher and presentity should be test for removal here			      * (and possibly in other error cases too			      */			goto error;		}		if (w->expires == 0) free_watcher(w);		if (p->slot == 0) free_presentity(p);	} else {		     /* FIXME: We should send a NOTIFY here too. We will end here when the		      * subscribe contained expires = 0; Either there is no watcher for the		      * presentity yet - in this case p and w will be set to 0 and we have to		      * query external module (usrloc, jabber) for presence status or there		      * are already another watchers - in this case only w will be set to zero		      * and we have to send a notify. To be implemented later when there is 		      * full UAS support		      */		DBG("subscribe(): expires==0 but we sent no NOTIFY - not implemented yet\n");	}	unlock_pdomain(d);		return 1;	 error:	send_reply(_m);	return 0;}