rem: DEBUG_LOG("rli_create_content(): doing XCAP query\n");
context: int create_virtual_subscriptions(rl_subscription_t *ss, const char *xcap_root){	flat_list_t *e, *flat = NULL;	xcap_query_t xcap;	virtual_subscription_t *vs;	int res = 0;	str s;	str_t user;	str_t *ss_uri = NULL;	str_t *ss_package = NULL;		/* TODO: create virtual subscriptions using Accept headers ... (for remote subscriptions) */	ss_uri = rls_get_uri(ss);	ss_package = rls_get_package(ss);	/* XCAP query */	memset(&xcap, 0, sizeof(xcap));	DEBUG_LOG("rli_create_content(): doing XCAP query\n");	switch (rls_mode) {		case rls_mode_full:			if (reduce_xcap_needs) {				res = get_rls_from_full_doc(xcap_root, ss_uri, &xcap, 					ss_package, &flat);			}			else {				res = get_rls(xcap_root, ss_uri, &xcap, 					ss_package, &flat);			}			break;		case rls_mode_simple:			if (get_user_from_list_uri(ss_uri, &user) == 0) {				/* it is uri in the form user-list@domain */				res = get_resource_list_as_rls(xcap_root, &user, &xcap, &flat);			}			else {				/* it is NOT uri in the form xxx-list@domain -> try to use				 * standard RLS subscription processing */				if (reduce_xcap_needs) {					res = get_rls_from_full_doc(xcap_root, ss_uri, &xcap, 						ss_package, &flat);				}				else {					res = get_rls(xcap_root, ss_uri, &xcap, 							ss_package, &flat);				}			}			break;	}				if (res != RES_OK) return res;	/* go through flat list and find/create virtual subscriptions */	e = flat;	while (e) {		s.s = e->uri;		if (s.s) s.len = strlen(s.s);		else s.len = 0;		res = vs_create(&s, rls_get_package(ss), &vs, e->names, ss);				if (res != RES_OK) return res;		ptr_vector_add(&ss->vs, vs);		e = e->next;	}	DEBUG_LOG("rli_create_content(): freeing flat list\n");	free_flat_list(flat);	return RES_OK;}