com.skype.api
Class Contact

java.lang.Object
  extended by com.skype.api.SkypeObject
      extended by com.skype.api.Contact

public class Contact
extends SkypeObject

Address book entry. Encapsulates methods like GetIdentity, GetAvatar, SendAuthRequest, OpenConversation etc. Single contact can have additional phone numbers attached to it (ASSIGNED_PHONE1 .. ASSIGNED_PHONE3). Note that in the context of a conversation, Contacts are represented by Participant objects. Contact member functions all return a Boolean indicating the success (true) or failure (false) of processing the request itself (transport, runtime availability, and so forth)?not the success or failure of its associated functionality. For example, Contact.IsMemberOf returns true if it was able to make a determination, and its result parameter reflects whether this Contact is a member of the target group. Similarly, Contact.IsMemberOf returns false if it was unable to make a determination, and the value of its result parameter is undefined.


Nested Class Summary
static class Contact.AUTHLEVEL
          Describes the recognized relational states between a local account and a remote contact.
static class Contact.AVAILABILITY
          Describes the superset list of possible Account and Contact online statuses.
static class Contact.CAPABILITY
          This enumerator is used by both Contact and Account objects.
static class Contact.CAPABILITYSTATUS
          List of possible states of each of the Contact class CAPABILITY items.
static interface Contact.ContactListener
           
static class Contact.EXTRA_AUTHREQ_FIELDS
           
 class Contact.GetAvatarResult
           
static class Contact.PROPERTY
          Properties of the Contact class
static class Contact.TYPE
          Same as with CAPABILITY, enumerator is used by both Contact and Account objects.
 
Field Summary
 
Fields inherited from class com.skype.api.SkypeObject
mObjectId, mPropCache, skype
 
Constructor Summary
Contact(int oid, Skype skype)
           
 
Method Summary
 Contact.GetAvatarResult GetAvatar()
          Returns Conrtact's avatar image (JPG).
 byte[] GetBinProperty(Contact.PROPERTY prop)
           
 boolean GetBooleanProperty(Contact.PROPERTY prop)
           
 Contact.CAPABILITYSTATUS GetCapabilityStatus(Contact.CAPABILITY capability, boolean queryServer)
          Retrieves a Contact.Capability value.
 java.lang.String GetIdentity()
           
 int GetIntProperty(Contact.PROPERTY prop)
           
 java.lang.Object GetPropertyAsEnum(int propid)
           
 java.lang.String GetStrProperty(Contact.PROPERTY prop)
           
 java.lang.String GetVerifiedCompany()
          returns verified-by-Skype company for this contact if exists and verifiable
 java.lang.String GetVerifiedEmail()
          returns verified-by-Skype e-mail for this contact if exists and verifiable
 void GiveDisplayName(java.lang.String name)
          sets CONTACT_GIVEN_DISPLAYNAME.
 boolean HasAuthorizedMe()
          the contact has accepted my auth request
 boolean HasCapability(Contact.CAPABILITY capability, boolean queryServer)
          Retrieves a Contact.Capability value.
 void IgnoreAuthRequest()
          Rejects and removes a pending authorization request from this Contact.
 boolean IsMemberOf(ContactGroup group)
          Checks whether the contact is member of a contact group given in group reference argument.
 boolean IsMemberOfHardwiredGroup(ContactGroup.TYPE groupType)
          Checks whether the contact is member of a pre-defined contact group given in the TYPE argument (type for this property comes from the ContactGroup class).
static int moduleID()
           
 Conversation OpenConversation()
          Retrieves a dialog conversation with the Contact.
 void RefreshProfile()
          Refreshes all properties, capabilities, and statuses associated with this Contact from p2p/CBL, and sets P_REFRESHING to true for the duration.
 void SendAuthRequest(java.lang.String message, int extras_bitmask)
          Sends a contact authorization request to this user.
 void SetBlocked(boolean blocked, boolean abuse)
          Blocks or unblocks any further incoming communication attempts from this contact.
 void SetBuddyStatus(boolean isMyBuddy, boolean syncAuth)
          Adds or removes this Contact from the ALL_BUDDIES hardwired group.
 void SetPhoneNumber(int num, java.lang.String label, java.lang.String number)
          Sets the three P_ASSIGNED_PHONEx and P_ASSIGNED_PHONEx_LABEL properties, where x reflects the value of num.
 
