Don't record meaningless copies when tokens aren't used
This should be possible by comparing the activity subject and details fields on the saved activity against what we're being passed in. If they're the same, then it means no tokens were used/replaced. This is thwarted by 3 things though:
- Other extensions that modify the mail contents before getting to us might trigger a false positive, but not much we can do about that and it's ok that it would record it then, since the spirit is the same where you want to see what was actually sent and it's different than the original.
- Case activities that add the hash to the subject - it will trigger a false positive every time. Probably not hard to deal with since we have the activity id and can look up the case id and see if it matches.
- The details stored on the activity isn't a proper email body, just ALTERNATIVE sections smushed together, and it's dependent on whether it's html, text, or both. So we can't use something like ezcMailParser to get the parts. We need to duplicate the code for how it was put together and then compare that.