Java 类org.jivesoftware.smackx.workgroup.settings.SoundSettings 实例源码

项目:Fastpath-webchat    文件:SoundServlet.java   
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    String workgroupName = request.getParameter("workgroup");
    String action = request.getParameter("action");
    Workgroup workgroup = new Workgroup(workgroupName, ChatManager.getInstance().getGlobalConnection());
    try {
        SoundSettings soundSettings = workgroup.getSoundSettings();
        response.setContentType("audio/wav");
        if (action != null) {
            if ("incoming".equals(action.trim())) {
                response.getOutputStream().write(soundSettings.getIncomingSoundBytes());
            } else if ("outgoing".equals(action.trim())) {
                response.getOutputStream().write(soundSettings.getOutgoingSoundBytes());
            }
        }
    } catch (XMPPException e) {
        WebLog.log("Could not load sound settings for workgroup " + workgroupName);
    }
}
项目:Smack    文件:Workgroup.java   
/**
 * Asks the workgroup for it's Sound Settings.
 *
 * @return soundSettings the sound settings for the specified workgroup.
 * @throws XMPPErrorException 
 * @throws NoResponseException 
 * @throws NotConnectedException 
 */
public SoundSettings getSoundSettings() throws NoResponseException, XMPPErrorException, NotConnectedException {
    SoundSettings request = new SoundSettings();
    request.setType(IQ.Type.get);
    request.setTo(workgroupJID);

    SoundSettings response = (SoundSettings) connection.createPacketCollectorAndSend(request).nextResultOrThrow();
    return response;
}