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,15 @@
|
|
1
|
+
require 'xmppify'
|
2
|
+
class OmniauthCallbacksController < Devise::OmniauthCallbacksController
|
3
|
+
def doorkeeper
|
4
|
+
oauth_data = request.env["omniauth.auth"]
|
5
|
+
@user = User.find_or_create_for_doorkeeper_oauth(oauth_data)
|
6
|
+
@user.update_doorkeeper_credentials(oauth_data)
|
7
|
+
@user.save
|
8
|
+
@user.connect
|
9
|
+
if @user.identities.find_by(provider:"github").nil?
|
10
|
+
@user.identities.create(provider:"github",auth_token:oauth_data.info.github_auth_token,email:oauth_data.info.github_email)
|
11
|
+
end
|
12
|
+
sign_in @user
|
13
|
+
redirect_to dashboard_path
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,221 @@
|
|
1
|
+
require 'rest_client'
|
2
|
+
require 'builder'
|
3
|
+
require 'rexml/document'
|
4
|
+
require 'base64'
|
5
|
+
require 'hpricot'
|
6
|
+
|
7
|
+
class RubyBOSH
|
8
|
+
BOSH_XMLNS = 'http://jabber.org/protocol/httpbind'
|
9
|
+
TLS_XMLNS = 'urn:ietf:params:xml:ns:xmpp-tls'
|
10
|
+
SASL_XMLNS = 'urn:ietf:params:xml:ns:xmpp-sasl'
|
11
|
+
BIND_XMLNS = 'urn:ietf:params:xml:ns:xmpp-bind'
|
12
|
+
SESSION_XMLNS = 'urn:ietf:params:xml:ns:xmpp-session'
|
13
|
+
CLIENT_XMLNS = 'jabber:client'
|
14
|
+
|
15
|
+
class Error < StandardError; end
|
16
|
+
class Timeout < RubyBOSH::Error; end
|
17
|
+
class AuthFailed < RubyBOSH::Error; end
|
18
|
+
class ConnFailed < RubyBOSH::Error; end
|
19
|
+
|
20
|
+
@@logging = false
|
21
|
+
def self.logging=(value)
|
22
|
+
@@logging = value
|
23
|
+
end
|
24
|
+
|
25
|
+
attr_accessor :jid, :rid, :sid, :success , :custom_resource
|
26
|
+
def initialize(jid, pw, service_url, opts={})
|
27
|
+
@service_url = service_url
|
28
|
+
# Extract the resource if present
|
29
|
+
split_jid = jid.split("/")
|
30
|
+
@jid = split_jid.first
|
31
|
+
@custom_resource = split_jid.last if split_jid.length > 1
|
32
|
+
@pw = pw
|
33
|
+
@host = @jid.split("@").last
|
34
|
+
@success = false
|
35
|
+
@timeout = opts[:timeout] || 3 #seconds
|
36
|
+
@headers = {"Content-Type" => "text/xml; charset=utf-8",
|
37
|
+
"Accept" => "text/xml"}
|
38
|
+
@wait = opts[:wait] || 5
|
39
|
+
@hold = opts[:hold] || 3
|
40
|
+
@window = opts[:window] || 5
|
41
|
+
end
|
42
|
+
|
43
|
+
def self.register(user)
|
44
|
+
salt = SecureRandom.random_bytes(64)
|
45
|
+
key = ActiveSupport::KeyGenerator.new('password').generate_key(salt) # => "\x89\xE0\x156\xAC..."
|
46
|
+
crypt = ActiveSupport::MessageEncryptor.new(key) # => #<ActiveSupport::MessageEncryptor ...>
|
47
|
+
ap ENV['DOORKEEPER_APP_ID']
|
48
|
+
encrypted_data = crypt.encrypt_and_sign("#{user.email}_#{ENV['DOORKEEPER_APP_ID']}")
|
49
|
+
jid = Jabber::JID.new("#{encrypted_data}@idlecampus.com")
|
50
|
+
client = Jabber::Client.new(jid)
|
51
|
+
Jabber::debug = false
|
52
|
+
client.connect
|
53
|
+
fields = {}
|
54
|
+
client.register("#{ENV['DOORKEEPER_APP_SECRET']}", fields)
|
55
|
+
client.close
|
56
|
+
encrypted_data
|
57
|
+
end
|
58
|
+
|
59
|
+
def success?
|
60
|
+
@success == true
|
61
|
+
end
|
62
|
+
|
63
|
+
def self.initialize_session(*args)
|
64
|
+
|
65
|
+
new(*args).connect
|
66
|
+
end
|
67
|
+
|
68
|
+
def connect
|
69
|
+
initialize_bosh_session
|
70
|
+
if send_auth_request
|
71
|
+
|
72
|
+
send_restart_request
|
73
|
+
request_resource_binding
|
74
|
+
@success = send_session_request
|
75
|
+
|
76
|
+
p @success
|
77
|
+
end
|
78
|
+
|
79
|
+
raise RubyBOSH::AuthFailed, "could not authenticate #{@jid}" unless success?
|
80
|
+
@rid += 1 #updates the rid for the next call from the browser
|
81
|
+
|
82
|
+
[@jid, @sid, @rid]
|
83
|
+
end
|
84
|
+
|
85
|
+
private
|
86
|
+
def initialize_bosh_session
|
87
|
+
response = deliver(construct_body(:wait => @wait, :to => @host,
|
88
|
+
:hold => @hold, :window => @window,
|
89
|
+
"xmpp:version" => '1.0'))
|
90
|
+
parse(response)
|
91
|
+
end
|
92
|
+
|
93
|
+
def construct_body(params={}, &block)
|
94
|
+
@rid ? @rid+=1 : @rid=rand(100000)
|
95
|
+
|
96
|
+
builder = Builder::XmlMarkup.new
|
97
|
+
parameters = {:rid => @rid, :xmlns => BOSH_XMLNS,
|
98
|
+
"xmpp:version" => "1.0",
|
99
|
+
"xmlns:xmpp" => "urn:xmpp:xbosh"}.merge(params)
|
100
|
+
|
101
|
+
if block_given?
|
102
|
+
builder.body(parameters) {|body| yield(body)}
|
103
|
+
else
|
104
|
+
builder.body(parameters)
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
108
|
+
def send_auth_request
|
109
|
+
request = construct_body(:sid => @sid) do |body|
|
110
|
+
auth_string = "#{@jid}\x00#{@jid.split("@").first.strip}\x00#{@pw}"
|
111
|
+
body.auth(Base64.encode64(auth_string).gsub(/\s/,''),
|
112
|
+
:xmlns => SASL_XMLNS, :mechanism => 'PLAIN')
|
113
|
+
end
|
114
|
+
|
115
|
+
response = deliver(request)
|
116
|
+
response.include?("success")
|
117
|
+
end
|
118
|
+
|
119
|
+
def send_restart_request
|
120
|
+
request = construct_body(:sid => @sid, "xmpp:restart" => true, "xmlns:xmpp" => 'urn:xmpp:xbosh')
|
121
|
+
deliver(request).include?("stream:features")
|
122
|
+
end
|
123
|
+
|
124
|
+
def request_resource_binding
|
125
|
+
request = construct_body(:sid => @sid) do |body|
|
126
|
+
body.iq(:id => "bind_#{rand(100000)}", :type => "set",
|
127
|
+
:xmlns => "jabber:client") do |iq|
|
128
|
+
iq.bind(:xmlns => BIND_XMLNS) do |bind|
|
129
|
+
bind.resource(resource_name)
|
130
|
+
end
|
131
|
+
end
|
132
|
+
end
|
133
|
+
|
134
|
+
response = deliver(request)
|
135
|
+
response.include?("<jid>")
|
136
|
+
end
|
137
|
+
|
138
|
+
def send_session_request
|
139
|
+
request = construct_body(:sid => @sid) do |body|
|
140
|
+
body.iq(:xmlns => CLIENT_XMLNS, :type => "set",
|
141
|
+
:id => "sess_#{rand(100000)}") do |iq|
|
142
|
+
iq.session(:xmlns => SESSION_XMLNS)
|
143
|
+
end
|
144
|
+
end
|
145
|
+
|
146
|
+
response = deliver(request)
|
147
|
+
response.include?("body")
|
148
|
+
end
|
149
|
+
|
150
|
+
def parse(_response)
|
151
|
+
doc = Hpricot(_response.to_s)
|
152
|
+
doc.search("//body").each do |body|
|
153
|
+
@sid = body.attributes["sid"].to_s
|
154
|
+
end
|
155
|
+
_response
|
156
|
+
end
|
157
|
+
|
158
|
+
begin
|
159
|
+
require 'system_timer'
|
160
|
+
def deliver(xml)
|
161
|
+
|
162
|
+
SystemTimer.timeout(@timeout) do
|
163
|
+
send(xml)
|
164
|
+
recv(RestClient.post(@service_url, xml, @headers))
|
165
|
+
end
|
166
|
+
rescue ::Timeout::Error => e
|
167
|
+
raise RubyBOSH::Timeout, e.message
|
168
|
+
rescue Errno::ECONNREFUSED => e
|
169
|
+
raise RubyBOSH::ConnFailed, "could not connect to #{@host}\n#{e.message}"
|
170
|
+
rescue Exception => e
|
171
|
+
raise RubyBOSH::Error, e.message
|
172
|
+
end
|
173
|
+
rescue LoadError
|
174
|
+
warn "WARNING: using the built-in Timeout class which is known to have issues when used for opening connections. Install the SystemTimer gem if you want to make sure the Redis client will not hang." unless RUBY_VERSION >= "1.9" || RUBY_PLATFORM =~ /java/
|
175
|
+
|
176
|
+
require "timeout"
|
177
|
+
|
178
|
+
|
179
|
+
def deliver(xml)
|
180
|
+
|
181
|
+
::Timeout.timeout(@timeout) do
|
182
|
+
|
183
|
+
send(xml)
|
184
|
+
recv(RestClient.post(@service_url, xml, @headers))
|
185
|
+
end
|
186
|
+
rescue ::Timeout::Error => e
|
187
|
+
raise RubyBOSH::Timeout, e.message
|
188
|
+
rescue Errno::ECONNREFUSED => e
|
189
|
+
raise RubyBOSH::ConnFailed, "could not connect to #{@host}\n#{e.message}"
|
190
|
+
rescue Exception => e
|
191
|
+
raise RubyBOSH::Error, e.message
|
192
|
+
end
|
193
|
+
end
|
194
|
+
|
195
|
+
def send(msg)
|
196
|
+
puts("Ruby-BOSH - SEND\n[#{now}]: #{msg}") if @@logging; msg
|
197
|
+
end
|
198
|
+
|
199
|
+
def recv(msg)
|
200
|
+
puts("Ruby-BOSH - RECV\n[#{now}]: #{msg}") if @logging; msg
|
201
|
+
end
|
202
|
+
|
203
|
+
private
|
204
|
+
def now
|
205
|
+
Time.now.strftime("%a %b %d %H:%M:%S %Y")
|
206
|
+
end
|
207
|
+
|
208
|
+
def resource_name
|
209
|
+
if @custom_resource.nil?
|
210
|
+
"bosh_#{rand(10000)}"
|
211
|
+
else
|
212
|
+
@custom_resource
|
213
|
+
end
|
214
|
+
end
|
215
|
+
end
|
216
|
+
|
217
|
+
|
218
|
+
if __FILE__ == $0
|
219
|
+
p RubyBOSH.initialize_session(ARGV[0], ARGV[1],
|
220
|
+
"http://localhost:5280/http-bind")
|
221
|
+
end
|
data/app/models/user.rb
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
require 'yaml'
|
2
|
+
require 'ruby_bosh'
|
3
|
+
class User < ActiveRecord::Base
|
4
|
+
include PublicActivity::Model
|
5
|
+
tracked
|
6
|
+
has_many :identities
|
7
|
+
has_merit
|
8
|
+
acts_as_followable
|
9
|
+
acts_as_follower
|
10
|
+
devise :database_authenticatable, :omniauthable, :omniauth_providers => [:doorkeeper]
|
11
|
+
|
12
|
+
after_create :register_user
|
13
|
+
def self.find_or_create_for_doorkeeper_oauth(oauth_data)
|
14
|
+
ap oauth_data
|
15
|
+
User.find_or_initialize_by_doorkeeper_uid(oauth_data.uid).tap do |user|
|
16
|
+
user.email = oauth_data.info.email
|
17
|
+
user.name = oauth_data.info.name
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def update_doorkeeper_credentials(oauth_data)
|
22
|
+
self.doorkeeper_access_token = oauth_data.credentials.token
|
23
|
+
end
|
24
|
+
has_many :projects
|
25
|
+
|
26
|
+
def github_auth_token
|
27
|
+
identities.find_by(provider:"github").auth_token
|
28
|
+
end
|
29
|
+
|
30
|
+
def register_user
|
31
|
+
self.encrypted_data = RubyBOSH.register(self)
|
32
|
+
self.save
|
33
|
+
end
|
34
|
+
|
35
|
+
|
36
|
+
|
37
|
+
def connect
|
38
|
+
@jid, @sid, @rid = RubyBOSH.initialize_session("#{self.encrypted_data}@idlecampus.com", "#{ENV['DOORKEEPER_APP_SECRET']}", "http://idlecampus.com:5280/http-bind")
|
39
|
+
end
|
40
|
+
end
|
data/bin/rails
ADDED
@@ -0,0 +1,8 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# This command will automatically be run when you run "rails" with Rails 4 gems installed from the root of your application.
|
3
|
+
|
4
|
+
ENGINE_ROOT = File.expand_path('../..', __FILE__)
|
5
|
+
ENGINE_PATH = File.expand_path('../../lib/xmppify', __FILE__)
|
6
|
+
|
7
|
+
require 'rails/all'
|
8
|
+
require 'rails/engine/commands'
|
@@ -0,0 +1,10 @@
|
|
1
|
+
class CreateUsers < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :users do |t|
|
4
|
+
add_column :users,:doorkeeper_uid,:integer
|
5
|
+
add_column :users,:doorkeeper_access_token,:string
|
6
|
+
add_column :users,:encrypted_data,:string
|
7
|
+
t.timestamps
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
data/lib/xmppify.rb
ADDED
data/xmppify.gemspec
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'xmppify/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "xmppify"
|
8
|
+
spec.version = Xmppify::VERSION
|
9
|
+
spec.authors = ["Charlie"]
|
10
|
+
spec.email = ["ankothari@gmail.com"]
|
11
|
+
spec.summary = "A gem for all your real time communication needs like group chatting, one-on-one chatting for Android and iOS devices. It also includes strophe.js for sending data to and from the browser. "
|
12
|
+
spec.description = "We have extracted out the logic from IdleCampus and built xmppify because I want to help anyone built a real time communication platform or a product as soon as possible. I am also working on creating a service so that mobile developers could easily implement all the required libraries and functionalities without much work which I had to do in the last 3 years. "
|
13
|
+
spec.homepage = "https://github.com/charlieanna/xmppify"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files`.split($/)
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_development_dependency "bundler", "~> 1.5"
|
22
|
+
spec.add_development_dependency "rake"
|
23
|
+
end
|
metadata
ADDED
@@ -0,0 +1,197 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: xmppify
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.12
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Charlie
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-03-29 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.5'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.5'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
description: 'We have extracted out the logic from IdleCampus and built xmppify because
|
42
|
+
I want to help anyone built a real time communication platform or a product as soon
|
43
|
+
as possible. I am also working on creating a service so that mobile developers could
|
44
|
+
easily implement all the required libraries and functionalities without much work
|
45
|
+
which I had to do in the last 3 years. '
|
46
|
+
email:
|
47
|
+
- ankothari@gmail.com
|
48
|
+
executables:
|
49
|
+
- rails
|
50
|
+
extensions: []
|
51
|
+
extra_rdoc_files: []
|
52
|
+
files:
|
53
|
+
- .gitignore
|
54
|
+
- Gemfile
|
55
|
+
- LICENSE.txt
|
56
|
+
- README.md
|
57
|
+
- Rakefile
|
58
|
+
- app/assets/javascripts/xmpp/index.js
|
59
|
+
- app/assets/javascripts/xmpp/scripts/checkplayer.js
|
60
|
+
- app/assets/javascripts/xmpp/scripts/crossdomain.xml
|
61
|
+
- app/assets/javascripts/xmpp/scripts/flXHR.js
|
62
|
+
- app/assets/javascripts/xmpp/scripts/flXHR.swf
|
63
|
+
- app/assets/javascripts/xmpp/scripts/flXHR.vbs
|
64
|
+
- app/assets/javascripts/xmpp/scripts/flensed.js
|
65
|
+
- app/assets/javascripts/xmpp/scripts/strophe.flxhr.js
|
66
|
+
- app/assets/javascripts/xmpp/scripts/strophe.js
|
67
|
+
- app/assets/javascripts/xmpp/scripts/swfobject.js
|
68
|
+
- app/assets/javascripts/xmpp/scripts/updateplayer.swf
|
69
|
+
- app/assets/javascripts/xmpp/scripts/xmpp.js.coffee
|
70
|
+
- app/assets/javascripts/xmpp/strophejs-plugins/LICENSE.txt
|
71
|
+
- app/assets/javascripts/xmpp/strophejs-plugins/README.markdown
|
72
|
+
- app/assets/javascripts/xmpp/strophejs-plugins/archive/README.markdown
|
73
|
+
- app/assets/javascripts/xmpp/strophejs-plugins/archive/iso8601_support.js
|
74
|
+
- app/assets/javascripts/xmpp/strophejs-plugins/archive/strophe.archive.js
|
75
|
+
- app/assets/javascripts/xmpp/strophejs-plugins/caps/README.markdown
|
76
|
+
- app/assets/javascripts/xmpp/strophejs-plugins/caps/sha1.js
|
77
|
+
- app/assets/javascripts/xmpp/strophejs-plugins/caps/strophe.CAPS.coffee
|
78
|
+
- app/assets/javascripts/xmpp/strophejs-plugins/caps/strophe.CAPS.js
|
79
|
+
- app/assets/javascripts/xmpp/strophejs-plugins/caps/strophe.caps.jsonly.js
|
80
|
+
- app/assets/javascripts/xmpp/strophejs-plugins/chatstates/strophe.chatstates.js
|
81
|
+
- app/assets/javascripts/xmpp/strophejs-plugins/cmds/README.markdown
|
82
|
+
- app/assets/javascripts/xmpp/strophejs-plugins/cmds/spec/GetUrlComamndSpec.js
|
83
|
+
- app/assets/javascripts/xmpp/strophejs-plugins/cmds/spec/strophe.cmds.spec.coffee
|
84
|
+
- app/assets/javascripts/xmpp/strophejs-plugins/cmds/spec/support/jasmine.json
|
85
|
+
- app/assets/javascripts/xmpp/strophejs-plugins/cmds/src/strophe.cmds.coffee
|
86
|
+
- app/assets/javascripts/xmpp/strophejs-plugins/cmds/src/strophe.cmds.js
|
87
|
+
- app/assets/javascripts/xmpp/strophejs-plugins/dataforms/README.markdown
|
88
|
+
- app/assets/javascripts/xmpp/strophejs-plugins/dataforms/spec/strophe.x.coffee
|
89
|
+
- app/assets/javascripts/xmpp/strophejs-plugins/dataforms/src/strophe.x.coffee
|
90
|
+
- app/assets/javascripts/xmpp/strophejs-plugins/dataforms/src/strophe.x.js
|
91
|
+
- app/assets/javascripts/xmpp/strophejs-plugins/disco/.gitignore
|
92
|
+
- app/assets/javascripts/xmpp/strophejs-plugins/disco/README.markdown
|
93
|
+
- app/assets/javascripts/xmpp/strophejs-plugins/disco/convert.js
|
94
|
+
- app/assets/javascripts/xmpp/strophejs-plugins/disco/jasmine.json
|
95
|
+
- app/assets/javascripts/xmpp/strophejs-plugins/disco/lib/strophe.disco.js
|
96
|
+
- app/assets/javascripts/xmpp/strophejs-plugins/disco/public/javascript/strophe.disco.js
|
97
|
+
- app/assets/javascripts/xmpp/strophejs-plugins/disco/spec/01_querying_information.xml
|
98
|
+
- app/assets/javascripts/xmpp/strophejs-plugins/disco/spec/02_result_set_for_information_request.xml
|
99
|
+
- app/assets/javascripts/xmpp/strophejs-plugins/disco/spec/03_target_entity_does_not_exist.xml
|
100
|
+
- app/assets/javascripts/xmpp/strophejs-plugins/disco/spec/04_service_unavailable.xml
|
101
|
+
- app/assets/javascripts/xmpp/strophejs-plugins/disco/spec/09_querying_specific_jid_and_node_combination.xml
|
102
|
+
- app/assets/javascripts/xmpp/strophejs-plugins/disco/spec/10_jid_and_node_result.xml
|
103
|
+
- app/assets/javascripts/xmpp/strophejs-plugins/disco/spec/11_requesting_all_items.xml
|
104
|
+
- app/assets/javascripts/xmpp/strophejs-plugins/disco/spec/12_result_set_for_all_items.xml
|
105
|
+
- app/assets/javascripts/xmpp/strophejs-plugins/disco/spec/13_empty_result_set.xml
|
106
|
+
- app/assets/javascripts/xmpp/strophejs-plugins/disco/spec/17_service_returns_nodes.xml
|
107
|
+
- app/assets/javascripts/xmpp/strophejs-plugins/disco/spec/18_requesting_further_nodes.xml
|
108
|
+
- app/assets/javascripts/xmpp/strophejs-plugins/disco/spec/24_jid_and_node_error.xml
|
109
|
+
- app/assets/javascripts/xmpp/strophejs-plugins/disco/spec/DiscoNodeSpec.js
|
110
|
+
- app/assets/javascripts/xmpp/strophejs-plugins/disco/spec/SpecHelper.js
|
111
|
+
- app/assets/javascripts/xmpp/strophejs-plugins/disco/spec/Stanzas.js
|
112
|
+
- app/assets/javascripts/xmpp/strophejs-plugins/disco/spec/strophe.disco.spec.helper.js
|
113
|
+
- app/assets/javascripts/xmpp/strophejs-plugins/disco/spec/strophe.disco.spec.js
|
114
|
+
- app/assets/javascripts/xmpp/strophejs-plugins/disco/spec/support/jasmine.json
|
115
|
+
- app/assets/javascripts/xmpp/strophejs-plugins/disco/strophe.disco.js
|
116
|
+
- app/assets/javascripts/xmpp/strophejs-plugins/epic/public/javascript/jquery.epic.js
|
117
|
+
- app/assets/javascripts/xmpp/strophejs-plugins/epic/spec/SpecHelper.js
|
118
|
+
- app/assets/javascripts/xmpp/strophejs-plugins/epic/spec/jquery.epic.js
|
119
|
+
- app/assets/javascripts/xmpp/strophejs-plugins/epic/spec/support/jasmine.json
|
120
|
+
- app/assets/javascripts/xmpp/strophejs-plugins/iexdomain/iexdomain.js
|
121
|
+
- app/assets/javascripts/xmpp/strophejs-plugins/joap/README.markdown
|
122
|
+
- app/assets/javascripts/xmpp/strophejs-plugins/joap/buster.js
|
123
|
+
- app/assets/javascripts/xmpp/strophejs-plugins/joap/jid.coffee
|
124
|
+
- app/assets/javascripts/xmpp/strophejs-plugins/joap/jid.js
|
125
|
+
- app/assets/javascripts/xmpp/strophejs-plugins/joap/spec/browserSetup.coffee
|
126
|
+
- app/assets/javascripts/xmpp/strophejs-plugins/joap/spec/jid.spec.coffee
|
127
|
+
- app/assets/javascripts/xmpp/strophejs-plugins/joap/spec/strophe.joap.spec.coffee
|
128
|
+
- app/assets/javascripts/xmpp/strophejs-plugins/joap/strophe.joap.coffee
|
129
|
+
- app/assets/javascripts/xmpp/strophejs-plugins/joap/strophe.joap.js
|
130
|
+
- app/assets/javascripts/xmpp/strophejs-plugins/mam/LICENSE.txt
|
131
|
+
- app/assets/javascripts/xmpp/strophejs-plugins/mam/README.markdown
|
132
|
+
- app/assets/javascripts/xmpp/strophejs-plugins/mam/strophe.mam.js
|
133
|
+
- app/assets/javascripts/xmpp/strophejs-plugins/muc/LICENSE.txt
|
134
|
+
- app/assets/javascripts/xmpp/strophejs-plugins/muc/strophe.muc.js
|
135
|
+
- app/assets/javascripts/xmpp/strophejs-plugins/ping/README.markdown
|
136
|
+
- app/assets/javascripts/xmpp/strophejs-plugins/ping/strophe.ping.js
|
137
|
+
- app/assets/javascripts/xmpp/strophejs-plugins/private/README.markdown
|
138
|
+
- app/assets/javascripts/xmpp/strophejs-plugins/private/strophe.private.js
|
139
|
+
- app/assets/javascripts/xmpp/strophejs-plugins/pubsub/strophe.pubsub.js
|
140
|
+
- app/assets/javascripts/xmpp/strophejs-plugins/receipts/strophe.receipts.js
|
141
|
+
- app/assets/javascripts/xmpp/strophejs-plugins/register/README.markdown
|
142
|
+
- app/assets/javascripts/xmpp/strophejs-plugins/register/strophe.register.js
|
143
|
+
- app/assets/javascripts/xmpp/strophejs-plugins/roster/public/javascript/strophe.roster.js
|
144
|
+
- app/assets/javascripts/xmpp/strophejs-plugins/roster/spec/strophe.roster.spec.js
|
145
|
+
- app/assets/javascripts/xmpp/strophejs-plugins/roster/spec/support/jasmine.json
|
146
|
+
- app/assets/javascripts/xmpp/strophejs-plugins/roster/strophe.roster.js
|
147
|
+
- app/assets/javascripts/xmpp/strophejs-plugins/rpc/.gitignore
|
148
|
+
- app/assets/javascripts/xmpp/strophejs-plugins/rpc/README.md
|
149
|
+
- app/assets/javascripts/xmpp/strophejs-plugins/rpc/buster.js
|
150
|
+
- app/assets/javascripts/xmpp/strophejs-plugins/rpc/lib/strophe.js
|
151
|
+
- app/assets/javascripts/xmpp/strophejs-plugins/rpc/spec/strophe.rpc.spec.helper.js
|
152
|
+
- app/assets/javascripts/xmpp/strophejs-plugins/rpc/spec/strophe.rpc.spec.js
|
153
|
+
- app/assets/javascripts/xmpp/strophejs-plugins/rpc/strophe.rpc.js
|
154
|
+
- app/assets/javascripts/xmpp/strophejs-plugins/rsm/strophe.rsm.js
|
155
|
+
- app/assets/javascripts/xmpp/strophejs-plugins/serverdate/strophe.serverdate.js
|
156
|
+
- app/assets/javascripts/xmpp/strophejs-plugins/vcard/examples/index.html
|
157
|
+
- app/assets/javascripts/xmpp/strophejs-plugins/vcard/examples/strophevcard.js
|
158
|
+
- app/assets/javascripts/xmpp/strophejs-plugins/vcard/strophe.vcard.coffee
|
159
|
+
- app/assets/javascripts/xmpp/strophejs-plugins/vcard/strophe.vcard.js
|
160
|
+
- app/assets/stylesheets/xmpp/index.css
|
161
|
+
- app/controllers/omniauth_callbacks_controller.rb
|
162
|
+
- app/controllers/ruby_bosh.rb
|
163
|
+
- app/models/identity.rb
|
164
|
+
- app/models/user.rb
|
165
|
+
- bin/rails
|
166
|
+
- db/migrate/20140329065635_create_users.rb
|
167
|
+
- db/migrate/20140329070238_create_identities.rb
|
168
|
+
- lib/xmppify.rb
|
169
|
+
- lib/xmppify/version.rb
|
170
|
+
- xmppify.gemspec
|
171
|
+
homepage: https://github.com/charlieanna/xmppify
|
172
|
+
licenses:
|
173
|
+
- MIT
|
174
|
+
metadata: {}
|
175
|
+
post_install_message:
|
176
|
+
rdoc_options: []
|
177
|
+
require_paths:
|
178
|
+
- lib
|
179
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
180
|
+
requirements:
|
181
|
+
- - '>='
|
182
|
+
- !ruby/object:Gem::Version
|
183
|
+
version: '0'
|
184
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
185
|
+
requirements:
|
186
|
+
- - '>='
|
187
|
+
- !ruby/object:Gem::Version
|
188
|
+
version: '0'
|
189
|
+
requirements: []
|
190
|
+
rubyforge_project:
|
191
|
+
rubygems_version: 2.1.10
|
192
|
+
signing_key:
|
193
|
+
specification_version: 4
|
194
|
+
summary: A gem for all your real time communication needs like group chatting, one-on-one
|
195
|
+
chatting for Android and iOS devices. It also includes strophe.js for sending data
|
196
|
+
to and from the browser.
|
197
|
+
test_files: []
|