Change sip user-agent header to include build number and os name.

cusax-fix
Damian Minkov 18 years ago
parent ad2b186994
commit c6be00c866

@ -1272,6 +1272,8 @@ javax.swing.event, javax.swing.border"/>
manifest="${src}/net/java/sip/communicator/impl/version/version.impl.manifest.mf">
<zipfileset dir="${dest}/net/java/sip/communicator/impl/version"
prefix="net/java/sip/communicator/impl/version"/>
<zipfileset dir="${resources}" includes="application.properties"
prefix="resources"/>
</jar>
</target>

@ -16,6 +16,7 @@
import net.java.sip.communicator.service.protocol.*;
import net.java.sip.communicator.service.protocol.event.*;
import net.java.sip.communicator.service.version.*;
import net.java.sip.communicator.util.*;
import gov.nist.javax.sip.*;
import gov.nist.javax.sip.header.*;
@ -2177,11 +2178,19 @@ public UserAgentHeader getSipCommUserAgentHeader()
try
{
List userAgentTokens = new LinkedList();
userAgentTokens.add("SIP Communicator");
userAgentTokens.add("1.0");
String dateString
= new Date().toString().replace(' ', '_').replace(':', '-');
userAgentTokens.add("CVS-" + dateString);
Version ver =
SipActivator.getVersionService().getCurrentVersion();
userAgentTokens.add(ver.getApplicationName());
userAgentTokens.add(
ver.getVersionMajor() + "." + ver.getVersionMinor());
if(ver.isNightly())
userAgentTokens.add(ver.getNightlyBuildID());
String osName = System.getProperty("os.name");
userAgentTokens.add(osName);
userAgentHeader
= this.headerFactory.createUserAgentHeader(userAgentTokens);

@ -14,6 +14,7 @@
import net.java.sip.communicator.service.protocol.*;
import net.java.sip.communicator.util.*;
import net.java.sip.communicator.service.media.*;
import net.java.sip.communicator.service.version.*;
/**
* Activates the SIP package
@ -30,6 +31,7 @@ public class SipActivator
private static NetworkAddressManagerService networkAddressManagerService
= null;
private static MediaService mediaService = null;
private static VersionService versionService = null;
private static ProtocolProviderFactorySipImpl sipProviderFactory = null;
@ -146,6 +148,26 @@ public static MediaService getMediaService()
}
return mediaService;
}
/**
* Returns a reference to a VersionService implementation currently registered
* in the bundle context or null if no such implementation was found.
*
* @return a reference to a VersionService implementation currently registered
* in the bundle context or null if no such implementation was found.
*/
public static VersionService getVersionService()
{
if(versionService == null)
{
ServiceReference versionServiceReference
= bundleContext.getServiceReference(
VersionService.class.getName());
versionService = (VersionService)bundleContext
.getService(versionServiceReference);
}
return versionService;
}
/**
* Called when this bundle is stopped so the Framework can perform the

@ -14,6 +14,7 @@ Import-Package: org.osgi.framework,
net.java.sip.communicator.service.netaddr,
net.java.sip.communicator.service.media,
net.java.sip.communicator.service.media.event,
net.java.sip.communicator.service.version,
javax.net.ssl,
javax.xml.parsers,
javax.xml.transform,

@ -6,6 +6,8 @@
*/
package net.java.sip.communicator.impl.version;
import java.util.*;
import net.java.sip.communicator.service.version.*;
/**
@ -59,10 +61,15 @@ public class VersionImpl
public static final boolean IS_NIGHTLY_BUILD = true;
/**
* The name of this application.
* The default name of this application.
*/
public static final String APPLICATION_NAME = "SIP Communicator";
public static final String DEFAULT_APPLICATION_NAME = "SIP Communicator";
/**
* The name of this application.
*/
public static String applicationName = null;
/**
* Returns the VersionImpl instance describing the current version of
* SIP Communicator.
@ -285,6 +292,21 @@ public static final VersionImpl currentVersion()
*/
public String getApplicationName()
{
return APPLICATION_NAME;
if(applicationName == null)
{
try
{
applicationName =
ResourceBundle.getBundle("resources.application").
getString("applicationName");
} catch (Exception e)
{
// if resource bundle is not found or the key is missing
// return the defautl name
applicationName = DEFAULT_APPLICATION_NAME;
}
}
return applicationName;
}
}

Loading…
Cancel
Save