⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 profile.java

📁 基于SKYPE API 控件的开发示例 JSkype is an JNI implementation which enables Java clients to use the Skyp API
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
        if (newValues == null) {
            newValues = new String[0];
        }
        setProperty("LANGUAGES", toSpaceSeparatedString(newValues));
    }

    /**
     * List a object in a space seperated String.
     * @param newValues objects to list.
     * @return String with whitespaces and objectnames.
     */
    private String toSpaceSeparatedString(Object[] newValues) {
        StringBuilder newValuesString = new StringBuilder();
        for (Object newValue : newValues) {
            newValuesString.append(newValue);
        }
        return newValuesString.toString();
    }

    /**
     * Gets the country of the current user by the ISO code.
     * @return the country of the current user by the ISO code.
     * @throws SkypeException when the connection has gone bad or an ERROR message is received.
     * @see #setCountryByISOCode(String)
     * @see <a href="http://en.wikipedia.org/wiki/ISO_3166-1">ISO 3166-1</a>
     */
    public String getCountryByISOCode() throws SkypeException {
        String value = getProperty("COUNTRY");
        return value.substring(0, value.indexOf(' '));
    }

    /**
     * Sets the country of the current user by the ISO code.
     * @param newValue the new country of the current user by the ISO code.
     * @throws SkypeException when the connection has gone bad or an ERROR message is received.
     * @see #getCountryByISOCode()
     * @see <a href="http://en.wikipedia.org/wiki/ISO_3166-1">ISO 3166-1</a>
     */
    public void setCountryByISOCode(String newValue) throws SkypeException {
        if (newValue == null) {
            newValue = "";
        }
        setProperty("COUNTRY", newValue + " " + getCountry());
    }

    /**
     * Gets the country of the current user.
     * @return the country of the current user.
     * @throws SkypeException when the connection has gone bad or an ERROR message is received.
     * @see #setCountry(String)
     */
    public String getCountry() throws SkypeException {
        String value = getProperty("COUNTRY");
        return value.substring(value.indexOf(' ') + 1);
    }

    /**
     * Sets the country of the current user.
     * @param newValue the new country of the current user.
     * @throws SkypeException when the connection has gone bad or an ERROR message is received.
     * @see #getCountry()
     */
    public void setCountry(String newValue) throws SkypeException {
        if (newValue == null) {
            newValue = "";
        }
        setProperty("COUNTRY", getCountryByISOCode() + " " + newValue);
    }

    /**
     * Gets the province of the current user.
     * @return the province of the current user.
     * @throws SkypeException when the connection has gone bad or an ERROR message is received.
     * @see #setProvince(String)
     */
    public String getProvince() throws SkypeException {
        return getProperty("PROVINCE");
    }

    /**
     * Sets the province of the current user.
     * @param newValue the new province of the current user.
     * @throws SkypeException when the connection has gone bad or an ERROR message is received.
     * @see #getProvince()
     */
    public void setProvince(String newValue) throws SkypeException {
        setProperty("PROVINCE", newValue);
    }

    /**
     * Gets the city of the current user.
     * @return the city of the current user.
     * @throws SkypeException when the connection has gone bad or an ERROR message is received.
     * @see #setCity(String)
     */
    public String getCity() throws SkypeException {
        return getProperty("CITY");
    }

    /**
     * Sets the city of the current user.
     * @param newValue the new city of the current user.
     * @throws SkypeException when the connection has gone bad or an ERROR message is received.
     * @see #getCity()
     */
    public void setCity(String newValue) throws SkypeException {
        setProperty("CITY", newValue);
    }

    /**
     * Gets the home phone number of the current user.
     * @return the home phone number of the current user.
     * @throws SkypeException when the connection has gone bad or an ERROR message is received.
     * @see #setHomePhoneNumber(String)
     */
    public String getHomePhoneNumber() throws SkypeException {
        return getProperty("PHONE_HOME");
    }

    /**
     * Sets the home phone number of the current user.
     * @param newValue the new home phone number of the current user.
     * @throws SkypeException when the connection has gone bad or an ERROR message is received.
     * @see #getHomePhoneNumber()
     */
    public void setHomePhoneNumber(String newValue) throws SkypeException {
        setProperty("PHONE_HOME", newValue);
    }

    /**
     * Gets the office phone number of the current user.
     * @return the office phone number of the current user.
     * @throws SkypeException when the connection has gone bad or an ERROR message is received.
     * @see #setOfficePhoneNumber(String)
     */
    public String getOfficePhoneNumber() throws SkypeException {
        return getProperty("PHONE_OFFICE");
    }

    /**
     * Sets the office phone number of the current user.
     * @param newValue the new office phone number of the current user.
     * @throws SkypeException when the connection has gone bad or an ERROR message is received.
     * @see #getOfficePhoneNumber()
     */
    public void setOfficePhoneNumber(String newValue) throws SkypeException {
        setProperty("PHONE_OFFICE", newValue);
    }

    /**
     * Gets the mobile phone number of the current user.
     * @return the mobile phone number of the current user.
     * @throws SkypeException when the connection has gone bad or an ERROR message is received.
     * @see #setMobilePhoneNumber(String)
     */
    public String getMobilePhoneNumber() throws SkypeException {
        return getProperty("PHONE_MOBILE");
    }

    /**
     * Sets the mobile phone number of the current user.
     * @param newValue the new mobile phone number of the current user.
     * @throws SkypeException when the connection has gone bad or an ERROR message is received.
     * @see #getMobilePhoneNumber()
     */
    public void setMobilePhoneNumber(String newValue) throws SkypeException {
        setProperty("PHONE_MOBILE", newValue);
    }

    /**
     * Gets the home page address of the current user.
     * @return the home page address of the current user.
     * @throws SkypeException when the connection has gone bad or an ERROR message is received.
     * @see #setHomePageAddress(String)
     */
    public String getHomePageAddress() throws SkypeException {
        return getProperty("HOMEPAGE");
    }

    /**
     * Sets the home page address of the current user.
     * @param newValue the new home page address of the current user.
     * @throws SkypeException when the connection has gone bad or an ERROR message is received.
     * @see #getHomePageAddress()
     */
    public void setHomePageAddress(String newValue) throws SkypeException {
        setProperty("HOMEPAGE", newValue);
    }

    /**
     * Gets the introduction of the current user.
     * @return the introduction of the current user.
     * @throws SkypeException when the connection has gone bad or an ERROR message is received.
     * @see #setIntroduction(String)
     */
    public String getIntroduction() throws SkypeException {
        return getProperty("ABOUT");
    }

    /**
     * Sets the introduction of the current user.
     * @param newValue the new introduction of the current user.
     * @throws SkypeException when the connection has gone bad or an ERROR message is received.
     * @see #getIntroduction()
     */
    public void setIntroduction(String newValue) throws SkypeException {
        setProperty("ABOUT", newValue);
    }

    /**
     * Gets the mood message of the current user.
     * @return the mood message of the current user.
     * @throws SkypeException when the connection has gone bad or an ERROR message is received.
     * @see #setMoodMessage(String)
     */
    public String getMoodMessage() throws SkypeException {
        return getProperty("MOOD_TEXT");
    }

    /**
     * Sets the mood message of the current user.
     * @param newValue the new mood message of the current user.
     * @throws SkypeException when the connection has gone bad or an ERROR message is received.
     * @see #getMoodMessage()
     */
    public void setMoodMessage(String newValue) throws SkypeException {
        setProperty("MOOD_TEXT", newValue);
    }

    /**
     * Gets the time zone of the current user.
     * @return the time zone of the current user.
     * @throws SkypeException when the connection has gone bad or an ERROR message is received.
     * @see #setTimeZone(int)
     */
    public int getTimeZone() throws SkypeException {
        return Integer.parseInt(getProperty("TIMEZONE"));
    }

    /**
     * Sets the time zone of the current user.
     * @param newValue the new time zone of the current user.
     * @throws SkypeException when the connection has gone bad or an ERROR message is received.
     * @see #getTimeZone()
     */
    public void setTimeZone(int newValue) throws SkypeException {
        setProperty("TIMEZONE", "" + newValue);
    }

    /**
     * Indicates whether the current user has a web camera.
     * @return <code>true</code> if the current user has a web camera; <code>false</code> otherwise.
     * @throws SkypeException when the connection has gone bad or an ERROR message is received.
     */
    public boolean isVideoCapable() throws SkypeException {
        return Boolean.parseBoolean(getProperty("IS_VIDEO_CAPABLE"));
    }

    /**
     * Gets the wait time in seconds before starting a call forwarding.
     * @return the wait time in seconds before starting a call forwarding.
     * @throws SkypeException when the connection has gone bad or an ERROR message is received.
     * @see #setWaitTimeBeforeCallForwarding(int)
     */
    public int getWaitTimeBeforeCallForwarding() throws SkypeException {
        return Integer.parseInt(getProperty("CALL_NOANSWER_TIMEOUT"));
    }

    /**
     * Sets the wait time in seconds before starting a call forwarding.
     * @param newValue the new wait time in seconds before starting a call forwarding.
     * @throws SkypeException when the connection has gone bad or an ERROR message is received.
     * @see #getWaitTimeBeforeCallForwarding()
     */
    public void setWaitTimeBeforeCallForwarding(int newValue) throws SkypeException {
        setProperty("CALL_NOANSWER_TIMEOUT", "" + newValue);
    }

    /**
     * Indicates whether the call forwarding function is on.
     * @return <code>true</code> if the call forwarding function is on; <code>false</code> otherwise.
     * @throws SkypeException when the connection has gone bad or an ERROR message is received.
     * @see #setCallForwarding(boolean)
     */
    public boolean isCallForwarding() throws SkypeException {
        return Boolean.parseBoolean(getProperty("CALL_APPLY_CF"));
    }

    /**
     * Starts or stops the call forwarding function.
     * @param on if <code>true</code>, starts the call forwarding function; otherwise, stops the call forwarding function
     * @throws SkypeException when the connection has gone bad or an ERROR message is received.
     * @see #isCallForwarding()
     */
    public void setCallForwarding(boolean on) throws SkypeException {
        setProperty("CALL_APPLY_CF", ("" + on).toUpperCase());
    }

    /**
     * Gets the all call forwarding rules of the current user.
     * @return the all call forwarding rules of the current user.
     * @throws SkypeException when the connection has gone bad or an ERROR message is received.
     * @see #setAllCallForwardingRules(CallForwardingRule[])
     */
    public CallForwardingRule[] getAllCallForwardingRules() throws SkypeException {
        List<CallForwardingRule> rules = new ArrayList<CallForwardingRule>();
        String value = getProperty("CALL_FORWARD_RULES");
        if ("".equals(value)) {
            return new CallForwardingRule[0];
        }
        for (String rule : value.split(" ")) {
            String[] elements = rule.split(",");
            rules.add(new CallForwardingRule(Integer.parseInt(elements[0]), Integer.parseInt(elements[1]), elements[2]));
        }
        return rules.toArray(new CallForwardingRule[0]);
    }

    /**
     * Sets the all call forwarding rules of the current user.
     * @param newValues the new all call forwarding rules of the current user.
     * @throws SkypeException when the connection has gone bad or an ERROR message is received.
     * @see #getAllCallForwardingRules()
     */
    public void setAllCallForwardingRules(CallForwardingRule[] newValues) throws SkypeException {
        setProperty("CALL_FORWARD_RULES", toSpaceSeparatedString(newValues));
    }

    /**
     * Return all the valid SMS numbers.
     * @return Array of Strings with the numbers.
     * @throws SkypeException when the connection has gone bad or an ERROR message is received.
     */
    String[] getAllValidSMSNumbers() throws SkypeException {
        return Utils.convertToArray(getProperty("SMS_VALIDATED_NUMBERS"));
    }

    /**
     * Return the value of a property for PROFILE object.
     * @param name name of the parameter.
     * @return the value of the parameter.
     * @throws SkypeException when the connection has gone bad or an ERROR message is received.
     */
    private String getProperty(String name) throws SkypeException {
        return Utils.getProperty("PROFILE", name);
    }

    /**
     * Set a value for a PROFILE property.
     * @param name name of the property.
     * @param value value of the property.
     * @throws SkypeException when the connection has gone bad or an ERROR message is received.
     */
    private void setProperty(String name, String value) throws SkypeException {
        Utils.setProperty("PROFILE", name, value);
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -