<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	
	xmlns:georss="http://www.georss.org/georss"
	xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#"
	>

<channel>
	<title>xmpp &#8211; Squix &#8211; TechBlog</title>
	<atom:link href="https://blog.squix.org/tag/xmpp/feed" rel="self" type="application/rss+xml" />
	<link>https://blog.squix.org</link>
	<description></description>
	<lastBuildDate>Sun, 17 Apr 2016 07:56:49 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.5.8</generator>
<site xmlns="com-wordpress:feed-additions:1">121913304</site>	<item>
		<title>Sending XMPP messages from Google App Engine with html</title>
		<link>https://blog.squix.org/2011/02/sending-xmpp-messages-from-google-app.html</link>
					<comments>https://blog.squix.org/2011/02/sending-xmpp-messages-from-google-app.html#comments</comments>
		
		<dc:creator><![CDATA[Daniel Eichhorn]]></dc:creator>
		<pubDate>Fri, 18 Feb 2011 17:13:00 +0000</pubDate>
				<category><![CDATA[Common]]></category>
		<category><![CDATA[GAE]]></category>
		<category><![CDATA[Google App Engine]]></category>
		<category><![CDATA[xhtml-im]]></category>
		<category><![CDATA[xmpp]]></category>
		<guid isPermaLink="false">http://blog.squix.org/2011/02/18/sending-xmpp-messages-from-google-app/</guid>

					<description><![CDATA[Since this took me a while to figure out I&#8217;d like to share with you. I wanted to extend Feederator to send incoming news items to the users XMPP client. What worked pretty fast was sending plain text messages: XMPPService xmpp = XMPPServiceFactory.getXMPPService(); JID jid ... <p><a class="read-more btn btn-secondary" href="https://blog.squix.org/2011/02/sending-xmpp-messages-from-google-app.html">Read More</a></p>]]></description>
										<content:encoded><![CDATA[<div dir="ltr" style="text-align: left;" trbidi="on">
<div dir="ltr" style="text-align: left;" trbidi="on">Since this took me a while to figure out I&#8217;d like to share with you. I wanted to extend Feederator to send incoming news items to the users XMPP client. What worked pretty fast was sending plain text messages:</p>
<p></p>
<div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;">XMPPService xmpp = XMPPServiceFactory.getXMPPService();</div>
<div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;">JID jid = new JID(xmppAddress);</div>
<div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;">
</div>
<div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;">Message msg = new MessageBuilder()</div>
<div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;">&nbsp;&nbsp; &nbsp;.withRecipientJids(jid)</div>
<div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;">&nbsp;&nbsp; &nbsp;.withMessageType(MessageType.CHAT)</div>
<div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;">&nbsp;&nbsp; &nbsp;.withBody(&#8220;New post arrived&#8221;)</div>
<div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;">&nbsp;&nbsp; &nbsp;.build();</div>
<div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;">
</div>
<div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"></div>
<div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;">if (xmpp.getPresence(jid).isAvailable()) {</div>
<div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;">&nbsp;&nbsp; &nbsp;SendResponse status = xmpp.sendMessage(msg);</div>
<div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;">&nbsp;&nbsp; &nbsp;messageSent = (status.getStatusMap().get(jid) == SendResponse.Status.SUCCESS);</div>
<div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;">&nbsp;&nbsp; &nbsp;if (messageSent) {</div>
<div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;Log.info(&#8220;message sent&#8221;);</div>
<div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;">&nbsp;&nbsp; &nbsp;}</div>
<div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;">}</div>
<p></p>
<div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;">
</div>
<div dir="ltr" style="text-align: left;" trbidi="on">But to send parts of the message bold and maybe even displaying pictures was trickier. But I finally figured it out. Change the part with the message:</div>
<div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;">
</div>
<div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;"></div>
<div style="font: normal normal normal 11px/normal Monaco; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">String message = &#8220;&lt;body&gt;Plain text message&lt;/body&gt;&#8221;</div>
<div style="font: normal normal normal 11px/normal Monaco; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"></div>
<div style="color: #5000ff; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;">&nbsp;&nbsp; + &#8220;&lt;html xmlns=&#8217;http://jabber.org/protocol/xhtml-im&#8217;&gt;&#8221;</div>
<div style="color: #5000ff; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;">&nbsp;&nbsp; + &#8220;&lt;body xmlns=&#8217;http://www.w3.org/1999/xhtml&#8217;&gt;&#8221;</div>
<div style="color: #5000ff; font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;">&nbsp;&nbsp; + &#8220;&lt;B&gt;bold text&lt;/B&gt;&nbsp;and normal text&#8221;</div>
<div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;">&nbsp;&nbsp; + &#8220;&lt;/body&gt;&#8221;</div>
<div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;">&nbsp;&nbsp; + &#8220;&lt;/html&gt;&#8221;;</div>
<div style="font: 11.0px Monaco; margin: 0.0px 0.0px 0.0px 0.0px;">
</div>
<div style="font: normal normal normal 11px/normal Monaco; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">Message msg =&nbsp;new&nbsp;MessageBuilder()<br />
&nbsp;&nbsp; .withRecipientJids(jid)</div>
<div style="font: normal normal normal 11px/normal Monaco; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">&nbsp;&nbsp; .withMessageType(MessageType.CHAT)</div>
<div style="font: normal normal normal 11px/normal Monaco; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">&nbsp;&nbsp; .withBody(message)</div>
<div style="font: normal normal normal 11px/normal Monaco; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">&nbsp;&nbsp; .asXml(true);</div>
<div style="font: normal normal normal 11px/normal Monaco; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">&nbsp;&nbsp; .build();</div>
</div>
<div dir="ltr" style="text-align: left;" trbidi="on">By adding the .asXml(true) parameter you tell the XMPP service that you take care yourself of the content of the message. Pay attention to the fact that you always should send a normal  elment for the plain text. Not all XMPP/ Jabber clients unterstand the xhtml-im extension. The specification (http://xmpp.org/extensions/xep-0071.html) says that the plain text should always tell the same as the element with markup and that clients are free to ignore the xhtml-im tag. Also note that clients are free to display the text defined by the alt attribute of a &lt;img&gt; tag and not the picture.</div>
<p>
</div>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.squix.org/2011/02/sending-xmpp-messages-from-google-app.html/feed</wfw:commentRss>
			<slash:comments>3</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">96</post-id>	</item>
	</channel>
</rss>
