mad-p-xmpp4r 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +91 -0
- data/COPYING +340 -0
- data/LICENSE +59 -0
- data/README.rdoc +113 -0
- data/README_ruby19.txt +43 -0
- data/Rakefile +252 -0
- data/data/doc/xmpp4r/examples/advanced/adventure/README +56 -0
- data/data/doc/xmpp4r/examples/advanced/adventure/adventure.rb +23 -0
- data/data/doc/xmpp4r/examples/advanced/adventure/adventuremuc.rb +136 -0
- data/data/doc/xmpp4r/examples/advanced/adventure/cube.xml +15 -0
- data/data/doc/xmpp4r/examples/advanced/adventure/tower.xml +69 -0
- data/data/doc/xmpp4r/examples/advanced/adventure/world.rb +424 -0
- data/data/doc/xmpp4r/examples/advanced/fileserve.conf +11 -0
- data/data/doc/xmpp4r/examples/advanced/fileserve.rb +346 -0
- data/data/doc/xmpp4r/examples/advanced/getonline.rb +56 -0
- data/data/doc/xmpp4r/examples/advanced/gtkmucclient.rb +315 -0
- data/data/doc/xmpp4r/examples/advanced/migrate.rb +88 -0
- data/data/doc/xmpp4r/examples/advanced/minimuc.rb +266 -0
- data/data/doc/xmpp4r/examples/advanced/pep-aggregator/index.xsl +235 -0
- data/data/doc/xmpp4r/examples/advanced/pep-aggregator/pep-aggregator.rb +147 -0
- data/data/doc/xmpp4r/examples/advanced/recvfile.rb +85 -0
- data/data/doc/xmpp4r/examples/advanced/rosterdiscovery.rb +129 -0
- data/data/doc/xmpp4r/examples/advanced/sendfile.conf +10 -0
- data/data/doc/xmpp4r/examples/advanced/sendfile.rb +72 -0
- data/data/doc/xmpp4r/examples/advanced/shellmgr/shellmgr.rb +51 -0
- data/data/doc/xmpp4r/examples/advanced/shellmgr/shellmgr_jabber.rb +43 -0
- data/data/doc/xmpp4r/examples/advanced/shellmgr/shellmgr_test.rb +10 -0
- data/data/doc/xmpp4r/examples/advanced/versionpoll.rb +109 -0
- data/data/doc/xmpp4r/examples/advanced/xmpping.rb +146 -0
- data/data/doc/xmpp4r/examples/advanced/xmppingrc.sample +14 -0
- data/data/doc/xmpp4r/examples/basic/change_password.rb +41 -0
- data/data/doc/xmpp4r/examples/basic/client.rb +70 -0
- data/data/doc/xmpp4r/examples/basic/component.rb +11 -0
- data/data/doc/xmpp4r/examples/basic/echo.rb +37 -0
- data/data/doc/xmpp4r/examples/basic/jabbersend.rb +41 -0
- data/data/doc/xmpp4r/examples/basic/mass_sender.rb +68 -0
- data/data/doc/xmpp4r/examples/basic/muc_owner_config.rb +12 -0
- data/data/doc/xmpp4r/examples/basic/mucinfo.rb +41 -0
- data/data/doc/xmpp4r/examples/basic/mucsimplebot.rb +82 -0
- data/data/doc/xmpp4r/examples/basic/register.rb +42 -0
- data/data/doc/xmpp4r/examples/basic/remove_registration.rb +18 -0
- data/data/doc/xmpp4r/examples/basic/roster.rb +44 -0
- data/data/doc/xmpp4r/examples/basic/rosterprint.rb +50 -0
- data/data/doc/xmpp4r/examples/basic/rosterrename.rb +34 -0
- data/data/doc/xmpp4r/examples/basic/rosterwatch.rb +171 -0
- data/data/doc/xmpp4r/examples/basic/send_vcard.rb +67 -0
- data/data/doc/xmpp4r/examples/basic/tune_client.rb +56 -0
- data/data/doc/xmpp4r/examples/basic/tune_server.rb +58 -0
- data/data/doc/xmpp4r/examples/basic/versionbot.rb +75 -0
- data/lib/xmpp4r.rb +116 -0
- data/lib/xmpp4r/base64.rb +32 -0
- data/lib/xmpp4r/bytestreams.rb +15 -0
- data/lib/xmpp4r/bytestreams/helper/filetransfer.rb +321 -0
- data/lib/xmpp4r/bytestreams/helper/ibb/base.rb +257 -0
- data/lib/xmpp4r/bytestreams/helper/ibb/initiator.rb +31 -0
- data/lib/xmpp4r/bytestreams/helper/ibb/target.rb +54 -0
- data/lib/xmpp4r/bytestreams/helper/socks5bytestreams/base.rb +153 -0
- data/lib/xmpp4r/bytestreams/helper/socks5bytestreams/initiator.rb +86 -0
- data/lib/xmpp4r/bytestreams/helper/socks5bytestreams/server.rb +198 -0
- data/lib/xmpp4r/bytestreams/helper/socks5bytestreams/socks5.rb +65 -0
- data/lib/xmpp4r/bytestreams/helper/socks5bytestreams/target.rb +82 -0
- data/lib/xmpp4r/bytestreams/iq/bytestreams.rb +170 -0
- data/lib/xmpp4r/bytestreams/iq/si.rb +206 -0
- data/lib/xmpp4r/callbacks.rb +133 -0
- data/lib/xmpp4r/caps.rb +1 -0
- data/lib/xmpp4r/caps/c.rb +67 -0
- data/lib/xmpp4r/caps/helper/generator.rb +160 -0
- data/lib/xmpp4r/caps/helper/helper.rb +84 -0
- data/lib/xmpp4r/client.rb +358 -0
- data/lib/xmpp4r/command/helper/responder.rb +53 -0
- data/lib/xmpp4r/command/iq/command.rb +154 -0
- data/lib/xmpp4r/component.rb +103 -0
- data/lib/xmpp4r/connection.rb +226 -0
- data/lib/xmpp4r/dataforms.rb +5 -0
- data/lib/xmpp4r/dataforms/x/data.rb +297 -0
- data/lib/xmpp4r/debuglog.rb +63 -0
- data/lib/xmpp4r/delay.rb +5 -0
- data/lib/xmpp4r/delay/x/delay.rb +99 -0
- data/lib/xmpp4r/discovery.rb +8 -0
- data/lib/xmpp4r/discovery/helper/helper.rb +58 -0
- data/lib/xmpp4r/discovery/helper/responder.rb +165 -0
- data/lib/xmpp4r/discovery/iq/discoinfo.rb +211 -0
- data/lib/xmpp4r/discovery/iq/discoitems.rb +147 -0
- data/lib/xmpp4r/entity_time.rb +6 -0
- data/lib/xmpp4r/entity_time/iq.rb +45 -0
- data/lib/xmpp4r/entity_time/responder.rb +57 -0
- data/lib/xmpp4r/errors.rb +284 -0
- data/lib/xmpp4r/feature_negotiation.rb +5 -0
- data/lib/xmpp4r/feature_negotiation/iq/feature.rb +28 -0
- data/lib/xmpp4r/framework/base.rb +55 -0
- data/lib/xmpp4r/framework/bot.rb +148 -0
- data/lib/xmpp4r/httpbinding.rb +5 -0
- data/lib/xmpp4r/httpbinding/client.rb +384 -0
- data/lib/xmpp4r/idgenerator.rb +37 -0
- data/lib/xmpp4r/iq.rb +221 -0
- data/lib/xmpp4r/jid.rb +167 -0
- data/lib/xmpp4r/last.rb +2 -0
- data/lib/xmpp4r/last/helper/helper.rb +37 -0
- data/lib/xmpp4r/last/iq/last.rb +67 -0
- data/lib/xmpp4r/location.rb +2 -0
- data/lib/xmpp4r/location/helper/helper.rb +56 -0
- data/lib/xmpp4r/location/location.rb +179 -0
- data/lib/xmpp4r/message.rb +226 -0
- data/lib/xmpp4r/muc.rb +14 -0
- data/lib/xmpp4r/muc/helper/mucbrowser.rb +92 -0
- data/lib/xmpp4r/muc/helper/mucclient.rb +469 -0
- data/lib/xmpp4r/muc/helper/simplemucclient.rb +332 -0
- data/lib/xmpp4r/muc/iq/mucadmin.rb +23 -0
- data/lib/xmpp4r/muc/iq/mucadminitem.rb +20 -0
- data/lib/xmpp4r/muc/iq/mucowner.rb +15 -0
- data/lib/xmpp4r/muc/item.rb +143 -0
- data/lib/xmpp4r/muc/x/muc.rb +70 -0
- data/lib/xmpp4r/muc/x/mucuserinvite.rb +60 -0
- data/lib/xmpp4r/muc/x/mucuseritem.rb +36 -0
- data/lib/xmpp4r/observable.rb +9 -0
- data/lib/xmpp4r/observable/contact.rb +61 -0
- data/lib/xmpp4r/observable/helper.rb +389 -0
- data/lib/xmpp4r/observable/observable_thing.rb +191 -0
- data/lib/xmpp4r/observable/pubsub.rb +211 -0
- data/lib/xmpp4r/observable/subscription.rb +57 -0
- data/lib/xmpp4r/observable/thread_store.rb +65 -0
- data/lib/xmpp4r/presence.rb +232 -0
- data/lib/xmpp4r/pubsub.rb +8 -0
- data/lib/xmpp4r/pubsub/children/configuration.rb +86 -0
- data/lib/xmpp4r/pubsub/children/event.rb +49 -0
- data/lib/xmpp4r/pubsub/children/item.rb +35 -0
- data/lib/xmpp4r/pubsub/children/items.rb +53 -0
- data/lib/xmpp4r/pubsub/children/node_config.rb +48 -0
- data/lib/xmpp4r/pubsub/children/publish.rb +38 -0
- data/lib/xmpp4r/pubsub/children/retract.rb +41 -0
- data/lib/xmpp4r/pubsub/children/subscription.rb +62 -0
- data/lib/xmpp4r/pubsub/children/subscription_config.rb +67 -0
- data/lib/xmpp4r/pubsub/children/unsubscribe.rb +63 -0
- data/lib/xmpp4r/pubsub/helper/nodebrowser.rb +129 -0
- data/lib/xmpp4r/pubsub/helper/nodehelper.rb +156 -0
- data/lib/xmpp4r/pubsub/helper/oauth_service_helper.rb +90 -0
- data/lib/xmpp4r/pubsub/helper/servicehelper.rb +490 -0
- data/lib/xmpp4r/pubsub/iq/pubsub.rb +19 -0
- data/lib/xmpp4r/query.rb +15 -0
- data/lib/xmpp4r/reliable.rb +168 -0
- data/lib/xmpp4r/rexmladdons.rb +197 -0
- data/lib/xmpp4r/roster.rb +7 -0
- data/lib/xmpp4r/roster/helper/roster.rb +532 -0
- data/lib/xmpp4r/roster/iq/roster.rb +215 -0
- data/lib/xmpp4r/roster/x/roster.rb +138 -0
- data/lib/xmpp4r/rpc.rb +2 -0
- data/lib/xmpp4r/rpc/helper/client.rb +123 -0
- data/lib/xmpp4r/rpc/helper/server.rb +74 -0
- data/lib/xmpp4r/rpc/helper/xmlrpcaddons.rb +67 -0
- data/lib/xmpp4r/rpc/iq/rpc.rb +23 -0
- data/lib/xmpp4r/sasl.rb +248 -0
- data/lib/xmpp4r/semaphore.rb +38 -0
- data/lib/xmpp4r/stream.rb +599 -0
- data/lib/xmpp4r/streamparser.rb +85 -0
- data/lib/xmpp4r/test/listener_mocker.rb +118 -0
- data/lib/xmpp4r/tune.rb +2 -0
- data/lib/xmpp4r/tune/helper/helper.rb +58 -0
- data/lib/xmpp4r/tune/tune.rb +113 -0
- data/lib/xmpp4r/vcard.rb +6 -0
- data/lib/xmpp4r/vcard/helper/vcard.rb +84 -0
- data/lib/xmpp4r/vcard/iq/vcard.rb +109 -0
- data/lib/xmpp4r/version.rb +7 -0
- data/lib/xmpp4r/version/helper/responder.rb +72 -0
- data/lib/xmpp4r/version/helper/simpleresponder.rb +44 -0
- data/lib/xmpp4r/version/iq/version.rb +105 -0
- data/lib/xmpp4r/x.rb +37 -0
- data/lib/xmpp4r/xhtml.rb +1 -0
- data/lib/xmpp4r/xhtml/html.rb +115 -0
- data/lib/xmpp4r/xmpp4r.rb +20 -0
- data/lib/xmpp4r/xmppelement.rb +168 -0
- data/lib/xmpp4r/xmppstanza.rb +162 -0
- data/mad-p-xmpp4r.gemspec +249 -0
- data/setup.rb +1586 -0
- data/test/bytestreams/tc_ibb.rb +188 -0
- data/test/bytestreams/tc_socks5bytestreams.rb +114 -0
- data/test/caps/tc_helper.rb +158 -0
- data/test/dataforms/tc_data.rb +81 -0
- data/test/delay/tc_xdelay.rb +51 -0
- data/test/discovery/tc_responder.rb +91 -0
- data/test/entity_time/tc_responder.rb +65 -0
- data/test/last/tc_helper.rb +75 -0
- data/test/lib/assert_equal_xml.rb +14 -0
- data/test/lib/clienttester.rb +149 -0
- data/test/muc/tc_muc_mucclient.rb +834 -0
- data/test/muc/tc_muc_simplemucclient.rb +114 -0
- data/test/muc/tc_mucowner.rb +50 -0
- data/test/pubsub/tc_helper.rb +785 -0
- data/test/pubsub/tc_nodeconfig.rb +61 -0
- data/test/pubsub/tc_subscriptionconfig.rb +41 -0
- data/test/reliable/tc_disconnect_cleanup.rb +334 -0
- data/test/reliable/tc_disconnect_exception.rb +37 -0
- data/test/reliable/tc_listener_mocked_test.rb +68 -0
- data/test/reliable/tc_reliable_connection.rb +31 -0
- data/test/roster/tc_helper.rb +523 -0
- data/test/roster/tc_iqqueryroster.rb +173 -0
- data/test/roster/tc_xroster.rb +73 -0
- data/test/rpc/tc_helper.rb +96 -0
- data/test/tc_callbacks.rb +129 -0
- data/test/tc_class_names.rb +146 -0
- data/test/tc_client.rb +30 -0
- data/test/tc_errors.rb +146 -0
- data/test/tc_idgenerator.rb +30 -0
- data/test/tc_iq.rb +113 -0
- data/test/tc_iqquery.rb +31 -0
- data/test/tc_jid.rb +204 -0
- data/test/tc_message.rb +182 -0
- data/test/tc_presence.rb +150 -0
- data/test/tc_rexml.rb +139 -0
- data/test/tc_stream.rb +167 -0
- data/test/tc_streamComponent.rb +105 -0
- data/test/tc_streamError.rb +129 -0
- data/test/tc_streamSend.rb +59 -0
- data/test/tc_streamparser.rb +125 -0
- data/test/tc_xmppstanza.rb +135 -0
- data/test/ts_xmpp4r.rb +44 -0
- data/test/tune/tc_helper_recv.rb +82 -0
- data/test/tune/tc_helper_send.rb +74 -0
- data/test/tune/tc_tune.rb +79 -0
- data/test/vcard/tc_helper.rb +49 -0
- data/test/vcard/tc_iqvcard.rb +62 -0
- data/test/version/tc_helper.rb +60 -0
- data/test/version/tc_iqqueryversion.rb +97 -0
- data/test/xhtml/tc_html.rb +41 -0
- data/tools/gen_requires.bash +31 -0
- data/tools/xmpp4r-gemspec-test.rb +11 -0
- metadata +286 -0
@@ -0,0 +1,20 @@
|
|
1
|
+
# =XMPP4R - XMPP Library for Ruby
|
2
|
+
# License:: Ruby's license (see the LICENSE file) or GNU GPL, at your option.
|
3
|
+
# Website::http://home.gna.org/xmpp4r/
|
4
|
+
|
5
|
+
##
|
6
|
+
# The Jabber module is the root namespace of the library.
|
7
|
+
module Jabber
|
8
|
+
# XMPP4R Version number. This is the ONLY place where the version number
|
9
|
+
# should be specified. This constant is used to determine the version of
|
10
|
+
# package tarballs and generated gems.
|
11
|
+
XMPP4R_VERSION = '0.6.0'
|
12
|
+
end
|
13
|
+
|
14
|
+
require 'xmpp4r/client'
|
15
|
+
require 'xmpp4r/reliable'
|
16
|
+
require 'xmpp4r/component'
|
17
|
+
require 'xmpp4r/debuglog'
|
18
|
+
require 'xmpp4r/errors'
|
19
|
+
|
20
|
+
require 'xmpp4r/test/listener_mocker'
|
@@ -0,0 +1,168 @@
|
|
1
|
+
# =XMPP4R - XMPP Library for Ruby
|
2
|
+
# License:: Ruby's license (see the LICENSE file) or GNU GPL, at your option.
|
3
|
+
# Website::http://home.gna.org/xmpp4r/
|
4
|
+
|
5
|
+
require 'xmpp4r/rexmladdons'
|
6
|
+
|
7
|
+
module Jabber
|
8
|
+
|
9
|
+
##
|
10
|
+
# This class represents an XML element and provides functionality
|
11
|
+
# for automatic casting of XML element classes according to their
|
12
|
+
# element name and namespace.
|
13
|
+
#
|
14
|
+
# Deriving classes must met these criteria:
|
15
|
+
# * The element name and namespace must be specified by calling
|
16
|
+
# the name_xmlns class method
|
17
|
+
# * The class constructor must be callable with no mandatory parameter
|
18
|
+
class XMPPElement < REXML::Element
|
19
|
+
@@name_xmlns_classes = {}
|
20
|
+
@@force_xmlns = false
|
21
|
+
|
22
|
+
##
|
23
|
+
# Specify XML element name and xmlns for a deriving class,
|
24
|
+
# this pair and the class will be added to a global pool
|
25
|
+
#
|
26
|
+
# If the namespace is nil the class is a "wildcard class"
|
27
|
+
# matching elements with any xmlns if no other class with
|
28
|
+
# that namespace was defined
|
29
|
+
def self.name_xmlns(name, xmlns=nil)
|
30
|
+
@@name_xmlns_classes[[name, xmlns]] = self
|
31
|
+
end
|
32
|
+
|
33
|
+
##
|
34
|
+
# Set whether this element is always built with an xmlns attribute
|
35
|
+
def self.force_xmlns(force)
|
36
|
+
@@force_xmlns = force
|
37
|
+
end
|
38
|
+
|
39
|
+
##
|
40
|
+
# Whether this element is always built with an xmlns attribute
|
41
|
+
def self.force_xmlns?
|
42
|
+
@@force_xmlns
|
43
|
+
end
|
44
|
+
|
45
|
+
##
|
46
|
+
# Find the name and namespace for a given class.
|
47
|
+
# This class must have registered these two values
|
48
|
+
# by calling name_xmlns at definition time.
|
49
|
+
#
|
50
|
+
# Raises an exception if none was found
|
51
|
+
# klass:: [Class]
|
52
|
+
# result:: [String, String] name and namespace
|
53
|
+
def self.name_xmlns_for_class(klass)
|
54
|
+
klass.ancestors.each do |klass1|
|
55
|
+
@@name_xmlns_classes.each do |name_xmlns,k|
|
56
|
+
if klass1 == k
|
57
|
+
return name_xmlns
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
raise NoNameXmlnsRegistered.new(klass)
|
63
|
+
end
|
64
|
+
|
65
|
+
##
|
66
|
+
# Find a class for given name and namespace
|
67
|
+
# name:: [String]
|
68
|
+
# xmlns:: [String]
|
69
|
+
# result:: A descendant of XMPPElement or REXML::Element
|
70
|
+
def self.class_for_name_xmlns(name, xmlns)
|
71
|
+
if @@name_xmlns_classes.has_key? [name, xmlns]
|
72
|
+
@@name_xmlns_classes[[name, xmlns]]
|
73
|
+
elsif @@name_xmlns_classes.has_key? [name, nil]
|
74
|
+
@@name_xmlns_classes[[name, nil]]
|
75
|
+
else
|
76
|
+
REXML::Element
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
##
|
81
|
+
# Import another REXML::Element descendant to:
|
82
|
+
# * Either an element class that registered with
|
83
|
+
# name and xmlns before
|
84
|
+
# * Or if none was found to the class itself
|
85
|
+
# (you may call this class method on a deriving class)
|
86
|
+
def self.import(element)
|
87
|
+
klass = class_for_name_xmlns(element.name, element.namespace)
|
88
|
+
if klass != self and klass.ancestors.include?(self)
|
89
|
+
klass.new.import(element)
|
90
|
+
else
|
91
|
+
self.new.import(element)
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
##
|
96
|
+
# Initialize this element, which will then be initialized
|
97
|
+
# with the name registered with name_xmlns.
|
98
|
+
def initialize(*arg)
|
99
|
+
if arg.empty?
|
100
|
+
name, xmlns = self.class::name_xmlns_for_class(self.class)
|
101
|
+
super(name)
|
102
|
+
if self.class::force_xmlns?
|
103
|
+
add_namespace(xmlns)
|
104
|
+
end
|
105
|
+
else
|
106
|
+
super
|
107
|
+
end
|
108
|
+
end
|
109
|
+
|
110
|
+
##
|
111
|
+
# Add a child element which will be imported according to the
|
112
|
+
# child's name and xmlns
|
113
|
+
# element:: [REXML::Element] Child
|
114
|
+
# result:: [REXML::Element or descendant of XMPPElement] New child
|
115
|
+
def typed_add(element)
|
116
|
+
if element.kind_of? REXML::Element
|
117
|
+
element_ns = (element.namespace.to_s == '') ? namespace : element.namespace
|
118
|
+
|
119
|
+
klass = XMPPElement::class_for_name_xmlns(element.name, element_ns)
|
120
|
+
if klass != element.class
|
121
|
+
element = klass.import(element)
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
125
|
+
super(element)
|
126
|
+
end
|
127
|
+
|
128
|
+
def parent=(new_parent)
|
129
|
+
if parent and parent.namespace('') == namespace('') and attributes['xmlns'].nil?
|
130
|
+
add_namespace parent.namespace('')
|
131
|
+
end
|
132
|
+
|
133
|
+
super
|
134
|
+
|
135
|
+
if new_parent and new_parent.namespace('') == namespace('')
|
136
|
+
delete_namespace
|
137
|
+
end
|
138
|
+
end
|
139
|
+
|
140
|
+
def clone
|
141
|
+
cloned = self.class.new
|
142
|
+
cloned.add_attributes self.attributes.clone
|
143
|
+
cloned.context = @context
|
144
|
+
cloned
|
145
|
+
end
|
146
|
+
|
147
|
+
##
|
148
|
+
# Generic XML attribute 'xml:lang'
|
149
|
+
# (REXML provides no shortcut)
|
150
|
+
def xml_lang
|
151
|
+
attributes['xml:lang']
|
152
|
+
end
|
153
|
+
|
154
|
+
##
|
155
|
+
# Set XML language attribute
|
156
|
+
def xml_lang=(l)
|
157
|
+
attributes['xml:lang'] = l
|
158
|
+
end
|
159
|
+
|
160
|
+
##
|
161
|
+
# Set XML language attribute (chainable)
|
162
|
+
def set_xml_lang(l)
|
163
|
+
self.xml_lang = l
|
164
|
+
self
|
165
|
+
end
|
166
|
+
|
167
|
+
end
|
168
|
+
end
|
@@ -0,0 +1,162 @@
|
|
1
|
+
# =XMPP4R - XMPP Library for Ruby
|
2
|
+
# License:: Ruby's license (see the LICENSE file) or GNU GPL, at your option.
|
3
|
+
# Website::http://home.gna.org/xmpp4r/
|
4
|
+
|
5
|
+
require 'xmpp4r/xmppelement'
|
6
|
+
require 'xmpp4r/errors'
|
7
|
+
require 'xmpp4r/jid'
|
8
|
+
|
9
|
+
module Jabber
|
10
|
+
##
|
11
|
+
# root class of all Jabber XML elements
|
12
|
+
class XMPPStanza < XMPPElement
|
13
|
+
##
|
14
|
+
# Compose a response by doing the following:
|
15
|
+
# * Create a new XMPPStanza of the same subclass
|
16
|
+
# with the same element-name
|
17
|
+
# * Import xmppstanza if import is true
|
18
|
+
# * Swap 'to' and 'from'
|
19
|
+
# * Copy 'id'
|
20
|
+
# * Does not take care about the type
|
21
|
+
#
|
22
|
+
# *Attention*: Be careful when answering to stanzas with
|
23
|
+
# <tt>type == :error</tt> - answering to an error may generate
|
24
|
+
# another error on the other side, which could be leading to a
|
25
|
+
# ping-pong effect quickly!
|
26
|
+
#
|
27
|
+
# xmppstanza:: [XMPPStanza] source
|
28
|
+
# import:: [true or false] Copy attributes and children of source
|
29
|
+
# result:: [XMPPStanza] answer stanza
|
30
|
+
def XMPPStanza.answer(xmppstanza, import=true)
|
31
|
+
x = xmppstanza.class.new
|
32
|
+
if import
|
33
|
+
x.import(xmppstanza)
|
34
|
+
end
|
35
|
+
x.from = xmppstanza.to
|
36
|
+
x.to = xmppstanza.from
|
37
|
+
x.id = xmppstanza.id
|
38
|
+
x
|
39
|
+
end
|
40
|
+
|
41
|
+
##
|
42
|
+
# Return the first <tt><error/></tt> child
|
43
|
+
def error
|
44
|
+
first_element('error')
|
45
|
+
end
|
46
|
+
|
47
|
+
##
|
48
|
+
# Compose a response of this XMPPStanza
|
49
|
+
# (see XMPPStanza.answer)
|
50
|
+
# result:: [XMPPStanza] New constructed stanza
|
51
|
+
def answer(import=true)
|
52
|
+
XMPPStanza.answer(self, import)
|
53
|
+
end
|
54
|
+
|
55
|
+
##
|
56
|
+
# Makes some changes to the structure of an XML element to help
|
57
|
+
# it respect the specification. For example, in a message, we should
|
58
|
+
# have <subject/> < <body/> < { rest of tags }
|
59
|
+
def normalize
|
60
|
+
end
|
61
|
+
|
62
|
+
##
|
63
|
+
# get the to attribute
|
64
|
+
#
|
65
|
+
# return:: [String] the element's to attribute
|
66
|
+
def to
|
67
|
+
(a = attribute('to')).nil? ? a : JID.new(a.value)
|
68
|
+
end
|
69
|
+
|
70
|
+
##
|
71
|
+
# set the to attribute
|
72
|
+
#
|
73
|
+
# v:: [String] the value to set
|
74
|
+
def to= (v)
|
75
|
+
add_attribute('to', v ? v.to_s : nil)
|
76
|
+
end
|
77
|
+
|
78
|
+
##
|
79
|
+
# set the to attribute (chaining-friendly)
|
80
|
+
#
|
81
|
+
# v:: [String] the value to set
|
82
|
+
def set_to(v)
|
83
|
+
self.to = v
|
84
|
+
self
|
85
|
+
end
|
86
|
+
|
87
|
+
##
|
88
|
+
# get the from attribute
|
89
|
+
#
|
90
|
+
# return:: [String] the element's from attribute
|
91
|
+
def from
|
92
|
+
(a = attribute('from')).nil? ? a : JID.new(a.value)
|
93
|
+
end
|
94
|
+
|
95
|
+
##
|
96
|
+
# set the from attribute
|
97
|
+
#
|
98
|
+
# v:: [String] the value from set
|
99
|
+
def from= (v)
|
100
|
+
add_attribute('from', v ? v.to_s : nil)
|
101
|
+
end
|
102
|
+
|
103
|
+
##
|
104
|
+
# set the from attribute (chaining-friendly)
|
105
|
+
#
|
106
|
+
# v:: [String] the value from set
|
107
|
+
def set_from(v)
|
108
|
+
add_attribute('from', v ? v.to_s : nil)
|
109
|
+
self
|
110
|
+
end
|
111
|
+
|
112
|
+
##
|
113
|
+
# get the id attribute
|
114
|
+
#
|
115
|
+
# return:: [String] the element's id attribute
|
116
|
+
def id
|
117
|
+
(a = attribute('id')).nil? ? a : a.value
|
118
|
+
end
|
119
|
+
|
120
|
+
##
|
121
|
+
# set the id attribute
|
122
|
+
#
|
123
|
+
# v:: [String] the value id set
|
124
|
+
def id= (v)
|
125
|
+
add_attribute('id', v.to_s)
|
126
|
+
end
|
127
|
+
|
128
|
+
##
|
129
|
+
# set the id attribute (chaining-friendly)
|
130
|
+
#
|
131
|
+
# v:: [String] the value id set
|
132
|
+
def set_id(v)
|
133
|
+
add_attribute('id', v.to_s)
|
134
|
+
self
|
135
|
+
end
|
136
|
+
|
137
|
+
##
|
138
|
+
# get the type attribute
|
139
|
+
#
|
140
|
+
# return:: [String] the element's type attribute
|
141
|
+
def type
|
142
|
+
(a = attribute('type')).nil? ? a : a.value
|
143
|
+
end
|
144
|
+
|
145
|
+
##
|
146
|
+
# set the type attribute
|
147
|
+
#
|
148
|
+
# v:: [String] the value type set
|
149
|
+
def type= (v)
|
150
|
+
add_attribute('type', v)
|
151
|
+
end
|
152
|
+
|
153
|
+
##
|
154
|
+
# set the type attribute (chaining-friendly)
|
155
|
+
#
|
156
|
+
# v:: [String] the value type set
|
157
|
+
def set_type(v)
|
158
|
+
add_attribute('type', v)
|
159
|
+
self
|
160
|
+
end
|
161
|
+
end
|
162
|
+
end
|
@@ -0,0 +1,249 @@
|
|
1
|
+
# WARNING : RAKE AUTO-GENERATED FILE. DO NOT MANUALLY EDIT!
|
2
|
+
# RUN : 'rake gem:update_gemspec'
|
3
|
+
|
4
|
+
Gem::Specification.new do |s|
|
5
|
+
s.activated = false
|
6
|
+
s.authors = ["Lucas Nussbaum", "Stephan Maka", "Glenn Rempe", "Kaoru Maeda"]
|
7
|
+
s.bindir = "bin"
|
8
|
+
s.description = "This is a fork from XMPP4R (https://github.com/ln/xmpp4r), fixing BOSH"
|
9
|
+
s.email = "kaoru.maeda@gmail.com"
|
10
|
+
s.extra_rdoc_files = ["CHANGELOG", "COPYING", "LICENSE", "README.rdoc", "README_ruby19.txt"]
|
11
|
+
s.files = ["CHANGELOG",
|
12
|
+
"COPYING",
|
13
|
+
"LICENSE",
|
14
|
+
"README.rdoc",
|
15
|
+
"README_ruby19.txt",
|
16
|
+
"Rakefile",
|
17
|
+
"data/doc/xmpp4r/examples/advanced/adventure/README",
|
18
|
+
"data/doc/xmpp4r/examples/advanced/adventure/adventure.rb",
|
19
|
+
"data/doc/xmpp4r/examples/advanced/adventure/adventuremuc.rb",
|
20
|
+
"data/doc/xmpp4r/examples/advanced/adventure/cube.xml",
|
21
|
+
"data/doc/xmpp4r/examples/advanced/adventure/tower.xml",
|
22
|
+
"data/doc/xmpp4r/examples/advanced/adventure/world.rb",
|
23
|
+
"data/doc/xmpp4r/examples/advanced/fileserve.conf",
|
24
|
+
"data/doc/xmpp4r/examples/advanced/fileserve.rb",
|
25
|
+
"data/doc/xmpp4r/examples/advanced/getonline.rb",
|
26
|
+
"data/doc/xmpp4r/examples/advanced/gtkmucclient.rb",
|
27
|
+
"data/doc/xmpp4r/examples/advanced/migrate.rb",
|
28
|
+
"data/doc/xmpp4r/examples/advanced/minimuc.rb",
|
29
|
+
"data/doc/xmpp4r/examples/advanced/pep-aggregator/index.xsl",
|
30
|
+
"data/doc/xmpp4r/examples/advanced/pep-aggregator/pep-aggregator.rb",
|
31
|
+
"data/doc/xmpp4r/examples/advanced/recvfile.rb",
|
32
|
+
"data/doc/xmpp4r/examples/advanced/rosterdiscovery.rb",
|
33
|
+
"data/doc/xmpp4r/examples/advanced/sendfile.conf",
|
34
|
+
"data/doc/xmpp4r/examples/advanced/sendfile.rb",
|
35
|
+
"data/doc/xmpp4r/examples/advanced/shellmgr/shellmgr.rb",
|
36
|
+
"data/doc/xmpp4r/examples/advanced/shellmgr/shellmgr_jabber.rb",
|
37
|
+
"data/doc/xmpp4r/examples/advanced/shellmgr/shellmgr_test.rb",
|
38
|
+
"data/doc/xmpp4r/examples/advanced/versionpoll.rb",
|
39
|
+
"data/doc/xmpp4r/examples/advanced/xmpping.rb",
|
40
|
+
"data/doc/xmpp4r/examples/advanced/xmppingrc.sample",
|
41
|
+
"data/doc/xmpp4r/examples/basic/change_password.rb",
|
42
|
+
"data/doc/xmpp4r/examples/basic/client.rb",
|
43
|
+
"data/doc/xmpp4r/examples/basic/component.rb",
|
44
|
+
"data/doc/xmpp4r/examples/basic/echo.rb",
|
45
|
+
"data/doc/xmpp4r/examples/basic/jabbersend.rb",
|
46
|
+
"data/doc/xmpp4r/examples/basic/mass_sender.rb",
|
47
|
+
"data/doc/xmpp4r/examples/basic/muc_owner_config.rb",
|
48
|
+
"data/doc/xmpp4r/examples/basic/mucinfo.rb",
|
49
|
+
"data/doc/xmpp4r/examples/basic/mucsimplebot.rb",
|
50
|
+
"data/doc/xmpp4r/examples/basic/register.rb",
|
51
|
+
"data/doc/xmpp4r/examples/basic/remove_registration.rb",
|
52
|
+
"data/doc/xmpp4r/examples/basic/roster.rb",
|
53
|
+
"data/doc/xmpp4r/examples/basic/rosterprint.rb",
|
54
|
+
"data/doc/xmpp4r/examples/basic/rosterrename.rb",
|
55
|
+
"data/doc/xmpp4r/examples/basic/rosterwatch.rb",
|
56
|
+
"data/doc/xmpp4r/examples/basic/send_vcard.rb",
|
57
|
+
"data/doc/xmpp4r/examples/basic/tune_client.rb",
|
58
|
+
"data/doc/xmpp4r/examples/basic/tune_server.rb",
|
59
|
+
"data/doc/xmpp4r/examples/basic/versionbot.rb",
|
60
|
+
"lib/xmpp4r.rb",
|
61
|
+
"lib/xmpp4r/base64.rb",
|
62
|
+
"lib/xmpp4r/bytestreams.rb",
|
63
|
+
"lib/xmpp4r/bytestreams/helper/filetransfer.rb",
|
64
|
+
"lib/xmpp4r/bytestreams/helper/ibb/base.rb",
|
65
|
+
"lib/xmpp4r/bytestreams/helper/ibb/initiator.rb",
|
66
|
+
"lib/xmpp4r/bytestreams/helper/ibb/target.rb",
|
67
|
+
"lib/xmpp4r/bytestreams/helper/socks5bytestreams/base.rb",
|
68
|
+
"lib/xmpp4r/bytestreams/helper/socks5bytestreams/initiator.rb",
|
69
|
+
"lib/xmpp4r/bytestreams/helper/socks5bytestreams/server.rb",
|
70
|
+
"lib/xmpp4r/bytestreams/helper/socks5bytestreams/socks5.rb",
|
71
|
+
"lib/xmpp4r/bytestreams/helper/socks5bytestreams/target.rb",
|
72
|
+
"lib/xmpp4r/bytestreams/iq/bytestreams.rb",
|
73
|
+
"lib/xmpp4r/bytestreams/iq/si.rb",
|
74
|
+
"lib/xmpp4r/callbacks.rb",
|
75
|
+
"lib/xmpp4r/caps.rb",
|
76
|
+
"lib/xmpp4r/caps/c.rb",
|
77
|
+
"lib/xmpp4r/caps/helper/generator.rb",
|
78
|
+
"lib/xmpp4r/caps/helper/helper.rb",
|
79
|
+
"lib/xmpp4r/client.rb",
|
80
|
+
"lib/xmpp4r/command/helper/responder.rb",
|
81
|
+
"lib/xmpp4r/command/iq/command.rb",
|
82
|
+
"lib/xmpp4r/component.rb",
|
83
|
+
"lib/xmpp4r/connection.rb",
|
84
|
+
"lib/xmpp4r/dataforms.rb",
|
85
|
+
"lib/xmpp4r/dataforms/x/data.rb",
|
86
|
+
"lib/xmpp4r/debuglog.rb",
|
87
|
+
"lib/xmpp4r/delay.rb",
|
88
|
+
"lib/xmpp4r/delay/x/delay.rb",
|
89
|
+
"lib/xmpp4r/discovery.rb",
|
90
|
+
"lib/xmpp4r/discovery/helper/helper.rb",
|
91
|
+
"lib/xmpp4r/discovery/helper/responder.rb",
|
92
|
+
"lib/xmpp4r/discovery/iq/discoinfo.rb",
|
93
|
+
"lib/xmpp4r/discovery/iq/discoitems.rb",
|
94
|
+
"lib/xmpp4r/entity_time.rb",
|
95
|
+
"lib/xmpp4r/entity_time/iq.rb",
|
96
|
+
"lib/xmpp4r/entity_time/responder.rb",
|
97
|
+
"lib/xmpp4r/errors.rb",
|
98
|
+
"lib/xmpp4r/feature_negotiation.rb",
|
99
|
+
"lib/xmpp4r/feature_negotiation/iq/feature.rb",
|
100
|
+
"lib/xmpp4r/framework/base.rb",
|
101
|
+
"lib/xmpp4r/framework/bot.rb",
|
102
|
+
"lib/xmpp4r/httpbinding.rb",
|
103
|
+
"lib/xmpp4r/httpbinding/client.rb",
|
104
|
+
"lib/xmpp4r/idgenerator.rb",
|
105
|
+
"lib/xmpp4r/iq.rb",
|
106
|
+
"lib/xmpp4r/jid.rb",
|
107
|
+
"lib/xmpp4r/last.rb",
|
108
|
+
"lib/xmpp4r/last/helper/helper.rb",
|
109
|
+
"lib/xmpp4r/last/iq/last.rb",
|
110
|
+
"lib/xmpp4r/location.rb",
|
111
|
+
"lib/xmpp4r/location/helper/helper.rb",
|
112
|
+
"lib/xmpp4r/location/location.rb",
|
113
|
+
"lib/xmpp4r/message.rb",
|
114
|
+
"lib/xmpp4r/muc.rb",
|
115
|
+
"lib/xmpp4r/muc/helper/mucbrowser.rb",
|
116
|
+
"lib/xmpp4r/muc/helper/mucclient.rb",
|
117
|
+
"lib/xmpp4r/muc/helper/simplemucclient.rb",
|
118
|
+
"lib/xmpp4r/muc/iq/mucadmin.rb",
|
119
|
+
"lib/xmpp4r/muc/iq/mucadminitem.rb",
|
120
|
+
"lib/xmpp4r/muc/iq/mucowner.rb",
|
121
|
+
"lib/xmpp4r/muc/item.rb",
|
122
|
+
"lib/xmpp4r/muc/x/muc.rb",
|
123
|
+
"lib/xmpp4r/muc/x/mucuserinvite.rb",
|
124
|
+
"lib/xmpp4r/muc/x/mucuseritem.rb",
|
125
|
+
"lib/xmpp4r/observable.rb",
|
126
|
+
"lib/xmpp4r/observable/contact.rb",
|
127
|
+
"lib/xmpp4r/observable/helper.rb",
|
128
|
+
"lib/xmpp4r/observable/observable_thing.rb",
|
129
|
+
"lib/xmpp4r/observable/pubsub.rb",
|
130
|
+
"lib/xmpp4r/observable/subscription.rb",
|
131
|
+
"lib/xmpp4r/observable/thread_store.rb",
|
132
|
+
"lib/xmpp4r/presence.rb",
|
133
|
+
"lib/xmpp4r/pubsub.rb",
|
134
|
+
"lib/xmpp4r/pubsub/children/configuration.rb",
|
135
|
+
"lib/xmpp4r/pubsub/children/event.rb",
|
136
|
+
"lib/xmpp4r/pubsub/children/item.rb",
|
137
|
+
"lib/xmpp4r/pubsub/children/items.rb",
|
138
|
+
"lib/xmpp4r/pubsub/children/node_config.rb",
|
139
|
+
"lib/xmpp4r/pubsub/children/publish.rb",
|
140
|
+
"lib/xmpp4r/pubsub/children/retract.rb",
|
141
|
+
"lib/xmpp4r/pubsub/children/subscription.rb",
|
142
|
+
"lib/xmpp4r/pubsub/children/subscription_config.rb",
|
143
|
+
"lib/xmpp4r/pubsub/children/unsubscribe.rb",
|
144
|
+
"lib/xmpp4r/pubsub/helper/nodebrowser.rb",
|
145
|
+
"lib/xmpp4r/pubsub/helper/nodehelper.rb",
|
146
|
+
"lib/xmpp4r/pubsub/helper/oauth_service_helper.rb",
|
147
|
+
"lib/xmpp4r/pubsub/helper/servicehelper.rb",
|
148
|
+
"lib/xmpp4r/pubsub/iq/pubsub.rb",
|
149
|
+
"lib/xmpp4r/query.rb",
|
150
|
+
"lib/xmpp4r/reliable.rb",
|
151
|
+
"lib/xmpp4r/rexmladdons.rb",
|
152
|
+
"lib/xmpp4r/roster.rb",
|
153
|
+
"lib/xmpp4r/roster/helper/roster.rb",
|
154
|
+
"lib/xmpp4r/roster/iq/roster.rb",
|
155
|
+
"lib/xmpp4r/roster/x/roster.rb",
|
156
|
+
"lib/xmpp4r/rpc.rb",
|
157
|
+
"lib/xmpp4r/rpc/helper/client.rb",
|
158
|
+
"lib/xmpp4r/rpc/helper/server.rb",
|
159
|
+
"lib/xmpp4r/rpc/helper/xmlrpcaddons.rb",
|
160
|
+
"lib/xmpp4r/rpc/iq/rpc.rb",
|
161
|
+
"lib/xmpp4r/sasl.rb",
|
162
|
+
"lib/xmpp4r/semaphore.rb",
|
163
|
+
"lib/xmpp4r/stream.rb",
|
164
|
+
"lib/xmpp4r/streamparser.rb",
|
165
|
+
"lib/xmpp4r/test/listener_mocker.rb",
|
166
|
+
"lib/xmpp4r/tune.rb",
|
167
|
+
"lib/xmpp4r/tune/helper/helper.rb",
|
168
|
+
"lib/xmpp4r/tune/tune.rb",
|
169
|
+
"lib/xmpp4r/vcard.rb",
|
170
|
+
"lib/xmpp4r/vcard/helper/vcard.rb",
|
171
|
+
"lib/xmpp4r/vcard/iq/vcard.rb",
|
172
|
+
"lib/xmpp4r/version.rb",
|
173
|
+
"lib/xmpp4r/version/helper/responder.rb",
|
174
|
+
"lib/xmpp4r/version/helper/simpleresponder.rb",
|
175
|
+
"lib/xmpp4r/version/iq/version.rb",
|
176
|
+
"lib/xmpp4r/x.rb",
|
177
|
+
"lib/xmpp4r/xhtml.rb",
|
178
|
+
"lib/xmpp4r/xhtml/html.rb",
|
179
|
+
"lib/xmpp4r/xmpp4r.rb",
|
180
|
+
"lib/xmpp4r/xmppelement.rb",
|
181
|
+
"lib/xmpp4r/xmppstanza.rb",
|
182
|
+
"mad-p-xmpp4r.gemspec",
|
183
|
+
"setup.rb",
|
184
|
+
"test/bytestreams/tc_ibb.rb",
|
185
|
+
"test/bytestreams/tc_socks5bytestreams.rb",
|
186
|
+
"test/caps/tc_helper.rb",
|
187
|
+
"test/dataforms/tc_data.rb",
|
188
|
+
"test/delay/tc_xdelay.rb",
|
189
|
+
"test/discovery/tc_responder.rb",
|
190
|
+
"test/entity_time/tc_responder.rb",
|
191
|
+
"test/last/tc_helper.rb",
|
192
|
+
"test/lib/assert_equal_xml.rb",
|
193
|
+
"test/lib/clienttester.rb",
|
194
|
+
"test/muc/tc_muc_mucclient.rb",
|
195
|
+
"test/muc/tc_muc_simplemucclient.rb",
|
196
|
+
"test/muc/tc_mucowner.rb",
|
197
|
+
"test/pubsub/tc_helper.rb",
|
198
|
+
"test/pubsub/tc_nodeconfig.rb",
|
199
|
+
"test/pubsub/tc_subscriptionconfig.rb",
|
200
|
+
"test/reliable/tc_disconnect_cleanup.rb",
|
201
|
+
"test/reliable/tc_disconnect_exception.rb",
|
202
|
+
"test/reliable/tc_listener_mocked_test.rb",
|
203
|
+
"test/reliable/tc_reliable_connection.rb",
|
204
|
+
"test/roster/tc_helper.rb",
|
205
|
+
"test/roster/tc_iqqueryroster.rb",
|
206
|
+
"test/roster/tc_xroster.rb",
|
207
|
+
"test/rpc/tc_helper.rb",
|
208
|
+
"test/tc_callbacks.rb",
|
209
|
+
"test/tc_class_names.rb",
|
210
|
+
"test/tc_client.rb",
|
211
|
+
"test/tc_errors.rb",
|
212
|
+
"test/tc_idgenerator.rb",
|
213
|
+
"test/tc_iq.rb",
|
214
|
+
"test/tc_iqquery.rb",
|
215
|
+
"test/tc_jid.rb",
|
216
|
+
"test/tc_message.rb",
|
217
|
+
"test/tc_presence.rb",
|
218
|
+
"test/tc_rexml.rb",
|
219
|
+
"test/tc_stream.rb",
|
220
|
+
"test/tc_streamComponent.rb",
|
221
|
+
"test/tc_streamError.rb",
|
222
|
+
"test/tc_streamSend.rb",
|
223
|
+
"test/tc_streamparser.rb",
|
224
|
+
"test/tc_xmppstanza.rb",
|
225
|
+
"test/ts_xmpp4r.rb",
|
226
|
+
"test/tune/tc_helper_recv.rb",
|
227
|
+
"test/tune/tc_helper_send.rb",
|
228
|
+
"test/tune/tc_tune.rb",
|
229
|
+
"test/vcard/tc_helper.rb",
|
230
|
+
"test/vcard/tc_iqvcard.rb",
|
231
|
+
"test/version/tc_helper.rb",
|
232
|
+
"test/version/tc_iqqueryversion.rb",
|
233
|
+
"test/xhtml/tc_html.rb",
|
234
|
+
"tools/gen_requires.bash",
|
235
|
+
"tools/xmpp4r-gemspec-test.rb"]
|
236
|
+
s.has_rdoc = true
|
237
|
+
s.homepage = "https://github.com/mad-p/xmpp4r"
|
238
|
+
s.name = "mad-p-xmpp4r"
|
239
|
+
s.platform = "ruby"
|
240
|
+
s.rdoc_options = ["--quiet", "--title", "This is a fork from XMPP4R (https://github.com/ln/xmpp4r), fixing BOSH", "--opname", "index.html", "--main", "lib/xmpp4r.rb", "--line-numbers", "--inline-source"]
|
241
|
+
s.require_paths = ["lib"]
|
242
|
+
s.required_ruby_version = ">= 1.8.4"
|
243
|
+
s.required_rubygems_version = ">= 0"
|
244
|
+
s.rubyforge_project = "mad-p-xmpp4r"
|
245
|
+
s.rubygems_version = "1.8.10"
|
246
|
+
s.specification_version = 3
|
247
|
+
s.summary = "This is a fork from XMPP4R (https://github.com/ln/xmpp4r), fixing BOSH"
|
248
|
+
s.version = "0.6.0"
|
249
|
+
end
|