use of org.xmpp.packet.Message in project Openfire by igniterealtime.
the class Chatbot method notifyQueueStatus.
public void notifyQueueStatus(JID sender, JID receiver, UserRequest request, boolean isPolling) {
// Get the chatbot session of the user
ChatbotSession session = getSession(receiver, false);
if (session != null) {
Message packet = new Message();
packet.setTo(receiver);
packet.setFrom(sender);
packet.setThread(session.getMessageThread());
if (session.getMessageThread() != null) {
packet.setType(Message.Type.chat);
}
String body = getPositionMessage().replace("${position}", String.valueOf(request.getPosition() + 1));
body = body.replace("${waitTime}", String.valueOf(request.getTimeStatus()));
packet.setBody(body);
send(packet);
}
}
use of org.xmpp.packet.Message in project Openfire by igniterealtime.
the class InvitationRequest method sendErrorMessage.
private void sendErrorMessage(String body) {
// Invitation request has failed. Inform inviter
userRequest.removeRelatedRequest(this);
Message message = new Message();
message.setError(PacketError.Condition.recipient_unavailable);
message.setTo(inviter);
message.setFrom(workgroup.getJID());
message.setBody(body);
Element element = message.addChildElement("invite", "http://jabber.org/protocol/workgroup");
element.addAttribute("type", type.toString());
Element sessionElement = element.addElement("session", "http://jivesoftware.com/protocol/workgroup");
sessionElement.addAttribute("id", sessionID);
element.addElement("inviter").setText(inviter.toString());
element.addElement("invitee").setText(invitee.toString());
workgroup.send(message);
}
use of org.xmpp.packet.Message in project Openfire by igniterealtime.
the class TransferRequest method sendErrorMessage.
private void sendErrorMessage(String body) {
// Invitation request has failed. Inform inviter
userRequest.removeRelatedRequest(this);
Message message = new Message();
message.setError(PacketError.Condition.recipient_unavailable);
message.setTo(inviter);
message.setFrom(workgroup.getJID());
message.setBody(body);
Element element = message.addChildElement("transfer", "http://jabber.org/protocol/workgroup");
element.addAttribute("type", type.toString());
Element sessionElement = element.addElement("session", "http://jivesoftware.com/protocol/workgroup");
sessionElement.addAttribute("id", sessionID);
element.addElement("inviter").setText(inviter.toString());
element.addElement("invitee").setText(invitee.toString());
workgroup.send(message);
}
use of org.xmpp.packet.Message in project Openfire by igniterealtime.
the class BroadcastMessage method readExternal.
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
Element packetElement = (Element) ExternalizableUtil.getInstance().readSerializable(in);
packet = new Message(packetElement, true);
}
use of org.xmpp.packet.Message in project Openfire by igniterealtime.
the class RemotePacketExecution method readExternal.
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
recipient = (JID) ExternalizableUtil.getInstance().readSerializable(in);
int packetType = ExternalizableUtil.getInstance().readInt(in);
Element packetElement = (Element) ExternalizableUtil.getInstance().readSerializable(in);
switch(packetType) {
case 1:
packet = new IQ(packetElement, true);
break;
case 2:
packet = new Message(packetElement, true);
break;
case 3:
packet = new Presence(packetElement, true);
break;
}
}
Aggregations