Home | History | Annotate | Download | only in receipts
      1 /*
      2  * All rights reserved. Licensed under the Apache License, Version 2.0 (the "License");
      3  * you may not use this file except in compliance with the License.
      4  * You may obtain a copy of the License at
      5  *
      6  *     http://www.apache.org/licenses/LICENSE-2.0
      7  *
      8  * Unless required by applicable law or agreed to in writing, software
      9  * distributed under the License is distributed on an "AS IS" BASIS,
     10  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     11  * See the License for the specific language governing permissions and
     12  * limitations under the License.
     13  */
     14 package org.jivesoftware.smackx.receipts;
     15 
     16 import org.jivesoftware.smack.packet.PacketExtension;
     17 import org.jivesoftware.smack.provider.PacketExtensionProvider;
     18 import org.xmlpull.v1.XmlPullParser;
     19 
     20 /**
     21  * Represents a <b>message delivery receipt request</b> entry as specified by
     22  * <a href="http://xmpp.org/extensions/xep-0184.html">Message Delivery Receipts</a>.
     23  *
     24  * @author Georg Lukas
     25  */
     26 public class DeliveryReceiptRequest implements PacketExtension
     27 {
     28     public static final String ELEMENT = "request";
     29 
     30     public String getElementName()
     31     {
     32         return ELEMENT;
     33     }
     34 
     35     public String getNamespace()
     36     {
     37         return DeliveryReceipt.NAMESPACE;
     38     }
     39 
     40     public String toXML()
     41     {
     42         return "<request xmlns='" + DeliveryReceipt.NAMESPACE + "'/>";
     43     }
     44 
     45     /**
     46      * This Provider parses and returns DeliveryReceiptRequest packets.
     47      */
     48     public static class Provider implements PacketExtensionProvider {
     49         @Override
     50         public PacketExtension parseExtension(XmlPullParser parser) {
     51             return new DeliveryReceiptRequest();
     52         }
     53     }
     54 }
     55