xmppify 0.0.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +17 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +29 -0
- data/Rakefile +1 -0
- data/app/assets/javascripts/xmpp/index.js +0 -0
- data/app/assets/javascripts/xmpp/scripts/checkplayer.js +12 -0
- data/app/assets/javascripts/xmpp/scripts/crossdomain.xml +7 -0
- data/app/assets/javascripts/xmpp/scripts/flXHR.js +2 -0
- data/app/assets/javascripts/xmpp/scripts/flXHR.swf +0 -0
- data/app/assets/javascripts/xmpp/scripts/flXHR.vbs +44 -0
- data/app/assets/javascripts/xmpp/scripts/flensed.js +12 -0
- data/app/assets/javascripts/xmpp/scripts/strophe.flxhr.js +31 -0
- data/app/assets/javascripts/xmpp/scripts/strophe.js +3538 -0
- data/app/assets/javascripts/xmpp/scripts/swfobject.js +5 -0
- data/app/assets/javascripts/xmpp/scripts/updateplayer.swf +0 -0
- data/app/assets/javascripts/xmpp/scripts/xmpp.js.coffee +386 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/LICENSE.txt +19 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/README.markdown +95 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/archive/README.markdown +14 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/archive/iso8601_support.js +32 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/archive/strophe.archive.js +88 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/caps/README.markdown +53 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/caps/sha1.js +202 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/caps/strophe.CAPS.coffee +153 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/caps/strophe.CAPS.js +88 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/caps/strophe.caps.jsonly.js +240 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/chatstates/strophe.chatstates.js +80 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/cmds/README.markdown +47 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/cmds/spec/GetUrlComamndSpec.js +66 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/cmds/spec/strophe.cmds.spec.coffee +145 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/cmds/spec/support/jasmine.json +16 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/cmds/src/strophe.cmds.coffee +265 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/cmds/src/strophe.cmds.js +403 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/dataforms/README.markdown +82 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/dataforms/spec/strophe.x.coffee +715 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/dataforms/src/strophe.x.coffee +443 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/dataforms/src/strophe.x.js +854 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/disco/.gitignore +1 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/disco/README.markdown +0 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/disco/convert.js +13 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/disco/jasmine.json +11 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/disco/lib/strophe.disco.js +137 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/disco/public/javascript/strophe.disco.js +137 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/disco/spec/01_querying_information.xml +6 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/disco/spec/02_result_set_for_information_request.xml +22 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/disco/spec/03_target_entity_does_not_exist.xml +10 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/disco/spec/04_service_unavailable.xml +11 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/disco/spec/09_querying_specific_jid_and_node_combination.xml +7 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/disco/spec/10_jid_and_node_result.xml +12 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/disco/spec/11_requesting_all_items.xml +6 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/disco/spec/12_result_set_for_all_items.xml +23 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/disco/spec/13_empty_result_set.xml +7 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/disco/spec/17_service_returns_nodes.xml +16 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/disco/spec/18_requesting_further_nodes.xml +7 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/disco/spec/24_jid_and_node_error.xml +11 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/disco/spec/DiscoNodeSpec.js +50 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/disco/spec/SpecHelper.js +51 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/disco/spec/Stanzas.js +0 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/disco/spec/strophe.disco.spec.helper.js +54 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/disco/spec/strophe.disco.spec.js +0 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/disco/spec/support/jasmine.json +13 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/disco/strophe.disco.js +232 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/epic/public/javascript/jquery.epic.js +61 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/epic/spec/SpecHelper.js +9 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/epic/spec/jquery.epic.js +39 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/epic/spec/support/jasmine.json +22 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/iexdomain/iexdomain.js +36 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/joap/README.markdown +117 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/joap/buster.js +23 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/joap/jid.coffee +64 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/joap/jid.js +92 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/joap/spec/browserSetup.coffee +1 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/joap/spec/jid.spec.coffee +96 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/joap/spec/strophe.joap.spec.coffee +461 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/joap/strophe.joap.coffee +304 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/joap/strophe.joap.js +522 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/mam/LICENSE.txt +19 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/mam/README.markdown +52 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/mam/strophe.mam.js +62 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/muc/LICENSE.txt +20 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/muc/strophe.muc.js +1003 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/ping/README.markdown +28 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/ping/strophe.ping.js +68 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/private/README.markdown +16 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/private/strophe.private.js +192 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/pubsub/strophe.pubsub.js +555 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/receipts/strophe.receipts.js +155 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/register/README.markdown +44 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/register/strophe.register.js +431 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/roster/public/javascript/strophe.roster.js +40 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/roster/spec/strophe.roster.spec.js +65 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/roster/spec/support/jasmine.json +15 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/roster/strophe.roster.js +438 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/rpc/.gitignore +6 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/rpc/README.md +113 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/rpc/buster.js +11 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/rpc/lib/strophe.js +4198 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/rpc/spec/strophe.rpc.spec.helper.js +38 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/rpc/spec/strophe.rpc.spec.js +262 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/rpc/strophe.rpc.js +464 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/rsm/strophe.rsm.js +52 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/serverdate/strophe.serverdate.js +58 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/vcard/examples/index.html +17 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/vcard/examples/strophevcard.js +0 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/vcard/strophe.vcard.coffee +44 -0
- data/app/assets/javascripts/xmpp/strophejs-plugins/vcard/strophe.vcard.js +66 -0
- data/app/assets/stylesheets/xmpp/index.css +0 -0
- data/app/controllers/omniauth_callbacks_controller.rb +15 -0
- data/app/controllers/ruby_bosh.rb +221 -0
- data/app/models/identity.rb +3 -0
- data/app/models/user.rb +40 -0
- data/bin/rails +8 -0
- data/db/migrate/20140329065635_create_users.rb +10 -0
- data/db/migrate/20140329070238_create_identities.rb +11 -0
- data/lib/xmppify/version.rb +3 -0
- data/lib/xmppify.rb +6 -0
- data/xmppify.gemspec +23 -0
- metadata +197 -0
@@ -0,0 +1,28 @@
|
|
1
|
+
# Strophe.ping.js
|
2
|
+
|
3
|
+
Strophe.ping.js is a plugin to provide XMPP Ping
|
4
|
+
( [ XEP-0199 ]( http://xmpp.org/extensions/xep-0199.html ) ).
|
5
|
+
|
6
|
+
## Usage
|
7
|
+
|
8
|
+
After you connected sucessfully to the XMPP server you can send a ping to a XMPP
|
9
|
+
client or server:
|
10
|
+
|
11
|
+
connection.ping.ping( "serviceJID@server.org", success, error, timeout );
|
12
|
+
|
13
|
+
You can also add a ping handler to receive pings:
|
14
|
+
|
15
|
+
connection.ping.addPingHandler( handler );
|
16
|
+
|
17
|
+
Within your ping handler function you surely want to reply with a pong iq:
|
18
|
+
|
19
|
+
handler = function( ping ){
|
20
|
+
...
|
21
|
+
connection.ping.pong( ping );
|
22
|
+
...
|
23
|
+
return true;
|
24
|
+
}
|
25
|
+
|
26
|
+
## ToDo
|
27
|
+
|
28
|
+
- write specs
|
@@ -0,0 +1,68 @@
|
|
1
|
+
/*
|
2
|
+
* This plugin is distributed under the terms of the MIT licence.
|
3
|
+
* Please see the LICENCE file for details.
|
4
|
+
*
|
5
|
+
* Copyright (c) Markus Kohlhase, 2010
|
6
|
+
* Refactored by Pavel Lang, 2011
|
7
|
+
*/
|
8
|
+
|
9
|
+
/**
|
10
|
+
* File: strophe.ping.js
|
11
|
+
* A Strophe plugin for XMPP Ping ( http://xmpp.org/extensions/xep-0199.html )
|
12
|
+
*/
|
13
|
+
|
14
|
+
Strophe.addConnectionPlugin('ping', {
|
15
|
+
_c: null,
|
16
|
+
|
17
|
+
// called by the Strophe.Connection constructor
|
18
|
+
init: function(conn)
|
19
|
+
{
|
20
|
+
this._c = conn;
|
21
|
+
Strophe.addNamespace('PING', "urn:xmpp:ping");
|
22
|
+
},
|
23
|
+
|
24
|
+
/**
|
25
|
+
* Function: ping
|
26
|
+
*
|
27
|
+
* Parameters:
|
28
|
+
* (String) to - The JID you want to ping
|
29
|
+
* (Function) success - Callback function on success
|
30
|
+
* (Function) error - Callback function on error
|
31
|
+
* (Integer) timeout - Timeout in milliseconds
|
32
|
+
*/
|
33
|
+
ping: function(jid, success, error, timeout)
|
34
|
+
{
|
35
|
+
var id = this._c.getUniqueId('ping');
|
36
|
+
var iq = $iq({type: 'get', to: jid, id: id}).c(
|
37
|
+
'ping', {xmlns: Strophe.NS.PING});
|
38
|
+
this._c.sendIQ(iq, success, error, timeout);
|
39
|
+
},
|
40
|
+
|
41
|
+
/**
|
42
|
+
* Function: pong
|
43
|
+
*
|
44
|
+
* Parameters:
|
45
|
+
* (Object) ping - The ping stanza from the server
|
46
|
+
*/
|
47
|
+
pong: function(ping)
|
48
|
+
{
|
49
|
+
var from = ping.getAttribute('from');
|
50
|
+
var id = ping.getAttribute('id');
|
51
|
+
var iq = $iq({type: 'result', to: from, id: id});
|
52
|
+
this._c.sendIQ(iq);
|
53
|
+
},
|
54
|
+
|
55
|
+
/**
|
56
|
+
* Function: addPingHandler
|
57
|
+
*
|
58
|
+
* Parameters:
|
59
|
+
* (Function) handler - Ping handler
|
60
|
+
*
|
61
|
+
* Returns:
|
62
|
+
* A reference to the handler that can be used to remove it.
|
63
|
+
*/
|
64
|
+
addPingHandler: function(handler)
|
65
|
+
{
|
66
|
+
return this._c.addHandler(handler, Strophe.NS.PING, "iq", "get");
|
67
|
+
}
|
68
|
+
});
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# Strophe.private.js
|
2
|
+
|
3
|
+
Strophe.private.js is a plugin for the XMPP library [Strophe.js](http://code.stanziq.com/strophe)
|
4
|
+
to provide XMPP Private XML Storage ( XEP-0049 ).
|
5
|
+
|
6
|
+
Strophe.private.js is licensed under the MIT license.
|
7
|
+
|
8
|
+
## Usage
|
9
|
+
|
10
|
+
After you connected successfully to the XMPP server you can save your data:
|
11
|
+
|
12
|
+
connection.private.set( myTagName, myNamespace, myData, success, error );
|
13
|
+
|
14
|
+
Receive your data by specifing the tag name and the namespace:
|
15
|
+
|
16
|
+
conncection.private.get( myTagName, myNamespace, success, error );
|
@@ -0,0 +1,192 @@
|
|
1
|
+
/**
|
2
|
+
* This plugin is distributed under the terms of the MIT licence.
|
3
|
+
* Please see the LICENCE file for details.
|
4
|
+
* Copyright (c) Markus Kohlhase, 2011
|
5
|
+
*/
|
6
|
+
|
7
|
+
/**
|
8
|
+
* File: strophe.private.js
|
9
|
+
* A Strophe plugin for XMPP Private XML Storage ( http://xmpp.org/extensions/xep-0049.html )
|
10
|
+
*/
|
11
|
+
|
12
|
+
Strophe.addConnectionPlugin('private',
|
13
|
+
{
|
14
|
+
_connection: null,
|
15
|
+
|
16
|
+
// called by the Strophe.Connection constructor
|
17
|
+
|
18
|
+
init: function( conn ){
|
19
|
+
|
20
|
+
this._connection = conn;
|
21
|
+
Strophe.addNamespace( 'PRIVATE', "jabber:iq:private" );
|
22
|
+
},
|
23
|
+
|
24
|
+
/**
|
25
|
+
* Function: set
|
26
|
+
*
|
27
|
+
* Parameters:
|
28
|
+
* (String) tag - the tag name
|
29
|
+
* (String) ns - the namespace
|
30
|
+
* (XML) data - the data you want to save
|
31
|
+
* (Function) success - Callback function on success
|
32
|
+
* (Function) error - Callback function on error
|
33
|
+
*/
|
34
|
+
|
35
|
+
set: function( tag, ns, data, success, error ){
|
36
|
+
|
37
|
+
var id = this._connection.getUniqueId('saveXML');
|
38
|
+
|
39
|
+
var iq = $iq({ type:'set', id: id })
|
40
|
+
.c('query', { xmlns: Strophe.NS.PRIVATE } )
|
41
|
+
.c( tag, { xmlns: ns } );
|
42
|
+
|
43
|
+
var d = this._transformData( data );
|
44
|
+
|
45
|
+
if( d ){
|
46
|
+
iq.cnode( d );
|
47
|
+
};
|
48
|
+
|
49
|
+
this._connection.sendIQ( iq, success, error );
|
50
|
+
|
51
|
+
},
|
52
|
+
|
53
|
+
/**
|
54
|
+
* Function: get
|
55
|
+
*
|
56
|
+
* Parameters:
|
57
|
+
* (String) tag - the tag name
|
58
|
+
* (String) ns - the namespace
|
59
|
+
* (Function) success - Callback function on success
|
60
|
+
* (Function) error - Callback function on error
|
61
|
+
*/
|
62
|
+
|
63
|
+
get: function( tag, ns, success, error ){
|
64
|
+
|
65
|
+
var id = this._connection.getUniqueId('loadXML');
|
66
|
+
|
67
|
+
var iq = $iq({ type:'get', id: id })
|
68
|
+
.c('query', { xmlns: Strophe.NS.PRIVATE } )
|
69
|
+
.c(tag, { xmlns: ns } );
|
70
|
+
|
71
|
+
this._connection.sendIQ( iq, function( iq ){
|
72
|
+
|
73
|
+
var data = iq;
|
74
|
+
|
75
|
+
for( var i=0; i<3; i++ ){
|
76
|
+
data = data.childNodes[0];
|
77
|
+
if( !data ){
|
78
|
+
break;
|
79
|
+
}
|
80
|
+
}
|
81
|
+
|
82
|
+
success( data, iq );
|
83
|
+
|
84
|
+
}, error );
|
85
|
+
|
86
|
+
},
|
87
|
+
|
88
|
+
/**
|
89
|
+
* PrivateFunction: _transformData
|
90
|
+
*/
|
91
|
+
_transformData: function( c ){
|
92
|
+
|
93
|
+
switch( typeof( c ) ){
|
94
|
+
|
95
|
+
case "number":
|
96
|
+
case "boolean": return Strophe.xmlTextNode( c + '' );
|
97
|
+
|
98
|
+
case "string":
|
99
|
+
|
100
|
+
var dom = this._textToXml( c );
|
101
|
+
|
102
|
+
if( dom !== null ){
|
103
|
+
return dom
|
104
|
+
} else {
|
105
|
+
return Strophe.xmlTextNode( c + '' );
|
106
|
+
}
|
107
|
+
|
108
|
+
case "object":
|
109
|
+
|
110
|
+
if( this._isNode(c) || this._isElement(c) ){
|
111
|
+
return c;
|
112
|
+
}
|
113
|
+
}
|
114
|
+
return null;
|
115
|
+
},
|
116
|
+
|
117
|
+
/**
|
118
|
+
* PrivateFunction: _textToXml
|
119
|
+
*
|
120
|
+
* Parameters:
|
121
|
+
* (String) text - XML String
|
122
|
+
*
|
123
|
+
* Returns:
|
124
|
+
* (Object) dom - DOM Object
|
125
|
+
*/
|
126
|
+
|
127
|
+
_textToXml: function( text ){
|
128
|
+
|
129
|
+
var doc = null;
|
130
|
+
|
131
|
+
if( window.DOMParser ){
|
132
|
+
var parser = new DOMParser();
|
133
|
+
doc = parser.parseFromString( text, 'text/xml');
|
134
|
+
} else if( window.ActiveXObject ){
|
135
|
+
doc = new ActiveXObject("MSXML2.DOMDocument");
|
136
|
+
doc.async = false;
|
137
|
+
doc.loadXML(text);
|
138
|
+
} else{
|
139
|
+
throw{
|
140
|
+
type: 'Parse error',
|
141
|
+
message: "No DOM parser object found."
|
142
|
+
};
|
143
|
+
}
|
144
|
+
|
145
|
+
var error = doc.getElementsByTagName("parsererror");
|
146
|
+
|
147
|
+
if( error.length > 0 ){
|
148
|
+
return null;
|
149
|
+
}
|
150
|
+
|
151
|
+
var node = document.importNode( doc.documentElement, true );
|
152
|
+
return node;
|
153
|
+
},
|
154
|
+
/**
|
155
|
+
* PrivateFunction: _isNode
|
156
|
+
*
|
157
|
+
* Parameters:
|
158
|
+
* ( Object ) obj - The object to test
|
159
|
+
*
|
160
|
+
* Returns:
|
161
|
+
* True if it is a DOM node
|
162
|
+
*/
|
163
|
+
|
164
|
+
_isNode: function( obj ){
|
165
|
+
|
166
|
+
if( typeof( Node ) === "object" ){
|
167
|
+
return ( obj instanceof Node );
|
168
|
+
}else{
|
169
|
+
return ( typeof( obj ) === "object" && typeof( obj.nodeType ) === "number" && typeof( obj.nodeName ) === "string");
|
170
|
+
}
|
171
|
+
},
|
172
|
+
|
173
|
+
/**
|
174
|
+
* PrivateFunction: _isElement
|
175
|
+
*
|
176
|
+
* Parameters:
|
177
|
+
* ( Object ) obj - The object to test
|
178
|
+
*
|
179
|
+
* Returns:
|
180
|
+
* True if it is a DOM element.
|
181
|
+
*/
|
182
|
+
|
183
|
+
_isElement: function( obj ){
|
184
|
+
|
185
|
+
if( typeof( HTMLElement ) === "object"){
|
186
|
+
return ( obj instanceof HTMLElement ); //DOM2
|
187
|
+
} else{
|
188
|
+
return ( typeof( obj ) === "object" && obj.nodeType === 1 && typeof( obj.nodeName ) === "string" );
|
189
|
+
}
|
190
|
+
}
|
191
|
+
|
192
|
+
});
|