[standards-jig] XHTML-IM (JEP-0071) and in-band images

Richard Dobson richard at dobson-i.net
Fri Jan 16 11:37:36 UTC 2004


----- Original Message ----- 
>From: "Tomasz Sterna" <tomek at smoczy.net>
To: <standards-jig at jabber.org>
Sent: Friday, January 16, 2004 10:30 AM
Subject: Re: [standards-jig] XHTML-IM (JEP-0071) and in-band images


> Richard Dobson wrote:
>
> >http://www.jabber.org/wiki/index.php/XHTML%20Inband%20Images?version=4
> >Comments?
> >
> >
> Looks nice and simple. :-)
> Good work Richard.
>
>
> XMPP-CORE:
> 9.2.3 IQ Semantics
>   Info/Query, or IQ, is a request-response mechanism [...]
> [...]
>   4. An entity that receives an IQ request of type "get" or "set" MUST
> reply with an IQ response of type "result" or "error" [...]
>
> So we need to add an iq-response.
>
> I also do not really like the attribute "hash". It should explain what
> the value is, not the technology used to generate it.

I used "hash" because it matches up with the "hash" value of the file in the
file transfer protocol, so I think it should be kept as hash e.g.

<iq type='set' id='offer1' to='receiver at jabber.org/resource'>
  <si xmlns='http://jabber.org/protocol/si'
      id='a0'
      mime-type='text/plain'
      profile='http://jabber.org/protocol/si/profile/file-transfer'>
    <file xmlns='http://jabber.org/protocol/si/profile/file-transfer'
          name='test.txt'
          size='1022'
          hash='552da749930852c69ae5d2141d3766b1'
          date='1969-07-21T02:56:15Z'/>
    <feature xmlns='http://jabber.org/protocol/feature-neg'>
      <x xmlns='jabber:x:data' type='form'>
        <field var='stream-method' type='list-single'>

<option><value>http://jabber.org/protocol/bytestreams</value></option>
          <option><value>http://jabber.org/protocol/ibb</value></option>
        </field>
      </x>
    </feature>
  </si>
</iq>

This shows where I got it from, so since it is "hash" here I think it should
stay the same.

> It could be any identifier as long, as the sender of the image is able
> to distinguish which file reciever wants.
> I also think it belongs to the text field, not the attribute (similiary
> to the OOB protocol).

I dont see any need to put the value into a sub node, it serves no real
purpose and unnecessarily increases the byte size of the xml.

> It's more natural and extensible this way.
>
> I would like to rewrite it as:
>
> <message type='chat' from='src at example.com/client' to='dest at example.com'>
>     <body>Hello mate :-)</body>
>     <html xmlns='http://jabber.org/protocol/xhtml-im'>
>         <body xmlns='http://www.w3.org/1999/xhtml'>
>             Hello mate <img src='cid:123456789'/>
>         </body>
>     </html>
>     <obj xmlns='http://jabber.org/protocol/iobj' cid='123456789'>
>         <fileid>552da749930852c69ae5d2141d3766b1</fileid>
>     </obj>
> </message>

What I was thinking about to simplify things is to possibly put the hash
value as the cid e.g.

<message type='chat' from='src at example.com/client' to='dest at example.com'>
    <body>Hello mate :-)</body>
    <html xmlns='http://jabber.org/protocol/xhtml-im'>
        <body xmlns='http://www.w3.org/1999/xhtml'>
            Hello mate <img src='cid:552da749930852c69ae5d2141d3766b1'/>
        </body>
    </html>
    <obj xmlns='http://jabber.org/protocol/iobj'
cid='552da749930852c69ae5d2141d3766b1'/>
</message>

And have the request like this, this keeps it nice and simple, and is
extensible because we can then create more top level iq requests using the
same namespace, which means we can add more features if necessary very
easily.

<iq type='set' from='dest at example.com/res' to='src at example.com/client'
id='iobj1'>
    <get xmlns='http://jabber.org/protocol/iobj'
cid='552da749930852c69ae5d2141d3766b1'/>
</iq>

And response like this

<iq type='result' from='src at example.com/client' to='dest at example.com/res'
id='iobj1'/>

As extra protocol you might want might be something to retrieve further info
about the file.

<iq type='get' from='dest at example.com/res' to='src at example.com/client'
id='iobj2'>
    <info xmlns='http://jabber.org/protocol/iobj'
cid='552da749930852c69ae5d2141d3766b1'/>
</iq>

With a response of

<iq type='result' from='dest at example.com/res' to='src at example.com/client'
id='iobj2'>
    <info xmlns='http://jabber.org/protocol/iobj'
cid='552da749930852c69ae5d2141d3766b1'>
        <type>image/gif</mime-type>
        <size>123432</size>
        <pixels>12x12</pixels>
    </info>
</iq>

Another extra protocol you might want could be thumbnail request for large
images, so you can implement image transfer like in MSN6 and display small
thumbnails in the chat window so a person can get a glace of what they are
accepting before they accept.

<iq type='get' from='dest at example.com/res' to='src at example.com/client'
id='iobj3'>
    <thumb xmlns='http://jabber.org/protocol/iobj'
cid='552da749930852c69ae5d2141d3766b1'/>
</iq>

And responds with a list of the available thumbs for that image, which you
can then in turn request.

<iq type='result' from='src at example.com/client' to='dest at example.com/res'
id='iobj3'>
    <thumb xmlns='http://jabber.org/protocol/iobj'>
        <cid pixels='10x30'
type='image/gif'>322da749930852c69ae5d4141d3866c1</cid>
        <cid pixels='10x30'
type='image/jpeg'>122da749930852c45ae5d4141d3866a1</cid>
    </thumb>
</iq>

> and the iq-type is more like 'set' to initiate the action, not to 'get'
> some information in 'result' response

Yea "set" does seem to be more correct.

> also changed the child of the iq set to <query/> element and added the
> resources in from/to.

It should definately stay as "get" and not "query", it simplifies it and
allows it to be more extensible to have the action you are performing be the
node name, using query is not a requirement in jabber iq protocols and is up
to the protocol dev if they have a valid reason for it not to be.

> 2. Reciever Initiates Request-Response:
>
> <iq type='set' from='dest at example.com/res' to='src at example.com/client'
> id='iobj1'>
>     <query xmlns='http://jabber.org/protocol/iobj'>
>         <fileid>552da749930852c69ae5d2141d3766b1</fileid>
>     </query>
> </iq>
>
> 3. Sender Acknowledges:
>
> <iq type='result' from='src at example.com/client'
> to='dest at example.com/res' id='iobj1'/>

Yup seems ok

> (or Informs Sender of Failure, like with OOB)

Yup

> 4. Sender Initiates a File Transfer (JEP-0096)

Yup

Richard




More information about the Standards mailing list