set_xml_property_copy(target, "unclean", "time");
time_t now = time(NULL); char *now_s = crm_itoa((int)now);  set_xml_property_copy(target, "unclean", now_s); cl_free(now_s);
update_node_state(xmlNodePtr target, xmlNodePtr update){	gboolean any_updates = FALSE;	gboolean replace_lrm = FALSE;		const char *old_state     = xmlGetProp(target, "state");	const char *old_unclean   = xmlGetProp(target, "unclean");	const char *source	  = NULL;	const char *unclean	  = NULL;	const char *exp_state	  = NULL;	const char *state	  = NULL;		xmlAttrPtr prop_iter = NULL;	FNIN();		prop_iter = update->properties;	while(prop_iter != NULL) {		const char *local_prop_name = prop_iter->name;		const char *local_prop_value =			xmlGetProp(update, local_prop_name);		if(local_prop_name == NULL) {			// error					} else if(strcmp(local_prop_name, "replace_lrm") == 0) {			replace_lrm = TRUE;			any_updates = TRUE;					} else if(strcmp(local_prop_name, "source") == 0) {			source = local_prop_value;					} else if(strcmp(local_prop_name, "state") == 0) {			state = local_prop_value;					} else {			any_updates = TRUE;			set_xml_property_copy(target,					      local_prop_name,					      local_prop_value);		}			  		prop_iter = prop_iter->next;	}		unclean   = xmlGetProp(target, "unclean");	exp_state = xmlGetProp(target, "exp_state");		if(safe_str_eq(state, "in_ccm")) {		if(safe_str_eq(old_state, "active")) {			state = "active";		} else {			any_updates = TRUE;		}			} else if(safe_str_eq(state, "down")) {		any_updates = TRUE;		if(safe_str_neq(exp_state, "down")) {			// TODO: Set the actual time			// TODO: Only if not set?			if(old_unclean == NULL) {				set_xml_property_copy(target,						      "unclean",						      "time");			}						// TODO: unset source?							}	} else if(state != NULL) {		any_updates = TRUE;	}	if(replace_lrm) {		xmlNodePtr lrm = find_xml_node(target, "lrm");		xmlUnlinkNode(lrm);		free_xml(lrm);			}			set_xml_property_copy(target, "state", state);		if(any_updates) {		set_node_tstamp(target);		set_xml_property_copy(target, "source", source);	}	}