use of org.jivesoftware.smackx.jingle.element.Jingle in project Smack by igniterealtime.
the class JingleProvider method parse.
@Override
public Jingle parse(XmlPullParser parser, int initialDepth, IqData iqData, XmlEnvironment xmlEnvironment) throws XmlPullParserException, IOException, SmackParsingException {
Jingle.Builder builder = Jingle.builder(iqData);
String actionString = parser.getAttributeValue("", Jingle.ACTION_ATTRIBUTE_NAME);
if (actionString != null) {
JingleAction action = JingleAction.fromString(actionString);
builder.setAction(action);
}
FullJid initiator = ParserUtils.getFullJidAttribute(parser, Jingle.INITIATOR_ATTRIBUTE_NAME);
builder.setInitiator(initiator);
FullJid responder = ParserUtils.getFullJidAttribute(parser, Jingle.RESPONDER_ATTRIBUTE_NAME);
builder.setResponder(responder);
String sessionId = parser.getAttributeValue("", Jingle.SESSION_ID_ATTRIBUTE_NAME);
builder.setSessionId(sessionId);
outerloop: while (true) {
XmlPullParser.Event eventType = parser.next();
switch(eventType) {
case START_ELEMENT:
String tagName = parser.getName();
switch(tagName) {
case JingleContent.ELEMENT:
JingleContent content = parseJingleContent(parser, parser.getDepth());
builder.addJingleContent(content);
break;
case JingleReason.ELEMENT:
JingleReason reason = parseJingleReason(parser);
builder.setReason(reason);
break;
default:
LOGGER.severe("Unknown Jingle element: " + tagName);
break;
}
break;
case END_ELEMENT:
if (parser.getDepth() == initialDepth) {
break outerloop;
}
break;
default:
// Catch all for incomplete switch (MissingCasesInEnumSwitch) statement.
break;
}
}
return builder.build();
}
use of org.jivesoftware.smackx.jingle.element.Jingle in project Smack by igniterealtime.
the class JingleUtil method createTransportAccept.
public Jingle createTransportAccept(FullJid recipient, FullJid initiator, String sessionId, JingleContent.Creator contentCreator, String contentName, JingleContentTransport transport) {
Jingle.Builder jb = Jingle.builder(connection);
jb.setAction(JingleAction.transport_accept).setInitiator(initiator).setSessionId(sessionId);
JingleContent.Builder cb = JingleContent.getBuilder();
cb.setCreator(contentCreator).setName(contentName).setTransport(transport);
Jingle jingle = jb.addJingleContent(cb.build()).build();
jingle.setTo(recipient);
jingle.setFrom(connection.getUser());
return jingle;
}
use of org.jivesoftware.smackx.jingle.element.Jingle in project Smack by igniterealtime.
the class JingleUtil method createTransportReplace.
public Jingle createTransportReplace(FullJid recipient, FullJid initiator, String sessionId, JingleContent.Creator contentCreator, String contentName, JingleContentTransport transport) {
Jingle.Builder jb = Jingle.builder(connection);
jb.setInitiator(initiator).setSessionId(sessionId).setAction(JingleAction.transport_replace);
JingleContent.Builder cb = JingleContent.getBuilder();
cb.setName(contentName).setCreator(contentCreator).setTransport(transport);
Jingle jingle = jb.addJingleContent(cb.build()).build();
jingle.setTo(recipient);
jingle.setFrom(connection.getUser());
return jingle;
}
use of org.jivesoftware.smackx.jingle.element.Jingle in project Smack by igniterealtime.
the class JingleUtil method createSessionInitiate.
public Jingle createSessionInitiate(FullJid recipient, String sessionId, JingleContent.Creator contentCreator, String contentName, JingleContent.Senders contentSenders, JingleContentDescription description, JingleContentTransport transport) {
Jingle.Builder jb = Jingle.builder(connection);
jb.setAction(JingleAction.session_initiate).setSessionId(sessionId).setInitiator(connection.getUser());
JingleContent.Builder cb = JingleContent.getBuilder();
cb.setCreator(contentCreator).setName(contentName).setSenders(contentSenders).setDescription(description).setTransport(transport);
Jingle jingle = jb.addJingleContent(cb.build()).build();
jingle.setFrom(connection.getUser());
jingle.setTo(recipient);
return jingle;
}
use of org.jivesoftware.smackx.jingle.element.Jingle in project Smack by igniterealtime.
the class JingleUtil method createTransportReject.
public Jingle createTransportReject(FullJid recipient, FullJid initiator, String sessionId, JingleContent.Creator contentCreator, String contentName, JingleContentTransport transport) {
Jingle.Builder jb = Jingle.builder(connection);
jb.setAction(JingleAction.transport_reject).setInitiator(initiator).setSessionId(sessionId);
JingleContent.Builder cb = JingleContent.getBuilder();
cb.setCreator(contentCreator).setName(contentName).setTransport(transport);
Jingle jingle = jb.addJingleContent(cb.build()).build();
jingle.setTo(recipient);
jingle.setFrom(connection.getUser());
return jingle;
}
Aggregations