Not logged in. · Lost password · Register
Forum: MatriX and XmppDotNet RSS
Avatar
joelhess #1
Member since Dec 2016 · 6 posts
Group memberships: Members
Show profile · Link to this post
Subject: Enabling Message Carbons
Good day,

I'm trying to figure out the proper way to enable Message Carbons via the Xamarin SDK. I'm running the following code during the OnBind Event.

  1. var carbon = new IqQuery<Matrix.Xmpp.MessageCarbons.Enable>() { Type = Matrix.Xmpp.IqType.Set };
  2. _reconnectWrapper.Client.IqFilter.SendIq(carbon, Client_OnIq);

I see the server receive the request, but no response is sent back to the client. Is there a specific point in the sequence that this should happen?
From the server:
  1. 00:26:35.089 [debug] Received XML on stream = <<"<iq id=\"MX_3\" type=\"set\"><enable xmlns=\"urn:xmpp:carbons:2\" />   </iq>">>

I can confirm the server reports the capability and that other clients can use it.

Any help would be appreciated.

Thanks!
This post was edited on 2016-12-02, 15:27 by Alex.
Avatar
Alex #2
Member since Feb 2003 · 4449 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Your code looks fine.
You should not send it before your resource is assigned. I would sent it after you get returned the initial presence from the server (OnInitialPresence).

Alex
Avatar
joelhess #3
Member since Dec 2016 · 6 posts
Group memberships: Members
Show profile · Link to this post
Thanks Alex,

Playing around with it a little bit, I moved it after OnRosterEnd, and it seemed to work.

Joel
Avatar
Alex #4
Member since Feb 2003 · 4449 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
ya, should be good as well. You need to have a resource assigned which happens after resource binding.

Alex
Avatar
joelhess #5
Member since Dec 2016 · 6 posts
Group memberships: Members
Show profile · Link to this post
In reply to post #3
Follow up... I get the carbon messages now, and am parsing it apart.

Here's the message...
  1.  <message from="JID" to="JID" xmlns="jabber:client" type="chat">
  2.    <sent xmlns="urn:xmpp:carbons:2">
  3.      <forwarded xmlns="urn:xmpp:forward:0">
  4.        <message from="RESOURCE..." id="6c2126bc-20b8-4a33-b921-d2556fe923d6" to="resouce" type="chat" xmlns="jabber:client">
  5.          <body>blarg</body>
  6.        </message>
  7.      </forwarded>
  8.    </sent>
  9.  </message>

Here's my parsing...
  1.  
  2. if (e.Message.FirstXmppXElement is ForwardContainer)
  3. {
  4. var container = (ForwardContainer) e.Message.FirstXmppXElement;
  5. if (container.Forwarded != null)
  6. {
  7. //ProcessMessage....
  8. }

The forwarded object is coming up null. I can traverse the nodes to get at the message, but just wondering if I'm missing something.
Avatar
Alex #6
Member since Feb 2003 · 4449 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
looks like there was a change in this XEP since we implemented it. Its still not final and went through many revisions.
In the current code a namespace in Matrix is different. We have fixed this and will make it available soon with over NuGet.

Iuntil we publish new packages you can just overwrite the namespace in the Factory with the following code:

  1. RegisterElement<Xmpp.MessageCarbons.Forwarded>  (Namespaces.Forward, "forwarded");

Alex
Close Smaller – Larger + Reply to this post:
Verification code: VeriCode Please enter the word from the image into the text field below. (Type the letters only, lower case is okay.)
Smileys: :-) ;-) :-D :-p :blush: :cool: :rolleyes: :huh: :-/ <_< :-( :'( :#: :scared: 8-( :nuts: :-O
Special characters: