Subject: Ways to Create new Iq
First off thanks again for the help.
I have the server set up to automatically archive any messages that pass through, and now I want to allow the client to retrieve their messages. I realize that there’s xep-0136 for this, but now I want to make a iq to retrieve them using your library. From looking at your tutorial, you can create a class that inherits XmppXElement, and then stick that in a a class that inherits from iq. However, if possible I would prefer to just build it as a string, and then just send it with IqFilter.SendIq. Is there a way to do this?
That being said, I do think it would be possible to do it the way you show in the tutorial however, I'm not quite sure how to go from xml code snippet below to the class set up, although I did make a rough attempt at it. Regardless the class format seems drawn out for such a small snippet of code.
My question, what ways are there to create a new Iq?
XML Code I want to Send:
C# Code to create new Iq:
I have the server set up to automatically archive any messages that pass through, and now I want to allow the client to retrieve their messages. I realize that there’s xep-0136 for this, but now I want to make a iq to retrieve them using your library. From looking at your tutorial, you can create a class that inherits XmppXElement, and then stick that in a a class that inherits from iq. However, if possible I would prefer to just build it as a string, and then just send it with IqFilter.SendIq. Is there a way to do this?
That being said, I do think it would be possible to do it the way you show in the tutorial however, I'm not quite sure how to go from xml code snippet below to the class set up, although I did make a rough attempt at it. Regardless the class format seems drawn out for such a small snippet of code.
My question, what ways are there to create a new Iq?
XML Code I want to Send:
- <iq type='get' id='page1'>
- <retrieve xmlns='urn:xmpp:archive'
- with='juliet@capulet.com/chamber'
- start='1469-07-21T02:56:15Z'>
- <set xmlns='http://jabber.org/protocol/rsm'>
- <max>100</max>
- </set>
- </retrieve>
- </iq>
C# Code to create new Iq:
- using Matrix.Xml;
- namespace Example
- {
- public class Set: XmppXElement
- {
- public Set() : base("http://jabber.org/protocol/rsm")
- {
- }
- public int Max
- {
- get { return GetTagInt("max"); }
- set { SetTag("max", value); }
- }
- }
- public class Retrieve: XmppXElement
- {
- public Retrieve() : base("urn:xmpp:", "archive")
- {
- }
- public string With
- {
- get { return GetTag("with"); }
- set { SetTag("zip", value); }
- }
- public string Start
- {
- get { return GetTag("zip"); }
- set { SetTag("start", value); }
- }
- public Set Set
- {
- get { return GetTag("set"); }
- set { SetTag("set", value); }
- }
- }
- public class RetrieveIq : Iq
- {
- public RetrieveIq()
- {
- GenerateId();
- }
- public Retrieve Retrieve
- {
- get { return Element<Retrieve>(); }
- set { Replace(value); }
- }
- }
- }