Added default resource name to Jabber engine. Added full identity data for Jabber servers.

git-svn-id: http://voip.null.ro/svn/yate@1164 acf43c95-373e-0410-b603-e72c3f656dc1
This commit is contained in:
marian 2007-01-14 22:15:46 +00:00
parent 20af373d5f
commit 8d8f216258
3 changed files with 34 additions and 8 deletions

View File

@ -45,6 +45,9 @@
; expire_interval: integer: Presence: Timeout after probe
;probe_interval=300000
; default_resource: string: Default resource name when missing from local users' JIDs
;default_resource=yate
[codecs]
; This section allows to individually enable or disable the codecs
@ -97,6 +100,9 @@ g729=default
; identity: string: The subdomain used by the component (required)
;identity=yate
; fullidentity: string: The fully qualified identity, default: identity.server
;fullidentity=
; startup: boolean: True to open the stream when initializing the driver
;startup=true

View File

@ -103,8 +103,11 @@ void JBEngine::initialize(const NamedList& params)
// XML parser max receive buffer
XMLParser::s_maxDataBuffer =
params.getIntValue("xmlparser_maxbuffer",XMLPARSER_MAXDATABUFFER);
// Default resource
m_defaultResource = params.getValue("default_resource","yate");
if (debugAt(DebugAll)) {
String s;
s << "\r\ndefault_resource=" << m_defaultResource;
s << "\r\nstream_restartupdateinterval=" << (unsigned int)m_restartUpdateInterval;
s << "\r\nstream_restartcount=" << (unsigned int)m_restartCount;
s << "\r\nxmlparser_maxbuffer=" << (unsigned int)XMLParser::s_maxDataBuffer;
@ -399,9 +402,7 @@ bool JBEngine::getFullServerIdentity(String& destination, const char* token,
JBServerInfo* server = getServer(token,domain);
if (!server)
return false;
// Component server
destination = "";
destination << server->identity() << "." << server->name();
destination = server->fullIdentity();
return true;
}

View File

@ -548,11 +548,11 @@ class YJINGLE_API JBServerInfo : public RefObject
{
public:
inline JBServerInfo(const char* name, const char* address, int port,
const char* password, const char* identity, bool autoRestart,
u_int32_t restartCount)
: m_name(name), m_address(address),
m_port(port), m_password(password), m_identity(identity),
m_autoRestart(autoRestart), m_restartCount(restartCount)
const char* password, const char* identity, const char* fullidentity,
bool autoRestart, u_int32_t restartCount)
: m_name(name), m_address(address), m_port(port), m_password(password),
m_identity(identity), m_fullIdentity(fullidentity), m_autoRestart(autoRestart),
m_restartCount(restartCount)
{}
virtual ~JBServerInfo() {}
inline const String& address() const
@ -565,6 +565,8 @@ public:
{ return m_password; }
inline const String& identity() const
{ return m_identity; }
inline const String& fullIdentity() const
{ return m_fullIdentity; }
inline bool autoRestart() const
{ return m_autoRestart; }
inline u_int32_t restartCount() const
@ -583,6 +585,7 @@ private:
int m_port; // Port
String m_password; // Authentication data
String m_identity; // Identity. Used for Jabber Component protocol
String m_fullIdentity; // Full identity for this server
bool m_autoRestart; // Automatically restart stream
u_int32_t m_restartCount; // Restart counter
};
@ -660,6 +663,13 @@ public:
inline u_int32_t restartCount() const
{ return m_restartCount; }
/**
* Get the default resource name.
* @return The default resource name.
*/
inline const String& defaultResource() const
{ return m_defaultResource; }
/**
* Check if a stream to the given server exists.
* If the stream doesn't exists creates it.
@ -878,6 +888,8 @@ private:
String m_componentAddr; // Default server address
ObjList m_server; // Server list
Mutex m_serverMutex; // Lock server list
// Misc
String m_defaultResource; // Default name for missing resources
};
/**
@ -962,6 +974,13 @@ public:
inline bool delUnavailable() const
{ return m_delUnavailable; }
/**
* Check if this server should add new users when receiving presence.
* @return True if should add a new user
*/
inline bool addOnPresence() const
{ return m_addOnPresence; }
/**
* Get the probe interval. Time to send a probe if nothing was received from that user.
* @return The probe interval.