gloox  0.9.9.12
stanzaextensionfactory.cpp
1 /*
2  Copyright (c) 2006-2008 by Jakob Schroeter <js@camaya.net>
3  This file is part of the gloox library. http://camaya.net/gloox
4 
5  This software is distributed under a license. The full license
6  agreement can be found in the file LICENSE in this distribution.
7  This software may not be copied, modified, sold or distributed
8  other than expressed in the named license agreement.
9 
10  This software is distributed without any warranty.
11 */
12 
13 
14 #include "stanzaextensionfactory.h"
15 
16 #include "gloox.h"
17 #include "tag.h"
18 #include "oob.h"
19 #include "vcardupdate.h"
20 #include "delayeddelivery.h"
21 #include "xdelayeddelivery.h"
22 #include "gpgsigned.h"
23 #include "gpgencrypted.h"
24 
25 namespace gloox
26 {
27 
29  {
30  const std::string& name = tag->name();
31  const std::string& xmlns = tag->findAttribute( "xmlns" );
32  if( name == "x" )
33  {
34  if( xmlns == XMLNS_X_DELAY )
35  return new XDelayedDelivery( tag );
36  else if( xmlns == XMLNS_X_OOB )
37  return new OOB( tag );
38  else if( xmlns == XMLNS_X_VCARD_UPDATE )
39  return new VCardUpdate( tag );
40  else if( xmlns == XMLNS_X_GPGSIGNED )
41  return new GPGSigned( tag );
42  else if( xmlns == XMLNS_X_GPGENCRYPTED )
43  return new GPGEncrypted( tag );
44  }
45  else if( name == "iq" )
46  {
47  if( xmlns == XMLNS_IQ_OOB )
48  return new OOB( tag );
49  }
50  else if( name == "delay" && xmlns == XMLNS_DELAY )
51  return new DelayedDelivery( tag );
52 
53  return 0;
54  }
55 
56 }