mirror of
https://github.com/vanitasvitae/Smack.git
synced 2025-09-10 17:49:38 +02:00
Jingle Extension added to Smack Repository
git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@6517 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
parent
f1972c2571
commit
4b6de6647b
104 changed files with 16411 additions and 0 deletions
|
@ -0,0 +1,138 @@
|
|||
package org.jivesoftware.smackx.packet;
|
||||
|
||||
import org.jivesoftware.smack.packet.PacketExtension;
|
||||
import org.jivesoftware.smackx.jingle.media.ContentInfo;
|
||||
|
||||
/**
|
||||
* Jingle content info
|
||||
*
|
||||
* @author Alvaro Saurin <alvaro.saurin@gmail.com>
|
||||
*/
|
||||
public class JingleContentInfo implements PacketExtension {
|
||||
|
||||
protected ContentInfo mediaInfoElement;
|
||||
|
||||
private String namespace;
|
||||
|
||||
/**
|
||||
* Empty constructor, with no jmf info.
|
||||
*/
|
||||
public JingleContentInfo() {
|
||||
this(null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor with a jmf info
|
||||
*
|
||||
* @param mediaInfoElement MediaInfo element
|
||||
*/
|
||||
public JingleContentInfo(final ContentInfo mediaInfoElement) {
|
||||
super();
|
||||
this.mediaInfoElement = mediaInfoElement;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the jmf info element.
|
||||
*
|
||||
* @return the mediaInfoElement
|
||||
*/
|
||||
public ContentInfo getMediaInfo() {
|
||||
return mediaInfoElement;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the element name
|
||||
*/
|
||||
public String getElementName() {
|
||||
// Media info is supposed to be just a single-word command...
|
||||
return getMediaInfo().toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the name space.
|
||||
*
|
||||
* @param ns the namespace
|
||||
*/
|
||||
protected void setNamespace(final String ns) {
|
||||
namespace = ns;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the publilc namespace
|
||||
*/
|
||||
public String getNamespace() {
|
||||
return namespace;
|
||||
}
|
||||
|
||||
public String toXML() {
|
||||
StringBuilder buf = new StringBuilder();
|
||||
buf.append("<").append(getElementName()).append(" xmlns=\"");
|
||||
buf.append(getNamespace()).append("\" ");
|
||||
buf.append("/>");
|
||||
return buf.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Transport part of a Jingle packet.
|
||||
*/
|
||||
public static class Audio extends JingleContentInfo {
|
||||
|
||||
public static final String NAMESPACE = "http://jabber.org/protocol/jingle/info/audio";
|
||||
|
||||
public Audio(final ContentInfo mi) {
|
||||
super(mi);
|
||||
setNamespace(NAMESPACE);
|
||||
}
|
||||
|
||||
public String getNamespace() {
|
||||
return NAMESPACE;
|
||||
}
|
||||
|
||||
// Subclasses: specialize the Audio jmf info...
|
||||
|
||||
/**
|
||||
* Busy jmf info.
|
||||
*/
|
||||
public static class Busy extends Audio {
|
||||
public Busy() {
|
||||
super(ContentInfo.Audio.BUSY);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Hold jmf info.
|
||||
*/
|
||||
public static class Hold extends Audio {
|
||||
public Hold() {
|
||||
super(ContentInfo.Audio.HOLD);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Mute jmf info.
|
||||
*/
|
||||
public static class Mute extends Audio {
|
||||
public Mute() {
|
||||
super(ContentInfo.Audio.MUTE);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Queued jmf info.
|
||||
*/
|
||||
public static class Queued extends Audio {
|
||||
public Queued() {
|
||||
super(ContentInfo.Audio.QUEUED);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Ringing jmf info.
|
||||
*/
|
||||
public static class Ringing extends Audio {
|
||||
public Ringing() {
|
||||
super(ContentInfo.Audio.RINGING);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue