📄 user.java
字号:
}
/**
* Return the country the User is based.
* @return String with country.
* @throws SkypeException when connection to Skype client has gone bad.
*/
public final String getCountry() throws SkypeException {
return getProperty("COUNTRY");
}
/**
* Return the province the user is based.
* @return String with the province the user is based.
* @throws SkypeException when connection to Skype client has gone bad.
*/
public final String getProvince() throws SkypeException {
return getProperty("PROVINCE");
}
/**
* Return the city this User is based in.
* @return String with the city name the User is based in.
* @throws SkypeException when connection to Skype client has gone bad.
*/
public final String getCity() throws SkypeException {
return getProperty("CITY");
}
/**
* Return the home phone number that is in the User profile.
* @return String with Home phone number.
* @throws SkypeException when connection to Skype client has gone bad.
*/
public final String getHomePhone() throws SkypeException {
return getProperty("PHONE_HOME");
}
/**
* Return the office phone number that is in the User profile.
* @return String with office phone number.
* @throws SkypeException when connection to Skype client has gone bad.
*/
public final String getOfficePhone() throws SkypeException {
return getProperty("PHONE_OFFICE");
}
/**
* Return the mobile phone number of this User.
* @return String with mobile phone number.
* @throws SkypeException when connection to Skype client has gone bad.
*/
public final String getMobilePhone() throws SkypeException {
return getProperty("PHONE_MOBILE");
}
/**
* Return the homepage URL of this User.
* @return String with URL of homepage.
* @throws SkypeException when connection to Skype client has gone bad.
*/
public final String getHomePageAddress() throws SkypeException {
return getProperty("HOMEPAGE");
}
/**
* Return extra information User has provided in his/her profile.
* @return STring with extra info.
* @throws SkypeException when connection to Skype client has gone bad.
*/
public final String getAbout() throws SkypeException {
return getProperty("ABOUT");
}
/**
* Return the mood message of this user.
* @return the mood message of this user.
* @throws SkypeException when connection to Skype client has gone bad.
*/
public String getMoodMessage() throws SkypeException {
return getProperty("MOOD_TEXT");
}
/**
* Return the displayname of this User.
* @return String with displayname.
* @throws SkypeException when connection to Skype client has gone bad.
*/
public final String getDisplayName() throws SkypeException {
return getProperty("DISPLAYNAME");
}
/**
* Check if this User has a Skype client that can do video chats.
* @return true if User can do videochats.
* @throws SkypeException when connection to Skype client has gone bad.
*/
public final boolean isVideoCapable() throws SkypeException {
return Boolean.parseBoolean(getProperty("IS_VIDEO_CAPABLE"));
}
/**
* Check if this User is authorized in your contactlist.
* @return true if User is authorized.
* @throws SkypeException when connection to Skype client has gone bad.
*/
public final boolean isAuthorized() throws SkypeException {
return Boolean.parseBoolean(getProperty("ISAUTHORIZED"));
}
/**
* Set the authorization of this user.
* @param authorized TRUE will authorize the user.
* @throws SkypeException when connection to Skype client has gone bad.
*/
public final void setAuthorized(boolean authorized) throws SkypeException {
if (authorized) {
getProperty("ISAUTHORIZED TRUE");
} else {
getProperty("ISAUTHORIZED FALSE");
}
}
/**
* Method used by other methods to retrieve a property value from Skype client.
* @param name name of the property.
* @return value of the property.
* @throws SkypeException when connection to Skype client has gone bad.
*/
private String getProperty(String name) throws SkypeException {
return Utils.getProperty("USER", getId(), name);
}
/**
* Start a call to this User.
* @return new Call object.
* @throws SkypeException when connection to Skype client has gone bad.
*/
public final Call call() throws SkypeException {
return Skype.call(getId());
}
/**
* Start a chat to this User.
* @return new Chat object.
* @throws SkypeException when connection to Skype client has gone bad.
*/
public final Chat chat() throws SkypeException {
return Skype.chat(getId());
}
/**
* Send this User a chatMessage.
* @param message The message to send.
* @return the new chatMessage object.
* @throws SkypeException when connection to Skype client has gone bad.
*/
public final ChatMessage send(String message) throws SkypeException {
return Skype.chat(getId()).send(message);
}
/**
* Leave a voicemail for this User.
* @return new VoiceMail object.
* @throws SkypeException when connection to Skype client has gone bad.
*/
public final VoiceMail voiceMail() throws SkypeException {
return Skype.voiceMail(getId());
}
/**
* Set a displayname for this User.
* @param displayName the new name to set.
* @throws SkypeException when connection to Skype client has gone bad.
*/
public final void setDisplayName(String displayName) throws SkypeException {
Utils.setProperty("USER", getId(), "DISPLAYNAME", displayName);
}
/**
* Search for all chatMessages to and from this User.
* @return array of Chatmessages found.
* @throws SkypeException when connection to Skype client has gone bad.
*/
public final ChatMessage[] getAllChatMessages() throws SkypeException {
String[] ids = getHistory("CHATMESSAGES");
ChatMessage[] messages = new ChatMessage[ids.length];
for (int i = 0; i < ids.length; i++) {
messages[i] = ChatMessage.getInstance(ids[i]);
}
List<ChatMessage> messageList = Arrays.asList(messages);
Collections.reverse(messageList);
return messageList.toArray(new ChatMessage[0]);
}
/**
* Search all calls to and from this User.
* @return an array of found calls.
* @throws SkypeException when connection to Skype client has gone bad.
*/
public final Call[] getAllCalls() throws SkypeException {
String[] ids = getHistory("CALLS");
Call[] calls = new Call[ids.length];
for (int i = 0; i < ids.length; i++) {
calls[i] = Call.getInstance(ids[i]);
}
return calls;
}
/**
* Search the history with this user.
* @param type Specify which history to search for.
* @return an String array with found events.
* @throws SkypeException when connection to Skype client has gone bad.
*/
private String[] getHistory(String type) throws SkypeException {
try {
String responseHeader = type + " ";
String response = Connector.getInstance().execute("SEARCH " + type + " " + getId(), responseHeader);
Utils.checkError(response);
String data = response.substring(responseHeader.length());
return Utils.convertToArray(data);
} catch (ConnectorException e) {
Utils.convertToSkypeException(e);
return null;
}
}
/**
* Remove this User from the list of watchable Users.
*/
final void dispose() {
users.remove(getId());
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -