powered by Jive Software

Way to specify ''prefix'' for all packet IDs?

In org.jivesoftware.smack.packet.Packet[/b], the prefix for all packets is set with:

private static String prefix = StringUtils.randomString(5) + “-”;

I’‘d like to be able to set this prefix manually.[/i] The ‘‘getPacketID()’’ and ‘‘setPacketID(String)’’ methods don’'t really seem to work right for me, I tried creating a PacketInterceptor to prepend a prefix on the ID, but it seems to confuse the return packets.

Is this as simple as adding to Prefix:

public static synchronized void setPrefix(String pfx)


prefix = pfx;


and calling it with

Packet.setPrefix(hackResistantSecurityID + “-”);[/b]

just before making a connection? Is there an easier way or something else I haven’‘t thought of or don’'t know yet?