当前位置: 首页>>代码示例>>Java>>正文


Java MessageEvent.setDelivered方法代码示例

本文整理汇总了Java中org.jivesoftware.smackx.xevent.packet.MessageEvent.setDelivered方法的典型用法代码示例。如果您正苦于以下问题:Java MessageEvent.setDelivered方法的具体用法?Java MessageEvent.setDelivered怎么用?Java MessageEvent.setDelivered使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.jivesoftware.smackx.xevent.packet.MessageEvent的用法示例。


在下文中一共展示了MessageEvent.setDelivered方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: addNotificationsRequests

import org.jivesoftware.smackx.xevent.packet.MessageEvent; //导入方法依赖的package包/类
/**
 * Adds event notification requests to a message. For each event type that
 * the user wishes event notifications from the message recepient for, <tt>true</tt>
 * should be passed in to this method.
 * 
 * @param message the message to add the requested notifications.
 * @param offline specifies if the offline event is requested.
 * @param delivered specifies if the delivered event is requested.
 * @param displayed specifies if the displayed event is requested.
 * @param composing specifies if the composing event is requested.
 */
public static void addNotificationsRequests(Message message, boolean offline,
        boolean delivered, boolean displayed, boolean composing)
{
    // Create a MessageEvent Package and add it to the message
    MessageEvent messageEvent = new MessageEvent();
    messageEvent.setOffline(offline);
    messageEvent.setDelivered(delivered);
    messageEvent.setDisplayed(displayed);
    messageEvent.setComposing(composing);
    message.addExtension(messageEvent);
}
 
开发者ID:TTalkIM,项目名称:Smack,代码行数:23,代码来源:MessageEventManager.java

示例2: sendDeliveredNotification

import org.jivesoftware.smackx.xevent.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.
 * @throws NotConnectedException 
 */
public void sendDeliveredNotification(String to, String packetID) throws NotConnectedException {
    // 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);
}
 
开发者ID:TTalkIM,项目名称:Smack,代码行数:19,代码来源:MessageEventManager.java

示例3: parse

import org.jivesoftware.smackx.xevent.packet.MessageEvent; //导入方法依赖的package包/类
/**
 * 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;
}
 
开发者ID:TTalkIM,项目名称:Smack,代码行数:36,代码来源:MessageEventProvider.java


注:本文中的org.jivesoftware.smackx.xevent.packet.MessageEvent.setDelivered方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。