<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DZone Snippets: chat code</title>
    <link>http://snippets.dzone.com/posts</link>
    <pubDate>Thu, 24 Jul 2008 08:56:55 GMT</pubDate>
    <description>DZone Snippets: chat code</description>
    <item>
      <title>[Ruby] Script/bot to send MediaWiki Recent Changes over UDP to a Campfire room</title>
      <link>http://snippets.dzone.com/posts/show/5037</link>
      <description>Requires the Tinder gem, and PHP on the server running MediaWiki must be compiled with --enable-sockets. The computer running the bot will also have to be open to the web - it can't be behind a firewall.&lt;br /&gt;&lt;br /&gt;First, add this code to your MediaWiki LocalSettings.php, replacing the IP address with the IP of the server/computer running the bot, and the port to whatever you want to use (probably something above 40,000, but it's up to you):&lt;br /&gt;&lt;code&gt;&lt;br /&gt;$wgRC2UDPAddress = '69.178.6.244';&lt;br /&gt;$wgRC2UDPPort = '41895';&lt;br /&gt;$wgRC2UDPPrefix = "";&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Now, you can run the bot! This is extremely hackish, because the retarded collective-mailing-list-coding system of the MediaWiki repos has somehow managed to code IRC color codes directly into their exported strings (at least with MediaWiki 1.2alpha, which is what I'm running right now).&lt;br /&gt;You'll need to replace the new tinder definition with your subdomain on Campfire, the username and password with ones for the bot account you've created on your campfire room, and the room name with the room you want the updates to be sent to.&lt;br /&gt;&lt;code&gt;&lt;br /&gt;require 'rubygems'&lt;br /&gt;require 'tinder'&lt;br /&gt;require 'socket'&lt;br /&gt;puts 'Dependencies loaded...'&lt;br /&gt;&lt;br /&gt;campfire = Tinder::Campfire.new 'subdomain'&lt;br /&gt;campfire.login 'email@domain.com', 'password'&lt;br /&gt;exit unless room = campfire.find_room_by_name('Case Sensitive Room Name')&lt;br /&gt;puts 'Campfire logged in...'&lt;br /&gt;&lt;br /&gt;server = UDPSocket.new&lt;br /&gt;exit unless server.bind('0.0.0.0', 41895)&lt;br /&gt;puts 'Socket listening...'&lt;br /&gt;&lt;br /&gt;loop do&lt;br /&gt;  msg = server.recv(2048).gsub(/\003[\d]{0,2}/,'').chomp&lt;br /&gt;  print "sending to room: #{msg.inspect}..."&lt;br /&gt;  exit unless room.speak msg.to_s&lt;br /&gt;  puts ' sent!'&lt;br /&gt;end&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Sat, 26 Jan 2008 14:29:08 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/5037</guid>
      <author>elliottcable (elliott cable)</author>
    </item>
    <item>
      <title>How to send IM jabber message to google chat using python and xmppy</title>
      <link>http://snippets.dzone.com/posts/show/3986</link>
      <description>// From http://www.franklinmint.fm/blog/archives/000603.html&lt;br /&gt;// This works with version xmpppy-0.4.0.win32.exe from http://xmpppy.sourceforge.net/&lt;br /&gt;&lt;code&gt;&lt;br /&gt;import sys,xmpp&lt;br /&gt;&lt;br /&gt;# Google Talk constants&lt;br /&gt;FROM_GMAIL_ID = "user@gmail.com"&lt;br /&gt;GMAIL_PASS = "password"&lt;br /&gt;GTALK_SERVER = "talk.google.com"&lt;br /&gt;TO_GMAIL_ID = "user@gmail.com"&lt;br /&gt;&lt;br /&gt;jid=xmpp.protocol.JID(FROM_GMAIL_ID)&lt;br /&gt;cl=xmpp.Client(jid.getDomain(),debug=[])&lt;br /&gt;if not cl.connect((GTALK_SERVER,5222)):&lt;br /&gt;    raise IOError('Can not connect to server.')&lt;br /&gt;if not cl.auth(jid.getNode(),GMAIL_PASS):&lt;br /&gt;    raise IOError('Can not auth with server.')&lt;br /&gt;&lt;br /&gt;cl.send( xmpp.Message( "someone@gmail.com" ,"Hi" ) )&lt;br /&gt;cl.disconnect()&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Thu, 10 May 2007 21:55:22 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/3986</guid>
      <author>mellerbeck (Michael Ellerbeck)</author>
    </item>
  </channel>
</rss>
