XEP-0297 Message Forwarding with XEP-0313 and XEP-0280

244 views
Skip to first unread message

Michael Bader

unread,
Sep 12, 2013, 1:02:21 PM9/12/13
to sleekxmpp-...@googlegroups.com
I have been looking into implementing MAM and carbon copy which require message forwarding using version 1.1.11.  I investigated a bit and realized that the implementation of these plugins are not up to date with the current spec of XMPP.  In addition I have had difficulty parsing the message objects I receive from these plugins using dictionary wrapper interface and had to create some hack work arounds to get them to work.

I was wondering if there was anything in the pipeline for updating these plugins.  If not I will probably end up updating them myself and would be willing contribute my changes.

Lance Stout

unread,
Sep 12, 2013, 1:20:41 PM9/12/13
to sleekxmpp-...@googlegroups.com
> In addition I have had difficulty parsing the message objects I receive from these plugins using dictionary wrapper interface and had to create some hack work arounds to get them to work.

How so?

> I was wondering if there was anything in the pipeline for updating these plugins. If not I will probably end up updating them myself and would be willing contribute my changes.

I'll go ahead and update them now.

Michael Bader

unread,
Sep 12, 2013, 2:20:38 PM9/12/13
to sleekxmpp-...@googlegroups.com
When I try to get the stanza from within the forwarded portion. I simple get back an empty string.  For instance when looking through a MAM message of the older compatible spec.

<?xml version="1.0" encoding="UTF-8"?>
<message to="mbader.1@ej/14d5d1001b2b11e3bbf6406c8f2cc4bb" from="mam.ej" id="107f527e-1bd6-11e3-84d3-406c8f2cc4bb">
   <result xmlns="urn:xmpp:mam:tmp" queryid="47e92a96-1bd6-11e3-89b9-406c8f2cc4bb-7" id="2013-09-11T11:36:15.008150Z-ejabberd@ej" />
   <forwarded xmlns="urn:xmpp:forward:0">
      <delay xmlns="urn:xmpp:delay" stamp="2013-09-11T11:36:15Z" from="ej" />
      <message to="mbellizzi.1@ej" type="chat" from="mbader.1@ej/14d5d1001b2b11e3bbf6406c8f2cc4bb" id="107f527e-1bd6-11e3-84d3-406c8f2cc4bb" xml:lang="en">
         <body>Test</body>
         <thread>1085be20-1bd6-11e3-84d3-406c8f2cc4bb</thread>
         <domain xmlns="http://imprivata.com/protocol/cortext">mpg.imprivata.com</domain>
         <request xmlns="urn:xmpp:receipts" />
         <content xmlns="http://imprivata.com/protocol/cortext" mime-type="application/x-cortext-directory-information">
            <Status>active</Status>
            <Family_Name>mbader.1</Family_Name>
            <Given_Name>test</Given_Name>
         </content>
      </message>
   </forwarded>
</message>


Message_Forwarded = Message["mam_result"].get_forwarded() #So far so good
Inner_Message = Message.get_stanza() # Returns an empty string

All the interfaces I have tried I have had no success.   The only way I got it to work was through this hack:

Message_Result = Message["mam_result"].get_forwarded().xml

for i in Message_Result:

    Xml = i

import sleekxmpp.stanza

Message = sleekxmpp.stanza.Message(xml=Xml)

Message.namespace = "urn:xmpp:forward:0"

Lance Stout

unread,
Sep 12, 2013, 2:38:52 PM9/12/13
to sleekxmpp-...@googlegroups.com
Ok. I'll look into that.

I just updated the develop branch with what should be the latest versions of the MAM spec.

You should be able to do: msg['mam_result']['forwarded']['stanza']

Michael Bader

unread,
Sep 16, 2013, 1:18:23 PM9/16/13
to sleekxmpp-...@googlegroups.com
Thanks.  Unfortunately I am still having issues with ["stanza"] portion of it (["forwarded] works fine).  Stepping through the code when it iterates through itself to find the (Message, Presence, Iq) there ends up being nothing to iterate through in the case of my message.  Here's the Message["forwarded"] part of the message.  Is something wrong with this message causing ["stanza"] to not work?

<forwarded xmlns="urn:xmpp:forward:0">

   <delay xmlns="urn:xmpp:delay" stamp="2013-09-12T11:40:49Z" from="ej" />
   <message to="mbellizzi.1@ej" type="chat" from="mbader.1@ej/14d5d1001b2b11e3bbf6406c8f2cc4bb" id="0180fafa-1ef3-11e3-87a5-406c8f2cc4bb" xml:lang="en">
      <body>Message1</body>
      <thread>0188f55c-1ef3-11e3-87a5-406c8f2cc4bb</thread>

      <domain xmlns="http://imprivata.com/protocol/cortext">mpg.imprivata.com</domain>
      <request xmlns="urn:xmpp:receipts" />
      <content xmlns="http://imprivata.com/protocol/cortext" mime-type="application/x-cortext-directory-information">
         <Status>active</Status>
         <Family_Name>mbader.1</Family_Name>
         <Given_Name>test</Given_Name>
      </content>
   </message>
</forwarded>

Lance Stout

unread,
Sep 16, 2013, 1:23:43 PM9/16/13
to sleekxmpp-...@googlegroups.com
Ah, ok. Found it.

> <message to="mbellizzi.1@ej" type="chat" from="mbader.1@ej/14d5d1001b2b11e3bbf6406c8f2cc4bb" id="0180fafa-1ef3-11e3-87a5-406c8f2cc4bb" xml:lang="en">

Note that the required xmlns declaration isn't there. So that is {urn:xmpp:forward:0}message, not {jabber:client}message and sleek doesn't recognize it.

Michael Bader

unread,
Sep 16, 2013, 2:06:07 PM9/16/13
to sleekxmpp-...@googlegroups.com
When I send a message out with Sleek Jabber:Client isn't explicitly inserted (it's top level namespace) and as a result isn't in the inner message.  Should the server insert that xmlns declaration or should I tell sleek to add it?

Lance Stout

unread,
Sep 16, 2013, 2:11:29 PM9/16/13
to sleekxmpp-...@googlegroups.com
> When I send a message out with Sleek Jabber:Client isn't explicitly inserted (it's top level namespace) and as a result isn't in the inner message. Should the server insert that xmlns declaration or should I tell sleek to add it?

The xmlns has to be inserted client side. How are you adding the forwarded message?


If I do:

msg['forwarded']['stanza'] = xmpp.Message()

then I get:

<message><forwarded xmlns="urn:xmpp:forward:0"><message xmlns="jabber:client" /></forwarded></message>

Michael Bader

unread,
Sep 16, 2013, 2:32:10 PM9/16/13
to sleekxmpp-...@googlegroups.com
That's good for XEP-0297 since the client would forward the message, but how would I do that with XEP-0313 and XEP-0280?  Since the client is not the one forwarding the message, I don't see how it can be done client side.

Lance Stout

unread,
Sep 16, 2013, 2:33:46 PM9/16/13
to sleekxmpp-...@googlegroups.com
> That's good for XEP-0297 since the client would forward the message, but how would I do that with XEP-0313 and XEP-0280? Since the client is not the one forwarding the message, I don't see how it can be done client side.

Ah. s/client side/sender's side/g

For MAM and carbons, the server is indeed responsible for setting that.

Michael Bader

unread,
Sep 17, 2013, 3:34:11 PM9/17/13
to sleekxmpp-...@googlegroups.com
Alright.  Got it all fixed.  Thank you for your help.
Message has been deleted

Lance Stout

unread,
Sep 17, 2013, 6:42:10 PM9/17/13
to sleekxmpp-...@googlegroups.com
> So MAM is working, but after trying carbon copy I came to the conclusion the current XEP-0280 (Carbon Copy) in sleek isn't up to to the latest version of the spec. Could you update that as well?

