smackr 0.0.1-universal-java-1.6
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/.gitignore +49 -0
- data/.rvmrc +2 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +15 -0
- data/LICENSE.txt +31 -0
- data/README.rdoc +22 -0
- data/Rakefile +1 -0
- data/lib/java/smack.jar +0 -0
- data/lib/java/smackx.jar +0 -0
- data/lib/smackr.rb +16 -0
- data/lib/smackr/chat.rb +43 -0
- data/lib/smackr/main.rb +0 -0
- data/lib/smackr/version.rb +3 -0
- data/smackr.gemspec +25 -0
- data/test/helper.rb +18 -0
- data/test/test_smackr.rb +7 -0
- metadata +67 -0
data/.document
ADDED
data/.gitignore
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
# rcov generated
|
2
|
+
coverage
|
3
|
+
coverage.data
|
4
|
+
|
5
|
+
# rdoc generated
|
6
|
+
rdoc
|
7
|
+
|
8
|
+
# yard generated
|
9
|
+
doc
|
10
|
+
.yardoc
|
11
|
+
|
12
|
+
# bundler
|
13
|
+
.bundle
|
14
|
+
|
15
|
+
# jeweler generated
|
16
|
+
pkg
|
17
|
+
|
18
|
+
# Have editor/IDE/OS specific files you need to ignore? Consider using a global gitignore:
|
19
|
+
#
|
20
|
+
# * Create a file at ~/.gitignore
|
21
|
+
# * Include files you want ignored
|
22
|
+
# * Run: git config --global core.excludesfile ~/.gitignore
|
23
|
+
#
|
24
|
+
# After doing this, these files will be ignored in all your git projects,
|
25
|
+
# saving you from having to 'pollute' every project you touch with them
|
26
|
+
#
|
27
|
+
# Not sure what to needs to be ignored for particular editors/OSes? Here's some ideas to get you started. (Remember, remove the leading # of the line)
|
28
|
+
#
|
29
|
+
# For MacOS:
|
30
|
+
#
|
31
|
+
#.DS_Store
|
32
|
+
|
33
|
+
# For TextMate
|
34
|
+
#*.tmproj
|
35
|
+
#tmtags
|
36
|
+
|
37
|
+
# For emacs:
|
38
|
+
#*~
|
39
|
+
#\#*
|
40
|
+
#.\#*
|
41
|
+
|
42
|
+
# For vim:
|
43
|
+
#*.swp
|
44
|
+
|
45
|
+
# For redcar:
|
46
|
+
#.redcar
|
47
|
+
|
48
|
+
# For rubinius:
|
49
|
+
#*.rbc
|
data/.rvmrc
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
SNACKR LICENSE:
|
2
|
+
Copyright 2012 PayPal, Inc.
|
3
|
+
|
4
|
+
All rights reserved. Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
you may not use this file except in compliance with the License.
|
6
|
+
You may obtain a copy of the License at
|
7
|
+
|
8
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
|
10
|
+
Unless required by applicable law or agreed to in writing, software
|
11
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
See the License for the specific language governing permissions and
|
14
|
+
limitations under the License.
|
15
|
+
|
16
|
+
|
17
|
+
|
18
|
+
SNACK LICENSE:
|
19
|
+
Copyright 2002-2008 Jive Software.
|
20
|
+
|
21
|
+
All rights reserved. Licensed under the Apache License, Version 2.0 (the "License");
|
22
|
+
you may not use this file except in compliance with the License.
|
23
|
+
You may obtain a copy of the License at
|
24
|
+
|
25
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
26
|
+
|
27
|
+
Unless required by applicable law or agreed to in writing, software
|
28
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
29
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
30
|
+
See the License for the specific language governing permissions and
|
31
|
+
limitations under the License.
|
data/README.rdoc
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
= smackr
|
2
|
+
|
3
|
+
Smackr is a JRuby gem which wraps the Smack XMPP Java library.
|
4
|
+
|
5
|
+
== Installing JRuby 1.6.7 Correctly
|
6
|
+
|
7
|
+
rvm get latest
|
8
|
+
rvm reload
|
9
|
+
rvm install jruby-1.6.7-ruby19 --1.9
|
10
|
+
rvm jruby-1.6.7-ruby19 exec gem install bundler
|
11
|
+
|
12
|
+
== Authors
|
13
|
+
|
14
|
+
Pete Gamache and Bob Breznak
|
15
|
+
|
16
|
+
== Copyright
|
17
|
+
|
18
|
+
Snackr is Copyright (c) 2012 PayPal, Inc.
|
19
|
+
Snack is Copyright (c) 2002-2008 Jive Software.
|
20
|
+
Both are released under the Apache License v2.0.
|
21
|
+
See LICENSE.txt for further details.
|
22
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
data/lib/java/smack.jar
ADDED
Binary file
|
data/lib/java/smackx.jar
ADDED
Binary file
|
data/lib/smackr.rb
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'java'
|
2
|
+
|
3
|
+
## Load our version of Smack (with smackx), if the our user hasn't loaded
|
4
|
+
## one already
|
5
|
+
smack_is_already_loaded = org.jivesoftware.smack.Connection rescue nil
|
6
|
+
unless smack_is_already_loaded
|
7
|
+
require File.dirname(__FILE__)+'/java/smack.jar'
|
8
|
+
require File.dirname(__FILE__)+'/java/smackx.jar'
|
9
|
+
org.jivesoftware.smack.Connection # this does stuff, oddly enough
|
10
|
+
end
|
11
|
+
|
12
|
+
## Load Smackr
|
13
|
+
%w(main version chat).each do |file|
|
14
|
+
require File.dirname(__FILE__)+"/smackr/#{file}"
|
15
|
+
end
|
16
|
+
|
data/lib/smackr/chat.rb
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
class Smackr
|
2
|
+
class Chat
|
3
|
+
attr_reader :chat, :chat_manager
|
4
|
+
attr_accessor :message_callback
|
5
|
+
attr_accessor :messages
|
6
|
+
|
7
|
+
def initialize(opts={})
|
8
|
+
unless opts[:chat_manager]
|
9
|
+
raise ArgumentError, ":chat_manager is required"
|
10
|
+
end
|
11
|
+
unless opts[:target]
|
12
|
+
raise ArgumentError, ':target is required'
|
13
|
+
end
|
14
|
+
|
15
|
+
@chat_manager = opts[:chat_manager]
|
16
|
+
@message_callback = opts[:message_callback]
|
17
|
+
self.messages = []
|
18
|
+
@chat = self.chat_manager.create_chat(opts[:target],
|
19
|
+
MessageReceiver.new(:chat => self))
|
20
|
+
end
|
21
|
+
|
22
|
+
def send_message(msg)
|
23
|
+
if msg.is_a?(String)
|
24
|
+
self.chat.send_message(msg)
|
25
|
+
else #TODO take a proper Message object instead of just the message body
|
26
|
+
raise Exception, "NOT IMPLEMENTED, SUCKA"
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
class MessageReceiver
|
31
|
+
include org.jivesoftware.smack.MessageListener
|
32
|
+
attr_accessor :chat
|
33
|
+
def initialize(opts={})
|
34
|
+
self.chat = opts[:chat]
|
35
|
+
end
|
36
|
+
def process_message(conn, msg)
|
37
|
+
chat.messages << msg
|
38
|
+
chat.message_callback.call(conn, msg) if chat.message_callback
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
end
|
43
|
+
end
|
data/lib/smackr/main.rb
ADDED
File without changes
|
data/smackr.gemspec
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "smackr/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "smackr"
|
7
|
+
s.version = Smackr::VERSION
|
8
|
+
s.authors = ["pete gamache", "Bob Breznak"]
|
9
|
+
s.email = ["pete@where.com", "bob@where.com"]
|
10
|
+
s.homepage = "https://github.com/where/smackr/"
|
11
|
+
s.summary = %q{Smackr is a JRuby gem which wraps the Smack XMPP Java library}
|
12
|
+
s.description = %q{Smackr is a JRuby gem which wraps the Smack XMPP Java library}
|
13
|
+
s.platform = Gem::Platform::CURRENT
|
14
|
+
|
15
|
+
s.rubyforge_project = "smackr"
|
16
|
+
|
17
|
+
s.files = `git ls-files`.split("\n")
|
18
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
19
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
20
|
+
s.require_paths = ["lib"]
|
21
|
+
|
22
|
+
# specify any dependencies here; for example:
|
23
|
+
# s.add_development_dependency "rspec"
|
24
|
+
# s.add_runtime_dependency "rest-client"
|
25
|
+
end
|
data/test/helper.rb
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'bundler'
|
3
|
+
begin
|
4
|
+
Bundler.setup(:default, :development)
|
5
|
+
rescue Bundler::BundlerError => e
|
6
|
+
$stderr.puts e.message
|
7
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
8
|
+
exit e.status_code
|
9
|
+
end
|
10
|
+
require 'test/unit'
|
11
|
+
require 'shoulda'
|
12
|
+
|
13
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
14
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
15
|
+
require 'smackr'
|
16
|
+
|
17
|
+
class Test::Unit::TestCase
|
18
|
+
end
|
data/test/test_smackr.rb
ADDED
metadata
ADDED
@@ -0,0 +1,67 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: smackr
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease:
|
5
|
+
version: 0.0.1
|
6
|
+
platform: universal-java-1.6
|
7
|
+
authors:
|
8
|
+
- pete gamache
|
9
|
+
- Bob Breznak
|
10
|
+
autorequire:
|
11
|
+
bindir: bin
|
12
|
+
cert_chain: []
|
13
|
+
date: 2012-03-09 00:00:00.000000000Z
|
14
|
+
dependencies: []
|
15
|
+
description: Smackr is a JRuby gem which wraps the Smack XMPP Java library
|
16
|
+
email:
|
17
|
+
- pete@where.com
|
18
|
+
- bob@where.com
|
19
|
+
executables: []
|
20
|
+
extensions: []
|
21
|
+
extra_rdoc_files: []
|
22
|
+
files:
|
23
|
+
- .document
|
24
|
+
- .gitignore
|
25
|
+
- .rvmrc
|
26
|
+
- Gemfile
|
27
|
+
- Gemfile.lock
|
28
|
+
- LICENSE.txt
|
29
|
+
- README.rdoc
|
30
|
+
- Rakefile
|
31
|
+
- lib/java/smack.jar
|
32
|
+
- lib/java/smackx.jar
|
33
|
+
- lib/smackr.rb
|
34
|
+
- lib/smackr/chat.rb
|
35
|
+
- lib/smackr/main.rb
|
36
|
+
- lib/smackr/version.rb
|
37
|
+
- smackr.gemspec
|
38
|
+
- test/helper.rb
|
39
|
+
- test/test_smackr.rb
|
40
|
+
homepage: https://github.com/where/smackr/
|
41
|
+
licenses: []
|
42
|
+
post_install_message:
|
43
|
+
rdoc_options: []
|
44
|
+
require_paths:
|
45
|
+
- lib
|
46
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
47
|
+
requirements:
|
48
|
+
- - ! '>='
|
49
|
+
- !ruby/object:Gem::Version
|
50
|
+
version: '0'
|
51
|
+
none: false
|
52
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
53
|
+
requirements:
|
54
|
+
- - ! '>='
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: '0'
|
57
|
+
none: false
|
58
|
+
requirements: []
|
59
|
+
rubyforge_project: smackr
|
60
|
+
rubygems_version: 1.8.15
|
61
|
+
signing_key:
|
62
|
+
specification_version: 3
|
63
|
+
summary: Smackr is a JRuby gem which wraps the Smack XMPP Java library
|
64
|
+
test_files:
|
65
|
+
- test/helper.rb
|
66
|
+
- test/test_smackr.rb
|
67
|
+
...
|