string name = "New Room";
string descri = "Testing Room";
Jid jid
= new Jid
(name
+ "@conference.XXXXX.com");
MucManager muc
= new MucManager
(this.XmppCon);
muc.JoinRoom(jid, this.XmppCon.Username);
muc.CreateReservedRoom(jid);
muc.GrantOwnershipPrivileges(jid, this.XmppCon.MyJID);
muc
.RequestConfigurationForm(jid,
new IqCB
(OnRequestConfiguration
));
public void OnRequestConfiguration(object sender, IQ iq, object obj)
{
agsXMPP
.protocol.x.muc.iq.owner.OwnerIq oIq
= new agsXMPP
.protocol.x.muc.iq.owner.OwnerIq();
oIq.Type = IqType.set;
oIq.To = iq.From;
agsXMPP
.protocol.x.data.Data xForm
= new agsXMPP
.protocol.x.data.Data(XDataFormType
.form);
xForm.Type = XDataFormType.submit;
Field f_form
= new Field
(FieldType
.Hidden);
f_form.Var = "FORM_TYPE";
f_form.Value = "http://jabber.org/protocol/muc#roomconfig";
xForm.AddField(f_form);
//Field f_title = new Field(FieldType.Text_Single);
//f_title.Var = "muc#roomconfig_roomname";
//f_title.Value = "VS2013-1";
//xForm.AddField(f_title);
//Field f_roomdesc = new Field(FieldType.Text_Single);
//f_roomdesc.Var = "muc#roomconfig_roomdesc";
//f_roomdesc.Value = "VS2013 Created Room";
//xForm.AddChild(f_roomdesc);
Field f_changesubject
= new Field
(FieldType
.Boolean);
f_changesubject.Var = "muc#roomconfig_changesubject";
f_changesubject.Value = "1";
xForm.AddChild(f_changesubject);
Field f_public
= new Field
(FieldType
.Boolean);
f_public.Var = "muc#roomconfig_publicroom";
f_public.Value = "1";
xForm.AddChild(f_public);
Field f_persistent
= new Field
(FieldType
.Boolean);
f_persistent.Var = "muc#roomconfig_persistentroom";
f_persistent.Value = "1";
xForm.AddChild(f_persistent);
Field f_moderatedroom
= new Field
(FieldType
.Boolean);
f_moderatedroom.Var = "muc#roomconfig_moderatedroom";
f_moderatedroom.Value = "0";
xForm.AddChild(f_moderatedroom);
Field f_membersonly
= new Field
(FieldType
.Boolean);
f_membersonly.Var = "muc#roomconfig_membersonly";
f_membersonly.Value = "0";
xForm.AddChild(f_membersonly);
Field f_allowinvites
= new Field
(FieldType
.Boolean);
f_allowinvites.Var = "muc#roomconfig_allowinvites";
f_allowinvites.Value = "0";
xForm.AddChild(f_allowinvites);
Field f_private
= new Field
(FieldType
.Boolean);
f_private.Var = "muc#roomconfig_passwordprotectedroom";
f_private.Value = "1";
xForm.AddChild(f_private);
Field f_password
= new Field
(FieldType
.Text_Private);
f_password.Var = "muc#roomconfig_roomsecret";
f_password.Value = "mars";
xForm.AddChild(f_password);
oIq.Query.AddChild(xForm);
XmppCon
.IqGrabber.SendIq(oIq,
new IqCB
(OnRoomConigResult
),
null);
}
public void OnRoomConigResult(object sender, IQ iq, object data)
{
if (iq.Type == IqType.result)
{
//success
}
else if (iq.Type == IqType.error)
{
//error
}
}