Subject: Analysis of file transfer request generated by PSI
I sniffed the message below, which is the first message in a successful file transfer scenario, from the PSI client application registered to the amessage.info server. While trying to reproduce this message using the agsXMPP library I hit the following problems:
1) I could not find an IQ or Element class that represented the "<si" part of the message. Do I need to create this by myself
2) I could not correctly format the option element of the field in the feature negotiation part of the message the same way PSI does it.
I have attached my best coding attempt at the bottom of this post, what am I missing?
Thanks in advance for your help,
Regards,
Simon
Message Produced By PSI
<iq
type="set"
to="chemda@amessage.info/Psi"
id="aad9a" >
<si
xmlns="http://jabber.org/protocol/si"
profile="http://jabber.org/protocol/si/profile/file-transfer"
id="s5b_35831f0457633023" >
<file
xmlns="http://jabber.org/protocol/si/profile/file-transfer"
size="3168"
name="astrike.log" >
<desc>1212</desc>
<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>
Best Attempt at Code
agsXMPP.protocol.extensions.filetransfer.File file =
new agsXMPP.protocol.extensions.filetransfer.File();
agsXMPP.protocol.extensions.featureneg.FeatureNeg featureNeg =
new agsXMPP.protocol.extensions.featureneg.FeatureNeg();
file.Name = "astrike.log";
file.Size = 3168;
file.Description = "Test File";
IQ ftiq = new IQ(IqType.set);
ftiq.To = new Jid("chemda@amessage.info/Psi");
featureNeg.Data = new Data(agsXMPP.protocol.x.data.XDataFormType.form);
Field field = new Field();
field.Type = FieldType.List_Single;
field.Var = "stream-method";
Option option = new Option();
option.Value = "http://jabber.org/protocol/bytestreams";
field.AddOption(option);
featureNeg.Data.AddField(field);
ftiq.AddChild(file);
ftiq.AddChild(featureNeg);
this.XmppCon.Send(ftiq);
Message Produced By this Code
<iq
xmlns="jabber:client"
type="set"
to="chemda@amessage.info/Psi">
<file
xmlns="http://jabber.org/protocol/si/profile/file-transfer"
name="astrike.log"
size="3168">
<desc>Test File</desc>
</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>
</iq>
1) I could not find an IQ or Element class that represented the "<si" part of the message. Do I need to create this by myself
2) I could not correctly format the option element of the field in the feature negotiation part of the message the same way PSI does it.
I have attached my best coding attempt at the bottom of this post, what am I missing?
Thanks in advance for your help,
Regards,
Simon
Message Produced By PSI
<iq
type="set"
to="chemda@amessage.info/Psi"
id="aad9a" >
<si
xmlns="http://jabber.org/protocol/si"
profile="http://jabber.org/protocol/si/profile/file-transfer"
id="s5b_35831f0457633023" >
<file
xmlns="http://jabber.org/protocol/si/profile/file-transfer"
size="3168"
name="astrike.log" >
<desc>1212</desc>
<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>
Best Attempt at Code
agsXMPP.protocol.extensions.filetransfer.File file =
new agsXMPP.protocol.extensions.filetransfer.File();
agsXMPP.protocol.extensions.featureneg.FeatureNeg featureNeg =
new agsXMPP.protocol.extensions.featureneg.FeatureNeg();
file.Name = "astrike.log";
file.Size = 3168;
file.Description = "Test File";
IQ ftiq = new IQ(IqType.set);
ftiq.To = new Jid("chemda@amessage.info/Psi");
featureNeg.Data = new Data(agsXMPP.protocol.x.data.XDataFormType.form);
Field field = new Field();
field.Type = FieldType.List_Single;
field.Var = "stream-method";
Option option = new Option();
option.Value = "http://jabber.org/protocol/bytestreams";
field.AddOption(option);
featureNeg.Data.AddField(field);
ftiq.AddChild(file);
ftiq.AddChild(featureNeg);
this.XmppCon.Send(ftiq);
Message Produced By this Code
<iq
xmlns="jabber:client"
type="set"
to="chemda@amessage.info/Psi">
<file
xmlns="http://jabber.org/protocol/si/profile/file-transfer"
name="astrike.log"
size="3168">
<desc>Test File</desc>
</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>
</iq>