Which part in particular isn't up-to-date? I see it's using the right namespace, and is embedding the forwarded stanza data inside of the carbon elements, instead of as a sibling element as in prior versions. Am I overlooking something else?

Michael Bader

unread,
Sep 17, 2013, 7:39:41 PM9/17/13
to sleekxmpp-...@googlegroups.com
So it may not be a spec version, I may have jumped the gun.  I am having trouble getting into the carbon_sent portion (returning None).  The server sends out this Message.

<message xmlns="jabber:client" from="mbader.1@ej" to="mbader.1@ej/14d5d1001b2b11e3bbf6406c8f2cc4bb" type="chat">
   <sent xmlns="urn:xmpp:carbons:2">

      <forwarded xmlns="urn:xmpp:forward:0">

         <message xml:lang="en" to="mbellizzi.1@ej" type="chat" id="e0945dba-1ff0-11e3-900f-bc52b73f175b">
            <body>Tech</body>
            <thread>ecf8dc80-1fe5-11e3-bcc8-406c8f2cc4bb</thread>

            <domain xmlns="http://imprivata.com/protocol/cortext">mpg.imprivata.com</domain>
            <request xmlns="urn:xmpp:receipts" />
            <content xmlns="http://imprivata.com/protocol/cortext" mime-type="application/x-cortext-directory-information">
               <Status>active</Status>
               <Family_Name>mbader.1</Family_Name>
               <Given_Name>test</Given_Name>
            </content>

            <delay xmlns="urn:xmpp:delay" from="ej" stamp="2013-09-17T23:29:48Z" />
         </message>
      </forwarded>
   </sent>
</message>
but for some reason all sleek is giving me is this:
<message to="mbader.1@ej/14d5d1001b2b11e3bbf6406c8f2cc4bb" from="mbader.1@ej" type="chat">
   <sent xmlns="urn:xmpp:carbons:2">

      <forwarded xmlns="urn:xmpp:forward:0">

         <message to="mbellizzi.1@ej" type="chat" xml:lang="en" id="e0945dba-1ff0-11e3-900f-bc52b73f175b">
            <body>Tech</body>
            <thread>ecf8dc80-1fe5-11e3-bcc8-406c8f2cc4bb</thread>

            <domain xmlns="http://imprivata.com/protocol/cortext">mpg.imprivata.com</domain>
            <request xmlns="urn:xmpp:receipts" />
            <content xmlns="http://imprivata.com/protocol/cortext" mime-type="application/x-cortext-directory-information">
               <Status>active</Status>
               <Family_Name>mbader.1</Family_Name>
               <Given_Name>test</Given_Name>
            </content>

            <delay xmlns="urn:xmpp:delay" stamp="2013-09-17T23:29:48Z" from="ej" />
         </message>
      </forwarded>
   </sent>
</message>
For some reason the outer namespace is being removed by Sleek.  Without that, I can't use ["carbon_sent"], so I am unable to get the inner message.  Is there something wrong with the message being sent out?

Lance Stout

unread,
Sep 17, 2013, 7:53:12 PM9/17/13
to sleekxmpp-...@googlegroups.com
In the message your server sent it has:

<forwarded xmlns="urn:xmpp:forward:0">
<message xml:lang="en" to="mbellizzi.1@ej" type="chat" id="e0945dba-1ff0-11e3-900f-bc52b73f175b">

which is missing the xmlns for that forwarded message. Looks like a similar issue that you had with MAM.

Michael Bader

unread,
Sep 17, 2013, 7:55:08 PM9/17/13
to sleekxmpp-...@googlegroups.com
Yeah I just noticed looking that over.  Thought I fixed it for both but I guess I only did it for one.  Will fix it thanks.
Reply all
Reply to author
Forward
0 new messages