當前位置: 首頁>>代碼示例>>Java>>正文


Java MessageEvent類代碼示例

本文整理匯總了Java中org.jivesoftware.smackx.xevent.packet.MessageEvent的典型用法代碼示例。如果您正苦於以下問題:Java MessageEvent類的具體用法?Java MessageEvent怎麽用?Java MessageEvent使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


MessageEvent類屬於org.jivesoftware.smackx.xevent.packet包,在下文中一共展示了MessageEvent類的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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: sendDisplayedNotification

import org.jivesoftware.smackx.xevent.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.
 * @throws NotConnectedException 
 */
public void sendDisplayedNotification(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.setDisplayed(true);
    messageEvent.setStanzaId(packetID);
    msg.addExtension(messageEvent);
    // Send the packet
    connection().sendStanza(msg);
}
 
開發者ID:TTalkIM,項目名稱:Smack,代碼行數:19,代碼來源:MessageEventManager.java

示例4: sendComposingNotification

import org.jivesoftware.smackx.xevent.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.
 * @throws NotConnectedException 
 */
public void sendComposingNotification(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.setComposing(true);
    messageEvent.setStanzaId(packetID);
    msg.addExtension(messageEvent);
    // Send the packet
    connection().sendStanza(msg);
}
 
開發者ID:TTalkIM,項目名稱:Smack,代碼行數:19,代碼來源:MessageEventManager.java

示例5: sendCancelledNotification

import org.jivesoftware.smackx.xevent.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.
 * @throws NotConnectedException 
 */
public void sendCancelledNotification(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.setCancelled(true);
    messageEvent.setStanzaId(packetID);
    msg.addExtension(messageEvent);
    // Send the packet
    connection().sendStanza(msg);
}
 
開發者ID:TTalkIM,項目名稱:Smack,代碼行數:19,代碼來源:MessageEventManager.java

示例6: 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類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。