// sets the recepients of the message
if (msgAttr.containsKey(TO_ATTR)) {
Object to = msgAttr.get(TO_ATTR);
if (to instanceof String) {
msgBuilder.withRecipientJids(new JID((String) to));
} else if (to instanceof List<?>) {
List<?> toList = (List<?>)to;
JID[] jids = new JID[toList.size()];
for (int i = 0; i < toList.size(); i++) {
jids[i] = new JID(String.valueOf(toList.get(i)));
}
msgBuilder.withRecipientJids(jids);
}
}
// sets the sender of the message
if (msgAttr.containsKey(FROM_ATTR)) {
msgBuilder.withFromJid(new JID(String.valueOf(msgAttr.get(FROM_ATTR))));
}
// sets the type of the message
if (msgAttr.containsKey(TYPE_ATTR)) {
Object type = msgAttr.get(TYPE_ATTR);