agent_xmpp 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/.gitignore +11 -0
- data/LICENSE +20 -0
- data/README.rdoc +417 -0
- data/Rakefile +75 -0
- data/VERSION +1 -0
- data/agent_xmpp.gemspec +144 -0
- data/lib/agent_xmpp.rb +22 -0
- data/lib/agent_xmpp/admin.rb +113 -0
- data/lib/agent_xmpp/client.rb +7 -0
- data/lib/agent_xmpp/client/boot.rb +83 -0
- data/lib/agent_xmpp/client/client.rb +64 -0
- data/lib/agent_xmpp/client/connection.rb +108 -0
- data/lib/agent_xmpp/client/controller.rb +394 -0
- data/lib/agent_xmpp/client/message_delegate.rb +720 -0
- data/lib/agent_xmpp/client/message_pipe.rb +193 -0
- data/lib/agent_xmpp/client/response.rb +102 -0
- data/lib/agent_xmpp/config.rb +48 -0
- data/lib/agent_xmpp/main.rb +175 -0
- data/lib/agent_xmpp/models.rb +7 -0
- data/lib/agent_xmpp/models/contact.rb +85 -0
- data/lib/agent_xmpp/models/message.rb +152 -0
- data/lib/agent_xmpp/models/publication.rb +53 -0
- data/lib/agent_xmpp/models/roster.rb +107 -0
- data/lib/agent_xmpp/models/service.rb +91 -0
- data/lib/agent_xmpp/models/subscription.rb +61 -0
- data/lib/agent_xmpp/models/table_definitions.rb +107 -0
- data/lib/agent_xmpp/patches.rb +7 -0
- data/lib/agent_xmpp/patches/array.rb +32 -0
- data/lib/agent_xmpp/patches/float.rb +10 -0
- data/lib/agent_xmpp/patches/hash.rb +13 -0
- data/lib/agent_xmpp/patches/object.rb +15 -0
- data/lib/agent_xmpp/patches/rexml.rb +69 -0
- data/lib/agent_xmpp/patches/string.rb +15 -0
- data/lib/agent_xmpp/xmpp.rb +18 -0
- data/lib/agent_xmpp/xmpp/element.rb +158 -0
- data/lib/agent_xmpp/xmpp/entry.rb +36 -0
- data/lib/agent_xmpp/xmpp/error_response.rb +189 -0
- data/lib/agent_xmpp/xmpp/iq.rb +90 -0
- data/lib/agent_xmpp/xmpp/iq_command.rb +54 -0
- data/lib/agent_xmpp/xmpp/iq_disco.rb +206 -0
- data/lib/agent_xmpp/xmpp/iq_pubsub.rb +270 -0
- data/lib/agent_xmpp/xmpp/iq_roster.rb +183 -0
- data/lib/agent_xmpp/xmpp/iq_version.rb +89 -0
- data/lib/agent_xmpp/xmpp/jid.rb +150 -0
- data/lib/agent_xmpp/xmpp/message.rb +82 -0
- data/lib/agent_xmpp/xmpp/presence.rb +127 -0
- data/lib/agent_xmpp/xmpp/sasl.rb +241 -0
- data/lib/agent_xmpp/xmpp/stanza.rb +107 -0
- data/lib/agent_xmpp/xmpp/x_data.rb +357 -0
- data/test/app/app.rb +339 -0
- data/test/cases/test_application_message_processing.rb +65 -0
- data/test/cases/test_errors.rb +24 -0
- data/test/cases/test_presence_management.rb +139 -0
- data/test/cases/test_roster_management.rb +214 -0
- data/test/cases/test_service_discovery.rb +168 -0
- data/test/cases/test_session_management.rb +120 -0
- data/test/cases/test_version_discovery.rb +67 -0
- data/test/helpers/matchers.rb +23 -0
- data/test/helpers/mocks.rb +82 -0
- data/test/helpers/test_case_extensions.rb +45 -0
- data/test/helpers/test_client.rb +44 -0
- data/test/helpers/test_delegate.rb +60 -0
- data/test/helpers/test_helper.rb +91 -0
- data/test/messages/application_messages.rb +206 -0
- data/test/messages/error_messages.rb +35 -0
- data/test/messages/presence_messages.rb +66 -0
- data/test/messages/roster_messages.rb +126 -0
- data/test/messages/service_discovery_messages.rb +201 -0
- data/test/messages/session_messages.rb +158 -0
- data/test/messages/version_discovery_messages.rb +69 -0
- data/test/peer/peer.rb +21 -0
- metadata +187 -0
@@ -0,0 +1,69 @@
|
|
1
|
+
##############################################################################################################
|
2
|
+
module VersionDiscoveryMessages
|
3
|
+
|
4
|
+
#####-------------------------------------------------------------------------------------------------------
|
5
|
+
class << self
|
6
|
+
|
7
|
+
#### received messages
|
8
|
+
#.........................................................................................................
|
9
|
+
def recv_iq_get_query_version(client, from)
|
10
|
+
<<-MSG
|
11
|
+
<iq from='#{from}' to='#{client.client.jid.to_s}' id='1' type='get' xmlns='jabber:client'>
|
12
|
+
<query xmlns='jabber:iq:version'/>
|
13
|
+
</iq>
|
14
|
+
MSG
|
15
|
+
end
|
16
|
+
|
17
|
+
#.........................................................................................................
|
18
|
+
def recv_iq_result_query_version(client, from)
|
19
|
+
<<-MSG
|
20
|
+
<iq from='#{from}' to='#{client.client.jid.to_s}' id='1' type='result' xmlns='jabber:client'>
|
21
|
+
<query xmlns='jabber:iq:version'>
|
22
|
+
<name>AgentXMPP</name>
|
23
|
+
<version>0.0.0</version>
|
24
|
+
<os>Linux 2.6.27-14-generic</os>
|
25
|
+
</query>
|
26
|
+
</iq>
|
27
|
+
MSG
|
28
|
+
end
|
29
|
+
|
30
|
+
#.........................................................................................................
|
31
|
+
def recv_iq_error_query_version(client, from)
|
32
|
+
<<-MSG
|
33
|
+
<iq from='#{from}' to='#{client.client.jid.to_s}' id='1' type='error' xmlns='jabber:client'>
|
34
|
+
<query xmlns='jabber:iq:version'/>
|
35
|
+
<error code='503' type='cancel'>
|
36
|
+
<service-unavailable xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
|
37
|
+
</error>
|
38
|
+
</iq>
|
39
|
+
MSG
|
40
|
+
end
|
41
|
+
|
42
|
+
#### sent messages
|
43
|
+
#.........................................................................................................
|
44
|
+
def send_iq_result_query_version(client, to)
|
45
|
+
<<-MSG
|
46
|
+
<iq id='1' to='#{to}' type='result' xmlns='jabber:client'>
|
47
|
+
<query xmlns='jabber:iq:version'>
|
48
|
+
<name>#{AgentXmpp::AGENT_XMPP_NAME}</name>
|
49
|
+
<version>#{AgentXmpp::VERSION}</version>
|
50
|
+
<os>#{AgentXmpp::OS_VERSION}</os>
|
51
|
+
</query>
|
52
|
+
</iq>
|
53
|
+
MSG
|
54
|
+
end
|
55
|
+
|
56
|
+
#.........................................................................................................
|
57
|
+
def send_iq_get_query_version(client, to)
|
58
|
+
<<-MSG
|
59
|
+
<iq id='1' to='#{to}' type='get' xmlns='jabber:client'>
|
60
|
+
<query xmlns='jabber:iq:version'/>
|
61
|
+
</iq>
|
62
|
+
MSG
|
63
|
+
end
|
64
|
+
|
65
|
+
## self
|
66
|
+
end
|
67
|
+
|
68
|
+
#### VersionDiscoveryMessages
|
69
|
+
end
|
data/test/peer/peer.rb
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
##########################################################################################################
|
2
|
+
require 'rubygems'
|
3
|
+
require "#{File.dirname(__FILE__)}/../../lib/agent_xmpp"
|
4
|
+
|
5
|
+
##########################################################################################################
|
6
|
+
before_start do
|
7
|
+
AgentXmpp.logger.level = Logger::DEBUG
|
8
|
+
AgentXmpp.logger.info "before_start"
|
9
|
+
end
|
10
|
+
|
11
|
+
#.........................................................................................................
|
12
|
+
discovered_pubsub_node do |service, node|
|
13
|
+
AgentXmpp.logger.info "discovered_pubsub_node: #{service}, #{node}"
|
14
|
+
if node.eql?(AgentXmpp.user_pubsub_root+'/time')
|
15
|
+
AgentXmpp.logger.info "LAUNCHING TIME PUBLISH TASK"
|
16
|
+
EventMachine::PeriodicTimer.new(30) do
|
17
|
+
publish_time({:time => Time.now.to_s, :greeting => 'Rockin'})
|
18
|
+
AgentXmpp.logger.info "FIRING EVENT TIME: #{Time.now.to_s}"
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
metadata
ADDED
@@ -0,0 +1,187 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: agent_xmpp
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Troy Stribling
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2010-08-21 00:00:00 -07:00
|
13
|
+
default_executable:
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: rake
|
17
|
+
type: :runtime
|
18
|
+
version_requirement:
|
19
|
+
version_requirements: !ruby/object:Gem::Requirement
|
20
|
+
requirements:
|
21
|
+
- - ">="
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: 0.8.3
|
24
|
+
version:
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: eventmachine
|
27
|
+
type: :runtime
|
28
|
+
version_requirement:
|
29
|
+
version_requirements: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 0.12.6
|
34
|
+
version:
|
35
|
+
- !ruby/object:Gem::Dependency
|
36
|
+
name: sequel
|
37
|
+
type: :runtime
|
38
|
+
version_requirement:
|
39
|
+
version_requirements: !ruby/object:Gem::Requirement
|
40
|
+
requirements:
|
41
|
+
- - ">="
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: 3.9.0
|
44
|
+
version:
|
45
|
+
- !ruby/object:Gem::Dependency
|
46
|
+
name: evma_xmlpushparser
|
47
|
+
type: :runtime
|
48
|
+
version_requirement:
|
49
|
+
version_requirements: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - ">="
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: 0.0.1
|
54
|
+
version:
|
55
|
+
description:
|
56
|
+
email: troy.stribling@gmail.com
|
57
|
+
executables: []
|
58
|
+
|
59
|
+
extensions: []
|
60
|
+
|
61
|
+
extra_rdoc_files:
|
62
|
+
- LICENSE
|
63
|
+
- README.rdoc
|
64
|
+
files:
|
65
|
+
- .document
|
66
|
+
- .gitignore
|
67
|
+
- LICENSE
|
68
|
+
- README.rdoc
|
69
|
+
- Rakefile
|
70
|
+
- VERSION
|
71
|
+
- agent_xmpp.gemspec
|
72
|
+
- lib/agent_xmpp.rb
|
73
|
+
- lib/agent_xmpp/admin.rb
|
74
|
+
- lib/agent_xmpp/client.rb
|
75
|
+
- lib/agent_xmpp/client/boot.rb
|
76
|
+
- lib/agent_xmpp/client/client.rb
|
77
|
+
- lib/agent_xmpp/client/connection.rb
|
78
|
+
- lib/agent_xmpp/client/controller.rb
|
79
|
+
- lib/agent_xmpp/client/message_delegate.rb
|
80
|
+
- lib/agent_xmpp/client/message_pipe.rb
|
81
|
+
- lib/agent_xmpp/client/response.rb
|
82
|
+
- lib/agent_xmpp/config.rb
|
83
|
+
- lib/agent_xmpp/main.rb
|
84
|
+
- lib/agent_xmpp/models.rb
|
85
|
+
- lib/agent_xmpp/models/contact.rb
|
86
|
+
- lib/agent_xmpp/models/message.rb
|
87
|
+
- lib/agent_xmpp/models/publication.rb
|
88
|
+
- lib/agent_xmpp/models/roster.rb
|
89
|
+
- lib/agent_xmpp/models/service.rb
|
90
|
+
- lib/agent_xmpp/models/subscription.rb
|
91
|
+
- lib/agent_xmpp/models/table_definitions.rb
|
92
|
+
- lib/agent_xmpp/patches.rb
|
93
|
+
- lib/agent_xmpp/patches/array.rb
|
94
|
+
- lib/agent_xmpp/patches/float.rb
|
95
|
+
- lib/agent_xmpp/patches/hash.rb
|
96
|
+
- lib/agent_xmpp/patches/object.rb
|
97
|
+
- lib/agent_xmpp/patches/rexml.rb
|
98
|
+
- lib/agent_xmpp/patches/string.rb
|
99
|
+
- lib/agent_xmpp/xmpp.rb
|
100
|
+
- lib/agent_xmpp/xmpp/element.rb
|
101
|
+
- lib/agent_xmpp/xmpp/entry.rb
|
102
|
+
- lib/agent_xmpp/xmpp/error_response.rb
|
103
|
+
- lib/agent_xmpp/xmpp/iq.rb
|
104
|
+
- lib/agent_xmpp/xmpp/iq_command.rb
|
105
|
+
- lib/agent_xmpp/xmpp/iq_disco.rb
|
106
|
+
- lib/agent_xmpp/xmpp/iq_pubsub.rb
|
107
|
+
- lib/agent_xmpp/xmpp/iq_roster.rb
|
108
|
+
- lib/agent_xmpp/xmpp/iq_version.rb
|
109
|
+
- lib/agent_xmpp/xmpp/jid.rb
|
110
|
+
- lib/agent_xmpp/xmpp/message.rb
|
111
|
+
- lib/agent_xmpp/xmpp/presence.rb
|
112
|
+
- lib/agent_xmpp/xmpp/sasl.rb
|
113
|
+
- lib/agent_xmpp/xmpp/stanza.rb
|
114
|
+
- lib/agent_xmpp/xmpp/x_data.rb
|
115
|
+
- test/app/app.rb
|
116
|
+
- test/cases/test_application_message_processing.rb
|
117
|
+
- test/cases/test_errors.rb
|
118
|
+
- test/cases/test_presence_management.rb
|
119
|
+
- test/cases/test_roster_management.rb
|
120
|
+
- test/cases/test_service_discovery.rb
|
121
|
+
- test/cases/test_session_management.rb
|
122
|
+
- test/cases/test_version_discovery.rb
|
123
|
+
- test/helpers/matchers.rb
|
124
|
+
- test/helpers/mocks.rb
|
125
|
+
- test/helpers/test_case_extensions.rb
|
126
|
+
- test/helpers/test_client.rb
|
127
|
+
- test/helpers/test_delegate.rb
|
128
|
+
- test/helpers/test_helper.rb
|
129
|
+
- test/messages/application_messages.rb
|
130
|
+
- test/messages/error_messages.rb
|
131
|
+
- test/messages/presence_messages.rb
|
132
|
+
- test/messages/roster_messages.rb
|
133
|
+
- test/messages/service_discovery_messages.rb
|
134
|
+
- test/messages/session_messages.rb
|
135
|
+
- test/messages/version_discovery_messages.rb
|
136
|
+
- test/peer/peer.rb
|
137
|
+
has_rdoc: true
|
138
|
+
homepage: http://github.com/troystribling/agent_xmpp
|
139
|
+
licenses: []
|
140
|
+
|
141
|
+
post_install_message:
|
142
|
+
rdoc_options:
|
143
|
+
- --charset=UTF-8
|
144
|
+
require_paths:
|
145
|
+
- lib
|
146
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
147
|
+
requirements:
|
148
|
+
- - ">="
|
149
|
+
- !ruby/object:Gem::Version
|
150
|
+
version: "0"
|
151
|
+
version:
|
152
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
153
|
+
requirements:
|
154
|
+
- - ">="
|
155
|
+
- !ruby/object:Gem::Version
|
156
|
+
version: "0"
|
157
|
+
version:
|
158
|
+
requirements: []
|
159
|
+
|
160
|
+
rubyforge_project:
|
161
|
+
rubygems_version: 1.3.5
|
162
|
+
signing_key:
|
163
|
+
specification_version: 3
|
164
|
+
summary: Agent XMPP is a ruby XMPP bot framework inspired by MVC web frameworks.
|
165
|
+
test_files:
|
166
|
+
- test/app/app.rb
|
167
|
+
- test/cases/test_application_message_processing.rb
|
168
|
+
- test/cases/test_errors.rb
|
169
|
+
- test/cases/test_presence_management.rb
|
170
|
+
- test/cases/test_roster_management.rb
|
171
|
+
- test/cases/test_service_discovery.rb
|
172
|
+
- test/cases/test_session_management.rb
|
173
|
+
- test/cases/test_version_discovery.rb
|
174
|
+
- test/helpers/matchers.rb
|
175
|
+
- test/helpers/mocks.rb
|
176
|
+
- test/helpers/test_case_extensions.rb
|
177
|
+
- test/helpers/test_client.rb
|
178
|
+
- test/helpers/test_delegate.rb
|
179
|
+
- test/helpers/test_helper.rb
|
180
|
+
- test/messages/application_messages.rb
|
181
|
+
- test/messages/error_messages.rb
|
182
|
+
- test/messages/presence_messages.rb
|
183
|
+
- test/messages/roster_messages.rb
|
184
|
+
- test/messages/service_discovery_messages.rb
|
185
|
+
- test/messages/session_messages.rb
|
186
|
+
- test/messages/version_discovery_messages.rb
|
187
|
+
- test/peer/peer.rb
|