GoogleTalk account wizard now accepts and only usrnames defaulting @gmail.com.

Fix NPE with IceUdpTransportManager if password is not saved for the account.
When init roaster in jabber check if there are some unresolved contacts (missing on server side) and remove them.
cusax-fix
Damian Minkov 15 years ago
parent 98e008ec3a
commit 6fd94d65de

@ -118,6 +118,42 @@ private Agent createIceAgent()
= JabberActivator.getProtocolProviderFactory().loadPassword(
accID);
// ask for password if not saved
if (password == null)
{
//create a default credentials object
UserCredentials credentials = new UserCredentials();
credentials.setUserName(accID.getUserID());
//request a password from the user
credentials = provider.getAuthority().obtainCredentials(
ProtocolNames.JABBER,
credentials,
SecurityAuthority.AUTHENTICATION_REQUIRED);
// in case user has canceled the login window
if(credentials == null)
{
return null;
}
//extract the password the user passed us.
char[] pass = credentials.getPassword();
// the user didn't provide us a password (canceled the operation)
if(pass == null)
{
return null;
}
password = new String(pass);
if (credentials.isPasswordPersistent())
{
JabberActivator.getProtocolProviderFactory()
.storePassword(accID, password);
}
}
StunCandidateHarvester autoHarvester
= namSer.discoverStunServer(
accID.getService(),

@ -375,7 +375,7 @@ void reregister(int authReasonCode)
* @throws OperationFailedException if login parameters
* as server port are not correct
*/
private synchronized void connectAndLogin(SecurityAuthority authority,
private void connectAndLogin(SecurityAuthority authority,
int reasonCode)
throws XMPPException, OperationFailedException
{
@ -1928,4 +1928,13 @@ public static void throwOperationFailedException( String message,
else
throw new OperationFailedException(message, errorCode, cause);
}
/**
* Used when we need to re-register or someone needs to obtain credentials.
* @return the SecurityAuthority.
*/
public SecurityAuthority getAuthority()
{
return authority;
}
}

@ -817,6 +817,27 @@ private void initRoster()
}
}
// now search all root contacts for unresolved ones
Iterator<Contact> iter = rootGroup.contacts();
List<ContactJabberImpl> contactsToRemove
= new ArrayList<ContactJabberImpl>();
while(iter.hasNext())
{
ContactJabberImpl contact = (ContactJabberImpl)iter.next();
if(!contact.isResolved())
{
contactsToRemove.add(contact);
}
}
for(ContactJabberImpl contact : contactsToRemove)
{
rootGroup.removeContact(contact);
fireContactRemoved(rootGroup, contact);
}
contactsToRemove.clear();
// fill in root group
for (RosterGroup item : roster.getGroups())
{
@ -845,9 +866,47 @@ private void initRoster()
//fire an event saying that the group has been resolved
fireGroupEvent(group
, ServerStoredGroupEvent.GROUP_RESOLVED_EVENT);
}
}
Iterator<ContactGroup> iterGroups = rootGroup.subgroups();
List<ContactGroupJabberImpl> groupsToRemove
= new ArrayList<ContactGroupJabberImpl>();
while(iterGroups.hasNext())
{
ContactGroupJabberImpl group =
(ContactGroupJabberImpl)iterGroups.next();
/** @todo if something to delete . delete it */
if(!group.isResolved())
{
groupsToRemove.add(group);
}
Iterator<Contact> iterContacts = group.contacts();
while(iterContacts.hasNext())
{
ContactJabberImpl contact =
(ContactJabberImpl)iterContacts.next();
if(!contact.isResolved())
{
contactsToRemove.add(contact);
}
}
for(ContactJabberImpl contact : contactsToRemove)
{
group.removeContact(contact);
fireContactRemoved(group, contact);
}
contactsToRemove.clear();
}
for(ContactGroupJabberImpl group: groupsToRemove)
{
rootGroup.removeSubGroup(group);
fireGroupEvent(
group, ServerStoredGroupEvent.GROUP_REMOVED_EVENT);
}
}

@ -83,6 +83,7 @@ public Object getSimpleForm()
*/
private void setPredefinedProperties(JabberAccountRegistration reg)
{
reg.setDefaultUserSufix("gmail.com");
reg.setServerAddress("talk.google.com");
reg.setServerOverridden(true);
@ -141,7 +142,7 @@ public String getProtocolDescription()
*/
public String getUserNameExample()
{
return "Ex: johnsmith@gmail.com";
return "Ex: johnsmith@gmail.com or johnsmith";
}
/**

@ -190,6 +190,10 @@ public boolean commitPage(JabberAccountRegistration registration)
if(userID == null || userID.trim().length() == 0)
throw new IllegalStateException("No user ID provided.");
if(userID.indexOf('@') < 0
&& registration.getDefaultUserSufix() != null)
userID = userID + '@' + registration.getDefaultUserSufix();
registration.setUserID(userID);
registration.setPassword(new String(accountPanel.getPassword()));
registration.setRememberPassword(accountPanel.isRememberPassword());

@ -313,6 +313,10 @@ protected ProtocolProviderService installAccount(
serverName = getServerFromUserName(userName);
}
if(userName.indexOf('@') < 0
&& registration.getDefaultUserSufix() != null)
userName = userName + '@' + registration.getDefaultUserSufix();
accountProperties.put(ProtocolProviderFactory.SERVER_ADDRESS,
serverName);

Loading…
Cancel
Save