powered by Jive Software

[feature request] Smack debug window on demand


This isn’‘t that important, but it would be nice. I’‘ve been trying to make it so that I can bring up the smack debug window on demand. I’‘ve added some methods to XMPPConnection.java, and the debug window comes up, but… for some reason it’‘s only recording recieved packets. Here’'s the code:

public void showDebugWindow()
          if( debugFrame == null )
               PacketListener debugListener = createDebug();
               packetReader.addPacketListener( debugListener, null );
          else debugFrame.setVisible( true );

So… instead, I have set XMPPConnection.DEBUG_ENABLED = true; and in create XMPPConnection.createDebug() I commented out the line that sets the frame to visible. Then, I have added to methods that basically set it’'s visibility to false or true. It works, but it means that the debug window is always open somewhere and taking up memory.

Can you help me figure out what I am doing wrong… or perhaps add this feature to smack?




I’‘m not really willing to add this method to the current API, because I think it would increase API complexity without providing much benefit for most users. However, we’'ve been talking about building out a much more robust debugging tool as a separate smack-debug.jar. In that more complete debug system, we can definitely add a features that give you more control over showing/hiding the smack debug window.

As for your method – you should modify it so that debug is turned on from the start of the connection but that setVisible true is never called on the frame until the showDebugWindow method is called. That should solve the problem of the server XML not showing up.