⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 x6079.htm

📁 Its a xmpp protocol book
💻 HTM
📖 第 1 页 / 共 2 页
字号:
          <offline/>
          <id>M31</id>
        </x>
      &#60;/message&#62;</PRE
></P
><P
>That is, the <TT
CLASS="LITERAL"
>&#60;offline/&#62;</TT
> tag is sent back
to the originator, along with an <TT
CLASS="LITERAL"
>&#60;id/&#62;</TT
> tag
which contains the <TT
CLASS="LITERAL"
>id</TT
> of the message that was stored
offline.</P
><P
><A
HREF="x6079.htm#JABTDG-CH-5A-EX-10"
>Example 5a-5</A
> shows the receipt of a chat message
and the <TT
CLASS="LITERAL"
>&#60;composing/&#62;</TT
> event being raised
as Sabine starts to type her reply.</P
><DIV
CLASS="EXAMPLE"
><A
NAME="JABTDG-CH-5A-EX-10"
></A
><P
><B
>Example 5a-5. Raising and cancelling the <TT
CLASS="LITERAL"
>&#60;composing/&#62;</TT
> evevent</B
></P
><P
>DJ sends a quick chat message to Sabine, and requests that his client
be notified when she starts typing her response.</P
><P
><PRE
CLASS="SCREEN"
>RECV: &#60;message to='sabine@yak/Work' from='dj@yak/home' id='122' type='chat'&#62;
        &#60;body&#62;hey, want a coffee?&#60;/body&#62;
        &#60;thread&#62;ABAF6FC6521546A2B65B19EA391CB72A&#60;/thread&#62;
        &#60;x xmlns='jabber:x:event'&#62;
          &#60;composing/&#62;
        &#60;/x&#62;
      &#60;/message&#62;</PRE
></P
><P
>Sabine starts to type, which fires the
<TT
CLASS="LITERAL"
>&#60;composing/&#62;</TT
> event:</P
><P
><PRE
CLASS="SCREEN"
>SEND: &#60;message from='sabine@yak/Work' to='dj@yak/home'&#62;
        &#60;x xmlns='jabber:x:event'&#62;
          &#60;composing/&#62;
          &#60;id&#62;122&#60;/id&#62;
        &#60;/x&#62;
      &#60;/message&#62;</PRE
></P
><P
>Sabine is distracted, and her client decides she's abandoned the reply,
and sends a cancellation of the
<TT
CLASS="LITERAL"
>&#60;composing/&#62;</TT
> event, containing only the
message <TT
CLASS="LITERAL"
>id</TT
> included when the event was originally raised.</P
><P
><PRE
CLASS="SCREEN"
>SEND: &#60;message from='sabine@yak/Work' to='dj@yak/home'&#62;
        &#60;x xmlns='jabber:x:event'&#62;
          &#60;id&#62;122&#60;/id&#62;
        &#60;/x&#62;
      &#60;/message&#62;</PRE
></P
></DIV
></DIV
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="JABTDG-CH-5A-SECT-3.7"
><TT
CLASS="LITERAL"
>jabber:x:expire</TT
></A
></H2
><P
>The <TT
CLASS="LITERAL"
>jabber:x:expire</TT
> is a simple namespace to
add an 'use by' or 'read by'  stamp to a message. If you wish to send a
message impose a finite lifetime upon it, attach an expiry extension thus:</P
><P
><PRE
CLASS="SCREEN"
>SEND: &#60;message to='piers@pipetree.com' id='M24'&#62;
        &#60;subject&#62;Eccles cakes!&#60;/subject&#62;
        &#60;body&#62;
          I've got some fresh Eccles cakes here, pop
          round for one before they all disappear!
        &#60;/body&#62;
        &#60;x xmlns='jabber:x:expire' seconds='1800'/&#62;
      &#60;/message&#62;</PRE
