You can either modify a packet directly, by manipulating the underlying (dom4j-based) XML representation, or use a org.xmpp.packet.PacketExtension.
The latter is probably the ‘cleaner’ solution, but, as Openfire plugins hardly every generate new packets themselves (typically, they generate responses to stuff they received), the former is more common. Have a look at one of the many implementations of IQHandler, for example.
I got as far as experimenting with the PacketExtensiok last night but it kept failing for some reason however, I thought that the PacketExtension WAS manipulating the underlying xml because it took an Element as the argument (and Element is a dom4j class).
Do you have a very simple fee lines of code that would show this? I’ve been looking at IQ, but because IQ seems somewhat different (Request Response) it was difficult to understand how to apply it to Presence.