com.skype.api
Class Account

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

public class Account
extends SkypeObject

Represents a local account. Encapsulates methods for Skype account creation, login and logout as well as account profile setting properties. NB! Unlike all the other SkypeKit classes, most of the Account class properties are actually read-write. In fact, there are two sorts of Account's read-write properties: server-side properties and local properties. Different setter methods need to be used for those two kinds.

The subset of server-side properties consists of all the policy properties (everything with _POLICY suffix) that are all of type int and can be set with SetServersideIntProperty method. There is currently only one server-side string property - OFFLINE_CALLFORWARD which can be set with SetServersideStrProperty setter.

The set of writeable account profile properties (local profile) is as follows;
- P_FULLNAME,
- P_BIRTHDAY,
- P_GENDER,
- P_LANGUAGES,
- P_COUNTRY,
- P_PROVINCE,
- P_CITY,
- P_PHONE_HOME,
- P_PHONE_OFFICE,
- P_PHONE_MOBILE,
- P_EMAILS,
- P_HOMEPAGE,
- P_ABOUT,
- P_MOOD_TEXT,
- P_TIMEZONE,
- P_AVATAR_IMAGE,
- P_RICH_MOOD_TEXT

These can be set with SetIntProperty, SetStrProperty and SetBinProperty setter methods. Note that there are special methods for changing account online status (availability) and enabling/disabling auto-login - SetAvailability and SetSavePwd.

Note that to set Account properties, you that Account needs to be logged in. Generally, assumption is that the first thing you do with an Account object after you retrieve it with Skype.GetAccount is login, with exception of creating a new account.

The Account class has no default constructor and creating an Account instance is not the same as creating a Skype account. To create a Skype account:

- obtain an Account instance by invoking Skype.GetAccount. This automatically sets P_SKYPENAME.
- set any additional profile-related properties. Skype recommends that you minimally set the following:
- their email address so that they can retrieve a lost password (P_EMAILS)
- the user's full name (P_FULLNAME)
- at least one phone number (P_PHONE_HOME, P_PHONE_HOME, P_PHONE_OFFICE)
- invoke Account.Register to actually create the account


Nested Class Summary
static interface Account.AccountListener
           
static class Account.AVATARPOLICY
          Recognized values for the P_AVATAR_POLICY property that controls whether remote contacts can view local account's avatar image.
static class Account.BUDDYCOUNTPOLICY
          Recognized values for the P_BUDDYCOUNT_POLICY property that controls whether the number of this user's authorized contacts is visible to other users, either through Account.GetPropNrofAuthedBuddies or Contact.GetPropNrofAuthedBuddies when those instances reference this user.
static class Account.CAPABILITYSTATUS
          Account capabability statuses are possible values of Contact class CAPABILITY enumerator, when that enumerator is used in context of account.
static class Account.CBLSYNCSTATUS
          Recognized values for the P_CBLSYNCSTATUS property.
static class Account.CHATPOLICY
          Recognized values for the P_CHAT_POLICY property that controls whether non-authorized users can initiate text chat with the currently logged in account.
static class Account.COMMITSTATUS
          The list of possible values of Account class COMMITSTATUS property.
 class Account.GetCapabilityStatusResult
           
 class Account.GetStatusWithProgressResult
           
static class Account.LOGOUTREASON
          Recognized values for the Account.P_LOGOUTREASON.
static class Account.PHONENUMBERSPOLICY
          Recognized values for the P_PHONENUMBERSPOLICY property that controls whether unauthorized remote users can see associated phone numbers in their UI (for reference, see the different phone number tabs in Windows desktop Client contact view).
static class Account.PROPERTY
          Properties of the Account class
static class Account.PSTNCALLPOLICY
          Recognized values for the P_PSTNCALLPOLICY property that controls whether (and from whom) this account accepts incoming PSTN calls.
static class Account.PWDCHANGESTATUS
          Recognized values for the P_PWDCHANGESTATUS property that provides information on whether a password change succeeded or failed, giving detailed failure reason.
static class Account.SKYPECALLPOLICY
          Recognized values for the P_SKYPECALLPOLICY property that controls acceptance of incoming Skype calls.
static class Account.STATUS
           
static class Account.TIMEZONEPOLICY
          Recognized values for the P_TIMEZONEPOLICY property that sets the rules for timezone offset so remote clients can determine your local time.
static class Account.VOICEMAILPOLICY
          Recognized values for the P_VOICEMAILPOLICY property that controls acceptance of incoming voicemail messages.
