If you want to give it a shot, I think there might be a way to do this without code, just via rules. The form name is stored in the xml:
<?mso-infoPathSolution solutionVersion="1.0.0.2348" productVersion="12.0.0" PIVersion="1.0.0.0" href="<XSN URL>" name="<URN SCHEMA INFO>"?>
So you could use substring-before and substring-after to grab the href and then get the xsn name from that. Good luck!