powered by Jive Software

Almost Joined

Well things are better I can get in to the GroupChat send and receive messages but the ChatGroup still is not knowing it has joined. I get the same old exception and I can not get the Roster by asking it from the ChatGroup

Any ideas where to look for the cause?

Thanks,

Ted

I joine like this:

connection.addPacketListener(this,new OrFilter(new PacketTypeFilter(Message.class), new PacketTypeFilter(Presence.class )));

groupChat = connection.createGroupChat(room);

groupChat.addMessageListener(this);

groupChat.join(client.login.userName);

I process the packets like this:

public void processPacket(Packet packet){

try{

if (Message.class.isInstance(packet)){

Message msg = (Message)packet;

client.timedCya(jabbing,"[ "msg.getFrom() " ] "+msg.getBody());

System.out.println(“Is GroupChat joined? :”+groupChat.getJoined());

}

else if (Presence.class.isInstance(packet)){

setRoster();

}

}

catch(Exception e)

{

e.printStackTrace(System.out);

System.out.println("processPacket error "+e);

}

}

public void rosterModified(){

setRoster();

}

Here is the Exception and the Joined Status: (Mean while I talked with room several times)

Buildfile: build.xml

run:

Is GroupChat joined? :false

GroupChatClient line 59 Exception: org.jivesoftware.smack.XMPPExcept

ion: No response from server.

OK,

I think that the join is not getting the server response some how and so it does not set up the joined to true and so I can not get the roster.

I added groupChat.addParticipantListner(this); to my Client but this apparently is not enough. What else do I need to do so the groupChat will receive the presence packet?

The error I get is from here.

Here is the Join Method code:

public synchronized void join(String nickname) throws XMPPException {

if (nickname == null || nickname.equals("")) {

throw new IllegalArgumentException(“Nickname must not be null or blank.”);

}

// If we’'ve already joined the room, leave it before joining under a new

// nickname.

if (joined) {

leave();

}

// We join a room by sending a presence packet where the “to”

// field is in the form “roomName@service/nickname”

Presence joinPresence = new Presence(Presence.Type.AVAILABLE);

joinPresence.setTo(room + “/” + nickname);

// Wait for a presence packet back from the server.

PacketFilter responseFilter = new AndFilter(

new FromContainsFilter(room + “/” + nickname),

new PacketTypeFilter(Presence.class));

PacketCollector response = connection.createPacketCollector(responseFilter);

// Send join packet.

connection.sendPacket(joinPresence);

// Wait up to five seconds for a reply.

Presence presence = (Presence)response.nextResult(5000);

if (presence == null) {

throw new XMPPException(“No response from server.”);

try setting the timeout to be 30 seconds. Maybe the server just doesn’'t respond in 5 seconds.

-Matt

Thanks Matt,

I tried reseting the time to 30 sec. No diffrance the groupchat do not get the server response.

Do I need to list it somwhere as a listner so it will?

Here is my call

connection.addPacketListener(this,new OrFilter(new PacketTypeFilter(Message.class), new PacketTypeFilter(Presence.class )));

groupChat = connection.createGroupChat(room);

groupChat.addParticipantListner(this);

groupChat.addMessageListener(this);

groupChat.join(client.login.userName);

Some how the join method do not recive the server packets

How do I make it do?

No, the listener is internal to Smack. If the server doesn’‘t reply with a join presence, there’‘s nothing Smack can do. It simply doesn’‘t know you’‘ve joined the room. When you look at the XML output, you don’‘t see the proper XML coming through? If you’'re not sure, please read through the groupchat protocol spec at:

http://www.jabber.org/protocol/groupchat.html

-Matt