Methods inherited from class com.skype.api.SkypeObject
close, getOid
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Contact

public Contact(int oid,
               Skype skype)
Method Detail

moduleID

public static final int moduleID()

GetPropertyAsEnum

public java.lang.Object GetPropertyAsEnum(int propid)
Specified by:
GetPropertyAsEnum in class SkypeObject

GetStrProperty

public java.lang.String GetStrProperty(Contact.PROPERTY prop)

GetIntProperty

public int GetIntProperty(Contact.PROPERTY prop)

GetBooleanProperty

public boolean GetBooleanProperty(Contact.PROPERTY prop)

GetBinProperty

public byte[] GetBinProperty(Contact.PROPERTY prop)

GetIdentity

public java.lang.String GetIdentity()
Returns:
identity returns CONTACT_SKYPENAME or CONTACT_PSTNNUMBER value

GetAvatar

public Contact.GetAvatarResult GetAvatar()
Returns Conrtact's avatar image (JPG).

Returns:
GetAvatarResult

GetVerifiedEmail

public java.lang.String GetVerifiedEmail()
returns verified-by-Skype e-mail for this contact if exists and verifiable

Returns:
email

GetVerifiedCompany

public java.lang.String GetVerifiedCompany()
returns verified-by-Skype company for this contact if exists and verifiable

Returns:
company

IsMemberOf

public boolean IsMemberOf(ContactGroup group)
Checks whether the contact is member of a contact group given in group reference argument.

Parameters:
group - The target contact group
Returns:
result
- true: the Contact is a member of the target contact group
- false: the Contact is not a member of the target contact group

IsMemberOfHardwiredGroup

public boolean IsMemberOfHardwiredGroup(ContactGroup.TYPE groupType)
Checks whether the contact is member of a pre-defined contact group given in the TYPE argument (type for this property comes from the ContactGroup class).

Parameters:
groupType - The type designator of the target pre-defined contact group. For example, specify this parameter as ContactGroup.TYPE.RECENTLY_CONTACTED_CONTACTS to determine if you've had a recent conversation with this Contact.
Returns:
result
- true: the Contact is a member of the target contact group
- false: the Contact is not a member of the target contact group

SetBlocked

public void SetBlocked(boolean blocked,
                       boolean abuse)
Blocks or unblocks any further incoming communication attempts from this contact.

Parameters:
blocked -
- true: block this contact
- false: unblock this contact
abuse - Optional parameter to report abuse by this Skype user when blocking this Contact. Note that you can specifiy this parameter as true only when blocking a Contact. Defaults to false if omitted.

IgnoreAuthRequest

public void IgnoreAuthRequest()
Rejects and removes a pending authorization request from this Contact.


GiveDisplayName

public void GiveDisplayName(java.lang.String name)
sets CONTACT_GIVEN_DISPLAYNAME. clears if size(name)==0

Parameters:
name -

SetBuddyStatus

public void SetBuddyStatus(boolean isMyBuddy,
                           boolean syncAuth)
Adds or removes this Contact from the ALL_BUDDIES hardwired group.

Parameters:
isMyBuddy -
- true: add this contact to the ALL_BUDDIES group
- false: delete contact from the ALL_BUDDIES group
syncAuth - This argument is deprecated and should not be used.

SendAuthRequest

public void SendAuthRequest(java.lang.String message,
                            int extras_bitmask)
Sends a contact authorization request to this user.

Parameters:
message - Text that typically introduces the requesting user and details the reason for the authorization request. This text will be set as Message.P_BODY_XML property of the notification Message the remote user will receive upon getting the authortization request. While this can be the empty string, it cannot be null.
extras_bitmask - Indicates additional information to include with this authorization request:
- 0 (zero): do not include any additional information
- SEND_VERIFIED_EMAIL: include the requestor's verified e-mail address
- SEND_VERIFIED_COMPANY: include verified information regarding the requestor's company
- SEND_VERIFIED_EMAIL + SEND_VERIFIED_COMPANY: include both e-mail and company information

HasAuthorizedMe

public boolean HasAuthorizedMe()
the contact has accepted my auth request

Returns:
result

SetPhoneNumber

public void SetPhoneNumber(int num,
                           java.lang.String label,
                           java.lang.String number)
Sets the three P_ASSIGNED_PHONEx and P_ASSIGNED_PHONEx_LABEL properties, where x reflects the value of num.

The Skype Windows desktop client uses the following conventions when interpreting and assigning values to these properties. While your solution can assign arbitrary values to these properties, we strongly recommend using these conventions to ensure interoperability with the Skype Windows desktop client. Keep in mind that the "number" of these property pairs has no relationship to how the Skype Windows client interprets their label property value strings. For example, the Skype Windows client will interpret P_ASSIGNED_PHONE3_LABEL as "Home" if its value is the string "0".

Label strings:

Populate the label properties with string representations of the numbers "0" through "3", rather than descriptive strings like "Home", "Mobile", and so forth. The Skype desktop clients interpret the numeric string values as:
- "0" (zero) - "Home"
- "1" (one) - "Office"
- "2" - "Mobile"
- "3" - "Other"

Keep in mind that the "number" of a property pair has no relationship to its label string. For example, the Skype Windows client will interpret P_ASSIGNED_PHONE3_LABEL as "Home" if its value is the string "0".

Phone number strings:

The Skype Windows desktop client has distinct conventions for Skype Contacts and PSTN (SkypeOut) Contacts: any or all of the property pairs can be used for Skype Contacts; P_ASSIGNED_PHONE1 cannot be used for PSTN Contacts and P_ASSIGNED_PHONE1_LABEL has special meaning for PSTN Contacts.
Specifically, the Skype desktop clients use P_ASSIGNED_PHONE1_LABEL as the label for a PSTN Contact's primary number (regardless of whether it's home, mobile, or office), and use P_PSTNNUMBER to hold the actual number.

Parameters:
num - The property pair being set, which must be in the range 0..3
label - The label text for the property being set
number - The phone number for the property being set

OpenConversation

public Conversation OpenConversation()
Retrieves a dialog conversation with the Contact.

Returns:
conversation Retrieved dialog.

HasCapability

public boolean HasCapability(Contact.CAPABILITY capability,
                             boolean queryServer)
Retrieves a Contact.Capability value. Sets P_REFRESHING to true while querying from server. This method is functionally the same as Contact.GetCapabilityStatus except that it returns a bool value rather than Contact.CAPABILITYSTATUS

Parameters:
capability - The target capability
queryServer -
- true: obtains the data from the p2p network/server, and sets P_REFRESHING to true for the duration
- false: obtains the data from the local client
Returns:
result
- true: the Contact has the target capability through at least one of the Skype clients they have logged into. Corresponds to CAPABILITY_MIXED and CAPABILITY_EXISTS
- false: the Contact does not have the target capability. Corresponds to NO_CAPABILITY

GetCapabilityStatus

public Contact.CAPABILITYSTATUS GetCapabilityStatus(Contact.CAPABILITY capability,
                                                    boolean queryServer)
Retrieves a Contact.Capability value. Sets P_REFRESHING to true while querying from server.

Parameters:
capability - The target capability, see Contact.Capability enumerator.
queryServer -
- true: obtains the data from the p2p network/server, and sets P_REFRESHING to true for the duration
- false: obtains the data from the local client
Returns:
status Status of the target capability.

RefreshProfile

public void RefreshProfile()
Refreshes all properties, capabilities, and statuses associated with this Contact from p2p/CBL, and sets P_REFRESHING to true for the duration.



Copyright © 2010, 2011 Skype Technologies. All Rights Reserved.