コード例 #1
0
        public override Field GetResult()
        {
            Field field = new Field( Field.Var, null, Field.Type );
            field.SetValueBool( ( bool ) _checkBox.IsChecked ) ;

            return field ;
        }
コード例 #2
0
        public override Field GetResult()
        {
            Field field = new Field( Field.Var, null, Field.Type );
            field.SetValue( _password.Password ) ;

            return field ;
        }
コード例 #3
0
        public override Field GetResult()
        {
            Field field = new Field( Field.Var, null, Field.Type );
            field.SetValue( Field.GetValue() );

            return field ;
        }
コード例 #4
0
        public override Field GetResult()
        {
            Field field = new Field( Field.Var, null, Field.Type );

            if ( _comboBox.SelectedItem != null )
            {
                field.SetValue( ( string )( ( ComboBoxItem ) _comboBox.SelectedItem ).DataContext ) ;
            }
            else
            {
                field.SetValue( null ) ;
            }

            return field ;
        }
コード例 #5
0
        public override Field GetResult()
        {
            List< string > values = new List< string >() ;

            foreach ( UIElement element in _panel.Children )
            {
                CheckBox checkBox = element as CheckBox ;

                if ( checkBox != null && ( bool ) checkBox.IsChecked )
                {
                    values.Add( ( string )checkBox.DataContext ) ;
                }
            }

            Field field = new Field( Field.Var, null, Field.Type );
            field.SetValues( values.ToArray() ) ;

            return field ;
        }
コード例 #6
0
        public override Field GetResult()
        {
            Field field = new Field( Field.Var, null, Field.Type );

            if ( Field.Type == FieldType.Text_Multi
                || Field.Type == FieldType.Jid_Multi )
            {
                string [] values = new string[ _textBox.LineCount ];

                for ( int i = 0; i < _textBox.LineCount; i++ )
                {
                    values[ i ] = _textBox.GetLineText( i ) ;
                }

                field.SetValues( values ) ;
            }
            else
            {
                field.SetValue( _textBox.Text ) ;
            }

            return field ;
        }
コード例 #7
0
ファイル: FieldContainer.cs プロジェクト: phiree/dzdocs
 /// <summary>
 /// Gets a list of all form fields
 /// </summary>
 /// <returns></returns>
 public Field[] GetFields()
 {
     ElementList nl = SelectElements(typeof(Field));
     Field[] fields = new Field[nl.Count];
     int i = 0;
     foreach (Element e in nl)
     {
         fields[i] = (Field)e;
         i++;
     }
     return fields;
 }
コード例 #8
0
ファイル: frmFileTransfer.cs プロジェクト: phiree/dzdocs
        private void cmdAccept_Click(object sender, EventArgs e)
        {
            cmdAccept.Enabled = false;
            cmdRefuse.Enabled = false;

            agsXMPP.protocol.extensions.featureneg.FeatureNeg fNeg = si.FeatureNeg;
            if (fNeg != null)
            {
                agsXMPP.protocol.x.data.Data data = fNeg.Data;
                if (data != null)
                {
                    agsXMPP.protocol.x.data.Field[] field = data.GetFields();
                    if (field.Length == 1)
                    {
                        Dictionary<string, string> methods = new Dictionary<string, string>();
                        foreach (agsXMPP.protocol.x.data.Option o in field[0].GetOptions())
                        {
                            string val = o.GetValue();
                            methods.Add(val, val);
                        }
                        if (methods.ContainsKey(agsXMPP.Uri.BYTESTREAMS))
                        {
                            // supports bytestream, so choose this option
                            agsXMPP.protocol.extensions.si.SIIq sIq = new agsXMPP.protocol.extensions.si.SIIq();
                            sIq.Id      = siIq.Id;
                            sIq.To      = siIq.From;
                            sIq.Type    = IqType.result;

                            sIq.SI.Id = si.Id;
                            sIq.SI.FeatureNeg = new agsXMPP.protocol.extensions.featureneg.FeatureNeg();

                            Data xdata = new Data();
                            xdata.Type = XDataFormType.submit;
                            Field f = new Field();
                            //f.Type = FieldType.List_Single;
                            f.Var = "stream-method";
                            f.AddValue(agsXMPP.Uri.BYTESTREAMS);
                            xdata.AddField(f);
                            sIq.SI.FeatureNeg.Data = xdata;

                            m_XmppCon.Send(sIq);
                        }
                    }
                }
            }
        }
コード例 #9
0
ファイル: FieldContainer.cs プロジェクト: phiree/dzdocs
 /// <summary>
 /// 
 /// </summary>
 /// <returns></returns>
 public Field AddField()
 {
     Field f = new Field();
     AddChild(f);
     return f;
 }
コード例 #10
0
ファイル: FieldContainer.cs プロジェクト: phiree/dzdocs
 /// <summary>
 /// 
 /// </summary>
 /// <param name="field"></param>
 public Field AddField(Field field)
 {
     AddChild(field);
     return field;
 }
コード例 #11
0
ファイル: XDataControl.cs プロジェクト: phiree/dzdocs
 /// <summary>
 /// helper function that maps old jabber hidden search and register fields to our XData fields
 /// </summary>
 /// <param name="var"></param>
 /// <param name="val"></param>
 /// <returns></returns>
 private Field CreateDummyHiddenField(string var, string val)
 {
     Field field = new Field(var, var, FieldType.Hidden);
     field.SetValue(val);
     return field;
 }
コード例 #12
0
ファイル: XDataControl.cs プロジェクト: phiree/dzdocs
        /// <summary>
        /// Create a form element from a given field
        /// </summary>
        /// <param name="field"></param>
        /// <param name="tabIdx"></param>
        /// <returns></returns>
        private XDataFieldControl CreateField(Field field, int tabIdx)
        {
            XDataFieldControl m_DataControl;
            //			panelFields.SuspendLayout();

            FieldType m_Type = field.Type;
            string lbl;
            switch (m_Type)
            {
                case FieldType.Hidden:
                    m_DataControl = new XDataHidden();
                    ((XDataHidden) m_DataControl).Value		= field.GetValue();

                    break;
                case FieldType.Fixed:
                    m_DataControl = new XDataLabel();

                    ((XDataLabel) m_DataControl).Value		= field.GetValue();

                    break;
                case FieldType.Boolean:
                    m_DataControl = new XDataCheckBox();

                    lbl = field.Label;
                    if (lbl == null)
                        lbl = field.Var;

                    ((XDataCheckBox) m_DataControl).Text	= lbl;
                    ((XDataCheckBox) m_DataControl).Value	= field.GetValueBool();

                    break;
                case FieldType.Text_Private:
                    m_DataControl = new XDataTextBox();

                    lbl = field.Label;
                    if (lbl == null)
                        lbl = field.Var;

                    ((XDataTextBox) m_DataControl).Text			= lbl;
                    ((XDataTextBox) m_DataControl).Value		= field.GetValue();
                    ((XDataTextBox) m_DataControl).IsPrivate	= true;

                    break;
                case FieldType.Text_Single:
                    m_DataControl = new XDataTextBox();

                    lbl = field.Label;
                    if (lbl == null)
                        lbl = field.Var;

                    ((XDataTextBox) m_DataControl).Text			= lbl;
                    ((XDataTextBox) m_DataControl).Value		= field.GetValue();

                    break;
                case FieldType.Text_Multi:
                    m_DataControl = new XDataTextBox();

                    lbl = field.Label;
                    if (lbl == null)
                        lbl = field.Var;

                    ((XDataTextBox) m_DataControl).Text			= lbl;
                    ((XDataTextBox) m_DataControl).Multiline	= true;
                    ((XDataTextBox) m_DataControl).Lines		= field.GetValues();

                    break;
                case FieldType.List_Single:
                    m_DataControl = new XDataListSingle();

                    lbl = field.Label;
                    if (lbl == null)
                        lbl = field.Var;

                    ((XDataListSingle) m_DataControl).Text		= lbl;

                    foreach(Option o in field.GetOptions())
                    {
                        ((XDataListSingle) m_DataControl).AddValue(o.GetValue(), o.Label);
                    }
                    ((XDataListSingle) m_DataControl).Value		= field.GetValue();

                    break;
                case FieldType.List_Multi:
                    m_DataControl = new XDataListMulti();

                    lbl = field.Label;
                    if (lbl == null)
                        lbl = field.Var;

                    ((XDataListMulti) m_DataControl).Text		= lbl;

                    foreach(Option o in field.GetOptions())
                    {
                        string optionValue = o.GetValue();
                        CheckState chk;
                        if (field.HasValue(optionValue))
                            chk = CheckState.Checked;
                        else
                            chk = CheckState.Unchecked;

                        ((XDataListMulti) m_DataControl).AddValue(optionValue, o.Label, chk);
                    }

                    break;
                case FieldType.Jid_Single:
                    m_DataControl = new XDataJidSingle();

                    lbl = field.Label;
                    if (lbl == null)
                        lbl = field.Var;

                    ((XDataJidSingle) m_DataControl).Text	= lbl;
                    ((XDataJidSingle) m_DataControl).Value	= field.Value;
                    break;
                case FieldType.Jid_Multi:
                    m_DataControl = new XDataJidMulti();

                    lbl = field.Label;
                    if (lbl == null)
                        lbl = field.Var;

                    ((XDataJidMulti) m_DataControl).Text	= lbl;
                    ((XDataJidMulti) m_DataControl).Lines	= field.GetValues();

                    break;
                default:
                    m_DataControl = new XDataLabel();

                    break;
            }
            m_DataControl.IsRequired	= field.IsRequired;
            m_DataControl.m_Var			= field.Var;
            m_DataControl.Parent		= panelFields;
            m_DataControl.Location		= new Point(0, 0);
            m_DataControl.Width			= panelFields.Width;
            m_DataControl.Dock			= DockStyle.Top;

            if (m_Type != FieldType.Hidden &&
                m_Type != FieldType.Fixed)
            {
                m_DataControl.TabIndex	= tabIdx;
                m_DataControl.Focus();
            }

            panelFields.Controls.Add(m_DataControl);

            //			panelFields.ResumeLayout();
            lbl = null;
            return m_DataControl;
        }
コード例 #13
0
ファイル: frmFileTransfer.cs プロジェクト: phiree/dzdocs
        private void SendSiIq()
        {
            /*
            Recv:
            <iq xmlns="jabber:client" from="[email protected]/Psi" to="[email protected]/SharpIM"
            type="set" id="aab4a"> <si xmlns="http://jabber.org/protocol/si"
            profile="http://jabber.org/protocol/si/profile/file-transfer" id="s5b_405645b6f2b7c681"> <file
            xmlns="http://jabber.org/protocol/si/profile/file-transfer" size="719" name="Kunden.dat"> <range />
            </file> <feature xmlns="http://jabber.org/protocol/feature-neg"> <x xmlns="jabber:x:data" type="form">
            <field type="list-single" var="stream-method"> <option>
            <value>http://jabber.org/protocol/bytestreams</value> </option> </field> </x> </feature> </si> </iq>

            Send: <iq xmlns="jabber:client" id="agsXMPP_5" to="[email protected]/Psi" type="set">
             <si xmlns="http://jabber.org/protocol/si" id="af5a2e8d-58d4-4038-8732-7fb348ff767f">
             <file xmlns="http://jabber.org/protocol/si/profile/file-transfer" name="ALEX1.JPG" size="22177"><range /></file>
             <feature xmlns="http://jabber.org/protocol/feature-neg"><x xmlns="jabber:x:data" type="form">
            <field type="list-single" var="stream-method"><option>http://jabber.org/protocol/bytestreams</option></field></x></feature></si></iq>

            Send:
            <iq xmlns="jabber:client" id="aab4a" to="[email protected]/Psi" type="result"><si
            xmlns="http://jabber.org/protocol/si" id="s5b_405645b6f2b7c681"><feature
            xmlns="http://jabber.org/protocol/feature-neg"><x xmlns="jabber:x:data" type="submit"><field
            var="stream-
            method"><value>http://jabber.org/protocol/bytestreams</value></field></x></feature></si></iq>

            Recv:
            <iq xmlns="jabber:client" from="[email protected]/Psi" to="[email protected]/SharpIM"
            type="set" id="aab6a"> <query xmlns="http://jabber.org/protocol/bytestreams" sid="s5b_405645b6f2b7c681"
            mode="tcp"> <streamhost port="8010" jid="[email protected]/Psi" host="192.168.74.142" /> <streamhost
            port="7777" jid="proxy.ag-software.de" host="82.165.34.23"> <proxy
            xmlns="http://affinix.com/jabber/stream" /> </streamhost> <fast xmlns="http://affinix.com/jabber/stream"
            /> </query> </iq>

            Send:
            <iq xmlns="jabber:client" type="result" to="[email protected]/Psi" id="aab6a"><query
            xmlns="http://jabber.org/protocol/bytestreams"><streamhost-used jid="[email protected]/Psi"
            /></query></iq>
            */

            SIIq iq = new SIIq();
            iq.To = m_To;
            iq.Type = IqType.set;

            m_lFileLength = new FileInfo(m_FileName).Length;

            agsXMPP.protocol.extensions.filetransfer.File file;
            file =new agsXMPP.protocol.extensions.filetransfer.File(
                        Path.GetFileName(m_FileName), m_lFileLength);
            if (m_DescriptionChanged)
                file.Description = txtDescription.Text;
            file.Range = new Range();

            FeatureNeg fNeg = new FeatureNeg();

            Data data = new Data(XDataFormType.form);
            Field f = new Field(FieldType.List_Single);
            f.Var = "stream-method";
            f.AddOption().SetValue(agsXMPP.Uri.BYTESTREAMS);
            data.AddField(f);

            fNeg.Data = data;

            iq.SI.File = file;
            iq.SI.FeatureNeg = fNeg;
            iq.SI.Profile = agsXMPP.Uri.SI_FILE_TRANSFER;

            m_Sid = Guid.NewGuid().ToString();
            iq.SI.Id = m_Sid;

            m_XmppCon.IqGrabber.SendIq(iq, new IqCB(SiIqResult), null);
        }
