001/**
002 *
003 * Copyright 2003-2007 Jive Software.
004 *
005 * Licensed under the Apache License, Version 2.0 (the "License");
006 * you may not use this file except in compliance with the License.
007 * You may obtain a copy of the License at
008 *
009 *     http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 */
017
018package org.jivesoftware.smackx.xevent;
019
020import org.jivesoftware.smack.SmackException.NotConnectedException;
021import org.jxmpp.jid.Jid;
022
023/**
024 *
025 * A listener that is fired anytime a message event request is received.
026 * Message event requests are received when the received message includes an extension 
027 * like this:
028 * 
029 * <pre>
030 * &lt;x xmlns='jabber:x:event'&gt;
031 *  &lt;offline/&gt;
032 *  &lt;delivered/&gt;
033 *  &lt;composing/&gt;
034 * &lt;/x&gt;
035 * </pre>
036 * 
037 * In this example you can see that the sender of the message requests to be notified
038 * when the user couldn't receive the message because he/she is offline, the message 
039 * was delivered or when the receiver of the message is composing a reply. 
040 *
041 * @author Gaston Dombiak
042 */
043public interface MessageEventRequestListener {
044
045    /**
046     * Called when a request for message delivered notification is received.
047     *  
048     * @param from the user that sent the notification.
049     * @param packetID the id of the message that was sent.
050     * @param messageEventManager the messageEventManager that fired the listener.
051     * @throws NotConnectedException 
052     * @throws InterruptedException 
053     */
054    public void deliveredNotificationRequested(Jid from, String packetID,
055            MessageEventManager messageEventManager) throws NotConnectedException, InterruptedException;
056
057    /**
058     * Called when a request for message displayed notification is received.
059     *  
060     * @param from the user that sent the notification.
061     * @param packetID the id of the message that was sent.
062     * @param messageEventManager the messageEventManager that fired the listener.
063     */
064    public void displayedNotificationRequested(Jid from, String packetID,
065            MessageEventManager messageEventManager);
066
067    /**
068     * Called when a request that the receiver of the message is composing a reply notification is 
069     * received.
070     *  
071     * @param from the user that sent the notification.
072     * @param packetID the id of the message that was sent.
073     * @param messageEventManager the messageEventManager that fired the listener.
074     */
075    public void composingNotificationRequested(Jid from, String packetID,
076                MessageEventManager messageEventManager);
077
078    /**
079     * Called when a request that the receiver of the message is offline is received.
080     *  
081     * @param from the user that sent the notification.
082     * @param packetID the id of the message that was sent.
083     * @param messageEventManager the messageEventManager that fired the listener.
084     */
085    public void offlineNotificationRequested(Jid from, String packetID,
086            MessageEventManager messageEventManager);
087
088}