mirror of
https://github.com/vanitasvitae/Smack.git
synced 2024-11-22 20:12:07 +01:00
Add MultiUserChat.requestVoice()
This commit is contained in:
parent
2aaedcb2fd
commit
eb6b8df7c5
1 changed files with 25 additions and 0 deletions
|
@ -67,6 +67,8 @@ import org.jivesoftware.smackx.muc.packet.MUCOwner;
|
|||
import org.jivesoftware.smackx.muc.packet.MUCUser;
|
||||
import org.jivesoftware.smackx.muc.packet.MUCUser.Status;
|
||||
import org.jivesoftware.smackx.xdata.Form;
|
||||
import org.jivesoftware.smackx.xdata.FormField;
|
||||
import org.jivesoftware.smackx.xdata.packet.DataForm;
|
||||
|
||||
/**
|
||||
* A MultiUserChat is a conversation that takes place among many users in a virtual
|
||||
|
@ -920,6 +922,29 @@ public class MultiUserChat {
|
|||
changeRole(nickname, MUCRole.none, reason);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends a voice request to the MUC. The room moderators usually need to approve this request.
|
||||
*
|
||||
* @throws NotConnectedException
|
||||
* @see <a href="http://xmpp.org/extensions/xep-0045.html#requestvoice">XEP-45 § 7.13 Requesting
|
||||
* Voice</a>
|
||||
* @since 4.1
|
||||
*/
|
||||
public void requestVoice() throws NotConnectedException {
|
||||
DataForm form = new DataForm(DataForm.Type.submit);
|
||||
FormField formTypeField = new FormField(FormField.FORM_TYPE);
|
||||
formTypeField.addValue(MUCInitialPresence.NAMESPACE + "#request");
|
||||
form.addField(formTypeField);
|
||||
FormField requestVoiceField = new FormField("muc#role");
|
||||
requestVoiceField.setType(FormField.Type.text_single);
|
||||
requestVoiceField.setLabel("Requested role");
|
||||
requestVoiceField.addValue("participant");
|
||||
form.addField(requestVoiceField);
|
||||
Message message = new Message(room);
|
||||
message.addExtension(form);
|
||||
connection.sendPacket(message);
|
||||
}
|
||||
|
||||
/**
|
||||
* Grants voice to visitors in the room. In a moderated room, a moderator may want to manage
|
||||
* who does and does not have "voice" in the room. To have voice means that a room occupant
|
||||
|
|
Loading…
Reference in a new issue