Nickname retreiving

Added persistent data - nickname
if there is no nickname add it for update
cusax-fix
Damian Minkov 21 years ago
parent 9459321079
commit 773cdbd479

@ -4,6 +4,7 @@
import net.kano.joscar.snaccmd.*;
import net.kano.joustsim.oscar.oscar.service.ssi.*;
import net.java.sip.communicator.service.protocol.icqconstants.*;
import java.util.*;
/**
* The ICQ implementation of the service.protocol.Contact interface.
@ -20,6 +21,8 @@ public class ContactIcqImpl
private boolean isPersistent = false;
private boolean isResolved = false;
private String nickName = null;
/**
* Creates an IcqContactImpl
* @param buddy the JoustSIM object that we will be encapsulating.
@ -175,10 +178,27 @@ public PresenceStatus getPresenceStatus()
*/
public String getDisplayName()
{
//temporarily return the uin as we don't have alias support in joust
//sim right now.
String alias = joustSimBuddy.getAlias();
return alias == null? getUIN():alias;
if(nickName != null)
{
return nickName;
}
else
{
String alias = joustSimBuddy.getAlias();
// if there is no alias we put this contact
// for future update, as we may be not registered yet
if(alias == null)
ssclCallback.addContactForUpdate(this);
nickName = alias == null ? getUIN() : alias;
return nickName;
}
}
protected void setDisplayName(String nickname)
{
this.nickName = nickname;
}
/**
@ -255,7 +275,7 @@ void setResolved(boolean resolved)
*/
public String getPersistentData()
{
return null;
return "nickname=" + getDisplayName() + ";";
}
/**
@ -272,4 +292,22 @@ public boolean isResolved()
return isResolved;
}
public void setPersistentData(String persistentData)
{
if(persistentData == null)
{
return;
}
StringTokenizer dataToks = new StringTokenizer(persistentData, ";");
while(dataToks.hasMoreTokens())
{
String data[] = dataToks.nextToken().split("=");
if(data[0].equals("nickname"))
{
// here we must inform that nick has changed
nickName = data[1];
}
}
}
}

Loading…
Cancel
Save