public FileTransfer(XmppClientConnection XmppCon, Jid m_To) { m_XmppCon = XmppCon; SIIq iq = new SIIq(); iq.To = m_To; iq.Type = IqType.set; m_lFileLength = new FileInfo(@"c:\\ping.txt").Length; agsXMPP.protocol.extensions.filetransfer.File file; file = new agsXMPP.protocol.extensions.filetransfer.File(Path.GetFileName(@"c:\\ping.txt"), 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); }
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); }