use of org.jivesoftware.smackx.xevent.packet.MessageEvent in project Smack by igniterealtime.
the class MessageEventManager method sendDisplayedNotification.
/**
* Sends the notification that the message was displayed to the sender of the original message.
*
* @param to the recipient of the notification.
* @param packetID the id of the message to send.
* @throws NotConnectedException
* @throws InterruptedException
*/
public void sendDisplayedNotification(Jid to, String packetID) throws NotConnectedException, InterruptedException {
// Create the message to send
Message msg = new Message(to);
// Create a MessageEvent Package and add it to the message
MessageEvent messageEvent = new MessageEvent();
messageEvent.setDisplayed(true);
messageEvent.setStanzaId(packetID);
msg.addExtension(messageEvent);
// Send the packet
connection().sendStanza(msg);
}
use of org.jivesoftware.smackx.xevent.packet.MessageEvent in project Smack by igniterealtime.
the class MessageEventProvider method parse.
/**
* Parses a MessageEvent stanza(/packet) (extension sub-packet).
*
* @param parser the XML parser, positioned at the starting element of the extension.
* @return a PacketExtension.
* @throws IOException
* @throws XmlPullParserException
*/
@Override
public MessageEvent parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException {
MessageEvent messageEvent = new MessageEvent();
boolean done = false;
while (!done) {
int eventType = parser.next();
if (eventType == XmlPullParser.START_TAG) {
if (parser.getName().equals("id"))
messageEvent.setStanzaId(parser.nextText());
if (parser.getName().equals(MessageEvent.COMPOSING))
messageEvent.setComposing(true);
if (parser.getName().equals(MessageEvent.DELIVERED))
messageEvent.setDelivered(true);
if (parser.getName().equals(MessageEvent.DISPLAYED))
messageEvent.setDisplayed(true);
if (parser.getName().equals(MessageEvent.OFFLINE))
messageEvent.setOffline(true);
} else if (eventType == XmlPullParser.END_TAG) {
if (parser.getName().equals("x")) {
done = true;
}
}
}
return messageEvent;
}
use of org.jivesoftware.smackx.xevent.packet.MessageEvent in project Smack by igniterealtime.
the class MessageEventManager method sendCancelledNotification.
/**
* Sends the notification that the receiver of the message has cancelled composing a reply.
*
* @param to the recipient of the notification.
* @param packetID the id of the message to send.
* @throws NotConnectedException
* @throws InterruptedException
*/
public void sendCancelledNotification(Jid to, String packetID) throws NotConnectedException, InterruptedException {
// Create the message to send
Message msg = new Message(to);
// Create a MessageEvent Package and add it to the message
MessageEvent messageEvent = new MessageEvent();
messageEvent.setCancelled(true);
messageEvent.setStanzaId(packetID);
msg.addExtension(messageEvent);
// Send the packet
connection().sendStanza(msg);
}
use of org.jivesoftware.smackx.xevent.packet.MessageEvent in project Smack by igniterealtime.
the class MessageEventManager method sendDeliveredNotification.
/**
* Sends the notification that the message was delivered to the sender of the original message.
*
* @param to the recipient of the notification.
* @param packetID the id of the message to send.
* @throws NotConnectedException
* @throws InterruptedException
*/
public void sendDeliveredNotification(Jid to, String packetID) throws NotConnectedException, InterruptedException {
// Create the message to send
Message msg = new Message(to);
// Create a MessageEvent Package and add it to the message
MessageEvent messageEvent = new MessageEvent();
messageEvent.setDelivered(true);
messageEvent.setStanzaId(packetID);
msg.addExtension(messageEvent);
// Send the packet
connection().sendStanza(msg);
}
use of org.jivesoftware.smackx.xevent.packet.MessageEvent in project Smack by igniterealtime.
the class MessageEventManager method sendComposingNotification.
/**
* Sends the notification that the receiver of the message is composing a reply.
*
* @param to the recipient of the notification.
* @param packetID the id of the message to send.
* @throws NotConnectedException
* @throws InterruptedException
*/
public void sendComposingNotification(Jid to, String packetID) throws NotConnectedException, InterruptedException {
// Create the message to send
Message msg = new Message(to);
// Create a MessageEvent Package and add it to the message
MessageEvent messageEvent = new MessageEvent();
messageEvent.setComposing(true);
messageEvent.setStanzaId(packetID);
msg.addExtension(messageEvent);
// Send the packet
connection().sendStanza(msg);
}
Aggregations