if(result != null)
manager.sendPacket(this,result);
}
}
} else if(packet instanceof Presence) {
Presence presence = (Presence)packet;
if(presence.getTo().equals(componentJID)) {
Kernel.debug(this,"Presence packet to: " + packet.getTo().toString() + " .. type: " + presence.getType(),3);
if(presence.getType() == null || presence.getType() == Presence.Type.probe) { // available
Presence reply = new Presence();
reply.setTo(presence.getFrom());
reply.setFrom(presence.getTo());
manager.sendPacket(this,reply);
} else if(presence.getType() == Presence.Type.subscribe) {
Presence reply = new Presence(Presence.Type.subscribed);
reply.setTo(presence.getFrom());
reply.setFrom(presence.getTo());
manager.sendPacket(this,reply);
}
} else {
if(presence.getType() == Presence.Type.subscribe) {
Presence reply = new Presence(Presence.Type.subscribed);
reply.setTo(presence.getFrom());
reply.setFrom(presence.getTo());
manager.sendPacket(this,reply);
//addSubscription(presence.getFrom().toBareJID(),presence.getTo().getNode());
} else if(presence.getType() == null || presence.getType() == Presence.Type.probe) { // available
//Kernel.debug(this,"Available presence packet to: " + presence.getTo().toString(),2);
Presence reply = new Presence();
reply.setTo(presence.getFrom());
reply.setFrom(presence.getTo());
manager.sendPacket(this,reply);
//addSubscription(presence.getFrom().toBareJID(),presence.getTo().getNode());
}
}
}