/// <summary>
        /// 设置聊天室的参数
        /// </summary>
        public void SetConfiguration()
        {
            IQ IqSetRquest = new IQ(IqType.set);
            IqSetRquest.Namespace = null;
            IqSetRquest.Id = CSS.IM.XMPP.Id.GetNextId();
            IqSetRquest.To = this.MJid;

            CSS.IM.XMPP.protocol.Base.Query query = new CSS.IM.XMPP.protocol.Base.Query();
            query.Namespace = CSS.IM.XMPP.Uri.MUC_OWNER;

            Data query_x = new Data(XDataFormType.submit);

            Field field1 = new Field();
            field1.Var = "FORM_TYPE";
            field1.Type = FieldType.Hidden;
            field1.AddValue(Features.FEAT_MUC_ROOMCONFIG);
            query_x.AddField(field1);

            Field field2 = new Field();
            field2.Var = "muc#roomconfig_roomname";
            field2.Type = FieldType.Text_Single;
            field2.AddValue(txt_name.Texts.Trim());
            query_x.AddField(field2);

            Field field3 = new Field();
            field3.Var = "muc#roomconfig_roomdesc";
            field3.Type = FieldType.Text_Single;
            field3.AddValue(txt_tm.Texts.Trim());
            query_x.AddField(field3);

            Field field4 = new Field();
            field4.Var = "muc#roomconfig_persistentroom";
            field4.Type = FieldType.Boolean;
            field4.AddValue(txt_gd.Checked == true ? "1" : "0");
            query_x.AddField(field4);

            Field field5 = new Field();
            field5.Var = "muc#roomconfig_passwordprotectedroom";
            field5.Type = FieldType.Boolean;
            field5.AddValue(txt_sy.Checked == true ? "1" : "0");
            query_x.AddField(field5);

            Field field6 = new Field();
            field6.Var = "muc#roomconfig_roomsecret";
            field6.Type = FieldType.Text_Private;
            field6.AddValue(txt_pswd2.Texts.ToString());
            query_x.AddField(field6);

            Field field7 = new Field();
            field7.Var = "muc#roomconfig_roomowners";
            field7.Type = FieldType.Jid_Multi;
            field7.AddValue(XmppCon.MyJID.ToString());
            query_x.AddField(field7);

            query.AddChild(query_x);
            IqSetRquest.AddChild(query);
            XmppCon.IqGrabber.SendIq(IqSetRquest, new IqCB(SetConfigurationCell), null, true);
        }
Пример #2
0
        private void btn_find_Click(object sender, EventArgs e)
        {
            listView1.Items.Clear();
            //<field type="boolean" var="Email"><value>1</value></field>
            //<field type="boolean" var="Name"><value>1</value></field>
            //<field type="boolean" var="Username"><value>1</value></field>
            //<field type="text-single" var="search"><value>*</value></field>
            //<field type="hidden" var="FORM_TYPE"><value>jabber:iq:search</value></field>

            Data data = new Data(XDataFormType.submit);
            Field fEmail = new Field(FieldType.Boolean);
            fEmail.SetValueBool(true);
            fEmail.Var = "Email";
            data.AddField(fEmail);

            Field fName = new Field(FieldType.Boolean);
            fName.SetValueBool(true);
            fName.Var = "Name";
            data.AddField(fName);

            Field fUsername = new Field(FieldType.Boolean);
            fUsername.SetValueBool(true);
            fUsername.Var = "Username";
            data.AddField(fUsername);

            Field fWhare = new Field(FieldType.Text_Single);
            if (cmb_findtype.Items[cmb_findtype.SelectIndex].ToString() != "全部")
            {
                fWhare.AddValues(new String[] { txt_userName.Texts.Trim().ToString() });
            }
            else
            {
                fWhare.AddValues(new String[] { "*" });
            }

            fWhare.Var = "search";
            data.AddField(fWhare);

            Field fsearch = new Field(FieldType.Hidden);

            fsearch.AddValue("jabber:iq:search");
            fsearch.Var = "FORM_TYPE";

            data.AddField(fsearch);

            IQ siq = siq = new SearchIq();
            ((SearchIq)siq).Query.Data = data;

            //directory

            if (Util.Services.Finds.Count==0)
            {
                 MsgBox.Show(this, "CSS&IM", "服务器没有注册Findes请与管理员联系!", MessageBoxButtons.OK);
                 return;
            }

            if (Util.Services.Finds[0]!=null)
            {
                try
                {
                    siq.To = Util.Services.Finds[0];
                    siq.Type = IqType.set;
                    m_XmppCon.IqGrabber.SendIq(siq, new IqCB(OnSearchResult), null, true);
                }
                catch (Exception)
                {

                }

            }
        }