Invite newInvite = new Invite(original.getFrom(), null, invite.getReason());
return createInviteDeclineMessageStanza(original, invite.getTo(), password, newInvite);
}
public static Stanza createDeclineMessageStanza(Stanza original) throws EntityFormatException {
X orginalX = X.fromStanza(original);
Decline decline = orginalX.getDecline();
if (decline == null || decline.getTo() == null) {
throw new IllegalArgumentException("Invalid decline element, must exist and contain to attribute");
}
Decline newDecline = new Decline(original.getFrom(), null, decline.getReason());