我試圖使用Strophe發送html消息到muc房間。我也嘗試通過Psi中的XML控制檯發送以下xml,但它不起作用,只顯示Hello World。信息節有什麼問題嗎?使用Strophe在muc房間發送XHTML消息
<message to="[email protected]" type="groupchat"><body>Hello World </body><html xmlns="http://jabber.org/protocols/xhtml-im"><body xmlns="http://www.w3.org/1999/xhtml"><p style="color : red">Hello HTML World</p></body></html></message>
謝謝!
編輯1:迪斯科#信息房間查詢。我使用的是真空IM,Psi和客戶端現在,但幽應該支持XHTML-IM(http://psi-im.org/wiki/Supported_Protocols)
<iq xmlns="jabber:client" from="[email protected]" type="result" id="foo" to="[email protected]/Vacuum-IM">
<query xmlns="http://jabber.org/protocol/disco#info">
<identity xmlns="http://jabber.org/protocol/disco#info" category="conference" type="text" name="room"/>
<feature xmlns="http://jabber.org/protocol/disco#info" var="http://jabber.org/protocol/muc"/>
<feature xmlns="http://jabber.org/protocol/disco#info" var="muc_public"/>
<feature xmlns="http://jabber.org/protocol/disco#info" var="muc_open"/>
<feature xmlns="http://jabber.org/protocol/disco#info" var="muc_moderated"/>
<feature xmlns="http://jabber.org/protocol/disco#info" var="muc_semianonymous"/>
<feature xmlns="http://jabber.org/protocol/disco#info" var="muc_unsecured"/>
<feature xmlns="http://jabber.org/protocol/disco#info" var="muc_persistent"/>
<feature xmlns="http://jabber.org/protocol/disco#info" var="http://jabber.org/protocol/disco#info"/>
<x xmlns="jabber:x:data" type="result">
<field xmlns="jabber:x:data" type="hidden" var="FORM_TYPE">
<value xmlns="jabber:x:data">http://jabber.org/protocol/muc#roominfo</value>
</field>
<field xmlns="jabber:x:data" label="Description" var="muc#roominfo_description">
<value xmlns="jabber:x:data">asdf</value>
</field>
<field xmlns="jabber:x:data" label="Subject" var="muc#roominfo_subject">
<value xmlns="jabber:x:data"/>
</field>
<field xmlns="jabber:x:data" label="Number of occupants" var="muc#roominfo_occupants">
<value xmlns="jabber:x:data">1</value>
</field>
<field xmlns="jabber:x:data" label="Creation date" var="x-muc#roominfo_creationdate">
<value xmlns="jabber:x:data">20120423T17:31:49</value>
</field>
</x>
</query>
EDIT2:響應消息節
<message xmlns="jabber:client" from="[email protected]/ad" type="groupchat" to="[email protected]/Vacuum-IM">
<body xmlns="jabber:client">Hello World </body>
<html xmlns="http://jabber.org/protocols/xhtml-im">
<body xmlns="http://www.w3.org/1999/xhtml">
<p xmlns="http://www.w3.org/1999/xhtml" style="color : red">Hello HTML World</p>
</body>
</html>
編輯3:對mu#流量查詢的迴應
<iq xmlns="jabber:client" from="[email protected]" type="error" id="foo" to="[email protected]/Vacuum-IM">
<query xmlns="http://jabber.org/protocol/disco#info" node="http://jabber.org/protocol/muc#traffic"/>
<error xmlns="jabber:client" type="cancel" code="404">
<item-not-found xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"/>
</error>
Edit4:幽響應客戶端(功能)的disco#info(XHTML-IM是最後一個)
<iq xmlns="jabber:client" from="[email protected]/Kostyas-MacBook-Pro" type="result" to="[email protected]/Vacuum-IM" id="foo">
<query xmlns="http://jabber.org/protocol/disco#info">
<identity xmlns="http://jabber.org/protocol/disco#info" category="client" type="pc" name="Psi"/>
<feature xmlns="http://jabber.org/protocol/disco#info" var="http://jabber.org/protocol/bytestreams"/>
<feature xmlns="http://jabber.org/protocol/disco#info" var="http://jabber.org/protocol/si"/>
<feature xmlns="http://jabber.org/protocol/disco#info" var="http://jabber.org/protocol/si/profile/file-transfer"/>
<feature xmlns="http://jabber.org/protocol/disco#info" var="http://jabber.org/protocol/disco#info"/>
<feature xmlns="http://jabber.org/protocol/disco#info" var="http://jabber.org/protocol/commands"/>
<feature xmlns="http://jabber.org/protocol/disco#info" var="http://jabber.org/protocol/rosterx"/>
<feature xmlns="http://jabber.org/protocol/disco#info" var="http://jabber.org/protocol/muc"/>
<feature xmlns="http://jabber.org/protocol/disco#info" var="jabber:x:data"/>
<feature xmlns="http://jabber.org/protocol/disco#info" var="urn:xmpp:jingle:1"/>
<feature xmlns="http://jabber.org/protocol/disco#info" var="urn:xmpp:jingle:transports:ice-udp:1"/>
<feature xmlns="http://jabber.org/protocol/disco#info" var="urn:xmpp:jingle:apps:rtp:1"/>
<feature xmlns="http://jabber.org/protocol/disco#info" var="urn:xmpp:jingle:apps:rtp:audio"/>
<feature xmlns="http://jabber.org/protocol/disco#info" var="http://jabber.org/protocol/chatstates"/>
<feature xmlns="http://jabber.org/protocol/disco#info" var="http://jabber.org/protocol/mood+notify"/>
<feature xmlns="http://jabber.org/protocol/disco#info" var="http://jabber.org/protocol/tune+notify"/>
<feature xmlns="http://jabber.org/protocol/disco#info" var="http://jabber.org/protocol/physloc+notify"/>
<feature xmlns="http://jabber.org/protocol/disco#info" var="http://jabber.org/protocol/geoloc+notify"/>
<feature xmlns="http://jabber.org/protocol/disco#info" var="http://www.xmpp.org/extensions/xep-0084.html#ns-metadata+notify"/>
<feature xmlns="http://jabber.org/protocol/disco#info" var="http://jabber.org/protocol/xhtml-im"/>
</query>
Edit5:解決方法:獲取的iChat和Adium :-) Adium以不同的顏色和字體發送xhtml消息,但它不顯示它自己做了什麼。只有iChat正確呈現xhtml。所以組合起作用。也不要使用p標籤,顏色應該是十六進制格式。例如:
<message xmlns="jabber:client" type="groupchat" to="[email protected]">
<body xmlns="jabber:client">Hello World</body>
<html xmlns="http://jabber.org/protocol/xhtml-im">
<body xmlns="http://www.w3.org/1999/xhtml">
<span xmlns="http://www.w3.org/1999/xhtml" style="font-family: Times New Roman; font-size: large; color: #FF0000;">Red text</span>
</body>
</html>
其實Psi應該支持xhtml-im(xep-0071)http://psi-im.org/wiki/Supported_Protocols。響應中有一個html體。請參閱問題中的Edit2。謝謝! – user1054134 2012-04-26 09:52:13