[prev in list] [next in list] [prev in thread] [next in thread] 

List:       jabber-jdev
Subject:    Re: [JDEV] Client using JabberBeans..
From:       Adrian Blakey <ajb () blakey ! org>
Date:       2002-11-27 1:38:07
[Download RAW message or body]

This might not be the answer you want -- but use Muse instead. 
http://www.echomine.org/projects/muse The interface is far simpler and 
license is not an issue.

On Monday 25 November 2002 03:41 pm, Adrian Brown wrote:
> If anyone is using JabberBeans, I would certainly appreciate you taking
> a look at this:
>
> I'm trying to build a simple client, at the moment everything is quite
> static (until I get things right).
>
> I can't seem to send the Message Packet to the other client (pre-set
> into code).. nothing seems to happen.  Is the code correct?
>
> public class KeyEventAlgorithm extends Connection implements
> KeyListener, ActionListener {
>
>
>      //Create a MessengerBean using the existing ConnectionBean within
> Connection Class
>      //MessengerBean msgBean = new MessengerBean( cb );//Didn't work!
>
>      //Thread test
>      private String thread;
>      { thread = Long.toHexString( ( new java.util.Random() ).nextLong()
> ) ; }
>
>      public KeyEventAlgorithm() {
>
>
>      }
>
>      //Listener method for KeyEventListener
>      public void keyPressed( KeyEvent e ) {
>
>
>      }
>
>      //Listener method for KeyEventListener
>      public void keyReleased( KeyEvent e ) {
>
>
>      }
>
>      //Listener method for KeyEventListener
>      public void keyTyped( KeyEvent e ) {
>
>          pushPacket( e );
>
>      }
>
>      //Listener method for ActionListener
>      public void actionPerformed( ActionEvent e ) {
>
>      }
>
>      //Method to push <body> packet to other client
>      protected void pushPacket( KeyEvent e ) {
>
>          char c[] = { e.getKeyChar() };
>
>          String s1 = new String ( c );
>
>          System.out.println( s1 );
>
>          //Create new Instance of MessageBuilder
>          MessageBuilder msgBuild = new MessageBuilder();
>
>          //Create new Instance of Message
>          Message  message;
>
>          msgBuild.reset();
>          JID jid = new JID( "adrianxp", "jabber.org", "home" );
>          JID jid1 = new JID( "adrian2000", "jabber.org", "work");
>
>          msgBuild.setFromAddress( jid1 );
>          msgBuild.setToAddress( jid );
>
>          msgBuild.setThread( thread );
>          msgBuild.setSubject( "Test client" );
>
>          msgBuild.setType( "normal" );
>
>          msgBuild.setBody( s1 );
>
>
>          try {
>
>              //Build Message Packet from MessageBuilder
>              message = ( Message ) msgBuild.build();
>              //Sends Message Packet
>              cb.send( message );
>          }
>
>          catch( InstantiationException g ) {
>
>              System.out.println( "Failed to build Message Packet");
>
>          }
>       }
> }

_______________________________________________
jdev mailing list
jdev@jabber.org
http://mailman.jabber.org/listinfo/jdev
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic