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;
021
022/**
023 *
024 * A listener that is fired anytime a message event request is received.
025 * Message event requests are received when the received message includes an extension 
026 * like this:
027 * 
028 * <pre>
029 * &lt;x xmlns='jabber:x:event'&gt;
030 *  &lt;offline/&gt;
031 *  &lt;delivered/&gt;
032 *  &lt;composing/&gt;
033 * &lt;/x&gt;
034 * </pre>
035 * 
036 * In this example you can see that the sender of the message requests to be notified
037 * when the user couldn't receive the message because he/she is offline, the message 
038 * was delivered or when the receiver of the message is composing a reply. 
039 *
040 * @author Gaston Dombiak
041 */
042public interface MessageEventRequestListener {
043
044    /**
045     * Called when a request for message delivered notification is received.
046     *  
047     * @param from the user that sent the notification.
048     * @param packetID the id of the message that was sent.
049     * @param messageEventManager the messageEventManager that fired the listener.
050     * @throws NotConnectedException 
051     */
052    public void deliveredNotificationRequested(String from, String packetID,
053            MessageEventManager messageEventManager) throws NotConnectedException;
054
055    /**
056     * Called when a request for message displayed notification is received.
057     *  
058     * @param from the user that sent the notification.
059     * @param packetID the id of the message that was sent.
060     * @param messageEventManager the messageEventManager that fired the listener.
061     */
062    public void displayedNotificationRequested(String from, String packetID,
063            MessageEventManager messageEventManager);
064
065    /**
066     * Called when a request that the receiver of the message is composing a reply notification is 
067     * received.
068     *  
069     * @param from the user that sent the notification.
070     * @param packetID the id of the message that was sent.
071     * @param messageEventManager the messageEventManager that fired the listener.
072     */
073    public void composingNotificationRequested(String from, String packetID,
074                MessageEventManager messageEventManager);
075
076    /**
077     * Called when a request that the receiver of the message is offline is received.
078     *  
079     * @param from the user that sent the notification.
080     * @param packetID the id of the message that was sent.
081     * @param messageEventManager the messageEventManager that fired the listener.
082     */
083    public void offlineNotificationRequested(String from, String packetID,
084            MessageEventManager messageEventManager);
085
086}