📄 voicemail.java
字号:
}
}
}
/**
* Notifies the status changed event of all listeners.
* @param status the new status
*/
private void fireStatusChanged(final Status status) {
VoiceMailStatusChangedListener[] listeners = this.listeners.toArray(new VoiceMailStatusChangedListener[0]);
if (status == oldStatus) {
return;
}
oldStatus = status;
for (VoiceMailStatusChangedListener listener : listeners) {
try {
listener.statusChanged(status);
} catch (Throwable e) {
Utils.handleUncaughtException(e, exceptionHandler);
}
}
}
/**
* Returns the type of this VoiceMail object.
* @return call the type of this VoiceMail object
* @throws SkypeException if the connection is bad
*/
public Type getType() throws SkypeException {
// call Utils#getPropertyWithCommandId(String, String, String) to prevent new event notification
return Type.valueOf(Utils.getPropertyWithCommandId("VOICEMAIL", getId(), "TYPE"));
}
/**
* Returns the Skype user who is the partner in this voice mail.
* @return the partner Skype user
* @throws SkypeException if the connection is bad
*/
public User getPartner() throws SkypeException {
return User.getInstance(getPartnerId());
}
/**
* Returns the Skype ID who is the partner in this voice mail.
* @return the partner Skype user
* @throws SkypeException if the connection is bad
*/
public String getPartnerId() throws SkypeException {
return getProperty("PARTNER_HANDLE");
}
/**
* Returns the display name of the Skype user who is the partner in this voice mail.
* @return the diplay name of the partner Skype user
* @throws SkypeException if the connection is bad
*/
public String getPartnerDisplayName() throws SkypeException {
return getProperty("PARTNER_DISPNAME");
}
/**
* Returns the current status of this VoiceMail object.
* @return the current status of this VoiceMail object
* @throws SkypeException if connection is bad
*/
public Status getStatus() throws SkypeException {
// call Utils#getPropertyWithCommandId(String, String, String) to prevent new event notification
return Status.valueOf(Utils.getPropertyWithCommandId("VOICEMAIL", getId(), "STATUS"));
}
/**
* Returns the failure reason of this VoiceMail object.
* @return the failure reason of this VoiceMail object
* @throws SkypeException if connection is bad
*/
public FailureReason getFailureReason() throws SkypeException {
return FailureReason.valueOf(getProperty("FAILUREREASON"));
}
/**
* Returns the start time of this VoiceMail object.
* @return the start time of this VoiceMail object
* @throws SkypeException if connection is bad
*/
public Date getStartTime() throws SkypeException {
return Utils.parseUnixTime(getProperty("TIMESTAMP"));
}
/**
* Returns the duration of this VoiceMail object in seconds.
* @return the duration of this VoiceMail object
* @throws SkypeException if connection is bad
*/
public int getDuration() throws SkypeException {
return Integer.parseInt(getProperty("DURATION"));
}
/**
* Returns the maximum duration of this VoiceMail object in seconds allowed to leave to partner.
* @return the maximum duration of this VoiceMail object
* @throws SkypeException if connection is bad
*/
public int getAllowedDuration() throws SkypeException {
return Integer.parseInt(getProperty("ALLOWED_DURATION"));
}
/**
* Returns the property of this VoiceMail object spcified by the name.
* @param name the property name
* @return The value of the property
* @throws SkypeException if the connection is bad
*/
private String getProperty(final String name) throws SkypeException {
return Utils.getProperty("VOICEMAIL", getId(), name);
}
/**
* Starts the playback of this VoiceMail object.
* @throws SkypeException if the connection is bad
*/
public void startPlayback() throws SkypeException {
Utils.executeWithErrorCheck("ALTER VOICEMAIL " + getId() + " " + "STARTPLAYBACK");
}
/**
* Stops the playback of this VoiceMail object.
* @throws SkypeException if the connection is bad
*/
public void stopPlayback() throws SkypeException {
Utils.executeWithErrorCheck("ALTER VOICEMAIL " + getId() + " " + "STOPPLAYBACK");
}
/**
* Uploads the playback of this VoiceMail object.
* @throws SkypeException if the connection is bad
*/
public void upload() throws SkypeException {
Utils.executeWithErrorCheck("ALTER VOICEMAIL " + getId() + " " + "UPLOAD");
}
/**
* Downloads the playback of this VoiceMail object.
* @throws SkypeException if the connection is bad
*/
public void download() throws SkypeException {
Utils.executeWithErrorCheck("ALTER VOICEMAIL " + getId() + " " + "DOWNLOAD");
}
/**
* Starts the recording of this VoiceMail object.
* @throws SkypeException if the connection is bad
*/
public void startRecording() throws SkypeException {
Utils.executeWithErrorCheck("ALTER VOICEMAIL " + getId() + " " + "STARTRECORDING");
}
/**
* Stops the recording of this VoiceMail object.
* @throws SkypeException if the connection is bad
*/
public void stopRecording() throws SkypeException {
Utils.executeWithErrorCheck("ALTER VOICEMAIL " + getId() + " " + "STOPRECORDING");
}
/**
* Deletes this VoiceMail object.
* @throws SkypeException if the connection is bad
*/
public void dispose() throws SkypeException {
Utils.executeWithErrorCheck("ALTER VOICEMAIL " + getId() + " " + "DELETE");
}
/**
* Opens the Skype window and starts playing this VoiceMail object.
* @throws SkypeException if the connection is bad
*/
public void openAndStartPlayback() throws SkypeException {
Utils.executeWithErrorCheck("OPEN VOICEMAIL " + getId());
}
/**
* Waits for finishing.
* @throws IllegalStateException if the type is not outgoing
* @throws SkypeException if the connection is bad
*/
public void waitForFinishing() throws SkypeException {
if (getType() != Type.OUTGOING) {
throw new IllegalStateException("The type must be outgoing.");
}
final Object wait = new Object();
VoiceMailStatusChangedListener listener = new VoiceMailStatusChangedListener() {
public void statusChanged(Status status) throws SkypeException {
synchronized(wait) {
switch (status) {
case UPLOADED:
case UNKNOWN:
case FAILED:
wait.notify();
break;
}
}
}
};
synchronized(wait) {
switch (getStatus()) {
case UPLOADED:
case UNKNOWN:
case FAILED:
break;
default:
addVoiceMailStatusChangedListener(listener);
try {
wait.wait();
} catch(InterruptedException e) {
// do nothing
}
removeVoiceMailStatusChangedListener(listener);
break;
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -