本文整理汇总了Java中org.jivesoftware.smackx.packet.MessageEvent.setPacketID方法的典型用法代码示例。如果您正苦于以下问题:Java MessageEvent.setPacketID方法的具体用法?Java MessageEvent.setPacketID怎么用?Java MessageEvent.setPacketID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jivesoftware.smackx.packet.MessageEvent
的用法示例。
在下文中一共展示了MessageEvent.setPacketID方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: checkEvents
import org.jivesoftware.smackx.packet.MessageEvent; //导入方法依赖的package包/类
private void checkEvents(String from, String packetID, MessageEvent messageEvent) {
if (messageEvent.isDelivered() || messageEvent.isDisplayed()) {
// Create the message to send
Message msg = new Message(from);
// Create a MessageEvent Package and add it to the message
MessageEvent event = new MessageEvent();
if (messageEvent.isDelivered()) {
event.setDelivered(true);
}
if (messageEvent.isDisplayed()) {
event.setDisplayed(true);
}
event.setPacketID(packetID);
msg.addExtension(event);
// Send the packet
SparkManager.getConnection().sendPacket(msg);
}
}
示例2: sendDeliveredNotification
import org.jivesoftware.smackx.packet.MessageEvent; //导入方法依赖的package包/类
/**
* 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.
*/
public void sendDeliveredNotification(String to, String packetID) {
// 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.setPacketID(packetID);
msg.addExtension(messageEvent);
// Send the packet
con.sendPacket(msg);
}
示例3: sendDisplayedNotification
import org.jivesoftware.smackx.packet.MessageEvent; //导入方法依赖的package包/类
/**
* 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.
*/
public void sendDisplayedNotification(String to, String packetID) {
// 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.setPacketID(packetID);
msg.addExtension(messageEvent);
// Send the packet
con.sendPacket(msg);
}
示例4: sendComposingNotification
import org.jivesoftware.smackx.packet.MessageEvent; //导入方法依赖的package包/类
/**
* 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.
*/
public void sendComposingNotification(String to, String packetID) {
// 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.setPacketID(packetID);
msg.addExtension(messageEvent);
// Send the packet
con.sendPacket(msg);
}
示例5: sendCancelledNotification
import org.jivesoftware.smackx.packet.MessageEvent; //导入方法依赖的package包/类
/**
* 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.
*/
public void sendCancelledNotification(String to, String packetID) {
// 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.setPacketID(packetID);
msg.addExtension(messageEvent);
// Send the packet
con.sendPacket(msg);
}
示例6: parseExtension
import org.jivesoftware.smackx.packet.MessageEvent; //导入方法依赖的package包/类
/**
* Parses a MessageEvent packet (extension sub-packet).
*
* @param parser the XML parser, positioned at the starting element of the extension.
* @return a PacketExtension.
* @throws Exception if a parsing error occurs.
*/
public PacketExtension parseExtension(XmlPullParser parser)
throws Exception {
MessageEvent messageEvent = new MessageEvent();
boolean done = false;
while (!done) {
int eventType = parser.next();
if (eventType == XmlPullParser.START_TAG) {
if (parser.getName().equals("id"))
messageEvent.setPacketID(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;
}
示例7: sendDeliveredNotification
import org.jivesoftware.smackx.packet.MessageEvent; //导入方法依赖的package包/类
/**
* 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.
*/
public void sendDeliveredNotification(String to, String packetID) {
// 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.setPacketID(packetID);
msg.addExtension(messageEvent);
// Send the packet
con.sendPacket(msg);
}
示例8: sendDisplayedNotification
import org.jivesoftware.smackx.packet.MessageEvent; //导入方法依赖的package包/类
/**
* 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.
*/
public void sendDisplayedNotification(String to, String packetID) {
// 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.setPacketID(packetID);
msg.addExtension(messageEvent);
// Send the packet
con.sendPacket(msg);
}
示例9: sendComposingNotification
import org.jivesoftware.smackx.packet.MessageEvent; //导入方法依赖的package包/类
/**
* 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.
*/
public void sendComposingNotification(String to, String packetID) {
// 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.setPacketID(packetID);
msg.addExtension(messageEvent);
// Send the packet
con.sendPacket(msg);
}
示例10: sendCancelledNotification
import org.jivesoftware.smackx.packet.MessageEvent; //导入方法依赖的package包/类
/**
* 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.
*/
public void sendCancelledNotification(String to, String packetID) {
// 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.setPacketID(packetID);
msg.addExtension(messageEvent);
// Send the packet
con.sendPacket(msg);
}
示例11: parseExtension
import org.jivesoftware.smackx.packet.MessageEvent; //导入方法依赖的package包/类
/**
* Parses a MessageEvent packet (extension sub-packet).
*
* @param parser
* the XML parser, positioned at the starting element of the
* extension.
* @return a PacketExtension.
* @throws Exception
* if a parsing error occurs.
*/
public PacketExtension parseExtension(XmlPullParser parser)
throws Exception {
MessageEvent messageEvent = new MessageEvent();
boolean done = false;
while (!done) {
int eventType = parser.next();
if (eventType == XmlPullParser.START_TAG) {
if (parser.getName().equals("id"))
messageEvent.setPacketID(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;
}