James Watts | 15 Feb 2006 17:41

RE: Using jso library to build an xmpp server

>> I found a couple problems and I can now receive server side packets.

Hi Steve,

Sorry to be a little lazy, but I'm looking at the EchoServer as an example to build xmpp server code.  I also found this post, and was wondering if you'd mind posting your fixes as well?

Thanks!

_____

From: jso-devel-bounces at jabberstudio.org
[mailto:jso-devel-bounces at jabberstudio.org ] On Behalf Of Steven Shaughnessy
Sent: Thursday, January 12, 2006 7:34 PM
To: jso-devel at jabberstudio.org
Subject: RE: [JSO-DEVEL] Using jso library to build an xmpp server



Here are some more specifics.



I execute "EchoServer pcl-shaughnessy 5222"

I execute "EchoClient sshaughnessy at pcl-shaughnessy /cmc dummy pcl-shaughnessy
5222"



This is output from the client when it attempts to login:



37766 [main] ERROR EchoClient$EventLogger - sent packet: <iq
xmlns='jabber:client' id='auth-1' to='pcl-shaughnessy' type='get'><query
xmlns='jabber:iq:auth'><username>sshaughnessy</username><resource>cmc</resou
rce></query></iq>



I have pasted my change to EchoServer.java at the end of this mail. I added
a setupIQListeners() method and call it from the end of the constructor.



However the "packetTransferred()" event handler is never called.



Any help would be appreciated.



-Steve



=========================================================



//Constructors

public Session(SocketChannel sc) throws StreamException {

JSOImplementation jso = JSOImplementation.getInstance();



_Conn = jso.createStream(Utilities.CLIENT_NAMESPACE);



_Conn.addStreamStatusListener(new StatusMonitor());

_Conn.addStreamStatusListener(this);

_Conn.connect(new ChannelStreamSource(sc));

setupIQListeners();

}

private void setupIQListeners() {

Logger log = obtainLogger();

Stream stream = getConnection();

StreamDataFactory sdf = stream.getDataFactory();

XPathListener xpl;

PacketListenerRelay dispatch = new PacketListenerRelay();



try {

xpl = new XPathListener(sdf, "app:iq[ <at> type='get']/auth:*",

new PacketListener() {

public void packetTransferred(PacketEvent evt) {

InfoQuery in = (InfoQuery) evt.getData();

InfoQuery out = (InfoQuery) in.copy();



evt.setHandled(true);



// Prepare IQ

out.reset();

out.setID(in.getID());

out.setTo(in.getFrom());

out.setType(InfoQuery.RESULT);



// Do somthing here...

// processAuth(in, out);

enque(out);

}

});

dispatch.addPacketListener(xpl);

}

catch (SAXPathException saxpe) {

log.error("SAXPathException", saxpe);

}

}


_______________________________________________
jso-devel mailing list
jso-devel <at> jabberstudio.org
http://mail.jabber.org/mailman/listinfo/jso-devel
Steven Shaughnessy | 15 Feb 2006 18:03

RE: Using jso library to build an xmpp server

Hi John,

 

I stopped working on this.

 

However, I believe the problems I fixed were with my code, not the jso library.

 

-Steve

 

From: jso-devel-bounces <at> jabberstudio.org [mailto:jso-devel-bounces <at> jabberstudio.org] On Behalf Of James Watts
Sent: Wednesday, February 15, 2006 8:42 AM
To: jso-devel <at> jabberstudio.org
Subject: RE: [JSO-DEVEL] Using jso library to build an xmpp server

 

>> I found a couple problems and I can now receive server side packets.

Hi Steve,

Sorry to be a little lazy, but I'm looking at the EchoServer as an example to build xmpp server code.  I also found this post, and was wondering if you'd mind posting your fixes as well?

Thanks!

  _____ 

From: jso-devel-bounces at jabberstudio.org
[mailto:jso-devel-bounces at jabberstudio.org

] On Behalf Of Steven Shaughnessy
Sent: Thursday, January 12, 2006 7:34 PM
To: jso-devel at jabberstudio.org
Subject: RE: [JSO-DEVEL] Using jso library to build an xmpp server



 

Here are some more specifics.

 

I execute "EchoServer pcl-shaughnessy 5222"

I execute "EchoClient sshaughnessy at pcl-shaughnessy

/cmc dummy pcl-shaughnessy
5222"

 

This is output from the client when it attempts to login:

 

37766 [main] ERROR EchoClient$EventLogger  - sent packet: <iq
xmlns='jabber:client' id='auth-1' to='pcl-shaughnessy' type='get'><query


xmlns='jabber:iq:auth'><username>sshaughnessy</username><resource>cmc</resou
rce></query></iq>

 

I have pasted my change to EchoServer.java at the end of this mail.  I added


a setupIQListeners() method and call it from the end of the constructor.

 

However the "packetTransferred()" event handler is never called.

 

Any help would be appreciated.


 

-Steve

 

=========================================================

 

        //Constructors

         public Session(SocketChannel sc) throws StreamException {

             JSOImplementation   jso =

JSOImplementation.getInstance();

           

             _Conn = jso.createStream(Utilities.CLIENT_NAMESPACE);

           

             _Conn.addStreamStatusListener(new StatusMonitor());


             _Conn.addStreamStatusListener(this);

             _Conn.connect(new ChannelStreamSource(sc));

             setupIQListeners();

        }

         private void setupIQListeners() {



             Logger          log = obtainLogger();

             Stream stream = getConnection();

             StreamDataFactory sdf = stream.getDataFactory();

             XPathListener xpl;


             PacketListenerRelay dispatch = new PacketListenerRelay();

 

            try {

               xpl = new XPathListener(sdf, "app:iq[ <at> type='get']/auth:*",

                   new PacketListener() {



                     public void packetTransferred(PacketEvent evt) {

                       InfoQuery in = (InfoQuery) evt.getData();

                       InfoQuery out = (InfoQuery) in.copy();


 

                       evt.setHandled(true);

 

                      // Prepare IQ

                      out.reset();

                      out.setID(in.getID());

                     

out.setTo(in.getFrom());

                       out.setType(InfoQuery.RESULT);

 

// Do somthing here...                     

//                      processAuth(in, out);

                       enque(out);



                    }

                  });

               dispatch.addPacketListener(xpl);

            }

         catch (SAXPathException saxpe) {

             log.error("SAXPathException", saxpe);



        }

    }

 

_______________________________________________
jso-devel mailing list
jso-devel <at> jabberstudio.org
http://mail.jabber.org/mailman/listinfo/jso-devel

Gmane