></P
><P
>If John was not connected when the message was sent, the
<TT
CLASS="LITERAL"
>mod_offline</TT
> module would hold the message ready
for when he reconnects. But before storing it, an extra attribute (<TT
CLASS="LITERAL"
>stored</TT
>) is added with the current
time. <A
HREF="x6079.htm#JABTDG-CH-5A-EX-11"
>Example 5a-6</A
> shows what the relevant section
of John's spool file would look like.</P
><DIV
CLASS="EXAMPLE"
><A
NAME="JABTDG-CH-5A-EX-11"
></A
><P
><B
>Example 5a-6. Storage of an offline message with the <TT
CLASS="LITERAL"
>jabber:x:expire</TT
> extension</B
></P
><P
><PRE
CLASS="SCREEN"
>&#60;foo xmlns='jabber:x:offline' xdbns='jabber:x:offline'&#62;
  &#60;message to='piers@pipetree.com' id='M24' from='dj@pipetree.com/kitchen'&#62;
    &#60;subject&#62;Eccles cakes!&#60;/subject&#62;
    &#60;body&#62;
      I've got some fresh Eccles cakes here, pop
      round for one before they all disappear!
    &#60;/body&#62;
    <TT
CLASS="USERINPUT"
><B
>&#60;x xmlns='jabber:x:expire' seconds='600' stored='993038415'/&#62;</B
></TT
>
    &#60;x xmlns='jabber:x:delay' from='dj@pipetree.com' stamp='20010620T12:00:15'&#62;
      Offline Storage
    &#60;/x&#62;
  &#60;/message&#62;
