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
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addAddress
(Address address) Adds an address in this friend.void
addListener
(FriendListener listener) void
addPhoneNumber
(String phoneNumber) Adds a phone number in this friend.void
addPhoneNumberWithLabel
(FriendPhoneNumber phoneNumber) Adds aFriendPhoneNumber
to this friend.boolean
createVcard
(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.void
done()
Commits modification made to the friend configuration.void
edit()
Starts editing a friend configuration.Get address of this friend.Address[]
Returns a list ofAddress
for this friend.int
Returns the capabilities associated to this friend.float
getCapabilityVersion
(Friend.Capability capability) Returns the version of a friend's capbility.Get the consolidated presence of a friend.getCore()
Returns theCore
object managing this friend, if any.Gets the contact's job title from it's vCard.getName()
Get the display name for this friend.long
Gets 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 ofFriendPhoneNumber
for 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.boolean
Gets 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.boolean
hasCapability
(Friend.Capability capability) Returns whether or not a friend has a capbility.boolean
hasCapabilityWithVersion
(Friend.Capability capability, float version) Returns whether or not a friend has a capbility with a given version.boolean
hasCapabilityWithVersionOrMore
(Friend.Capability capability, float version) Returns whether or not a friend has a capbility with a given version or more.boolean
hasPhoneNumber
(String phoneNumber) Returns whether a friend contains the given phone number.boolean
inList()
Check that the given friend is in a friend list.boolean
Tells whether we already received presence information for a friend.boolean
get subscription flag value
newFromVcard
(Vcard vcard) void
remove()
Removes a friend from it's friend list and from the rc if exists.void
removeAddress
(Address address) Removes an address in this friend.void
removeListener
(FriendListener listener) void
removePhoneNumber
(String phoneNumber) Removes a phone number in this friend.void
removePhoneNumberWithLabel
(FriendPhoneNumber phoneNumber) Removes aFriendPhoneNumber
from this friend.void
Saves a friend either in database if configured, otherwise in linphonerc.int
setAddress
(Address address) SetAddress
for this friend.int
setIncSubscribePolicy
(SubscribePolicy policy) Configure incoming subscription policy for this friend.void
setJobTitle
(String jobTitle) Sets the contact's job title.int
Set the display name for this friend.void
setNativeUri
(String nativeUri) Sets the contact's native URI.void
setOrganization
(String organization) Sets the contact's organization.void
Sets the contact's picture URI.void
setPresenceModel
(PresenceModel presence) Set the presence model of a friend.void
setPresenceModelForUriOrTel
(String uriOrTel, PresenceModel presence) Set the presence model for a specific SIP URI or phone number of a friend.void
Set the reference key of a friend.void
setStarred
(boolean isStarred) Sets if the friend is a user's favorite or important contact.int
setSubscribesEnabled
(boolean enable) ConfigureFriend
to subscribe to presence information.void
setUserData
(Object data) Sets the object to store in this object user's datavoid
Binds a vCard object to a friend.toString()
-
Method Details
-
getAddress
Get address of this friend.
note: theAddress
object returned is hold by the LinphoneFriend,
however calling several time this function may return different objects.- Returns:
- the
Address
.
-
setAddress
- Parameters:
address
- theAddress
to 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
ConsolidatedPresence
of the friend
-
getCore
- Returns:
- the
Core
object associated.
-
getIncSubscribePolicy
SubscribePolicy getIncSubscribePolicy()- Returns:
- the
SubscribePolicy
enum
-
setIncSubscribePolicy
Configure incoming subscription policy for this friend.
- Parameters:
policy
-SubscribePolicy
policy 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
PresenceModel
object, 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
- ThePresenceModel
object 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.
-
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
SubscriptionState
enum
-
getVcard
Returns the vCard object associated to this friend, if any.
- Returns:
- the
Vcard
or null.
-
setVcard
Binds a vCard object to a friend.
- Parameters:
vcard
- TheVcard
object to bind
-
addAddress
Adds an address in this friend.
- Parameters:
address
-Address
object
-
addPhoneNumber
Adds a phone number in this friend.
- Parameters:
phoneNumber
- number to add
-
addPhoneNumberWithLabel
- Parameters:
phoneNumber
- theFriendPhoneNumber
to 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.Capability
object- Returns:
- the version of a friend's capbility.
-
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
PresenceModel
object, or null if the friend do not have
presence information for this SIP URI or phone number.
-
hasCapability
Returns whether or not a friend has a capbility.
- Parameters:
capability
-Friend.Capability
object- 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.Capability
objectversion
- 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.Capability
objectversion
- 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
-Address
object
-
removePhoneNumber
Removes a phone number in this friend.
- Parameters:
phoneNumber
- number to remove
-
removePhoneNumberWithLabel
- Parameters:
phoneNumber
- theFriendPhoneNumber
to 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
- ThePresenceModel
object to set
-
newFromVcard
- Parameters:
vcard
- aVcard
object- Returns:
- a new
Friend
which has its vCard attribute initialized from the
given vCard. This can be get bygetVcard()
.
-
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()
-