social_stream-presence 0.1.4 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/app/controllers/xmpp_controller.rb +41 -52
- data/ejabberd/conf/ssconfig_example.cfg +2 -1
- data/ejabberd/ejabberd_files.zip +0 -0
- data/ejabberd/ejabberd_scripts/reset_connection_script +255 -13
- data/ejabberd/ejabberd_scripts/rest_api_client_script +301 -0
- data/ejabberd/ejabberd_scripts/synchronize_presence_script +256 -18
- data/ejabberd/mod_sspresence/mod_sspresence.beam +0 -0
- data/ejabberd/mod_sspresence/mod_sspresence.erl +10 -10
- data/lib/generators/social_stream/presence/templates/initializer.rb +6 -4
- data/lib/social_stream-presence.rb +2 -0
- data/lib/social_stream/presence/version.rb +1 -1
- data/lib/social_stream/presence/xmpp_server_order.rb +190 -12
- data/lib/tasks/presence/installer.rake +38 -4
- metadata +4 -7
- data/ejabberd/ejabberd_scripts/set_connection_script +0 -48
- data/ejabberd/ejabberd_scripts/set_presence_script +0 -48
- data/ejabberd/ejabberd_scripts/unset_connection_script +0 -48
- data/ejabberd/ejabberd_scripts/unset_presence_script +0 -48
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 1
|
8
|
-
-
|
9
|
-
version: 0.1.
|
8
|
+
- 6
|
9
|
+
version: 0.1.6
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Aldo Gordillo
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2011-12-
|
17
|
+
date: 2011-12-13 00:00:00 +01:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
@@ -151,12 +151,9 @@ files:
|
|
151
151
|
- ejabberd/ejabberd_scripts/development_scripts/stop_ejabberd.sh
|
152
152
|
- ejabberd/ejabberd_scripts/emanagement
|
153
153
|
- ejabberd/ejabberd_scripts/reset_connection_script
|
154
|
-
- ejabberd/ejabberd_scripts/
|
155
|
-
- ejabberd/ejabberd_scripts/set_presence_script
|
154
|
+
- ejabberd/ejabberd_scripts/rest_api_client_script
|
156
155
|
- ejabberd/ejabberd_scripts/set_script_header.sh
|
157
156
|
- ejabberd/ejabberd_scripts/synchronize_presence_script
|
158
|
-
- ejabberd/ejabberd_scripts/unset_connection_script
|
159
|
-
- ejabberd/ejabberd_scripts/unset_presence_script
|
160
157
|
- ejabberd/installer.sh
|
161
158
|
- ejabberd/mod_admin_extra/mod_admin_extra.beam
|
162
159
|
- ejabberd/mod_admin_extra/mod_admin_extra.erl
|
@@ -1,48 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
#Set Connection Script
|
3
|
-
#@author Aldo
|
4
|
-
|
5
|
-
require 'logger'
|
6
|
-
require 'rest_client'
|
7
|
-
|
8
|
-
path = "/var/log/ejabberd/scripts.log"
|
9
|
-
file = File.open(path, File::WRONLY | File::APPEND | File::CREAT)
|
10
|
-
file.sync = true
|
11
|
-
$logger = Logger.new(file)
|
12
|
-
$logger.level = Logger::DEBUG
|
13
|
-
|
14
|
-
def getOption(option)
|
15
|
-
File.open('/etc/ejabberd/ssconfig.cfg', 'r') do |f1|
|
16
|
-
while line = f1.gets
|
17
|
-
line = line.gsub(/\n/,'')
|
18
|
-
if line.match(/^#/)
|
19
|
-
#Comments
|
20
|
-
elsif line.match(/^#{option}/)
|
21
|
-
return line.gsub(/#{option}/,'')
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
return "Undefined"
|
26
|
-
end
|
27
|
-
|
28
|
-
$url = "http://" + getOption("web_domain=") + "/xmpp/setConnection"
|
29
|
-
$pass = getOption("ejabberd_password=")
|
30
|
-
|
31
|
-
|
32
|
-
def log(text)
|
33
|
-
$logger.info "Set Connection Script: " + text
|
34
|
-
end
|
35
|
-
|
36
|
-
def setConnection(username)
|
37
|
-
log("setConnection(#{username})")
|
38
|
-
RestClient.post($url, :name => username, :password => $pass)
|
39
|
-
return true
|
40
|
-
|
41
|
-
rescue RestClient::Exception
|
42
|
-
log("RestClient::Exception with setConnection(#{username})")
|
43
|
-
end
|
44
|
-
|
45
|
-
|
46
|
-
setConnection(ARGV[0])
|
47
|
-
|
48
|
-
|
@@ -1,48 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
#Set Presence Script
|
3
|
-
#@author Aldo
|
4
|
-
|
5
|
-
require 'logger'
|
6
|
-
require 'rest_client'
|
7
|
-
|
8
|
-
path = "/var/log/ejabberd/scripts.log"
|
9
|
-
file = File.open(path, File::WRONLY | File::APPEND | File::CREAT)
|
10
|
-
file.sync = true
|
11
|
-
$logger = Logger.new(file)
|
12
|
-
$logger.level = Logger::DEBUG
|
13
|
-
|
14
|
-
def getOption(option)
|
15
|
-
File.open('/etc/ejabberd/ssconfig.cfg', 'r') do |f1|
|
16
|
-
while line = f1.gets
|
17
|
-
line = line.gsub(/\n/,'')
|
18
|
-
if line.match(/^#/)
|
19
|
-
#Comments
|
20
|
-
elsif line.match(/^#{option}/)
|
21
|
-
return line.gsub(/#{option}/,'')
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
return "Undefined"
|
26
|
-
end
|
27
|
-
|
28
|
-
$url = "http://" + getOption("web_domain=") + "/xmpp/setPresence"
|
29
|
-
$pass = getOption("ejabberd_password=")
|
30
|
-
|
31
|
-
|
32
|
-
def log(text)
|
33
|
-
$logger.info "Set Presence Script: " + text
|
34
|
-
end
|
35
|
-
|
36
|
-
def setPresence(username,status)
|
37
|
-
log("setPresence(#{username},#{status})")
|
38
|
-
RestClient.post($url, :name => username, :status => status, :password => $pass)
|
39
|
-
return true
|
40
|
-
|
41
|
-
rescue RestClient::Exception
|
42
|
-
log("RestClient::Exception with setPresence(#{username})")
|
43
|
-
end
|
44
|
-
|
45
|
-
|
46
|
-
setPresence(ARGV[0],ARGV[1])
|
47
|
-
|
48
|
-
|
@@ -1,48 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
#Unset Connection Script
|
3
|
-
#@author Aldo
|
4
|
-
|
5
|
-
require 'logger'
|
6
|
-
require 'rest_client'
|
7
|
-
|
8
|
-
path = "/var/log/ejabberd/scripts.log"
|
9
|
-
file = File.open(path, File::WRONLY | File::APPEND | File::CREAT)
|
10
|
-
file.sync = true
|
11
|
-
$logger = Logger.new(file)
|
12
|
-
$logger.level = Logger::DEBUG
|
13
|
-
|
14
|
-
def getOption(option)
|
15
|
-
File.open('/etc/ejabberd/ssconfig.cfg', 'r') do |f1|
|
16
|
-
while line = f1.gets
|
17
|
-
line = line.gsub(/\n/,'')
|
18
|
-
if line.match(/^#/)
|
19
|
-
#Comments
|
20
|
-
elsif line.match(/^#{option}/)
|
21
|
-
return line.gsub(/#{option}/,'')
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
return "Undefined"
|
26
|
-
end
|
27
|
-
|
28
|
-
$url = "http://" + getOption("web_domain=") + "/xmpp/unsetConnection"
|
29
|
-
$pass = getOption("ejabberd_password=")
|
30
|
-
|
31
|
-
|
32
|
-
def log(text)
|
33
|
-
$logger.info "Unset Connection: " + text
|
34
|
-
end
|
35
|
-
|
36
|
-
def unsetConnection(username)
|
37
|
-
log("unsetConnection(#{username})")
|
38
|
-
RestClient.post($url, :name => username, :password => $pass)
|
39
|
-
return true
|
40
|
-
|
41
|
-
rescue RestClient::Exception
|
42
|
-
log("RestClient::Exception with unsetConnection(#{username})")
|
43
|
-
end
|
44
|
-
|
45
|
-
|
46
|
-
unsetConnection(ARGV[0])
|
47
|
-
|
48
|
-
|
@@ -1,48 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
#Unset Presence Script
|
3
|
-
#@author Aldo
|
4
|
-
|
5
|
-
require 'logger'
|
6
|
-
require 'rest_client'
|
7
|
-
|
8
|
-
path = "/var/log/ejabberd/scripts.log"
|
9
|
-
file = File.open(path, File::WRONLY | File::APPEND | File::CREAT)
|
10
|
-
file.sync = true
|
11
|
-
$logger = Logger.new(file)
|
12
|
-
$logger.level = Logger::DEBUG
|
13
|
-
|
14
|
-
def getOption(option)
|
15
|
-
File.open('/etc/ejabberd/ssconfig.cfg', 'r') do |f1|
|
16
|
-
while line = f1.gets
|
17
|
-
line = line.gsub(/\n/,'')
|
18
|
-
if line.match(/^#/)
|
19
|
-
#Comments
|
20
|
-
elsif line.match(/^#{option}/)
|
21
|
-
return line.gsub(/#{option}/,'')
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
return "Undefined"
|
26
|
-
end
|
27
|
-
|
28
|
-
$url = "http://" + getOption("web_domain=") + "/xmpp/unsetPresence"
|
29
|
-
$pass = getOption("ejabberd_password=")
|
30
|
-
|
31
|
-
|
32
|
-
def log(text)
|
33
|
-
$logger.info "Unset Presence Script: " + text
|
34
|
-
end
|
35
|
-
|
36
|
-
def unsetPresence(username)
|
37
|
-
log("unsetPresence(#{username})")
|
38
|
-
RestClient.post($url, :name => username, :password => $pass)
|
39
|
-
return true
|
40
|
-
|
41
|
-
rescue RestClient::Exception
|
42
|
-
log("RestClient::Exception with unsetPresence(#{username})")
|
43
|
-
end
|
44
|
-
|
45
|
-
|
46
|
-
unsetPresence(ARGV[0])
|
47
|
-
|
48
|
-
|