001    /*
002     Copyright (C) 2003 Adam Olsen
003     This program is free software; you can redistribute it and/or modify
004     it under the terms of the GNU General Public License as published by
005     the Free Software Foundation; either version 1, or (at your option)
006     any later version.
007     This program is distributed in the hope that it will be useful,
008     but WITHOUT ANY WARRANTY; without even the implied warranty of
009     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
010     GNU General Public License for more details.
011     You should have received a copy of the GNU General Public License
012     along with this program; if not, write to the Free Software
013     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
014     */
015    package com.valhalla.jbother.jabber.smack.provider;
016    
017    import org.jivesoftware.smack.packet.PacketExtension;
018    import org.jivesoftware.smack.provider.PacketExtensionProvider;
019    import org.xmlpull.v1.XmlPullParser;
020    
021    import com.valhalla.jbother.jabber.smack.SecureExtension;
022    
023    /**
024     * Parses jabber:x:encrypted extensions
025     * 
026     * @author Andrey Zakirov
027     * @version 0.1
028     */
029    public class EncryptedProvider implements PacketExtensionProvider {
030        /**
031         * Parses extension XML
032         * 
033         * @param parser
034         *            the xml parser
035         * @return extension
036         * @exception Exception
037         *                if an error occurs while parsing the XML
038         */
039        public PacketExtension parseExtension(XmlPullParser parser)
040                throws Exception {
041            SecureExtension t = new SecureExtension("encrypted");
042            t.setData(parser.nextText());
043            return t;
044        }
045    }
046