Package org.linphone.core
Interface Friend
public interface Friend
This object is used to store a SIP address.
as data for the
also use it to subscribe to presence information.
The objects are stored in a
the
configured, otherwise they will be lost after the
Thanks to the vCard plugin, you can also store more information like phone
numbers, organization, etc...
Friend is mainly used to implement an adressbook feature, and are usedas data for the
MagicSearch object. If your proxy supports it, you canalso use it to subscribe to presence information.
The objects are stored in a
FriendList which are in turn stored insidethe
Core. They can be stored inside a database if the path to it isconfigured, otherwise they will be lost after the
Core is destroyed.Thanks to the vCard plugin, you can also store more information like phone
numbers, organization, etc...
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionvoidaddAddress(Address address) Adds an address in this friend.voidaddListener(FriendListener listener) voidaddPhoneNumber(String phoneNumber) Adds a phone number in this friend.voidaddPhoneNumberWithLabel(FriendPhoneNumber phoneNumber) Adds aFriendPhoneNumberto this friend.booleancreateVcard(String name) Creates a vCard object associated to this friend if there isn't one yet and if
the full name is available, either by the parameter or the one in the friend's
SIP URI.voiddone()Commits modification made to the friend configuration.voidedit()Starts editing a friend configuration.Get address of this friend.Address[]Returns a list ofAddressfor this friend.intReturns the capabilities associated to this friend.floatgetCapabilityVersion(Friend.Capability capability) Returns the version of a friend's capbility.Get the consolidated presence of a friend.getCore()Returns theCoreobject managing this friend, if any.Returns a list ofFriendDevicefor this friend, for all known
addresses.getDevicesForAddress(Address address) Returns a list ofFriendDevicefor this friend and a specific address.Check that the given friend is in a friend list.Gets the contact's job title from it's vCard.getName()Get the display name for this friend.longGets the native pointer used by this class to make native method calls.Gets the contact's native URI.Gets the contact's organization from it's vCard.String[]Returns a list of phone numbers for this friend.Returns a list ofFriendPhoneNumberfor this friend.getPhoto()Gets the contact's picture URI.Get the presence model of a friend.getPresenceModelForUriOrTel(String uriOrTel) Get the presence model for a specific SIP URI or phone number of a friend.Get the reference key of a friend.Returns the security level of a friend which is the lowest among all devices we
know for it.getSecurityLevelForAddress(Address address) Returns the security level of a friend for a given address which is the lowest
among all devices we know for that address.booleanGets if the friend is to be considered as important for the user.Get subscription state of a friend.Gets the object stored in this object user's datagetVcard()Returns the vCard object associated to this friend, if any.booleanhasCapability(Friend.Capability capability) Returns whether or not a friend has a capbility.booleanhasCapabilityWithVersion(Friend.Capability capability, float version) Returns whether or not a friend has a capbility with a given version.booleanhasCapabilityWithVersionOrMore(Friend.Capability capability, float version) Returns whether or not a friend has a capbility with a given version or more.booleanhasPhoneNumber(String phoneNumber) Returns whether a friend contains the given phone number.booleaninList()Check that the given friend is in a friend list.booleanTells whether we already received presence information for a friend.booleanget subscription flag value
voidremove()Removes a friend from it's friend list and from the rc if exists.voidremoveAddress(Address address) Removes an address in this friend.voidremoveListener(FriendListener listener) voidremovePhoneNumber(String phoneNumber) Removes a phone number in this friend.voidremovePhoneNumberWithLabel(FriendPhoneNumber phoneNumber) Removes aFriendPhoneNumberfrom this friend.voidSaves a friend either in database if configured, otherwise in linphonerc.intsetAddress(Address address) SetAddressfor this friend.intsetIncSubscribePolicy(SubscribePolicy policy) Configure incoming subscription policy for this friend.voidsetJobTitle(String jobTitle) Sets the contact's job title.intSet the display name for this friend.voidsetNativeUri(String nativeUri) Sets the contact's native URI.voidsetOrganization(String organization) Sets the contact's organization.voidSets the contact's picture URI.voidsetPresenceModel(PresenceModel presence) Set the presence model of a friend.voidsetPresenceModelForUriOrTel(String uriOrTel, PresenceModel presence) Set the presence model for a specific SIP URI or phone number of a friend.voidSet the reference key of a friend.voidsetStarred(boolean isStarred) Sets if the friend is a user's favorite or important contact.intsetSubscribesEnabled(boolean enable) ConfigureFriendto subscribe to presence information.voidsetUserData(Object data) Sets the object to store in this object user's datavoidBinds a vCard object to a friend.toString()
-
Method Details
-
getAddress
Get address of this friend.
note: theAddressobject returned is hold by the LinphoneFriend,
however calling several time this function may return different objects.- Returns:
- the
Address.
-
setAddress
- Parameters:
address- theAddressto set return 0 if successful, -1
otherwise
-
getAddresses
- Returns:
- A list of
Address.
-
getCapabilities
int getCapabilities()Returns the capabilities associated to this friend.
- Returns:
- an int representing the capabilities of the friend
-
getConsolidatedPresence
ConsolidatedPresence getConsolidatedPresence()Get the consolidated presence of a friend.
It will return the "most open" presence found if more than one presence model
are found.- Returns:
- The
ConsolidatedPresenceof the friend
-
getCore
- Returns:
- the
Coreobject associated.
-
getDevices
- Returns:
- A list of
FriendDevice.
-
getFriendList
Check that the given friend is in a friend list.
- Returns:
- The
FriendListthe friend is in if any, null otherwise.
-
getIncSubscribePolicy
SubscribePolicy getIncSubscribePolicy()- Returns:
- the
SubscribePolicyenum
-
setIncSubscribePolicy
Configure incoming subscription policy for this friend.
- Parameters:
policy-SubscribePolicypolicy to apply.- Returns:
- 0
-
isPresenceReceived
boolean isPresenceReceived()Tells whether we already received presence information for a friend.
- Returns:
- true if presence information has been received for the friend, false
otherwise.
-
getJobTitle
Gets the contact's job title from it's vCard.
It's a shortcut togetVcard()andVcard.getJobTitle().- Returns:
- the job_title set if any & vCard is available, null otherwise.
-
setJobTitle
Sets the contact's job title.
It's a shortcut togetVcard()andVcard.setJobTitle(java.lang.String).- Parameters:
jobTitle- the job title to store in Friend's vCard.
-
getName
Get the display name for this friend.
- Returns:
- The display name of this friend.
-
setName
Set the display name for this friend.
- Parameters:
name- the display name to set- Returns:
- 0 if successful, -1 otherwise
-
getNativeUri
Gets the contact's native URI.
- Returns:
- the native URI set if any, null otherwise.
-
setNativeUri
Sets the contact's native URI.
- Parameters:
nativeUri- the URI that matches the contact on the native system.
-
getOrganization
Gets the contact's organization from it's vCard.
It's a shortcut togetVcard()andVcard.getOrganization().- Returns:
- the organization set if any & vCard is available, null otherwise.
-
setOrganization
Sets the contact's organization.
It's a shortcut togetVcard()andVcard.setOrganization(java.lang.String).- Parameters:
organization- the organization to store in Friend's vCard.
-
getPhoneNumbers
Returns a list of phone numbers for this friend.
- Returns:
- A list of phone numbers as string.
-
getPhoneNumbersWithLabel
- Returns:
- A list of phone numbers as string.
-
getPhoto
Gets the contact's picture URI.
- Returns:
- the picture URI set if any, null otherwise.
-
setPhoto
Sets the contact's picture URI.
- Parameters:
pictureUri- the picture URI to set.
-
getPresenceModel
Get the presence model of a friend.
If a friend has more than one SIP address and phone number, this method will
return the most recent presence model usingPresenceModel.getTimestamp().- Returns:
- A
PresenceModelobject, or null if the friend do not have
presence information (in which case he is considered offline).
-
setPresenceModel
Set the presence model of a friend.
- Parameters:
presence- ThePresenceModelobject to set for the friend
-
getRefKey
Get the reference key of a friend.
- Returns:
- The reference key of the friend.
-
setRefKey
Set the reference key of a friend.
- Parameters:
key- The reference key to use for the friend.
-
getSecurityLevel
SecurityLevel getSecurityLevel()Returns the security level of a friend which is the lowest among all devices we
know for it.
- Returns:
- A
SecurityLevel, which is the lowest among all known devices.
-
getStarred
boolean getStarred()Gets if the friend is to be considered as important for the user.
- Returns:
- true if the contact is a user's favorite, false otherwise.
-
setStarred
void setStarred(boolean isStarred) Sets if the friend is a user's favorite or important contact.
- Parameters:
isStarred- true if the friend is to be considered as important, false
otherwise.
-
isSubscribesEnabled
boolean isSubscribesEnabled()get subscription flag value
- Returns:
- returns true is subscription is activated for this friend
-
setSubscribesEnabled
int setSubscribesEnabled(boolean enable) - Parameters:
enable- if true this friend will receive subscription message- Returns:
- 0
-
getSubscriptionState
SubscriptionState getSubscriptionState()Get subscription state of a friend.
- Returns:
- the
SubscriptionStateenum
-
getVcard
Returns the vCard object associated to this friend, if any.
- Returns:
- the
Vcardor null.
-
setVcard
Binds a vCard object to a friend.
- Parameters:
vcard- TheVcardobject to bind
-
addAddress
Adds an address in this friend.
- Parameters:
address-Addressobject
-
addPhoneNumber
Adds a phone number in this friend.
- Parameters:
phoneNumber- number to add
-
addPhoneNumberWithLabel
- Parameters:
phoneNumber- theFriendPhoneNumberto add
-
createVcard
Creates a vCard object associated to this friend if there isn't one yet and if
the full name is available, either by the parameter or the one in the friend's
SIP URI.
- Parameters:
name- The full name of the friend or null to use the one from the
friend's SIP URI- Returns:
- true if the vCard has been created, false if it wasn't possible (for
exemple if name and the friend's SIP URI are null or if the friend's SIP URI
doesn't have a display name), or if there is already one vcard
-
done
void done()Commits modification made to the friend configuration.
-
edit
void edit()Starts editing a friend configuration.
Because friend configuration must be consistent, applications MUST calledit()
before doing any attempts to modify friend configuration (such assetAddress(org.linphone.core.Address)
orsetIncSubscribePolicy(org.linphone.core.SubscribePolicy)). Once the modifications are done, then the
application must calldone()to commit the changes. -
getCapabilityVersion
Returns the version of a friend's capbility.
- Parameters:
capability-Friend.Capabilityobject- Returns:
- the version of a friend's capbility.
-
getDevicesForAddress
- Parameters:
address-Addressobject- Returns:
- A list of
FriendDevice.
-
getPresenceModelForUriOrTel
Get the presence model for a specific SIP URI or phone number of a friend.
- Parameters:
uriOrTel- The SIP URI or phone number for which to get the presence model
- Returns:
- A
PresenceModelobject, or null if the friend do not have
presence information for this SIP URI or phone number.
-
getSecurityLevelForAddress
Returns the security level of a friend for a given address which is the lowest
among all devices we know for that address.
- Parameters:
address-Addressobject- Returns:
- A
SecurityLevel, which is the lowest among all known devices
for that address.
-
hasCapability
Returns whether or not a friend has a capbility.
- Parameters:
capability-Friend.Capabilityobject- Returns:
- whether or not a friend has a capbility
-
hasCapabilityWithVersion
Returns whether or not a friend has a capbility with a given version.
- Parameters:
capability-Friend.Capabilityobjectversion- the version to test- Returns:
- whether or not a friend has a capbility with a given version or -1.0 if
friend has not capability.
-
hasCapabilityWithVersionOrMore
Returns whether or not a friend has a capbility with a given version or more.
- Parameters:
capability-Friend.Capabilityobjectversion- the version to test- Returns:
- whether or not a friend has a capbility with a given version or more.
-
hasPhoneNumber
Returns whether a friend contains the given phone number.
- Parameters:
phoneNumber- the phone number to search for- Returns:
- true if found, false otherwise
-
inList
boolean inList()Check that the given friend is in a friend list.
- Returns:
- true if the friend is in a friend list, false otherwise.
-
remove
void remove()Removes a friend from it's friend list and from the rc if exists.
-
removeAddress
Removes an address in this friend.
- Parameters:
address-Addressobject
-
removePhoneNumber
Removes a phone number in this friend.
- Parameters:
phoneNumber- number to remove
-
removePhoneNumberWithLabel
- Parameters:
phoneNumber- theFriendPhoneNumberto remove
-
save
Saves a friend either in database if configured, otherwise in linphonerc.
- Parameters:
core- the linphone core
-
setPresenceModelForUriOrTel
Set the presence model for a specific SIP URI or phone number of a friend.
- Parameters:
uriOrTel- The SIP URI or phone number for which to set the presence model
presence- ThePresenceModelobject to set
-
addListener
-
removeListener
-
setUserData
Sets the object to store in this object user's data- Parameters:
data- the object to store
-
getUserData
Object getUserData()Gets the object stored in this object user's data- Returns:
- the object store if any, null otherwise
-
getNativePointer
long getNativePointer()Gets the native pointer used by this class to make native method calls.- Returns:
- the nativer pointer, as long
-
toString
String toString()
-