Added a proper method for changing the name of an identity.

Fixes random but relatively frequent crashes.


git-svn-id: http://yate.null.ro/svn/yate/trunk@1885 acf43c95-373e-0410-b603-e72c3f656dc1
This commit is contained in:
paulc 2008-04-09 20:29:48 +00:00
parent 6c76c622e1
commit 2a4e5d69f7
2 changed files with 9 additions and 2 deletions

View File

@ -321,7 +321,7 @@ JBEngine::~JBEngine()
for (GenObject* o = 0; 0 != (o = iter.get());)
TelEngine::destruct(static_cast<JBStream*>(o));
}
TelEngine::destruct((RefObject*)m_identity);
TelEngine::destruct(m_identity);
XDebug(this,DebugAll,"~JBEngine [%p]",this);
}
@ -860,7 +860,7 @@ bool JBEngine::processDisco(JBEvent* event)
XMLElement* query = XMPPUtils::createElement(XMLElement::Query,XMPPNamespace::DiscoInfo);
m_features.addTo(query);
if (m_identity) {
*(String*)(m_identity) = stream->local();
m_identity->setName(stream->local());
query->addChild(m_identity->toXML());
}
iq->addChild(query);

View File

@ -563,6 +563,13 @@ public:
return RefObject::getObject(name);
}
/**
* Set the name of this identity
* @param name New identity name
*/
inline void setName(const char* name)
{ if (name) m_name = name; }
/**
* Lookup for a text associated with a given category
* @return The category's name