use of org.jivesoftware.smackx.muc.packet.MUCOwner in project Smack by igniterealtime.
the class MUCOwnerProvider method parse.
@Override
public MUCOwner parse(XmlPullParser parser, int initialDepth) throws Exception {
MUCOwner mucOwner = new MUCOwner();
boolean done = false;
while (!done) {
int eventType = parser.next();
if (eventType == XmlPullParser.START_TAG) {
if (parser.getName().equals("item")) {
mucOwner.addItem(MUCParserUtils.parseItem(parser));
} else if (parser.getName().equals("destroy")) {
mucOwner.setDestroy(MUCParserUtils.parseDestroy(parser));
} else // Otherwise, it must be a packet extension.
{
PacketParserUtils.addExtensionElement(mucOwner, parser);
}
} else if (eventType == XmlPullParser.END_TAG) {
if (parser.getName().equals("query")) {
done = true;
}
}
}
return mucOwner;
}
use of org.jivesoftware.smackx.muc.packet.MUCOwner in project Smack by igniterealtime.
the class MultiUserChat method sendConfigurationForm.
/**
* Sends the completed configuration form to the server. The room will be configured
* with the new settings defined in the form.
*
* @param form the form with the new settings.
* @throws XMPPErrorException if an error occurs setting the new rooms' configuration.
* @throws NoResponseException if there was no response from the server.
* @throws NotConnectedException if the XMPP connection is not connected.
* @throws InterruptedException if the calling thread was interrupted.
*/
public void sendConfigurationForm(FillableForm form) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
final DataForm dataForm;
if (form != null) {
dataForm = form.getDataFormToSubmit();
} else {
// Instant room, cf. XEP-0045 ยง 10.1.2
dataForm = DataForm.builder().build();
}
MUCOwner iq = new MUCOwner();
iq.setTo(room);
iq.setType(IQ.Type.set);
iq.addExtension(dataForm);
connection.sendIqRequestAndWaitForResponse(iq);
}
use of org.jivesoftware.smackx.muc.packet.MUCOwner in project Smack by igniterealtime.
the class MUCOwnerProvider method parse.
@Override
public MUCOwner parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) throws XmlPullParserException, IOException, SmackParsingException {
MUCOwner mucOwner = new MUCOwner();
boolean done = false;
while (!done) {
XmlPullParser.Event eventType = parser.next();
if (eventType == XmlPullParser.Event.START_ELEMENT) {
if (parser.getName().equals("item")) {
mucOwner.addItem(MUCParserUtils.parseItem(parser));
} else if (parser.getName().equals("destroy")) {
mucOwner.setDestroy(MUCParserUtils.parseDestroy(parser));
} else // Otherwise, it must be a packet extension.
{
PacketParserUtils.addExtensionElement(mucOwner, parser, xmlEnvironment);
}
} else if (eventType == XmlPullParser.Event.END_ELEMENT) {
if (parser.getName().equals("query")) {
done = true;
}
}
}
return mucOwner;
}
use of org.jivesoftware.smackx.muc.packet.MUCOwner in project Smack by igniterealtime.
the class MultiUserChat method sendConfigurationForm.
/**
* Sends the completed configuration form to the server. The room will be configured
* with the new settings defined in the form.
*
* @param form the form with the new settings.
* @throws XMPPErrorException if an error occurs setting the new rooms' configuration.
* @throws NoResponseException if there was no response from the server.
* @throws NotConnectedException
* @throws InterruptedException
*/
public void sendConfigurationForm(Form form) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
MUCOwner iq = new MUCOwner();
iq.setTo(room);
iq.setType(IQ.Type.set);
iq.addExtension(form.getDataFormToSend());
connection.createStanzaCollectorAndSend(iq).nextResultOrThrow();
}
use of org.jivesoftware.smackx.muc.packet.MUCOwner in project Smack by igniterealtime.
the class MultiUserChat method getConfigurationForm.
/**
* Returns the room's configuration form that the room's owner can use.
* The configuration form allows to set the room's language,
* enable logging, specify room's type, etc..
*
* @return the Form that contains the fields to complete together with the instrucions or
* <code>null</code> if no configuration is possible.
* @throws XMPPErrorException if an error occurs asking the configuration form for the room.
* @throws NoResponseException if there was no response from the server.
* @throws NotConnectedException if the XMPP connection is not connected.
* @throws InterruptedException if the calling thread was interrupted.
*/
public Form getConfigurationForm() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
MUCOwner iq = new MUCOwner();
iq.setTo(room);
iq.setType(IQ.Type.get);
IQ answer = connection.sendIqRequestAndWaitForResponse(iq);
DataForm dataForm = DataForm.from(answer, MucConfigFormManager.FORM_TYPE);
return new Form(dataForm);
}
Aggregations