&#60;/foo&#62;</PRE
></P
></DIV
><P
>When John reconnects, <TT
CLASS="LITERAL"
>mod_offline</TT
> retrieves the message
and compares the current time with the value in the
<TT
CLASS="LITERAL"
>stored</TT
> attribute. If the difference exceeds the
desired lifetime of the message, as specified in the
<TT
CLASS="LITERAL"
>seconds</TT
> attribute, the message is discarded. Otherwise,
the <TT
CLASS="LITERAL"
>seconds</TT
> attribute value is reduced to reflect the
amount of time the message sat in storage, the <TT
CLASS="LITERAL"
>stored</TT
>
attribute is removed, and the message is sent to John.</P
><P
>Furthermore, if John's client supports it, a further check of the message's
lifetime can be made before display, in case the message was stored in an
inbox-style mechanism.
(With John's luck, he probably missed out on the Eccles cake.)</P
></DIV
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="JABTDG-CH-5A-SECT-3.8"
><TT
CLASS="LITERAL"
>jabber:x:oob</TT
></A
></H2
><P
>We've already seen the <TT
CLASS="LITERAL"
>jabber:x:oob</TT
> in action earlier
in the book. It is used in a similar way to its big brother the
<TT
CLASS="LITERAL"
>jabber:iq:oob</TT
> namespace. Attaching URLs to messages,
typically done by mechanisms that delivery news and alert style headines,
is done like this:</P
><P
><PRE
CLASS="SCREEN"
>SEND: &#60;message type='headline' to='qmacro@jabber.org/laptop' id='h12'&#62;
        &#60;subject&#62;Jabber Foundation Public Conference&#60;/subject&#62;
        &#60;x xmlns='jabber:x:oob'&#62;
          &#60;url&#62;
            http://www.jabbercentral.com/news/view.php?news_id=989358658
          &#60;/url&#62;
          &#60;desc&#62;
            Tomorrow, May 9th, a meeting regarding the Jabber
            Foundation will be held.
          &#60;/desc&#62;
        &#60;/x&#62;
      &#60;/message&#62;</PRE
></P
><P
>Multiple attachments can be made to a message.</P
><P
>The RSS Punter, described in <A
HREF="x9016.htm"
>the section called <I
>RSS punter</I
> in Chapter 8</A
> and the
Headline Viewer, described in <A
HREF="x9991.htm"
>the section called <I
>Headline viewer</I
> in Chapter 8</A
> both
use the <TT
CLASS="LITERAL"
>jabber:x:oob</TT
> namespace.</P
></DIV
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="JABTDG-CH-5A-SECT-3.9"
><TT
CLASS="LITERAL"
>jabber:x:roster</TT
></A
></H2
><P
>The <TT
CLASS="LITERAL"
>jabber:x:roster</TT
> namespace is related to its big
brother <TT
CLASS="LITERAL"
>jabber:iq:roster</TT
>; it is used to carry
roster information as message attachments. This makes it straightforward
for users to exchange contact information between themselves:</P
><P
><PRE
CLASS="SCREEN"
>SEND: &#60;message id='M91' to='shiels@jabber.org'&#62;
        &#60;body&#62;Hi Robert - this is that fool I was telling you about...&#60;/body&#62;
        &#60;x xmlns='jabber:x:roster'&#62;
          &#60;item jid='qmacro@jabber.org' name='DJ Adams'&#62;
            &#60;group&#62;Fools&#60;/group&#62;
          &#60;/item&#62;
        &#60;/x&#62;
      &#60;/message&#62;</PRE
></P
><P
>Note that it is inappropriate to send the subscription related attributes
(<TT
CLASS="LITERAL"
>subscription</TT
> and <TT
CLASS="LITERAL"
>ask</TT
>, described
in <A
HREF="x5334.htm#JABTDG-CH-5A-SECT-2.12"
>the section called <I
><TT
CLASS="LITERAL"
>jabber:iq:roster</TT
></I
></A
>). Instead, it is up
to the recipient to negotiate their own presence subscription arrangements
with the contact, or contacts (more than one item can be sent in such an
attachment) listed.</P
></DIV
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="JABTDG-CH-5A-SECT-3.10"
><TT
CLASS="LITERAL"
>jabber:x:signed</TT
></A
></H2
><P
>The <TT
CLASS="LITERAL"
>jabber:x:signed</TT
> namespace is related to the
<TT
CLASS="LITERAL"
>jabber:x:encrypted</TT
> namespace and is used to
stamp <TT
CLASS="LITERAL"
>&#60;presence/&#62;</TT
> and
<TT
CLASS="LITERAL"
>&#60;message/&#62;</TT
> packets with a PKI-based
signature, thus providing reliable identification of the packet
originator.</P
><P
>In generating the signature block, some relevant data must be used
to pass into the signing algorithm so that an electronic signature
is produced.
<A
NAME="AEN6284"
HREF="#FTN.AEN6284"
>[2]</A
>
In the case of <TT
CLASS="LITERAL"
>&#60;presence/&#62;</TT
> packets, the
contents of the <TT
CLASS="LITERAL"
>&#60;status/&#62;</TT
> tag are
used, and in the case of <TT
CLASS="LITERAL"
>&#60;message/&#62;</TT
>
packets, the contents of the <TT
CLASS="LITERAL"
>&#60;body/&#62;</TT
>
tag are used.</P
><P
>The presence of a <TT
CLASS="LITERAL"
>jabber:x:signed</TT
> signature in a
<TT
CLASS="LITERAL"
>&#60;presence/&#62;</TT
> packet is intended to
signify that the client sending the packet supports such PKI
infrastucture and, for example, is able to decrypt messages encrypted
in the <TT
CLASS="LITERAL"
>jabber:x:encrypted</TT
> namespace.</P
><P
>Here's a <TT
CLASS="LITERAL"
>&#60;presence/&#62;</TT
> packet containing
a signature; the data <I
CLASS="EMPHASIS"
>All present and correct</I
> is what
is fed into the algorithm.</P
><P
><PRE
CLASS="SCREEN"
>SEND: &#60;presence from='piers@jabber.org' to='qmacro@pipetree.com'&#62;
  &#60;status&#62;All present and correct&#60;/status&#62;
  &#60;x xmlns='jabber:x:signed'&#62;
    aslkjlksjdf jsfkjk23jskdfskjdfksjdf
  &#60;/x&#62;
&#60;/presence&#62;</PRE
></P
></DIV
></DIV
><H3
CLASS="FOOTNOTES"
>Notes</H3
><TABLE
BORDER="0"
CLASS="FOOTNOTES"
WIDTH="100%"
><TR
><TD
ALIGN="LEFT"
VALIGN="TOP"
WIDTH="5%"
><A
NAME="FTN.AEN6140"
HREF="x6079.htm#AEN6140"
>[1]</A
></TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
WIDTH="95%"
><P
>The filter service is described in
<A
HREF="x1740.htm#JABTDG-CH-4-SECT-4.3.1.3.1"
>the section called <I
>Filter Service</I
> in Chapter 4</A
>.</P
></TD
></TR
><TR
><TD
ALIGN="LEFT"
VALIGN="TOP"
WIDTH="5%"
><A
NAME="FTN.AEN6284"
HREF="x6079.htm#AEN6284"
>[2]</A
></TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
WIDTH="95%"
><P
>Typically, when signing an email message electronically, the body
of the email is passed into the signing algorithm to generate the
signature.</P
></TD
></TR
></TABLE
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="x5334.htm"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="book1.htm"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="x6299.htm"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>The IQ Namespaces</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="c5281.htm"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>The X::IQ relationship</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -