~ubuntu-branches/ubuntu/vivid/gloox/vivid-proposed

« back to all changes in this revision

Viewing changes to src/stanzaextensionfactory.cpp

  • Committer: Package Import Robot
  • Author(s): Vincent Cheng
  • Date: 2014-03-16 17:34:43 UTC
  • mfrom: (12.1.2 experimental)
  • mto: This revision was merged to the branch mainline in revision 15.
  • Revision ID: package-import@ubuntu.com-20140316173443-4s177dovzaz5dm8o
Upload to unstable.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
 
  Copyright (c) 2006-2009 by Jakob Schroeter <js@camaya.net>
 
2
  Copyright (c) 2006-2013 by Jakob Schroeter <js@camaya.net>
3
3
  This file is part of the gloox library. http://camaya.net/gloox
4
4
 
5
5
  This software is distributed under a license. The full license
14
14
#include "stanzaextensionfactory.h"
15
15
 
16
16
#include "gloox.h"
 
17
#include "mutexguard.h"
17
18
#include "util.h"
18
19
#include "stanza.h"
19
20
#include "stanzaextension.h"
28
29
 
29
30
  StanzaExtensionFactory::~StanzaExtensionFactory()
30
31
  {
 
32
    m_extensionsMutex.lock();
31
33
    util::clearList( m_extensions );
 
34
    m_extensionsMutex.unlock();
32
35
  }
33
36
 
34
37
  void StanzaExtensionFactory::registerExtension( StanzaExtension* ext )
36
39
    if( !ext )
37
40
      return;
38
41
 
 
42
    util::MutexGuard m( m_extensionsMutex );
39
43
    SEList::iterator it = m_extensions.begin();
40
44
    SEList::iterator it2;
41
45
    while( it != m_extensions.end() )
52
56
 
53
57
  bool StanzaExtensionFactory::removeExtension( int ext )
54
58
  {
 
59
    util::MutexGuard m( m_extensionsMutex );
55
60
    SEList::iterator it = m_extensions.begin();
56
61
    for( ; it != m_extensions.end(); ++it )
57
62
    {
68
73
  void StanzaExtensionFactory::addExtensions( Stanza& stanza, Tag* tag )
69
74
  {
70
75
    ConstTagList::const_iterator it;
 
76
 
 
77
    util::MutexGuard m( m_extensionsMutex );
71
78
    SEList::const_iterator ite = m_extensions.begin();
72
79
    for( ; ite != m_extensions.end(); ++ite )
73
80
    {
77
84
      {
78
85
        StanzaExtension* se = (*ite)->newInstance( (*it) );
79
86
        if( se )
 
87
        {
80
88
          stanza.addExtension( se );
 
89
          if( se->embeddedStanza() )
 
90
            stanza.setEmbeddedStanza();
 
91
        }
81
92
      }
82
93
    }
83
94
  }