static class Account.WEBPRESENCEPOLICY
          Recognized values for the P_WEBPRESENCEPOLICY property that controls whether your online status (presence) can be seen using the "Skype buttons" ( http://www.skype.com/share/buttons/ ) embedded in web pages.
 
Field Summary
 
Fields inherited from class com.skype.api.SkypeObject
mObjectId, mPropCache, skype
 
Constructor Summary
Account(int oid, Skype skype)
           
 
Method Summary
 void CancelServerCommit()
          Cancels an attempt to commit a server-side P_XXX_POLICY or the P_OFFLINE_CALLFORWARD server-side property.
 void ChangePassword(java.lang.String oldPassword, java.lang.String newPassword, boolean savePwd)
          Changes this account's password.
 void Delete()
          Deletes all account data stored locally.
 byte[] GetBinProperty(Account.PROPERTY prop)
           
 boolean GetBooleanProperty(Account.PROPERTY prop)
           
 Account.GetCapabilityStatusResult GetCapabilityStatus(Contact.CAPABILITY capability)
          Returns state of a given account capability.
 int GetIntProperty(Account.PROPERTY prop)
           
 java.lang.Object GetPropertyAsEnum(int propid)
           
 java.lang.String GetSkypenameHash()
          Response is empty when called with an inactive or invalid account
 Account.GetStatusWithProgressResult GetStatusWithProgress()
          This is a legacy method.
 java.lang.String GetStrProperty(Account.PROPERTY prop)
           
 java.lang.String GetVerifiedCompany()
          returns verified-by-Skype company for this account if exists and verifiable
 java.lang.String GetVerifiedEmail()
          returns verified-by-Skype e-mail for this account if exists and verifiable
 void Login(Contact.AVAILABILITY setAvailabilityTo)
          Login an auto-login enabled account (P_STATUS is LOGGED_OUT_AND_PWD_SAVED) and optionally set the availability, for example login in as Contact.DO_NOT_DISTURB.
 void LoginWithPassword(java.lang.String password, boolean savePwd, boolean saveDataLocally)
          
Login in an account by specifying its password.
 void Logout(boolean clearSavedPwd)
          Logs out current account.
static int moduleID()
           
 void Register(java.lang.String password, boolean savePwd, boolean saveDataLocally, java.lang.String email, boolean allowSpam)
          This command can be used to create a new Skype account, based on the Account object.
 void SetAvailability(Contact.AVAILABILITY availability)
          Sets online status of the currently logged in account to one of the values from Contact class AVAILABILITY enumerator.
 void SetBinProperty(int propKey, byte[] value)
          Setter for BLOB properties, such as its avatar image.
 void SetIntProperty(int propKey, int value)
          Setter for integer properties.
 void SetPasswordSaved(boolean savePwd)
          save or clear credentials for auto-login whilst already logged in
 void SetServersideIntProperty(int propKey, int value)
          Setter for integer (and enum) server-side properties.
 void SetServersideStrProperty(int propKey, java.lang.String value)
          Setter for String server-side properties.
 void SetStandby(boolean standby)
          Transitions the availability of this account's associated user, who is assumed to be logged in.
 void SetStrProperty(int propKey, java.lang.String value)
          Setter for String properties.
 
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

Account

public Account(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(Account.PROPERTY prop)

GetIntProperty

public int GetIntProperty(Account.PROPERTY prop)

GetBooleanProperty

public boolean GetBooleanProperty(Account.PROPERTY prop)

GetBinProperty

public byte[] GetBinProperty(Account.PROPERTY prop)

GetStatusWithProgress

public Account.GetStatusWithProgressResult GetStatusWithProgress()
This is a legacy method. The progress argument does not return overall login progress. Instead, it used to return database mount or conversion progress in case of logging in with a newer client on an older database version. Currently, the progress value should always return 0 under normal circumstances. There is currently no functionality in the SkypeKit API to accurately guess how long the login will take, as the P2P connect times are unpredictable. The maximum progress granularity available through SkypeKit API is currently the Account.P_STATUS property values.

Returns:
GetStatusWithProgressResult

Login

public void Login(Contact.AVAILABILITY setAvailabilityTo)
Login an auto-login enabled account (P_STATUS is LOGGED_OUT_AND_PWD_SAVED) and optionally set the availability, for example login in as Contact.DO_NOT_DISTURB. To find out whether there is an auto-login enabled account available, you can use Skype.GetDefaultAccountName to retrieve the skypename of that account. You can then get an Account instance for login by invoking Skype.GetAccount.

If no accounts with stored login credentials are available (GetDefaultAccountName returns an empty string), then you will have to prompt the user for account name and password and then use LoginWithPassword. Account name field in the UI can be pre-populated with strings retrieved with Skype.GetExistingAccounts

Parameters:
setAvailabilityTo - force this account's initial online status to the specified Contact.AVAILABILITY value.

LoginWithPassword

public void LoginWithPassword(java.lang.String password,
                              boolean savePwd,
                              boolean saveDataLocally)

Login in an account by specifying its password. To retrieve an account instance for login, invoke Skype.GetAccount.

Parameters:
password - Password string (plaintext) for this account, which should be pre-validated (Skype.ValidatePassword)
savePwd -
- true: Saves the password, ensuring that auto-login is enabled.
- false (default): Does not save the password, and so the user might not be able to effect auto-login until they explicitly invoke Account.SetPasswordSaved(true).
saveDataLocally - For internal use only.

Register

public void Register(java.lang.String password,
                     boolean savePwd,
                     boolean saveDataLocally,
                     java.lang.String email,
                     boolean allowSpam)
This command can be used to create a new Skype account, based on the Account object. When successful, this command will also log in with the newly created account. If the new account registration was not successful, Account status property will change to LOGGED_OUT. A common reason for registration failures is that the an account with that name already exists. In that case, Account LOGOUT_REASON will be set to SKYPENAME_TAKEN. Also, Account SUGGESTED_SKYPENAME property will be set to a list of similar but still available skypenames that could be used instead. The property will contain up to 5 semicolon-separated alternative skypenames. In if no suggested skypenames were available, then this property will contain an empty string.
NB! You should pre-validate your P_SKYPENAME value and any email string (Skype.ValidateProfileString) prior to invoking this method.

Parameters:
password - Password string (plaintext) for this account, which should be pre-validated (Skype.ValidatePassword)
savePwd -
- true: Saves the password and enables auto-login.
- false (default): Does not save the password, and the user needs to be prompted for password on the next login attempt.
saveDataLocally - For internal use only.
email - An email address for retrieving lost passwords and receiving news and information from Skype.
allowSpam - enable/disable news and information from Skype being sent to account's e-mail.

Logout

public void Logout(boolean clearSavedPwd)
Logs out current account. Note that calling this on client application exit is optional.

Parameters:
clearSavedPwd -
- true: Clears any saved password use with auto-login and so disables auto-login until you explicitly invoke Account.SetPasswordSaved(true).
- false (default): Does not clear any saved password and so does not affect existing auto-login behavior.

ChangePassword

public void ChangePassword(java.lang.String oldPassword,
                           java.lang.String newPassword,
                           boolean savePwd)
Changes this account's password. Returns false if the change failed. NB! You should pre-validate your password strings (Skype.ValidatePassword) and ensure that they are different prior to invoking this method.

Parameters:
oldPassword - "Current password string (plaintext) for this account
newPassword - New password string (plaintext) for this account
savePwd -
- true: Saves the new password and enables auto-login.
- false (default): Clears any existing saved password and so the user cannot effect auto-login until they explicitly invoke Account.SetPasswordSaved(true)

SetPasswordSaved

public void SetPasswordSaved(boolean savePwd)
save or clear credentials for auto-login whilst already logged in

Parameters:
savePwd -

SetServersideIntProperty

public void SetServersideIntProperty(int propKey,
                                     int value)
Setter for integer (and enum) server-side properties. For a list of writeable server-side properties, see the detailed description of the Account class.

Parameters:
propKey -
value -

SetServersideStrProperty

public void SetServersideStrProperty(int propKey,
                                     java.lang.String value)
Setter for String server-side properties. For a list of writeable server-side properties, see the detailed description of the Account class.

Parameters:
propKey -
value -

CancelServerCommit

public void CancelServerCommit()
Cancels an attempt to commit a server-side P_XXX_POLICY or the P_OFFLINE_CALLFORWARD server-side property. Invoking this cancellation only makes sense whilst the P_COMMITTSTATUS is in COMMITTING_TO_SERVER state.


SetIntProperty

public void SetIntProperty(int propKey,
                           int value)
Setter for integer properties. For a list of writeable account profile properties, see the detailed description of the Account class.

Parameters:
propKey -
value -

SetStrProperty

public void SetStrProperty(int propKey,
                           java.lang.String value)
Setter for String properties. For a list of writeable account profile properties, see the detailed description of the Account class. NB! You should pre-validate your about and mood message strings (Skype.ValidateProfileString) prior to invoking this method.

Parameters:
propKey -
value -

SetBinProperty

public void SetBinProperty(int propKey,
                           byte[] value)
Setter for BLOB properties, such as its avatar image. For a list of writeable account profile properties, see the detailed description of the Account class. NB! You should pre-validate your avatar image (Skype.ValidateAvatar) prior to invoking this method.

Parameters:
propKey -
value -

SetAvailability

public void SetAvailability(Contact.AVAILABILITY availability)
Sets online status of the currently logged in account to one of the values from Contact class AVAILABILITY enumerator.

Parameters:
availability - only subset of all contact availabilities allowed

SetStandby

public void SetStandby(boolean standby)
Transitions the availability of this account's associated user, who is assumed to be logged in.

Parameters:
standby -
- true: Saves the user's current availability, then sets it to CONTACT.AVAILABILITY.OFFLINE
- false: Reconnects the user and restores their previous availability

GetCapabilityStatus

public Account.GetCapabilityStatusResult GetCapabilityStatus(Contact.CAPABILITY capability)
Returns state of a given account capability. Takes Contact class CAPABILITY property as input argument and returns its state and expiration timestamp where appropriate. For example (C++ wrapper, with other wrappers the syntax may vary but the idea is the same) MyAccount.GetCapabilityStatus(Contact.CAPABILITY_SKYPEOUT, Cap, T); will return Account.CAPABILITY_EXISTS if local account has SkypeOut enabled.

Parameters:
capability -
Returns:
GetCapabilityStatusResult

GetSkypenameHash

public java.lang.String GetSkypenameHash()
Response is empty when called with an inactive or invalid account

Returns:
skypenameHash

GetVerifiedEmail

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

Returns:
email

GetVerifiedCompany

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

Returns:
company

Delete

public void Delete()
Deletes all account data stored locally. Does not remove any account data from the server!



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