Methods Summary |
---|
public void | addContact(java.lang.String address)Add a contact to the list. The contact is specified by its address
string.
address = mManager.normalizeAddress(address);
if (null == address) {
throw new NullPointerException();
}
if (mManager.isBlocked(address)) {
throw new ImException(ImErrorInfo.CANT_ADD_BLOCKED_CONTACT,
"Contact has been blocked");
}
if(containsContact(address)){
throw new ImException(ImErrorInfo.CONTACT_EXISTS_IN_LIST,
"Contact already exists in the list");
}
mManager.addContactToListAsync(address, this);
|
public synchronized boolean | containsContact(java.lang.String address)
return mContactsCache.containsKey(mManager.normalizeAddress(address));
|
public synchronized boolean | containsContact(Address address)
return address == null ? false
: mContactsCache.containsKey(mManager.normalizeAddress(address.getFullName()));
|
public synchronized boolean | containsContact(Contact c)
return c == null ? false
: mContactsCache.containsKey(mManager.normalizeAddress(c.getAddress().getFullName()));
|
public Address | getAddress()
return mAddress;
|
public synchronized Contact | getContact(Address address)
return mContactsCache.get(mManager.normalizeAddress(address.getFullName()));
|
public synchronized Contact | getContact(java.lang.String address)
return mContactsCache.get(mManager.normalizeAddress(address));
|
public synchronized java.util.Collection | getContacts()
return new ArrayList<Contact>(mContactsCache.values());
|
public synchronized int | getContactsCount()
return mContactsCache.size();
|
public java.lang.String | getName()
return mName;
|
protected void | insertToCache(Contact contact)
mContactsCache.put(mManager.normalizeAddress(contact.getAddress().getFullName()), contact);
|
public boolean | isDefault()
return mDefault;
|
public void | removeContact(Address address)Remove a contact from the list. If the contact is not in the list,
nothing will happen. Otherwise, the contact will be removed from
the list on the server asynchronously.
if(address == null) {
throw new NullPointerException();
}
Contact c = getContact(address);
if(c != null) {
removeContact(c);
}
|
public void | removeContact(Contact contact)Remove a contact from the list. If the contact is not in the list,
nothing will happen. Otherwise, the contact will be removed from
the list on the server asynchronously.
if(contact == null) {
throw new NullPointerException();
}
if(containsContact(contact)) {
mManager.removeContactFromListAsync(contact, this);
}
|
protected void | removeFromCache(Contact contact)
mContactsCache.remove(mManager.normalizeAddress(contact.getAddress().getFullName()));
|
public void | setDefault(boolean isDefault)
this.mDefault = isDefault;
|
public void | setName(java.lang.String name)
if (null == name) {
throw new NullPointerException();
}
mManager.setListNameAsync(name, this);
|