i have this code …
and yet…
an exodus client(for example) when he adds me:
first i am viewed at his list
then i get the question…(see at the code)…
// Presence listener
presListener = new PacketListener() {
public void processPacket(Packet packet) {
Presence presence = (Presence) packet;
// If we got request to subscribe ,we’'ll show the
// request
if (presence.getType() == Presence.Type.SUBSCRIBE) {
String from = presence.getFrom();
int accept = JOptionPane.showConfirmDialog(null,
…,
JOptionPane.YES_NO_OPTION);
//We accept the request
if (accept == JOptionPane.YES_OPTION) {
presence.setFrom(presence.getTo());
presence.setTo(from);
presence.setType(Presence.Type.SUBSCRIBED);
connection.sendPacket(presence);
// Now will add to our roster
presence.setType(Presence.Type.SUBSCRIBE);
connection.sendPacket(presence);
}
else
if (accept == JOptionPane.NO_OPTION) {
presence.setFrom(presence.getTo());
presence.setTo(from);
presence.setType(Presence.Type.UNSUBSCRIBED);
connection.sendPacket(presence);
}
}
}
};
is this good? because it sure aint working right…
i also did the
roster.setDefaultSubscriptionMode(Roster.SUBSCRIPTION_MANUAL );