d.addButton("Yes", 1);
d.addButton("No", 2);
d.setVisible(true);
d.addOptionListener(
new NMOptionListener() {
public void buttonClicked(int num) {
currentlyRequesting.remove(userId);
if (num == 1) {
Presence packet = new Presence(
Presence.Type.SUBSCRIBED);
packet.setTo(userId);
BuddyList.getInstance().getConnection().sendPacket(
packet);
BuddyStatus buddy = BuddyList.getInstance()
.getBuddyStatus(userId);
buddy.setRemoved(false);
}
boolean add = true;
// find out if they are already in the roster
if (ConnectorThread.getInstance().getRoster()
.contains(userId.toLowerCase())) {
add = false;
}
if (userId.indexOf("@") < 0) {
add = false;
}
if (add) {
NMOptionDialog di = new NMOptionDialog(
(JFrame) null, resources.getString("addButton"),
MessageFormat.format(resources.getString("doAddBuddy"),
new Object[]{userId}),
NMOptionDialog.QUESTION);
di.addButton("Yes", 1);
di.addButton("No", 2);
di.setVisible(true);
di.addOptionListener(
new NMOptionListener() {
public void buttonClicked(int num) {
if (num == 1) {
AddBuddyDialog dialog = new AddBuddyDialog();
dialog.setBuddyId(userId);
dialog.setVisible(true);