return false;
}
}
for (int i = 0; i < send.size(); i++) {
Chat chat = null;
if (buddy instanceof MUCBuddyStatus) {
MultiUserChat muc = ((MUCBuddyStatus) buddy).getMUC();
chat = muc.createPrivateChat(buddy.getUser());
} else {
chat = (Chat) chats.get((String) send.get(i));
}
if (chat == null) {
chat = BuddyList.getInstance().getConnection().createChat(
(String) send.get(i));
chats.put((String) send.get(i), chat);
}
Message message = chat.createMessage();
if (secureExtension.getData() != null) {
message.setBody("[This message is encrypted]");
message.addExtension(secureExtension);
} else {
message.setBody(text);
}
if (signedExtension.getData() != null) {
message.addExtension(signedExtension);
}
if (buddy.isAskForDelivered()) {
BuddyList.getInstance().putEventMessage(message.getPacketID(), message.getTo(), getDate(null), 1);
}
if (buddy.isAskForDisplayed()) {
BuddyList.getInstance().putEventMessage(message.getPacketID(), message.getTo(), getDate(null), 2);
}
if (buddy.isAskForOffline()) {
BuddyList.getInstance().putEventMessage(message.getPacketID(), message.getTo(), getDate(null), 3);
}
MessageEventManager.addNotificationsRequests(message, buddy.isAskForOffline(), buddy.isAskForDelivered(), buddy.isAskForDisplayed(), true);
MessageSendingEvent event = new MessageSendingEvent(this);
event.setMessage(message);
com.valhalla.pluginmanager.PluginChain.fireEvent(event);
try {
if (BuddyList.getInstance().checkConnection()) {
chat.sendMessage(message);
} else {
BuddyList.getInstance().connectionError();
}
} catch (XMPPException e) {
com.valhalla.Logger.debug("Could not send message: "