stanzaextensionfactory.cpp

00001 /*
00002   Copyright (c) 2006-2008 by Jakob Schroeter <js@camaya.net>
00003   This file is part of the gloox library. http://camaya.net/gloox
00004 
00005   This software is distributed under a license. The full license
00006   agreement can be found in the file LICENSE in this distribution.
00007   This software may not be copied, modified, sold or distributed
00008   other than expressed in the named license agreement.
00009 
00010   This software is distributed without any warranty.
00011 */
00012 
00013 
00014 #include "stanzaextensionfactory.h"
00015 
00016 #include "gloox.h"
00017 #include "tag.h"
00018 #include "oob.h"
00019 #include "vcardupdate.h"
00020 #include "delayeddelivery.h"
00021 #include "xdelayeddelivery.h"
00022 #include "gpgsigned.h"
00023 #include "gpgencrypted.h"
00024 
00025 namespace gloox
00026 {
00027 
00028   StanzaExtension* StanzaExtensionFactory::create( Tag* tag )
00029   {
00030     const std::string& name = tag->name();
00031     const std::string& xmlns = tag->findAttribute( "xmlns" );
00032     if( name == "x" )
00033     {
00034       if( xmlns == XMLNS_X_DELAY )
00035         return new XDelayedDelivery( tag );
00036       else if( xmlns == XMLNS_X_OOB )
00037         return new OOB( tag );
00038       else if( xmlns == XMLNS_X_VCARD_UPDATE )
00039         return new VCardUpdate( tag );
00040       else if( xmlns == XMLNS_X_GPGSIGNED )
00041         return new GPGSigned( tag );
00042       else if( xmlns == XMLNS_X_GPGENCRYPTED )
00043         return new GPGEncrypted( tag );
00044     }
00045     else if( name == "iq" )
00046     {
00047       if( xmlns == XMLNS_IQ_OOB )
00048         return new OOB( tag );
00049     }
00050     else if( name == "delay" && xmlns == XMLNS_DELAY )
00051       return new DelayedDelivery( tag );
00052 
00053     return 0;
00054   }
00055 
00056 }

Generated on Sun Apr 27 11:08:13 2008 for gloox by  doxygen 1.5.5