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);