You'd have to go look into dealing with strings in php and then maybe you can find a hook to use to perform the action on the message string and count the words. I'm really not sure exactly how to do it, but that should get you started. http://us.php.net/manual/en/ref.strings.php