XCAP: When using manually entered values for the login, use them as is without stripping the domain name.

cusax-fix
Ingo Bauersachs 15 years ago
parent 7c52a2ee58
commit b6573bb94a

@ -350,28 +350,28 @@ public void fireRegistrationStateChanged(RegistrationState oldState,
XCAP_USE_SIP_CREDETIALS, true);
String serverUri =
accountID.getAccountPropertyString(XCAP_SERVER_URI);
String user;
String username = accountID.getAccountPropertyString(
ProtocolProviderFactory.USER_ID);
Address userAddress = parseAddressString(username);
String password;
if (useSipCredetials)
{
user = accountID.getAccountPropertyString(
ProtocolProviderFactory.USER_ID);
username = ((SipUri)userAddress.getURI()).getUser();
password = SipActivator.getProtocolProviderFactory().
loadPassword(accountID);
}
else
{
user = accountID.getAccountPropertyString(XCAP_USER);
username = accountID.getAccountPropertyString(XCAP_USER);
password = accountID.getAccountPropertyString(XCAP_PASSWORD);
}
// Connect to xcap server
Address userAddress = parseAddressString(user);
if(enableXCap && serverUri != null)
{
URI uri = new URI(serverUri.trim());
if(uri.getHost() != null && uri.getPath() != null)
{
xCapClient.connect(uri, userAddress, password);
xCapClient.connect(uri, userAddress, username, password);
}
}
}

@ -79,6 +79,11 @@ public abstract class BaseHttpXCapClient implements HttpXCapClient
*/
protected Address userAddress;
/**
* Current user loginname.
*/
private String username;
/**
* Current user password.
*/
@ -120,11 +125,12 @@ public BaseHttpXCapClient()
* Connects user to XCap server.
*
* @param uri the server location.
* @param userAddress the user name.
* @param userAddress the URI of the user used for requests
* @param username the user name.
* @param password the user password.
* @throws XCapException if there is some error during operation.
*/
public void connect(URI uri, Address userAddress, String password)
public void connect(URI uri, Address userAddress, String username, String password)
throws XCapException
{
if (!userAddress.getURI().isSipURI())
@ -133,6 +139,7 @@ public void connect(URI uri, Address userAddress, String password)
}
this.uri = uri;
this.userAddress = (Address) userAddress.clone();
this.username = username;
this.password = password == null ? "" : password;
connected = true;
}
@ -333,8 +340,7 @@ public XCapHttpResponse delete(XCapResourceId resourceId)
*/
public String getUserName()
{
return userAddress != null ?
((SipURI) userAddress.getURI()).getUser() : null;
return username;
}
/**

@ -22,11 +22,12 @@ public interface HttpXCapClient
* Connects user to XCAP server.
*
* @param uri the server location.
* @param userAddress the user name.
* @param userAddress the URI of the user used for requests
* @param username the user name.
* @param password the user password.
* @throws XCapException if there is some error during operation.
*/
public void connect(URI uri, Address userAddress, String password)
public void connect(URI uri, Address userAddress, String username, String password)
throws XCapException;
/**

@ -53,14 +53,15 @@ public class XCapClientImpl extends BaseHttpXCapClient implements XCapClient
* anaylyze if resource-lists, pres-rules, pres-content is supported.
*
* @param uri the server location.
* @param userAddress the user name.
* @param userAddress the URI of the user used for requests
* @param username the user name.
* @param password the user password.
* @throws XCapException if there is some error during operation.
*/
public void connect(URI uri, Address userAddress, String password)
public void connect(URI uri, Address userAddress, String username, String password)
throws XCapException
{
super.connect(uri, userAddress, password);
super.connect(uri, userAddress, username, password);
try
{
xCapCaps = loadXCapCaps();

@ -6,6 +6,7 @@
*/
package net.java.sip.communicator.slick.protocol.sip;
import gov.nist.javax.sip.address.*;
import junit.framework.*;
import net.java.sip.communicator.util.*;
import net.java.sip.communicator.service.protocol.*;
@ -150,7 +151,10 @@ private XCapClient createXCapClient()
XCapClient xCapClient = new XCapClientImpl();
xCapClient.connect(new URI(xCapServerUri),
((ProtocolProviderServiceSipImpl) fixture.provider1).
parseAddressString(userName), password);
parseAddressString(userName),
((SipUri)(((ProtocolProviderServiceSipImpl) fixture.provider1).
parseAddressString(userName))).getUser(),
password);
return xCapClient;
}

Loading…
Cancel
Save