<?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:media="http://search.yahoo.com/mrss/"
>

<channel>
	<title>Yabfog &#187; xmpp</title>
	<atom:link href="http://yabfog.com/blog/tag/xmpp/feed" rel="self" type="application/rss+xml" />
	<link>http://yabfog.com/blog</link>
	<description>Yet another blog full of gas</description>
	<lastBuildDate>Tue, 17 Apr 2012 18:51:03 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
<cloud domain='yabfog.com' port='80' path='/blog/?rsscloud=notify' registerProcedure='' protocol='http-post' />
		<item>
		<title>XMPP vCard Python Script</title>
		<link>http://yabfog.com/blog/2009/06/03/xmpp-vcard-python-script</link>
		<comments>http://yabfog.com/blog/2009/06/03/xmpp-vcard-python-script#comments</comments>
		<pubDate>Wed, 03 Jun 2009 16:39:31 +0000</pubDate>
		<dc:creator>Dan</dc:creator>
				<category><![CDATA[uncategorized]]></category>
		<category><![CDATA[gtalk]]></category>
		<category><![CDATA[jabber]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[vcard]]></category>
		<category><![CDATA[xmpp]]></category>

		<guid isPermaLink="false">http://yabfog.com/blog/?p=231</guid>
		<description><![CDATA[Couldn't find a script to update my Jabber/XMPP vCard photo (a/k/a avatar), so I wrote one. It requires xmpppy (a/k/a python-xmpp). It should work with gTalk, but I have not tested it. Credit to pastebin for some code snippets. Hope this saves someone some time and effort. #!/usr/bin/python '''vcard.py - Update your XMPP vcard photo [...]]]></description>
			<content:encoded><![CDATA[<p>Couldn't find a script to update my Jabber/XMPP vCard photo (a/k/a avatar), so I wrote one. It requires xmpppy (a/k/a python-xmpp). It should work with gTalk, but I have not tested it.</p>
<p>Credit to <a href="http://en.pastebin.ca/1237241">pastebin</a> for some code snippets.</p>
<p>Hope this saves someone some time and effort.</p>
<pre>
#!/usr/bin/python
'''vcard.py - Update your XMPP vcard photo with the image you provide

Usage: vcard.py image_file jid password
'''

from xmpp import JID, Client, Iq, Presence, NS_VERSION, NS_VCARD
import sys
import os
import time
from base64 import encode, decode
from hashlib import sha1

try:
    file=os.path.expanduser(sys.argv[1])
    jid=sys.argv[2]
    password=sys.argv[3]
    resource='vcard'
except:
    print >>sys.stderr, __doc__
    sys.exit(2)

NS_VCARD_UPDATE = 'vcard-temp:x:update'
NS_NICK = 'http://jabber.org/protocol/nick'

def hash_img(img):
    return sha1(img).hexdigest()

def base64_img(img):
    return img.encode('base64')

def get_img(file):
    try:
        os.stat(file)[6]
        fh = open(file, 'rb')
        img = fh.read()
        return img
    except Exception, e:
        print >>sys.stderr, e
        sys.exit(2)

def get_mime_type(file):
    try:
        ext = file[-4:]
        if ext == '.png':
            mime_type = 'image/png'
        elif ext == '.gif':
            mime_type = 'image/gif'
        elif ext == '.jpg' or ext == '.jpeg':
            mime_type = 'image/jpeg'
        else:
            raise ValueError, "Wrong mime-type detected. Check file suffix."
    except ValueError, e:
        print >>sys.stderr, e
        sys.exit(2)
    return mime_type

def send_vcard(conn, base64_img, mime_type, nick):
    iq_vcard = Iq(typ='set')
    vcard = iq_vcard.addChild(name='vCard', namespace=NS_VCARD)
    vcard.addChild(name='NICKNAME', payload=[nick])
    photo = vcard.addChild(name='PHOTO')
    photo.setTagData(tag='TYPE', val=mime_type)
    photo.setTagData(tag='BINVAL', val=base64_img)
    conn.send(iq_vcard)

def send_presence(conn, status, hash1, nick):
    presence = Presence(status = status, show = 'xa', priority = '-1')
    presence.setTag(name='x',namespace=NS_VCARD_UPDATE).setTag(name='photo',namespace=NS_VCARD_UPDATE).setData(hash1)
    presence.setTag(name='nick',namespace=NS_NICK).setData(nick)
    conn.send(presence)

if __name__ == '__main__':
    img = get_img(file)
    j=JID(jid)
    cl=Client(j.getDomain(),debug=[])
    conn=cl.connect()
    if not conn:
        raise Exception, 'failed to start connection'
    auth=cl.auth(j.getNode(),password,resource,sasl=1)
    if not auth:
        raise Exception, 'could not authenticate'
    send_vcard(cl, base64_img(img), get_mime_type(file), j.getNode())
    send_presence(cl, 'Updated vCard Image', hash_img(img), j.getNode())
    time.sleep(1)
    cl.disconnect()
</pre>
]]></content:encoded>
			<wfw:commentRss>http://yabfog.com/blog/2009/06/03/xmpp-vcard-python-script/feed</wfw:commentRss>
		<slash:comments>8</slash:comments>
	
	</item>
		<item>
		<title>Itch Scratched</title>
		<link>http://yabfog.com/blog/2008/12/30/itch-scratched</link>
		<comments>http://yabfog.com/blog/2008/12/30/itch-scratched#comments</comments>
		<pubDate>Wed, 31 Dec 2008 00:07:42 +0000</pubDate>
		<dc:creator>Dan</dc:creator>
				<category><![CDATA[uncategorized]]></category>
		<category><![CDATA[nntp]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[twitter]]></category>
		<category><![CDATA[xmpp]]></category>

		<guid isPermaLink="false">http://danmactough.posterous.com/itch-scratched</guid>
		<description><![CDATA[Ah... feels so good to scratch that itch. Python, nntp, twitter, xmpp.]]></description>
			<content:encoded><![CDATA[<p>Ah... feels so good to scratch that itch. Python, nntp, twitter, xmpp.
</p>
<p><a href='http://posterous.com/getfile/files.posterous.com/danmactough/lrFBEgjXDePtLegLowkFUBJAeKDJE2OIL7lPinZtiFHnBltlufU43dUq2j9B/subping01.png'><img src="http://posterous.com/getfile/files.posterous.com/danmactough/fvi9QoHrLn1hHOCHLyxzJx3ydaFa0uEkWquKbVNjyY56djvdE3ntgUVvCeyO/subping01.png.scaled.500.jpg" width="500" height="315"/></a></p>
]]></content:encoded>
			<wfw:commentRss>http://yabfog.com/blog/2008/12/30/itch-scratched/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:thumbnail url="http://posterous.com/getfile/files.posterous.com/danmactough/fvi9QoHrLn1hHOCHLyxzJx3ydaFa0uEkWquKbVNjyY56djvdE3ntgUVvCeyO/subping01.png.scaled.500.jpg" />
		<media:content url="http://posterous.com/getfile/files.posterous.com/danmactough/fvi9QoHrLn1hHOCHLyxzJx3ydaFa0uEkWquKbVNjyY56djvdE3ntgUVvCeyO/subping01.png.scaled.500.jpg" medium="image" />
	</item>
		<item>
		<title>Twitter-Speak at BearHugCamp</title>
		<link>http://yabfog.com/blog/2008/09/12/twitter-speak-at-bearhugcamp</link>
		<comments>http://yabfog.com/blog/2008/09/12/twitter-speak-at-bearhugcamp#comments</comments>
		<pubDate>Fri, 12 Sep 2008 19:03:52 +0000</pubDate>
		<dc:creator>Dan</dc:creator>
				<category><![CDATA[uncategorized]]></category>
		<category><![CDATA[bot]]></category>
		<category><![CDATA[twitter]]></category>
		<category><![CDATA[xmpp]]></category>

		<guid isPermaLink="false">http://yabfog.com/wp/?p=202</guid>
		<description><![CDATA[After a fairly testy exchange at BearHugCamp this morning among Steve Gillmor, Dustin Sallings (twitterspy and IdentiSpy bot creator), a few audience members and the guys at Twitter, Alex Payne actually gave a very clear statement about the lengths to which Twitter was willing to go to aide developers in building upon and extending Twitter. [...]]]></description>
			<content:encoded><![CDATA[<p>After a fairly testy exchange at <a href="http://www.microblog.org/wiki/BearHugCamp">BearHugCamp</a> this morning among <a href="http://identi.ca/stevegillmor">Steve Gillmor</a>, <a href="http://identi.ca/dustin">Dustin Sallings</a> (twitterspy and IdentiSpy bot creator), a few audience members and the guys at <a href="http://twitter.com">Twitter</a>, <a href="http://twitter.com/al3x">Alex Payne</a> actually gave a very clear statement about the lengths to which Twitter was willing to go to aide developers in building upon and extending Twitter.</p>
<p>If you need to poll the API more frequently that the API limits allow, email Alex and chances are very good that you can be accommodated. Ditto regarding something Alex referred to as a "research project" involving a data-mining feed -- presumably, this is like a customized (or perhaps random) fraction of the full public timeline firehose.</p>
<p>As for the full public timeline firehose via XMPP: "That would require a business discussion."</p>
<p>My Twitter bot works just fine for me, but Dustin is actually trying to provide a service to people other than himself, so he needs more cooperation from Twitter. Based on what Alex said, it seems that Dustin and others who are working on various bots to bring back the "track" feature via IM should be able to do so.</p>
<p>As for the "official" return of "track" and IM -- don't hold your breath.</p>
]]></content:encoded>
			<wfw:commentRss>http://yabfog.com/blog/2008/09/12/twitter-speak-at-bearhugcamp/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
	</item>
		<item>
		<title>XMPP and Google Apps for Domains</title>
		<link>http://yabfog.com/blog/2008/07/02/xmpp-and-google-apps-for-domains</link>
		<comments>http://yabfog.com/blog/2008/07/02/xmpp-and-google-apps-for-domains#comments</comments>
		<pubDate>Thu, 03 Jul 2008 03:43:00 +0000</pubDate>
		<dc:creator>Dan</dc:creator>
				<category><![CDATA[uncategorized]]></category>
		<category><![CDATA[dns]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[googletalk]]></category>
		<category><![CDATA[tips]]></category>
		<category><![CDATA[xmpp]]></category>

		<guid isPermaLink="false">http://yabfog.com/wp/?p=191</guid>
		<description><![CDATA[Jesus, my head hurts. I setup xmpppy on my box, thinking I could quickly set up a bot to run as one of my Google Apps for Domains users. I've spent about six or seven hours (off and on) getting this to work, though, because the documentation from Google about setting up my DNS configuration [...]]]></description>
			<content:encoded><![CDATA[<p>Jesus, my head hurts.</p>
<p>I setup <a href="http://xmpppy.sourceforge.net/">xmpppy</a> on my box, thinking I could quickly set up a bot to run as one of my <a href="https://www.google.com/a/">Google Apps for Domains</a> users. I've spent about six or seven hours (off and on) getting this to work, though, because the <a href="http://www.google.com/support/a/bin/answer.py?answer=60227&#038;hl=en">documentation from Google about setting up my DNS configuration</a> is incomplete. Thanks a lot!!! Like DNS isn't difficult enough for amateurs.</p>
<p>After many searches, I finally found <a href="http://forum.meebo.com/viewtopic.php?p=101956&#038;sid=1f51c6dea800c7b64c0ef558a86edf5b#p101956">the magic incantation</a>, so here it is for posterity, in case that link disappears:</p>
<p><code>_xmpp-server._tcp.YOURDOMAIN.TLD.	3600	IN	SRV	5	0	5269	xmpp-server.l.google.com.<br />
_xmpp-server._tcp.YOURDOMAIN.TLD.	3600	IN	SRV	20	0	5269	xmpp-server1.l.google.com.<br />
_xmpp-server._tcp.YOURDOMAIN.TLD.	3600	IN	SRV	20	0	5269	xmpp-server2.l.google.com.<br />
_xmpp-server._tcp.YOURDOMAIN.TLD.	3600	IN	SRV	20	0	5269	xmpp-server3.l.google.com.<br />
_xmpp-server._tcp.YOURDOMAIN.TLD.	3600	IN	SRV	20	0	5269	xmpp-server4.l.google.com.<br />
_jabber._tcp.YOURDOMAIN.TLD.	3600	IN	SRV	5	0	5269	xmpp-server.l.google.com.<br />
_jabber._tcp.YOURDOMAIN.TLD.	3600	IN	SRV	20	0	5269	xmpp-server1.l.google.com.<br />
_jabber._tcp.YOURDOMAIN.TLD.	3600	IN	SRV	20	0	5269	xmpp-server2.l.google.com.<br />
_jabber._tcp.YOURDOMAIN.TLD.	3600	IN	SRV	20	0	5269	xmpp-server3.l.google.com.<br />
_jabber._tcp.YOURDOMAIN.TLD.	3600	IN	SRV	20	0	5269	xmpp-server4.l.google.com.<br />
_xmpp-client._tcp.YOURDOMAIN.TLD.	3600	IN	SRV	5	0	5222	talk.l.google.com.<br />
_xmpp-client._tcp.YOURDOMAIN.TLD.	3600	IN	SRV	20	0	5222	talk1.l.google.com.<br />
_xmpp-client._tcp.YOURDOMAIN.TLD.	3600	IN	SRV	20	0	5222	talk2.l.google.com.<br />
_xmpp-client._tcp.YOURDOMAIN.TLD.	3600	IN	SRV	20	0	5222	talk3.l.google.com.<br />
_xmpp-client._tcp.YOURDOMAIN.TLD.	3600	IN	SRV	20	0	5222	talk4.l.google.com.<br />
</code></p>
<p><strong>N.B.</strong> Those trailing periods at the end of the domain names may or may not be necessary, depending on how you update your DNS records. For example, GoDaddy inserted them for me. YMMV.</p>
]]></content:encoded>
			<wfw:commentRss>http://yabfog.com/blog/2008/07/02/xmpp-and-google-apps-for-domains/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
	
	</item>
	</channel>
</rss>

