Skip to content

Commit

Permalink
Added jabber service
Browse files Browse the repository at this point in the history
  • Loading branch information
koke committed May 19, 2008
1 parent 9346aec commit e177d60
Show file tree
Hide file tree
Showing 174 changed files with 20,848 additions and 1 deletion.
16 changes: 16 additions & 0 deletions docs/jabber
@@ -0,0 +1,16 @@
Jabber
======

Install Notes
-------------

1. user is the Jabber ID (e.g.: myusername@gmail.com)

Developer Notes
---------------

data
- user

payload
- refer to docs/github_payload
2 changes: 1 addition & 1 deletion github-services.rb
@@ -1,5 +1,5 @@
$:.unshift *Dir["#{File.dirname(__FILE__)}/vendor/**/lib"]
%w( rack sinatra tinder twitter json net/http net/https socket timeout xmlrpc/client openssl ).each { |f| require f }
%w( rack sinatra tinder twitter json net/http net/https socket timeout xmlrpc/client openssl xmpp4r xmpp4r-simple ).each { |f| require f }

module GitHub
def service(name, &block)
Expand Down
23 changes: 23 additions & 0 deletions services/jabber.rb
@@ -0,0 +1,23 @@
JABBER_USER = "github-services@jabber.org"
JABBER_PASSWORD = "g1thub"

service :jabber do |data, payload|
repository = payload['repository']['name']
branch = payload['ref'].split('/').last
recipient = data['user']
puts "*** Connecting" if $DEBUG
im = Jabber::Simple.new(JABBER_USER, JABBER_PASSWORD)

# Accept any friend request
im.accept_subscriptions = true

payload['commits'].each do |sha1, commit|
puts "*** Sending commit #{sha1[0..6]}" if $DEBUG
im.deliver recipient, <<EOM
#{repository}: #{commit['author']['name']} #{branch} SHA1-#{sha1[0..6]}"
#{commit['message']}
#{commit['url']}
EOM
end
end
340 changes: 340 additions & 0 deletions vendor/xmpp4r-0.3.2/COPYING

Large diffs are not rendered by default.

50 changes: 50 additions & 0 deletions vendor/xmpp4r-0.3.2/ChangeLog
@@ -0,0 +1,50 @@
XMPP4R 0.3.2 (15/10/2007)
=========================
* Serious bug involving Ruby threading fixed (caused exceptions with
ruby 1.8.6)
* vCard helper fixes
* Jabber RPC (JEP0009) support
* HTTP Binding (JEP0124) support
* Publish-Subscribe support
* XMPPElement: a framework for classes representing XML elements
* Ad-hoc commands support
* Improvements to Dataforms: XData, XDataTitle and XDataInstructions

XMPP4R 0.3.1 (23/04/2007)
=========================
* SASL fixes
* Message#x and Presence#x support element selection by namespace
* Proper XML entity escaping for REXML text nodes
* Improvements to FileTransfer::Helper and SOCKS5BytestreamsServer
* Vcard::Helper fixes
* Update Digest module usage to reflect recent Ruby versions
* More documentation

XMPP4R 0.3 (20/07/2006)
=======================
* SRV lookup capability in Client#connect
* Stringprep support for JIDs
* TLS & SASL support
* Basic Dataforms support
* Multi-User Chat Helpers
* Helpers for File-Transfer, SOCKS5 Bytestreams, In-Band Bytestreams
* Roster helper has modified subscription-request semantics (see Roster#add_subscription_request_callback)
* A lot of features have renamed namespaces (see UPDATING file)

XMPP4R 0.2 (20/10/2005)
=======================
* Workarounds for REXML bugs.
* Presences are now Comparable according to priority or interest
* fixed a serious bug in Stream#send which caused some lockups. Reported by
chunlinyao@gmail.com.
* Moved REXML::Element#add to REXML::Element#typed_add to keep add accessible
* Rewritten Roster helper
* Added Vcard helper and improved IqVcard
* XMLStanza id generator
* Support for Roster Item Exchange (JEP-0093 and JEP-0144)
* Client#password= to change client's account password
* Documentation fixes

XMPP4R 0.1 (12/09/2005)
=======================
* first public release.
59 changes: 59 additions & 0 deletions vendor/xmpp4r-0.3.2/LICENSE
@@ -0,0 +1,59 @@
XMPP4R is copyrighted free software by Lucas Nussbaum
<lucas@lucas-nussbaum.net>, Stephan Maka <astro@spaceboyz.net>, and others.
You can redistribute it and/or modify it under either the terms of the GPL (see
COPYING file), or the conditions below:

1. You may make and give away verbatim copies of the source form of the
software without restriction, provided that you duplicate all of the
original copyright notices and associated disclaimers.

2. You may modify your copy of the software in any way, provided that
you do at least ONE of the following:

a) place your modifications in the Public Domain or otherwise
make them Freely Available, such as by posting said
modifications to Usenet or an equivalent medium, or by allowing
the author to include your modifications in the software.

b) use the modified software only within your corporation or
organization.

c) rename any non-standard executables so the names do not conflict
with standard executables, which must also be provided.

d) make other distribution arrangements with the author.

3. You may distribute the software in object code or executable
form, provided that you do at least ONE of the following:

a) distribute the executables and library files of the software,
together with instructions (in the manual page or equivalent)
on where to get the original distribution.

b) accompany the distribution with the machine-readable source of
the software.

c) give non-standard executables non-standard names, with
instructions on where to get the original software distribution.

d) make other distribution arrangements with the author.

4. You may modify and include the part of the software into any other
software (possibly commercial). But some files in the distribution
are not written by the author, so that they are not under this terms.

They are gc.c(partly), utils.c(partly), regex.[ch], st.[ch] and some
files under the ./missing directory. See each file for the copying
condition.

5. The scripts and library files supplied as input to or produced as
output from the software do not automatically fall under the
copyright of the software, but belong to whomever generated them,
and may be sold commercially, and may be aggregated with this
software.

6. THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE.

28 changes: 28 additions & 0 deletions vendor/xmpp4r-0.3.2/README
@@ -0,0 +1,28 @@
XMPP4R
----------
by:
Lucas Nussbaum <lucas@lucas-nussbaum.net>
Stephan Maka <stephan@spaceboyz.net>
Kirill A. Shutemov <k.shutemov@gmail.com>
Yuki Mitsui
Peter Schrammel
Olli
Vojtech Vobr
Andreas Wiese

Currently, all the information is provided on

http://home.gna.org/xmpp4r/

The integrated HTML documentation can be built with

rake rdoc

If you need to ask questions, feel free to ask them on the
xmpp4r-devel@gna.org mailing list. When reporting problems,
please include a protocol dump which can be enabled with:
Jabber::debug = true

XMPP4R is released under the Ruby license (see the LICENSE file), which is
compatible with the GNU GPL (see the COPYING file) via an explicit
dual-licensing clause.
40 changes: 40 additions & 0 deletions vendor/xmpp4r-0.3.2/UPDATING
@@ -0,0 +1,40 @@
Updating from XMPP4R 0.2 to 0.3
===============================


There has been a redesign process in the development of XMPP4R 0.3. If
you encounter any problems, read the following instructions.


1) All extension libraries have different paths and namespaces:

Roster:
require 'xmpp4r/roster'
Jabber::Helpers::Roster -> Jabber::Roster::Helper

Multi-User Chat:
require 'xmpp4r/muc'
Jabber::Helpers::MUCBrowser -> Jabber::MUC::MUCBrowser
Jabber::Helpers::MUCClient -> Jabber::MUC::MUCClient
Jabber::Helpers::SimpleMUCClient -> Jabber::MUC::SimpleMUCClient

Software Version:
require 'xmpp4r/version'
Jabber::Helpers::Version -> Jabber::Version::SimpleResponder

vCard:
require 'xmpp4r/vcard'
Jabber::Helpers::Vcard -> Jabber::Vcard::Helper

Bytestreams:
require 'xmpp4r/bytestreams'
Jabber::Helpers::FileTransfer -> Jabber::FileTransfer::Helper

For a complete list of new class names see test/tc_class_names.rb


2) add_*_callback methods do not accept procs anymore. procs maybe
instead passed with the & sign.

Example: client.add_message_callback(&my_message_handler)

@@ -0,0 +1,57 @@
What is this?

This is an example of what you can do with XMPP4R. It is a conferencing
component in which you can walk around, travel to various places, look
at things and talk to other visitors on the same places. If you like
Multi-User Dungeons (MUDs) this is for you!

---

How does it work?

The component loads a few worlds from a few XML files. Each world is a
component. Once joined the chat will tell you what you can do. Remember
that you can get a command listing anytime by saying '?'.

Reading 'You can go north, west' you may say 'go north' to go in the
northern direction and 'go west' to go in the western direction. You'll
then find yourself at some other place but still in the same MUC
conference. Your groupchat roster will change as you'll notice different
people and things that are just in the same place, not other places.

Before starting to hack the scripts you may want to take a look at
tower.xml. Note that users are <thing/>s, too and the whole world could
be serialized back to XML by just issuing "world.to_s".

Please note that the code, especially the error handling, is of extreme
poor quality and was mostly written in one afternoon. If I'm going to
develop this further everything should be rewritten...

---

How to try?

Because this is a component you are going to need your own Jabber
Daemon - which you'll need anyways if you're going to experiment with
XMPP4R. ;-)

Syntax:
./adventure.rb <JID> <Password> <Host>

Example:
./adventure.rb mud.example.com geheimnis localhost

---

Messages seem to have random order?

I don't know any solution for this. One may add short delays between
messages, but that would only be a very dirty hack.

RFC3920:

"10. Server Rules for Handling XML Stanzas

Compliant server implementations MUST ensure in-order processing of
XML stanzas between any two entities."

@@ -0,0 +1,23 @@
#!/usr/bin/ruby

$:.unshift '../../lib'

require 'xmpp4r'
require 'xmpp4r/discovery'
require 'xmpp4r/muc/x/muc'

require 'adventuremuc'


#Jabber::debug = true

if ARGV.size != 3
puts "Syntax: ./adventure.rb <JID> <Password> <Host>"
puts "See README for further help"
exit
end

muc = AdventureMUC::new(Jabber::JID::new(ARGV[0]), ARGV[1], ARGV[2])
muc.add_world('tower.xml')
muc.add_world('cube.xml')
Thread.stop

0 comments on commit e177d60

Please sign in to comment.