xmppbot 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/Manifest.txt +0 -2
- data/README.rdoc +3 -47
- data/Rakefile +5 -7
- data/lib/xmppbot.rb +2 -2
- metadata +4 -6
- data/Rakefile.save +0 -29
- data/Rakefile.save.1 +0 -29
data/Manifest.txt
CHANGED
data/README.rdoc
CHANGED
@@ -8,64 +8,20 @@ It's for those who want to build xmpp bots quickly. It features only the essenti
|
|
8
8
|
- callback for received messages
|
9
9
|
- callback for received presences
|
10
10
|
- a method to send messages and presences
|
11
|
-
- That's it
|
11
|
+
- That's about it
|
12
12
|
|
13
13
|
Warning : StropheRuby is quite experimental at the moment. It is definitely NOT ready for production!
|
14
14
|
|
15
15
|
== FEATURES/PROBLEMS:
|
16
16
|
|
17
|
-
- Only tested under Debian
|
17
|
+
- Only tested under Debian
|
18
18
|
- Does not work under windows
|
19
19
|
- No TLS support for now. It will work once TLS with OpenSSL is working in Strophe 'http://code.stanziq.com/strophe'
|
20
20
|
- Exiting the program can cause segmentation errors (not really problematic)
|
21
21
|
|
22
22
|
== SYNOPSIS:
|
23
23
|
|
24
|
-
|
25
|
-
|
26
|
-
class Johnny5 < XMPPBot::Bot
|
27
|
-
def connect
|
28
|
-
super do |status|
|
29
|
-
if status == XMPPBot::ConnectionEvents::CONNECT
|
30
|
-
announce_presence
|
31
|
-
register_callbacks
|
32
|
-
else
|
33
|
-
disconnect
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
def register_callbacks
|
39
|
-
on_presence_received do |pres|
|
40
|
-
puts "#{pres.from} is now #{pres.to_s}" unless pres.to_s.strip == ""
|
41
|
-
end
|
42
|
-
|
43
|
-
on_message_received do |msg|
|
44
|
-
if msg.body == "exit"
|
45
|
-
disconnect
|
46
|
-
else
|
47
|
-
stanza=XMPPBot::Message.new
|
48
|
-
stanza.to=msg.from
|
49
|
-
stanza.body="You said : #{msg.body}"
|
50
|
-
send(stanza)
|
51
|
-
end
|
52
|
-
end
|
53
|
-
end
|
54
|
-
end
|
55
|
-
|
56
|
-
@bot = Johnny5.new
|
57
|
-
@bot.jid = "cripes@jaim.at"
|
58
|
-
@bot.password = "cripes"
|
59
|
-
@bot.log_level = XMPPBot::Logging::INFO
|
60
|
-
@bot.auto_accept_subscriptions = true
|
61
|
-
|
62
|
-
@bot.connect
|
63
|
-
|
64
|
-
#We pause the execution of the current thread to prevent the program from exiting
|
65
|
-
Thread.stop
|
66
|
-
|
67
|
-
#Once the parsing thread exits, execution resumes here
|
68
|
-
puts "Connection terminated"
|
24
|
+
http://github.com/flamontagne/xmppbot/wikis/how-to-use-xmppbot
|
69
25
|
|
70
26
|
== INSTALL:
|
71
27
|
|
data/Rakefile
CHANGED
@@ -1,16 +1,14 @@
|
|
1
1
|
%w[rubygems rake rake/clean fileutils newgem rubigen].each { |f| require f }
|
2
|
-
#require File.dirname(__FILE__) + '/lib/xmppbot'
|
3
2
|
|
4
3
|
# Generate all the Rake tasks
|
5
4
|
# Run 'rake -T' to see list of generated tasks (from gem root directory)
|
6
|
-
$hoe = Hoe.new('xmppbot', '0.0.
|
5
|
+
$hoe = Hoe.new('xmppbot', '0.0.3') do |p|
|
7
6
|
p.developer('François Lamontagne', 'flamontagne@gmail.com')
|
8
7
|
p.changes = p.paragraphs_of("History.txt", 0..1).join("\n\n")
|
9
|
-
# p.post_install_message = File.open(File.dirname(__FILE__) + "/PostInstall.txt").read
|
10
8
|
p.rubyforge_name = p.name # TODO this is default value
|
11
|
-
|
12
|
-
|
13
|
-
|
9
|
+
p.extra_deps = [
|
10
|
+
['strophe_ruby','>= 0.0.5'],
|
11
|
+
]
|
14
12
|
p.extra_dev_deps = [
|
15
13
|
['newgem', ">= #{::Newgem::VERSION}"]
|
16
14
|
]
|
@@ -25,4 +23,4 @@ require 'newgem/tasks' # load /tasks/*.rake
|
|
25
23
|
Dir['tasks/**/*.rake'].each { |t| load t }
|
26
24
|
|
27
25
|
# TODO - want other tests/tasks run by default? Add them to the list
|
28
|
-
|
26
|
+
task :default => :compile
|
data/lib/xmppbot.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: xmppbot
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- "Fran\xC3\xA7ois Lamontagne"
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-12-
|
12
|
+
date: 2008-12-14 00:00:00 -05:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -20,7 +20,7 @@ dependencies:
|
|
20
20
|
requirements:
|
21
21
|
- - ">="
|
22
22
|
- !ruby/object:Gem::Version
|
23
|
-
version: 0.0.
|
23
|
+
version: 0.0.5
|
24
24
|
version:
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: newgem
|
@@ -42,7 +42,7 @@ dependencies:
|
|
42
42
|
- !ruby/object:Gem::Version
|
43
43
|
version: 1.8.0
|
44
44
|
version:
|
45
|
-
description: "This is a simple implementation on top of StropheRuby 'http://github.com/flamontagne/strophe_ruby/'. It's for those who want to build xmpp bots quickly. It features only the essential : - auto accept subscriptions - callback for received messages - callback for received presences - a method to send messages and presences - That's it Warning : StropheRuby is quite experimental at the moment. It is definitely NOT ready for production!"
|
45
|
+
description: "This is a simple implementation on top of StropheRuby 'http://github.com/flamontagne/strophe_ruby/'. It's for those who want to build xmpp bots quickly. It features only the essential : - auto accept subscriptions - callback for received messages - callback for received presences - a method to send messages and presences - That's about it Warning : StropheRuby is quite experimental at the moment. It is definitely NOT ready for production!"
|
46
46
|
email:
|
47
47
|
- flamontagne@gmail.com
|
48
48
|
executables: []
|
@@ -60,8 +60,6 @@ files:
|
|
60
60
|
- PostInstall.txt
|
61
61
|
- README.rdoc
|
62
62
|
- Rakefile
|
63
|
-
- Rakefile.save
|
64
|
-
- Rakefile.save.1
|
65
63
|
- lib/xmppbot.rb
|
66
64
|
- lib/xmppbot/bot.rb
|
67
65
|
- lib/xmppbot/message.rb
|
data/Rakefile.save
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
%w[rubygems rake rake/clean fileutils newgem rubigen].each { |f| require f }
|
2
|
-
#require File.dirname(__FILE__) + '/lib/xmppbot'
|
3
|
-
|
4
|
-
# Generate all the Rake tasks
|
5
|
-
# Run 'rake -T' to see list of generated tasks (from gem root directory)
|
6
|
-
$hoe = Hoe.new('xmppbot', '0.0.1') do |p|
|
7
|
-
p.developer('François Lamontagne', 'flamontagne@gmail.com')
|
8
|
-
p.changes = p.paragraphs_of("History.txt", 0..1).join("\n\n")
|
9
|
-
p.post_install_message = 'PostInstall.txt' # TODO remove if
|
10
|
-
post-install message not required
|
11
|
-
p.rubyforge_name = p.name # TODO this is default value
|
12
|
-
p.extra_deps = [
|
13
|
-
['strophe_ruby','>= 0.0.1'],
|
14
|
-
]
|
15
|
-
p.extra_dev_deps = [
|
16
|
-
['newgem', ">= #{::Newgem::VERSION}"]
|
17
|
-
]
|
18
|
-
|
19
|
-
p.clean_globs |= %w[**/.DS_Store tmp *.log]
|
20
|
-
path = (p.rubyforge_name == p.name) ? p.rubyforge_name : "\#{p.rubyforge_name}/\#{p.name}"
|
21
|
-
p.remote_rdoc_dir = File.join(path.gsub(/^#{p.rubyforge_name}\/?/,''), 'rdoc')
|
22
|
-
p.rsync_args = '-av --delete --ignore-errors'
|
23
|
-
end
|
24
|
-
|
25
|
-
require 'newgem/tasks' # load /tasks/*.rake
|
26
|
-
Dir['tasks/**/*.rake'].each { |t| load t }
|
27
|
-
|
28
|
-
# TODO - want other tests/tasks run by default? Add them to the list
|
29
|
-
# task :default => [:spec, :features]
|
data/Rakefile.save.1
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
%w[rubygems rake rake/clean fileutils newgem rubigen].each { |f| require f }
|
2
|
-
#require File.dirname(__FILE__) + '/lib/xmppbot'
|
3
|
-
|
4
|
-
# Generate all the Rake tasks
|
5
|
-
# Run 'rake -T' to see list of generated tasks (from gem root directory)
|
6
|
-
$hoe = Hoe.new('xmppbot', '0.0.1') do |p|
|
7
|
-
p.developer('François Lamontagne', 'flamontagne@gmail.com')
|
8
|
-
p.changes = p.paragraphs_of("History.txt", 0..1).join("\n\n")
|
9
|
-
p.post_install_message =
|
10
|
-
# TODO remove if post-install message not required
|
11
|
-
p.rubyforge_name = p.name # TODO this is default value
|
12
|
-
p.extra_deps = [
|
13
|
-
['strophe_ruby','>= 0.0.1'],
|
14
|
-
]
|
15
|
-
p.extra_dev_deps = [
|
16
|
-
['newgem', ">= #{::Newgem::VERSION}"]
|
17
|
-
]
|
18
|
-
|
19
|
-
p.clean_globs |= %w[**/.DS_Store tmp *.log]
|
20
|
-
path = (p.rubyforge_name == p.name) ? p.rubyforge_name : "\#{p.rubyforge_name}/\#{p.name}"
|
21
|
-
p.remote_rdoc_dir = File.join(path.gsub(/^#{p.rubyforge_name}\/?/,''), 'rdoc')
|
22
|
-
p.rsync_args = '-av --delete --ignore-errors'
|
23
|
-
end
|
24
|
-
|
25
|
-
require 'newgem/tasks' # load /tasks/*.rake
|
26
|
-
Dir['tasks/**/*.rake'].each { |t| load t }
|
27
|
-
|
28
|
-
# TODO - want other tests/tasks run by default? Add them to the list
|
29
|
-
# task :default => [:spec, :features]
|