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

📄 c7982.htm

📁 Its a xmpp protocol book
💻 HTM
字号:
<HTML
><HEAD
><TITLE
>Extending Messages, Groupchat, Components, and Event Models</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.64
"><LINK
REL="HOME"
TITLE="Programming Jabber"
HREF="book1.htm"><LINK
REL="UP"
TITLE="Putting Jabber's Concepts to Work"
HREF="p3608.htm"><LINK
REL="PREVIOUS"
TITLE="Presence-sensitive CVS notification"
HREF="x7499.htm"><LINK
REL="NEXT"
TITLE="Keyword assistant"
HREF="x8004.htm"></HEAD
><BODY
CLASS="CHAPTER"
BGCOLOR="#FFFFFF"
TEXT="#000000"
LINK="#0000FF"
VLINK="#840084"
ALINK="#0000FF"
><DIV
CLASS="NAVHEADER"
><TABLE
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>Programming Jabber</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="x7499.htm"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="x8004.htm"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="CHAPTER"
><H1
><A
NAME="JABTDG-CH-8"
>Chapter 8. Extending Messages, Groupchat, Components, and Event Models</A
></H1
><DIV
CLASS="TOC"
><DL
><DT
><B
>Table of Contents</B
></DT
><DT
><A
HREF="c7982.htm#JABTDG-CH-8-SECT-INTRO"
></A
></DT
><DT
><A
HREF="x8004.htm"
>Keyword assistant</A
></DT
><DT
><A
HREF="x8561.htm"
>Any coffee left?</A
></DT
><DT
><A
HREF="x9016.htm"
>RSS punter</A
></DT
><DT
><A
HREF="x9991.htm"
>Headline viewer</A
></DT
></DL
></DIV
><DIV
CLASS="SECT1"
><H1
CLASS="SECT1"
><A
NAME="JABTDG-CH-8-SECT-INTRO"
></A
></H1
><P
>At this stage, we've got a good idea of how scripts interact with Jabber,
and how the core elements such as <TT
CLASS="LITERAL"
>&#60;message/&#62;</TT
>
and <TT
CLASS="LITERAL"
>&#60;presence/&#62;</TT
> can be constructed
and handled.</P
><P
>This Chapter builds upon what we've already seen in the 
previous one, and introduces new concepts. We build a nosey assistant that
joins a conference room and alerts us to words and phrases that we want it
to listen for. There are two popular conference protocols; the assistant
recipe, a foray into the world of 'bots, takes a look at the original
presence-based one.
<A
NAME="AEN7990"
HREF="#FTN.AEN7990"
>[1]</A
></P
><P
>Programming within Jabber's event model is, as we've seen, straightforward.
What happens when you want to meld other components with event models of
their own? We look at a couple of typical scenarios where this melding 
needs to happen. The first is a homage to the Trojan Room Coffee Machine,
<A
NAME="AEN7995"
HREF="#FTN.AEN7995"
>[2]</A
>
where we give life, or at least presence, to a coffee pot,
using LEGO Mindstorms. The second is an RSS headline viewer that uses
Tk, which has an event loop of its own.</P
><P
>We also look at extending messages, and build a mechanism that "punts"
RSS headlines to clients who register with that mechanism. These headlines
are carried using an extended message type.</P
><P
>In fact, the RSS punter mechanism is a <I
CLASS="EMPHASIS"
>component</I
>.
The three recipes in the
previous Chapter were Jabber <I
CLASS="EMPHASIS"
>clients</I
>, in that they
connected to the Jabber network via the JSM (Jabber Session Manager) service.
We look at the differences between programming a client and programming
a component in this Chapter, and build a complete component that can be
queried and interacted with the third of Jabber's building blocks&mdash;the
<TT
CLASS="LITERAL"
>&#60;iq/&#62;</TT
> element.</P
><P
>Happy coding!</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.AEN7990"
HREF="c7982.htm#AEN7990"
>[1]</A
></TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
WIDTH="95%"
><P
>The other uses the <TT
CLASS="LITERAL"
>jabber:iq:conference</TT
> namespace
described in <A
HREF="x5334.htm#JABTDG-CH-5A-SECT-2.6"
>the section called <I
><TT
CLASS="LITERAL"
>jabber:iq:conference</TT
></I
> in Chapter 5a</A
>.</P
></TD
></TR
><TR
><TD
ALIGN="LEFT"
VALIGN="TOP"
WIDTH="5%"
><A
NAME="FTN.AEN7995"
HREF="c7982.htm#AEN7995"
>[2]</A
></TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
WIDTH="95%"
><P
>Famously the first "device" to be reachable over the Web, at
<A
HREF="http://www.cl.cam.ac.uk/coffee/coffee.html"
TARGET="_top"
>http://www.cl.cam.ac.uk/coffee/coffee.html</A
>.</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="x7499.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="x8004.htm"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>Presence-sensitive CVS notification</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="p3608.htm"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>Keyword assistant</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>

⌨️ 快捷键说明

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