コード例 #14
0
ファイル: XDataControl.cs プロジェクト: phiree/dzdocs
        /// <summary>
        /// Creates the XData Response Element from the entered Data in the GUI Form
        /// </summary>
        /// <returns></returns>
        public Data CreateResponse()
        {
            Data data = new Data(XDataFormType.submit);
            foreach(XDataFieldControl ctl in panelFields.Controls)
            {
                Type type = ctl.GetType();

                if ( type == typeof(XDataTextBox) )
                {
                    Field f;
                    XDataTextBox txt = ctl as XDataTextBox;
                    if (txt.Multiline == true)
                    {
                        f = new Field(FieldType.Text_Multi);
                    }
                    else
                    {
                        if (txt.IsPrivate)
                            f = new Field(FieldType.Text_Private);
                        else
                            f = new Field(FieldType.Text_Single);

                    }
                    f.AddValues(txt.Values);
                    f.Var = txt.Var;
                    data.AddField(f);

                }
                else if ( type == typeof(XDataHidden) )
                {
                    Field f;
                    XDataHidden hidden = ctl as XDataHidden;

                    f = new Field(FieldType.Hidden);

                    f.AddValue(hidden.Value);
                    f.Var = hidden.Var;

                    data.AddField(f);
                }
                else if ( type == typeof(XDataJidSingle) )
                {
                    XDataJidSingle jids = ctl as XDataJidSingle;
                    Field f = new Field(FieldType.Jid_Single);
                    f.SetValue(jids.Value);
                    f.Var = jids.Var;
                    data.AddField(f);
                }
                else if ( type == typeof(XDataJidMulti) )
                {
                    XDataJidMulti jidm = ctl as XDataJidMulti;
                    Field f = new Field(FieldType.Jid_Multi);
                    f.AddValues(jidm.Values);
                    f.Var = jidm.Var;
                    data.AddField(f);

                }
                else if ( type == typeof(XDataCheckBox) )
                {
                    XDataCheckBox chk = ctl as XDataCheckBox;
                    Field f = new Field(FieldType.Boolean);
                    f.SetValueBool(chk.Value);
                    f.Var = chk.Var;
                    data.AddField(f);
                }
                else if ( type == typeof(XDataListMulti) )
                {
                    XDataListMulti listm = ctl as XDataListMulti;
                    Field f = new Field(FieldType.List_Multi);
                    f.AddValues(listm.Values);
                    f.Var = listm.Var;
                    data.AddField(f);
                }
                else if ( type == typeof(XDataListSingle) )
                {
                    XDataListSingle lists = ctl as XDataListSingle;
                    Field f = new Field(FieldType.List_Single);
                    f.SetValue(lists.Value);
                    f.Var = lists.Var;
                    data.AddField(f);
                }
            }

            return data;
        }
コード例 #15
0
        private void CreateFieldControl( Field field )
        {
            XDataControl control = null ;

            switch ( field.Type )
            {
                case FieldType.Boolean:
                    {
                        control = new XDataCheckBox() ;
                        break ;
                    }
                case FieldType.Fixed:
                    {
                        control = new XDataFixed() ;
                        break ;
                    }
                case FieldType.Hidden:
                    {
                        control = new XDataHidden() ;
                        break ;
                    }
                case FieldType.List_Multi:
                    {
                        control = new XDataListMulti() ;
                        break ;
                    }
                case FieldType.List_Single:
                    {
                        control = new XDataListSingle() ;
                        break ;
                    }
                case FieldType.Text_Private:
                    {
                        control = new XDataSecret() ;
                        break ;
                    }
                case FieldType.Jid_Multi:
                case FieldType.Jid_Single:
                case FieldType.Text_Multi:
                case FieldType.Text_Single:
                    {
                        control = new XDataTextBox() ;
                        break ;
                    }
                default:
                    {
                        control = new XDataFixed() ;
                        break ;
                    }
            }

            control.Field = field ;
            _container.Children.Add( control ) ;
        }
コード例 #16
0
        private void SendSiIq()
        {
            SIIq iq = new SIIq();
            iq.To = Contact.FullJid;
            iq.Type = IqType.set;

            File afile;
            afile = new File(Path.GetFileName(FileName), _fileLength);

            afile.Description = FileDescription;
            afile.Range = new Range();

            FeatureNeg fNeg = new FeatureNeg();

            agsXMPP.protocol.x.data.Data data = new agsXMPP.protocol.x.data.Data(XDataFormType.form);
            Field f = new Field(FieldType.List_Single);
            f.Var = "stream-method";
            f.AddOption().SetValue(Uri.BYTESTREAMS);
            data.AddField(f);

            fNeg.Data = data;

            iq.SI.File = afile;
            iq.SI.FeatureNeg = fNeg;
            iq.SI.Profile = Uri.SI_FILE_TRANSFER;

            _sid = Guid.NewGuid().ToString();
            iq.SI.Id = _sid;

            _xmppConnection.IqGrabber.SendIq(iq, new IqCB(SiIqResult), null);

            State = FileTransferState.WaitingForResponse;
        }
コード例 #17
0
            //SEND: 
            //<iq xmlns="jabber:client" id="agsXMPP_14" type="get" to="users.localhost">
            //    <query xmlns="jabber:iq:search" />
            //</iq>

            //RECV: 
            //<iq xmlns="jabber:client" from="users.localhost" to="test@localhost/MF" type="result" id="agsXMPP_14">
            //    <query xmlns="jabber:iq:search">
            //        <instructions />
            //        <x xmlns="jabber:x:data" type="form">
            //            <instructions>Use this form to search for users in the SoapBox User Directory.  Use '*' as a wildcard character.</instructions>
            //            <title>SoapBox User Directory</title>
            //            <field type="list-single" label="Group" var="role">
            //            <desc>Search for Users in the Group</desc>
            //            <option label="All"><value>0</value></option>
            //            <option label="Administrator"><value>103</value></option>
            //            </field>
            //            <field type="text-single" label="User Name" var="userName">
            //            <desc>User Name to Search for</desc>
            //            </field>
            //        </x>
            //    </query>
            //</iq>

            //SEND: 
            //<iq xmlns="jabber:client" id="agsXMPP_16" to="users.localhost" type="set">
            //    <query xmlns="jabber:iq:search">
            //        <x xmlns="jabber:x:data" type="submit">
            //            <field type="text-single" var="userName">
            //                <value>test</value>
            //            </field>
            //            <field type="list-single" var="role">
            //                <value>0</value>
            //            </field>
            //        </x>
            //    </query>
            //</iq>

            //RECV: 
            //<iq xmlns="jabber:client" from="users.localhost" to="test@localhost/MF" type="result" id="agsXMPP_16">
            //    <query xmlns="jabber:iq:search">
            //        <x xmlns="jabber:x:data" type="result">
            //            <title>UserRecords</title>
            //            <reported>
            //                <field type="hidden" label="JabberID" var="jid"/>
            //                <field type="text-single" label="User Name" var="UserJIDNode"/>
            //                <field type="text-single" label="Domain" var="UserJIDDomain"/>
            //                <field type="boolean" label="MessageLogging" var="MessageLogging">
            //                    <value>0</value>
            //                </field>
            //                <field type="int32-single" label="ActualMaxRecords" var="ActualMaxRecords"/>
            //            </reported>
            //            <item>
            //                <field type="hidden" label="JabberID" var="jid">
            //                    <value>test@localhost</value>
            //                </field>
            //                <field type="text-single" label="User Name" var="UserJIDNode">
            //                    <value>test</value>
            //                </field>
            //                <field type="text-single" label="Domain" var="UserJIDDomain">
            //                    <value>localhost</value>
            //                </field>
            //                <field type="boolean" label="MessageLogging" var="MessageLogging">
            //                    <value>0</value>
            //                </field>
            //                <field type="int32-single" label="ActualMaxRecords" var="ActualMaxRecords">
            //                    <value>3</value>
            //                </field>
            //            </item>
            //            <item>
            //                <field type="hidden" label="JabberID" var="jid">
            //                    <value>test2@localhost</value>
            //                </field>
            //                <field type="text-single" label="User Name" var="UserJIDNode">
            //                    <value>test2</value>
            //                </field>
            //                <field type="text-single" label="Domain" var="UserJIDDomain">
            //                    <value>localhost</value>
            //                </field>
            //                <field type="boolean" label="MessageLogging" var="MessageLogging">
            //                    <value>0</value>
            //                </field>
            //                <field type="int32-single" label="ActualMaxRecords" var="ActualMaxRecords">
            //                    <value>3</value>
            //                </field>
            //            </item>
            //            <item>
            //                <field type="hidden" label="JabberID" var="jid">
            //                    <value>test3@localhost</value>
            //                </field>
            //                <field type="text-single" label="User Name" var="UserJIDNode">
            //                    <value>test3</value>
            //                </field>
            //                <field type="text-single" label="Domain" var="UserJIDDomain">
            //                    <value>localhost</value>
            //                </field>
            //                <field type="boolean" label="MessageLogging" var="MessageLogging">
            //                    <value>0</value>
            //                </field>
            //                <field type="int32-single" label="ActualMaxRecords" var="ActualMaxRecords">
            //                    <value>3</value>
            //                </field>
            //            </item>
            //        </x>
            //    </query>
            //</iq>
            private void ProcessSearchIQ(IQ iq)
            {
                agsXMPP.protocol.iq.search.SearchIq searchIq = new SearchIq(IqType.result);
                searchIq.Id = iq.Id;
                searchIq.From = iq.To;
                searchIq.To = this.m_ClientAccount.JID;

                if (iq.Type == IqType.get)
                {
                    searchIq.Query.Instructions = "Fill in a field to search for any matching Jabber User";

                    //  <UserID>test</UserID>
                    //  <UserName>test</UserName>
                    //  <Password>test</Password>
                    //  <Role>0</Role>
                    //  <Privacy></Privacy>
                    //  <Privilege>0</Privilege>

                    Data data = new Data(XDataFormType.form);
                    data.Instructions = "Use this form to search for users in the SiteView MF User Directory.  Use '*' as a wildcard character.";
                    data.Title = "SiteView MF User Directory";

                    searchIq.Query.Data = data;

                    Field field = null;
                    Option option = null;

                    //field = new Field();
                    //field.Type = FieldType.List_Single;
                    //field.Label = "Group";
                    //field.Var = "Group";
                    //field.Description = "Search for Users in the Group";

                    //option = new Option("All", "0");
                    //field.AddOption(option);

                    //option = new Option("SiteView", "1");
                    //field.AddOption(option);

                    //data.AddField(field);

                    field = new Field();
                    field.Type = FieldType.Text_Single;
                    field.Label = "User ID";
                    field.Var = "UserID";
                    field.Description = "User ID to Search for";
                    data.AddField(field);

                    field = new Field();
                    field.Type = FieldType.Text_Single;
                    field.Label = "User Name";
                    field.Var = "UserName";
                    field.Description = "User Name to Search for";
                    data.AddField(field);

                    //searchIq.Query.AddTag("Role");
                    //searchIq.Query.AddTag("Group");
                    //searchIq.Query.AddTag("Privilege");

                }
                else if (iq.Type == IqType.set)
                {
                    Search search = iq.Query as Search;
                    Data xOldData = search.Data;

                    if (xOldData.Type == XDataFormType.submit)
                    {

                        string strUserID = xOldData.GetField("UserID").GetValue();
                        string strUserName = xOldData.GetField("UserName").GetValue();

                        //string strGroup = xOldData.GetField("Group").GetValue();
                        //if (strGroup == "0")
                        //{
                        //    strGroup = string.Empty;
                        //}
                        //else if (strGroup == "1")
                        //{
                        //    strGroup = "SiteView";
                        //}
                        //else
                        //{
                        //    strGroup = null;
                        //}

                        Data data = new Data(XDataFormType.result);
                        data.Title = "UserRecords";

                        searchIq.Query.Data = data;

                        Reported reported = new Reported();
                        data.Reported = reported;

                        Field field = null;

                        field = new Field();
                        field.Type = FieldType.Hidden;
                        field.Label = "Jabber ID";
                        field.Var = "JID";
                        reported.AddField(field);

                        //field = new Field();
                        //field.Type = FieldType.Text_Single;
                        //field.Label = "Group";
                        //field.Var = "Group";
                        //reported.AddField(field);

                        field = new Field();
                        field.Type = FieldType.Text_Single;
                        field.Label = "User ID";
                        field.Var = "UserID";
                        reported.AddField(field);

                        field = new Field();
                        field.Type = FieldType.Text_Single;
                        field.Label = "User Name";
                        field.Var = "UserName";
                        reported.AddField(field);

                        //company........continue....
                        foreach (Account account in this.m_Server.AccountManager.Accounts)
                        {
                            if (account.Type != AccountType.User)
                            {
                                continue;
                            }

                            if (strUserID != null && account.UserID.IndexOf(strUserID) < 0)
                            {
                                continue;
                            }

                            if (strUserName != null && account.UserName.IndexOf(strUserName) < 0)
                            {
                                continue;
                            }

                            //if (strGroup != null && account.Group.IndexOf(strGroup) < 0)
                            //{
                            //    continue;
                            //}

                            Item item = data.AddItem();

                            field = item.AddField();
                            field.Type = FieldType.Hidden;
                            field.Label = "Jabber ID";
                            field.Var = "JID";
                            field.SetValue(account.JID.ToString());

                            //field = item.AddField();
                            //field.Type = FieldType.Text_Single;
                            //field.Label = "Group";
                            //field.Var = "Group";
                            //field.SetValue(account.Group);

                            field = item.AddField();
                            field.Type = FieldType.Text_Single;
                            field.Label = "User ID";
                            field.Var = "UserID";
                            field.SetValue(account.UserID);

                            field = item.AddField();
                            field.Type = FieldType.Text_Single;
                            field.Label = "User Name";
                            field.Var = "UserName";
                            field.SetValue(account.UserName);

                        }
                    }
                }

                Send(searchIq);
            }
コード例 #18
0
ファイル: FormConferention.cs プロジェクト: Khelek/XMPP
 private void addFieldInDataIQ(agsXMPP.protocol.x.data.Data data, string fieldname, string value)
 {
     Field field = new Field();
     field.Var = fieldname;
     agsXMPP.Xml.Dom.Element e = new agsXMPP.Xml.Dom.Element("value", value);
     field.AddChild(e);
     data.AddChild(field);
 }
コード例 #19
0
        private void AddField( string tag )
        {
            string value = _register.GetTag( tag ) ;

            if ( value != null )
            {
                XDataControl control ;

                if ( tag == "password" )
                {
                    control = new XDataSecret() ;
                }
                else if ( tag == "key" )
                {
                    control = new XDataHidden() ;
                }
                else
                {
                    control = new XDataTextBox() ;
                }

                Field field = new Field( tag, TextUtil.ToTitleCase( tag ), FieldType.Text_Single ) ;
                field.IsRequired = false ;
                field.AddValue( value ) ;
                field.Description = tag ;

                control.Field = field ;

                _container.Children.Add( control ) ;
            }
        }
コード例 #20
0
        public void Accept()
        {
            FeatureNeg fNeg = _si.FeatureNeg;

            bool ok = false;

            if (fNeg != null)
            {
                agsXMPP.protocol.x.data.Data data = fNeg.Data;

                if (data != null)
                {
                    Field[] field = data.GetFields();

                    if (field.Length == 1)
                    {
                        Dictionary<string, string> methods = new Dictionary<string, string>();
                        foreach (Option o in field[0].GetOptions())
                        {
                            string val = o.GetValue();
                            methods.Add(val, val);
                        }

                        if (methods.ContainsKey(Uri.BYTESTREAMS))
                        {
                            // supports bytestream, so choose this option
                            SIIq sIq = new SIIq();
                            sIq.Id = _siIq.Id;
                            sIq.To = _siIq.From;
                            sIq.Type = IqType.result;

                            sIq.SI.Id = _si.Id;
                            sIq.SI.FeatureNeg = new FeatureNeg();

                            agsXMPP.protocol.x.data.Data xdata = new agsXMPP.protocol.x.data.Data();
                            xdata.Type = XDataFormType.submit;
                            Field f = new Field();
                            //f.Type = FieldType.List_Single;
                            f.Var = "stream-method";
                            f.AddValue(Uri.BYTESTREAMS);
                            xdata.AddField(f);
                            sIq.SI.FeatureNeg.Data = xdata;

                            _xmppConnection.OnIq += _xmppConnection_OnIq;
                            _xmppConnection.Send(sIq);

                            ok = true;
                        }
                    }
                }
            }

            if (ok)
            {
                State = FileTransferState.WaitingForResponse;
            }
            else
            {
                State = FileTransferState.Error;
                EventErrorFileTransfer transfer =
                    new EventErrorFileTransfer("Error while negotiating file transfer conditions");
                Events.Instance.OnEvent(this, transfer);
            }
        }
コード例 #21
0
        private void SetupSimpleSearch()
        {
            _instructions.Text = _search.Instructions;

            // first name
            if ( _search.Firstname != null )
            {
                _textFirst = new XDataTextBox() ;

                Field fieldUserName = new Field( "firstname", Properties.Resources.Constant_FirstName, FieldType.Text_Single ) ;
                fieldUserName.IsRequired = false ;
                fieldUserName.AddValue( _search.Firstname ) ;
                fieldUserName.Description = Properties.Resources.Constant_EnterFirstNameForSearch ;

                _textFirst.Field = fieldUserName ;

                _container.Children.Add( _textFirst ) ;
            }

            // last name
            if ( _search.Lastname != null )
            {
                _textLast = new XDataTextBox() ;

                Field fieldUserName = new Field( "lastname", Properties.Resources.Constant_LastName, FieldType.Text_Single ) ;
                fieldUserName.IsRequired = false ;
                fieldUserName.AddValue( _search.Lastname ) ;
                fieldUserName.Description = Properties.Resources.Constant_EnterLastNameForSearch ;

                _textLast.Field = fieldUserName ;

                _container.Children.Add( _textLast ) ;
            }

            // nickname
            if ( _search.Nickname != null )
            {
                _textNick = new XDataTextBox() ;

                Field fieldUserName = new Field( "nickname", Properties.Resources.Constant_Nickname, FieldType.Text_Single ) ;
                fieldUserName.IsRequired = false ;
                fieldUserName.AddValue( _search.Nickname ) ;
                fieldUserName.Description = Properties.Resources.Constant_EnterNicknameForSearch ;

                _textNick.Field = fieldUserName ;

                _container.Children.Add( _textNick ) ;
            }

            // email
            if ( _search.Email != null )
            {
                _textEmail = new XDataTextBox() ;

                Field fieldEmail = new Field( "email", Properties.Resources.Constant_Email, FieldType.Text_Single ) ;
                fieldEmail.IsRequired = false ;
                fieldEmail.AddValue( _search.Email ) ;
                fieldEmail.Description = Properties.Resources.Constant_EnterEmailForSearch ;

                _textEmail.Field = fieldEmail ;

                _container.Children.Add( _textEmail ) ;
            }
        }