social_stream-presence 0.0.2 → 0.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. data/Rakefile +7 -0
  2. data/app/assets/audio/chat/onMessageAudio.mp3 +0 -0
  3. data/app/assets/audio/chat/onMessageAudio.wav +0 -0
  4. data/app/assets/images/black_arrow3.png +0 -0
  5. data/app/assets/images/status/available.png +0 -0
  6. data/app/assets/images/status/away.png +0 -0
  7. data/app/assets/images/status/dnd.png +0 -0
  8. data/app/assets/javascripts/jquery-ui-1.8.14.custom.min.js +789 -0
  9. data/app/assets/javascripts/jquery.tools.min.js +17 -0
  10. data/app/assets/javascripts/jquery.tools.tooltip.js +11 -0
  11. data/app/assets/javascripts/jquery.ui.chatbox.js +260 -0
  12. data/app/assets/javascripts/social_stream-presence.js +2 -0
  13. data/app/assets/javascripts/store.js +20 -0
  14. data/app/assets/javascripts/strophe.js +3612 -0
  15. data/app/assets/javascripts/xmpp_client.js +494 -0
  16. data/app/assets/stylesheets/chat.css +239 -0
  17. data/app/assets/stylesheets/jquery.ui.chatbox.css +54 -0
  18. data/app/assets/stylesheets/social_stream-presence.css +3 -0
  19. data/app/controllers/xmpp_controller.rb +223 -0
  20. data/app/helpers/xmpp_helper.rb +20 -0
  21. data/app/views/xmpp/_chat.html.erb +63 -0
  22. data/app/views/xmpp/_chat_connecting.html.erb +8 -0
  23. data/app/views/xmpp/_chat_contacts.html.erb +46 -0
  24. data/app/views/xmpp/_chat_off.html.erb +35 -0
  25. data/app/views/xmpp/active_users.html.erb +33 -0
  26. data/app/views/xmpp/chat.html.erb +13 -0
  27. data/app/views/xmpp/index.html +19 -0
  28. data/app/views/xmpp/test.html.erb +11 -0
  29. data/config/routes.rb +15 -0
  30. data/db/migrate/20110711111408_add_connected_column_to_user.rb +9 -0
  31. data/db/migrate/20110928135031_add_status_column_to_user.rb +9 -0
  32. data/ejabberd/conf/ejabberd.cfg +625 -0
  33. data/ejabberd/conf/ejabberdctl.cfg +154 -0
  34. data/ejabberd/conf/inetrc +3 -0
  35. data/ejabberd/conf/server.pem +37 -0
  36. data/ejabberd/conf/ssconfig.cfg +32 -0
  37. data/ejabberd/ejabberd_scripts/authentication_script +117 -0
  38. data/ejabberd/ejabberd_scripts/authentication_script_org +114 -0
  39. data/ejabberd/ejabberd_scripts/compile_module +34 -0
  40. data/ejabberd/ejabberd_scripts/emanagement +245 -0
  41. data/ejabberd/ejabberd_scripts/generate_random_password +18 -0
  42. data/ejabberd/ejabberd_scripts/kill_authentication_script.sh +13 -0
  43. data/ejabberd/ejabberd_scripts/reset_connection_script +55 -0
  44. data/ejabberd/ejabberd_scripts/reset_logs.sh +23 -0
  45. data/ejabberd/ejabberd_scripts/set_connection_script +48 -0
  46. data/ejabberd/ejabberd_scripts/set_presence_script +48 -0
  47. data/ejabberd/ejabberd_scripts/show_config.sh +30 -0
  48. data/ejabberd/ejabberd_scripts/start_ejabberd.sh +68 -0
  49. data/ejabberd/ejabberd_scripts/stop_ejabberd.sh +12 -0
  50. data/ejabberd/ejabberd_scripts/synchronize_presence_script +57 -0
  51. data/ejabberd/ejabberd_scripts/unset_connection_script +48 -0
  52. data/ejabberd/mod_admin_extra/mod_admin_extra.beam +0 -0
  53. data/ejabberd/mod_admin_extra/mod_admin_extra.erl +1560 -0
  54. data/ejabberd/mod_sspresence/mod_sspresence.beam +0 -0
  55. data/ejabberd/mod_sspresence/mod_sspresence.erl +257 -0
  56. data/lib/social_stream-presence.rb +19 -2
  57. data/lib/social_stream/migrations/presence.rb +9 -0
  58. data/lib/social_stream/presence/engine.rb +62 -0
  59. data/lib/social_stream/presence/models/buddy_manager.rb +76 -0
  60. data/lib/social_stream/presence/version.rb +5 -0
  61. data/lib/tasks/presence/synchronize.rake +63 -0
  62. data/social_stream-presence.gemspec +4 -4
  63. metadata +69 -11
  64. data/.project +0 -17
@@ -0,0 +1,20 @@
1
+ module XmppHelper
2
+
3
+ def getChatContacts
4
+ connected_users = []
5
+
6
+ #Get bidirectional contacts
7
+ contacts = current_user.contact_actors(:type=>:user)
8
+
9
+ #Apply filters
10
+
11
+ contacts.each do |contact|
12
+ if contact.user.connected
13
+ connected_users << contact.user
14
+ end
15
+ end
16
+
17
+ return connected_users
18
+ end
19
+
20
+ end
@@ -0,0 +1,63 @@
1
+ <% if current_subject.subject_type=="User" %>
2
+
3
+ <% content_for :headers do %>
4
+ <%= stylesheet_link_tag "chat.css", :media => "screen, projection" %>
5
+ <%= javascript_include_tag 'jquery-ui-1.8.14.custom.min'%>
6
+ <%= javascript_include_tag 'jquery.ui.chatbox'%>
7
+ <%= javascript_include_tag 'jquery.tools.min'%>
8
+ <%= javascript_include_tag 'strophe'%>
9
+ <%= javascript_include_tag 'xmpp_client'%>
10
+ <%= javascript_include_tag 'store'%>
11
+ <% end %>
12
+
13
+
14
+ <script type="text/javascript">
15
+
16
+ //Global variables
17
+ var BOSH_SERVICE = '<%=SocialStream::Presence.bosh_service%>';
18
+ var domain = '<%=SocialStream::Presence.domain%>';
19
+ var user_name = '<%=current_user.name%>';
20
+ var user_slug = '<%=current_user.slug%>';
21
+ var user_jid = '<%=current_user.slug%>'+"@"+domain;
22
+ var sound_path = "/assets/audio/chat/onMessage"
23
+
24
+ function connectToServer(chatPassword){
25
+ <%unless current_user.nil? %>
26
+
27
+ //Get Password
28
+ if ((chatPassword!=null)&&(chatPassword!="")){
29
+ var password = chatPassword;
30
+ } else if ((window.sessionStorage)&&(sessionStorage.getItem("ss_user_pass") != null)) {
31
+ var password = sessionStorage.getItem("ss_user_pass");
32
+ } else {
33
+ return false;
34
+ }
35
+
36
+ try {
37
+ //Connect actual user to the chat
38
+ connection = new Strophe.Connection(BOSH_SERVICE);
39
+ connection.connect(user_jid, password, onConnect);
40
+ } catch (err) {
41
+ //"Handle errors"
42
+ return false;
43
+ }
44
+
45
+ return true;
46
+ <%end%>
47
+ }
48
+
49
+ $(document).ready(function () {
50
+ if (connectToServer(null)==false){
51
+ refreshChatWindow();
52
+ }
53
+ initialTimer = setTimeout("updateChatWindow()", 15000);
54
+ initAudio();
55
+ });
56
+
57
+ </script>
58
+
59
+ <div id="chat_partial">
60
+ <%= render :partial => 'xmpp/chat_connecting' %>
61
+ </div>
62
+
63
+ <% end %>
@@ -0,0 +1,8 @@
1
+ <div class="block">
2
+ <div class="header">
3
+ <%=image_tag("btn/btn_friend.png", :class => "header_icon")%>
4
+ <div class="header_text">
5
+ Chat Connecting
6
+ </div>
7
+ </div>
8
+ </div>
@@ -0,0 +1,46 @@
1
+ <div>
2
+
3
+ <div class="block">
4
+ <div class="header">
5
+ <%=image_tag("btn/btn_friend.png", :class => "header_icon")%>
6
+ <div class="header_text">
7
+ Chat
8
+ </div>
9
+ </div>
10
+
11
+ <div id="status" class="dropdown">
12
+ <dt><a href=""><span>Establecer estado</span></a></dt>
13
+ <dd>
14
+ <ul>
15
+ <li><a href="#" class="option"><img class="flag" src="assets/status/available.png" alt=""/> Disponible <span class="value">chat</span></a></li>
16
+ <li><a href="#" class="option"><img class="flag" src="assets/status/away.png" alt=""/> Ausente <span class="value">away</span></a></li>
17
+ <li><a href="#" class="option"><img class="flag" src="assets/status/dnd.png" alt=""/> No molestar <span class="value">dnd</span></a></li>
18
+ </ul>
19
+ </dd>
20
+ </div>
21
+
22
+ </div>
23
+
24
+ <% @contacts = getChatContacts %>
25
+
26
+ <div class="users_connected">
27
+ <% unless @contacts.empty? %>
28
+ <%@contacts.each do |contact| %>
29
+ <div class="user_presence" name='<%=contact.name%>' slug='<%=contact.slug%>'>
30
+ <a title='<%=contact.name%>' class="presence_user_link" width="28">
31
+ <%=image_tag(contact.logo.url, :alt => contact.name , :title => contact.name, :size => "28x28")%>
32
+ <% if contact.user.status %>
33
+ <%=image_tag("status/" + contact.user.status + ".png", :class => "presence_status") %></a>
34
+ <% end %>
35
+ </a>
36
+ </div>
37
+ <%end%>
38
+ <% end %>
39
+ </div>
40
+
41
+ </div>
42
+
43
+ <div id="chat_divs">
44
+ <div id="chat_div">
45
+ </div>
46
+ </div>
@@ -0,0 +1,35 @@
1
+ <script type="text/javascript">
2
+ $(document).ready(function () {
3
+ if ((window.sessionStorage) && (sessionStorage.getItem("ss_user_pass") != null)) {
4
+ $("#passwordFormChat").hide();
5
+ } else {
6
+ $("#passwordFormChat").show();
7
+ }
8
+
9
+ $('.connectChatButton').bind('click', function () {
10
+ connectToServer($('#user_password').val());
11
+ });
12
+
13
+ $('.storePass').bind('click', function () {
14
+ storePassword();
15
+ });
16
+
17
+ });
18
+ </script>
19
+
20
+ <div class="block">
21
+ <div class="header">
22
+ <%=image_tag("btn/btn_friend.png", :class => "header_icon")%>
23
+ <div class="header_text">
24
+ Chat Disconnected
25
+ </div>
26
+ </div>
27
+ </div>
28
+
29
+ <div class="chat_off">
30
+ <div id="passwordFormChat">
31
+ <label for="user_password" class="chatPasswordTitle">Password</label>
32
+ <input id="user_password" class="chat_password" type="password"></input>
33
+ </div>
34
+ <input class="connectChatButton storePass" value="Connect">
35
+ </div>
@@ -0,0 +1,33 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Demo2</title>
5
+ </head>
6
+ <body>
7
+
8
+
9
+ <p> Usuarios conectados Social Stream </p>
10
+
11
+ <p>&nbsp;</p>
12
+ <ul>
13
+ <%@users.each do |user| %>
14
+ <li><b><%=user.name%></b></li>
15
+ <%end%>
16
+ </ul>
17
+ <p>&nbsp;</p>
18
+
19
+
20
+ <p> Usuarios Social Stream </p>
21
+
22
+ <p>&nbsp;</p>
23
+ <ul>
24
+ <%@all_users.each do |user| %>
25
+ <li><b><%=user.slug%></b> with email: <%=user.email%></li>
26
+ <%end%>
27
+ </ul>
28
+ <p>&nbsp;</p>
29
+
30
+ <p> <a href="/test">Volver</a></p>
31
+
32
+ </body>
33
+ </html>
@@ -0,0 +1,13 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
2
+ <html xmlns="http://www.w3.org/1999/xhtml">
3
+ <head>
4
+ <title>Chat</title>
5
+ </head>
6
+ <body>
7
+ <script type="text/javascript">
8
+ sessionStorage.setItem("ss_user_pass","demonstration")
9
+ </script>
10
+ <%= render :partial => 'xmpp/chat' %>
11
+ <p> <a href="/test">Volver</a></p>
12
+ </body>
13
+ </html>
@@ -0,0 +1,19 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Ruby on Rails: Welcome aboard</title>
5
+ <script type="text/javascript">
6
+
7
+ </script>
8
+ </head>
9
+ <body>
10
+ <div id="page">
11
+ <p> Hello World </p>
12
+
13
+ <p> <a href="/xmpp4r_test">Test</a></p>
14
+ <p> <a href="/active_users">Usuarios conectados al servidor XMPP</a></p>
15
+ <p> <a href="/chat">Chat</a></p>
16
+
17
+ </div>
18
+ </body>
19
+ </html>
@@ -0,0 +1,11 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Demo2</title>
5
+ </head>
6
+ <body>
7
+
8
+ <p> <a href="/test">Volver</a></p>
9
+
10
+ </body>
11
+ </html>
data/config/routes.rb ADDED
@@ -0,0 +1,15 @@
1
+ Rails.application.routes.draw do
2
+ match "/test" => "Xmpp#index"
3
+ match "/xmpp4r_test" => "Xmpp#test"
4
+ match "/active_users" => "Xmpp#active_users"
5
+ match '/chat' => "Xmpp#chat"
6
+
7
+ match '/xmpp/resetConnection' => "Xmpp#resetConnection"
8
+ match '/xmpp/setConnection' => "Xmpp#setConnection"
9
+ match '/xmpp/unsetConnection' => "Xmpp#unsetConecction"
10
+ match '/xmpp/synchronizePresence' => "Xmpp#synchronizePresence"
11
+ match '/xmpp/setPresence' => "Xmpp#setPresence"
12
+ match '/xmpp/unsetPresence' => "Xmpp#unsetPresence"
13
+ match '/chatWindow'=> "Xmpp#chatWindow"
14
+
15
+ end
@@ -0,0 +1,9 @@
1
+ class AddConnectedColumnToUser < ActiveRecord::Migration
2
+ def self.up
3
+ add_column :users, :connected, :boolean, :default => false
4
+ end
5
+
6
+ def self.down
7
+ remove_column :users, :connected
8
+ end
9
+ end
@@ -0,0 +1,9 @@
1
+ class AddStatusColumnToUser < ActiveRecord::Migration
2
+ def self.up
3
+ add_column :users, :status, :string, :default => "chat"
4
+ end
5
+
6
+ def self.down
7
+ remove_column :users, :status
8
+ end
9
+ end
@@ -0,0 +1,625 @@
1
+ %%%
2
+ %%% ejabberd configuration file
3
+ %%%
4
+ %%%'
5
+
6
+ %%% The parameters used in this configuration file are explained in more detail
7
+ %%% in the ejabberd Installation and Operation Guide.
8
+ %%% Please consult the Guide in case of doubts, it is included with
9
+ %%% your copy of ejabberd, and is also available online at
10
+ %%% http://www.process-one.net/en/ejabberd/docs/
11
+
12
+ %%% This configuration file contains Erlang terms.
13
+ %%% In case you want to understand the syntax, here are the concepts:
14
+ %%%
15
+ %%% - The character to comment a line is %
16
+ %%%
17
+ %%% - Each term ends in a dot, for example:
18
+ %%% override_global.
19
+ %%%
20
+ %%% - A tuple has a fixed definition, its elements are
21
+ %%% enclosed in {}, and separated with commas:
22
+ %%% {loglevel, 4}.
23
+ %%%
24
+ %%% - A list can have as many elements as you want,
25
+ %%% and is enclosed in [], for example:
26
+ %%% [http_poll, web_admin, tls]
27
+ %%%
28
+ %%% - A keyword of ejabberd is a word in lowercase.
29
+ %%% Strings are enclosed in "" and can contain spaces, dots, ...
30
+ %%% {language, "en"}.
31
+ %%% {ldap_rootdn, "dc=example,dc=com"}.
32
+ %%%
33
+ %%% - This term includes a tuple, a keyword, a list, and two strings:
34
+ %%% {hosts, ["jabber.example.net", "im.example.com"]}.
35
+ %%%
36
+
37
+
38
+ %%%. =======================
39
+ %%%' OVERRIDE STORED OPTIONS
40
+
41
+ %%
42
+ %% Override the old values stored in the database.
43
+ %%
44
+
45
+ %%
46
+ %% Override global options (shared by all ejabberd nodes in a cluster).
47
+ %%
48
+ %%override_global.
49
+
50
+ %%
51
+ %% Override local options (specific for this particular ejabberd node).
52
+ %%
53
+ %%override_local.
54
+
55
+ %%
56
+ %% Remove the Access Control Lists before new ones are added.
57
+ %%
58
+ %%override_acls.
59
+
60
+
61
+ %%%. =========
62
+ %%%' DEBUGGING
63
+
64
+ %%
65
+ %% loglevel: Verbosity of log files generated by ejabberd.
66
+ %% 0: No ejabberd log at all (not recommended)
67
+ %% 1: Critical
68
+ %% 2: Error
69
+ %% 3: Warning
70
+ %% 4: Info
71
+ %% 5: Debug
72
+ %%
73
+ {loglevel, 4}.
74
+
75
+ %%
76
+ %% watchdog_admins: Only useful for developers: if an ejabberd process
77
+ %% consumes a lot of memory, send live notifications to these XMPP
78
+ %% accounts.
79
+ %%
80
+ %%{watchdog_admins, ["bob@example.com"]}.
81
+
82
+
83
+ %%%. ================
84
+ %%%' SERVED HOSTNAMES
85
+
86
+ %%
87
+ %% hosts: Domains served by ejabberd.
88
+ %% You can define one or several, for example:
89
+ %% {hosts, ["example.net", "example.com", "example.org"]}.
90
+ %%
91
+ {hosts, ["trapo"]}.
92
+
93
+ %%
94
+ %% route_subdomains: Delegate subdomains to other XMPP servers.
95
+ %% For example, if this ejabberd serves example.org and you want
96
+ %% to allow communication with an XMPP server called im.example.org.
97
+ %%
98
+ %%{route_subdomains, s2s}.
99
+
100
+
101
+ %%%. ===============
102
+ %%%' LISTENING PORTS
103
+
104
+ %%
105
+ %% listen: The ports ejabberd will listen on, which service each is handled
106
+ %% by and what options to start it with.
107
+ %%
108
+ {listen,
109
+ [
110
+
111
+ {5222, ejabberd_c2s, [
112
+
113
+ %%
114
+ %% If TLS is compiled in and you installed a SSL
115
+ %% certificate, specify the full path to the
116
+ %% file and uncomment this line:
117
+ %%
118
+ %%{certfile, "/path/to/ssl.pem"}, starttls,
119
+ {certfile, "/etc/ejabberd/server.pem"}, starttls,
120
+
121
+ {access, c2s},
122
+ {shaper, c2s_shaper},
123
+ {max_stanza_size, 65536}
124
+ ]},
125
+
126
+ %%
127
+ %% To enable the old SSL connection method on port 5223:
128
+ %%
129
+ %%{5223, ejabberd_c2s, [
130
+ %% {access, c2s},
131
+ %% {shaper, c2s_shaper},
132
+ %% {certfile, "/path/to/ssl.pem"}, tls,
133
+ %% {max_stanza_size, 65536}
134
+ %% ]},
135
+
136
+ {5269, ejabberd_s2s_in, [
137
+ {shaper, s2s_shaper},
138
+ {max_stanza_size, 131072}
139
+ ]},
140
+
141
+ %%
142
+ %% ejabberd_service: Interact with external components (transports, ...)
143
+ %%
144
+ %%{8888, ejabberd_service, [
145
+ %% {access, all},
146
+ %% {shaper_rule, fast},
147
+ %% {ip, {127, 0, 0, 1}},
148
+ %% {hosts, ["icq.example.org", "sms.example.org"],
149
+ %% [{password, "secret"}]
150
+ %% }
151
+ %% ]},
152
+
153
+ %% {8888, ejabberd_service, [
154
+ %% {access, all},
155
+ %% {shaper_rule, fast},
156
+ %% {ip, {127, 0, 0, 1}},
157
+ %% {hosts, ["parser.localhost", "parser.example.org"],
158
+ %% [{password, "sabran1w0d0"}]
159
+ %% }
160
+ %% ]},
161
+
162
+ %%
163
+ %% ejabberd_stun: Handles STUN Binding requests
164
+ %%
165
+ %%{{3478, udp}, ejabberd_stun, []},
166
+
167
+ {5280, ejabberd_http, [
168
+ %%{request_handlers,
169
+ %% [
170
+ %% {["pub", "archive"], mod_http_fileserver}
171
+ %% ]},
172
+ captcha,
173
+ http_bind,
174
+ http_poll,
175
+ %%register,
176
+ web_admin
177
+ ]}
178
+
179
+ ]}.
180
+
181
+ %%
182
+ %% s2s_use_starttls: Enable STARTTLS + Dialback for S2S connections.
183
+ %% Allowed values are: false optional required required_trusted
184
+ %% You must specify a certificate file.
185
+ %%
186
+ %%{s2s_use_starttls, optional}.
187
+
188
+ %%
189
+ %% s2s_certfile: Specify a certificate file.
190
+ %%
191
+ %%{s2s_certfile, "/path/to/ssl.pem"}.
192
+
193
+ %%
194
+ %% domain_certfile: Specify a different certificate for each served hostname.
195
+ %%
196
+ %%{domain_certfile, "example.org", "/path/to/example_org.pem"}.
197
+ %%{domain_certfile, "example.com", "/path/to/example_com.pem"}.
198
+
199
+ %%
200
+ %% S2S whitelist or blacklist
201
+ %%
202
+ %% Default s2s policy for undefined hosts.
203
+ %%
204
+ %%{s2s_default_policy, allow}.
205
+
206
+ %%
207
+ %% Allow or deny communication with specific servers.
208
+ %%
209
+ %%{{s2s_host, "goodhost.org"}, allow}.
210
+ %%{{s2s_host, "badhost.org"}, deny}.
211
+
212
+ %%
213
+ %% Outgoing S2S options
214
+ %%
215
+ %% Preferred address families (which to try first) and connect timeout
216
+ %% in milliseconds.
217
+ %%
218
+ %%{outgoing_s2s_options, [ipv4, ipv6], 10000}.
219
+
220
+
221
+ %%%. ==============
222
+ %%%' AUTHENTICATION
223
+
224
+ %%
225
+ %% auth_method: Method used to authenticate the users.
226
+ %% The default method is the internal.
227
+ %% If you want to use a different method,
228
+ %% comment this line and enable the correct ones.
229
+ %%
230
+ %%{auth_method, internal}.
231
+
232
+ %%
233
+ %% Authentication using external script
234
+ %% Make sure the script is executable by ejabberd.
235
+ %% Exauth Response Timeout is a extauth module constant and its value is 60 seconds.
236
+ %%
237
+ {auth_method, external}.
238
+ {extauth_program, "/home/aldo/ejabberd-2.1.8_scripts/authentication_script"}.
239
+ {extauth_instances, 3}.
240
+
241
+
242
+ %%{auth_method, external}.
243
+ %%{extauth_program, "/home/aldo/ejabberd-2.1.8_scripts/authentication_script"}.
244
+
245
+ %%
246
+ %% Authentication using ODBC
247
+ %% Remember to setup a database in the next section.
248
+ %%
249
+ %%{auth_method, odbc}.
250
+
251
+ %%
252
+ %% Authentication using PAM
253
+ %%
254
+ %%{auth_method, pam}.
255
+ %%{pam_service, "pamservicename"}.
256
+
257
+ %%
258
+ %% Authentication using LDAP
259
+ %%
260
+ %%{auth_method, ldap}.
261
+ %%
262
+ %% List of LDAP servers:
263
+ %%{ldap_servers, ["localhost"]}.
264
+ %%
265
+ %% Encryption of connection to LDAP servers:
266
+ %%{ldap_encrypt, none}.
267
+ %%{ldap_encrypt, tls}.
268
+ %%
269
+ %% Port to connect to on LDAP servers:
270
+ %%{ldap_port, 389}.
271
+ %%{ldap_port, 636}.
272
+ %%
273
+ %% LDAP manager:
274
+ %%{ldap_rootdn, "dc=example,dc=com"}.
275
+ %%
276
+ %% Password of LDAP manager:
277
+ %%{ldap_password, "******"}.
278
+ %%
279
+ %% Search base of LDAP directory:
280
+ %%{ldap_base, "dc=example,dc=com"}.
281
+ %%
282
+ %% LDAP attribute that holds user ID:
283
+ %%{ldap_uids, [{"mail", "%u@mail.example.org"}]}.
284
+ %%
285
+ %% LDAP filter:
286
+ %%{ldap_filter, "(objectClass=shadowAccount)"}.
287
+
288
+ %%
289
+ %% Anonymous login support:
290
+ %% auth_method: anonymous
291
+ %% anonymous_protocol: sasl_anon | login_anon | both
292
+ %% allow_multiple_connections: true | false
293
+ %%
294
+ %%{host_config, "public.example.org", [{auth_method, anonymous},
295
+ %% {allow_multiple_connections, false},
296
+ %% {anonymous_protocol, sasl_anon}]}.
297
+ %%
298
+ %% To use both anonymous and internal authentication:
299
+ %%
300
+ %%{host_config, "public.example.org", [{auth_method, [internal, anonymous]}]}.
301
+
302
+
303
+ %%%. ==============
304
+ %%%' DATABASE SETUP
305
+
306
+ %% ejabberd by default uses the internal Mnesia database,
307
+ %% so you do not necessarily need this section.
308
+ %% This section provides configuration examples in case
309
+ %% you want to use other database backends.
310
+ %% Please consult the ejabberd Guide for details on database creation.
311
+
312
+ %%
313
+ %% MySQL server:
314
+ %%
315
+ %%{odbc_server, {mysql, "server", "database", "username", "password"}}.
316
+ %%
317
+ %% If you want to specify the port:
318
+ %%{odbc_server, {mysql, "server", 1234, "database", "username", "password"}}.
319
+
320
+ %%
321
+ %% PostgreSQL server:
322
+ %%
323
+ %%{odbc_server, {pgsql, "server", "database", "username", "password"}}.
324
+ %%
325
+ %% If you want to specify the port:
326
+ %%{odbc_server, {pgsql, "server", 1234, "database", "username", "password"}}.
327
+ %%
328
+ %% If you use PostgreSQL, have a large database, and need a
329
+ %% faster but inexact replacement for "select count(*) from users"
330
+ %%
331
+ %%{pgsql_users_number_estimate, true}.
332
+
333
+ %%
334
+ %% ODBC compatible or MSSQL server:
335
+ %%
336
+ %%{odbc_server, "DSN=ejabberd;UID=ejabberd;PWD=ejabberd"}.
337
+
338
+ %%
339
+ %% Number of connections to open to the database for each virtual host
340
+ %%
341
+ %%{odbc_pool_size, 10}.
342
+
343
+ %%
344
+ %% Interval to make a dummy SQL request to keep the connections to the
345
+ %% database alive. Specify in seconds: for example 28800 means 8 hours
346
+ %%
347
+ %%{odbc_keepalive_interval, undefined}.
348
+
349
+
350
+ %%%. ===============
351
+ %%%' TRAFFIC SHAPERS
352
+
353
+ %%
354
+ %% The "normal" shaper limits traffic speed to 1000 B/s
355
+ %%
356
+ {shaper, normal, {maxrate, 1000}}.
357
+
358
+ %%
359
+ %% The "fast" shaper limits traffic speed to 50000 B/s
360
+ %%
361
+ {shaper, fast, {maxrate, 50000}}.
362
+
363
+ %%
364
+ %% This option specifies the maximum number of elements in the queue
365
+ %% of the FSM. Refer to the documentation for details.
366
+ %%
367
+ {max_fsm_queue, 1000}.
368
+
369
+
370
+ %%%. ====================
371
+ %%%' ACCESS CONTROL LISTS
372
+
373
+ %%
374
+ %% The 'admin' ACL grants administrative privileges to XMPP accounts.
375
+ %% You can put here as many accounts as you want.
376
+ %%
377
+ %%{acl, admin, {user, "aleksey", "localhost"}}.
378
+ %%{acl, admin, {user, "ermine", "example.org"}}.
379
+ {acl, admin, {user, "admin", "trapo"}}.
380
+
381
+ %%
382
+ %% Blocked users
383
+ %%
384
+ %%{acl, blocked, {user, "baduser", "example.org"}}.
385
+ %%{acl, blocked, {user, "test"}}.
386
+
387
+ %%
388
+ %% Local users: don't modify this line.
389
+ %%
390
+ {acl, local, {user_regexp, ""}}.
391
+
392
+ %%
393
+ %% More examples of ACLs
394
+ %%
395
+ %%{acl, jabberorg, {server, "jabber.org"}}.
396
+ %%{acl, aleksey, {user, "aleksey", "jabber.ru"}}.
397
+ %%{acl, test, {user_regexp, "^test"}}.
398
+ %%{acl, test, {user_glob, "test*"}}.
399
+
400
+ %%
401
+ %% Define specific ACLs in a virtual host.
402
+ %%
403
+ %%{host_config, "localhost",
404
+ %% [
405
+ %% {acl, admin, {user, "bob-local", "localhost"}}
406
+ %% ]
407
+ %%}.
408
+
409
+
410
+ %%%. ============
411
+ %%%' ACCESS RULES
412
+
413
+ %% Maximum number of simultaneous sessions allowed for a single user:
414
+ {access, max_user_sessions, [{10, all}]}.
415
+
416
+ %% Maximum number of offline messages that users can have:
417
+ {access, max_user_offline_messages, [{5000, admin}, {100, all}]}.
418
+
419
+ %% This rule allows access only for local users:
420
+ {access, local, [{allow, local}]}.
421
+
422
+ %% Only non-blocked users can use c2s connections:
423
+ {access, c2s, [{deny, blocked},
424
+ {allow, all}]}.
425
+
426
+ %% For C2S connections, all users except admins use the "normal" shaper
427
+ {access, c2s_shaper, [{none, admin},
428
+ {normal, all}]}.
429
+
430
+ %% All S2S connections use the "fast" shaper
431
+ {access, s2s_shaper, [{fast, all}]}.
432
+
433
+ %% Only admins can send announcement messages:
434
+ {access, announce, [{allow, admin}]}.
435
+
436
+ %% Only admins can use the configuration interface:
437
+ {access, configure, [{allow, admin}]}.
438
+
439
+ %% Admins of this server are also admins of the MUC service:
440
+ {access, muc_admin, [{allow, admin}]}.
441
+
442
+ %% Only accounts of the local ejabberd server can create rooms:
443
+ {access, muc_create, [{allow, local}]}.
444
+
445
+ %% All users are allowed to use the MUC service:
446
+ {access, muc, [{allow, all}]}.
447
+
448
+ %% Only accounts on the local ejabberd server can create Pubsub nodes:
449
+ {access, pubsub_createnode, [{allow, local}]}.
450
+
451
+ %% In-band registration allows registration of any possible username.
452
+ %% To disable in-band registration, replace 'allow' with 'deny'.
453
+ {access, register, [{allow, all}]}.
454
+
455
+ %% By default the frequency of account registrations from the same IP
456
+ %% is limited to 1 account every 10 minutes. To disable, specify: infinity
457
+ %%{registration_timeout, 600}.
458
+ {registration_timeout, infinity}.
459
+
460
+ %%
461
+ %% Define specific Access Rules in a virtual host.
462
+ %%
463
+ %%{host_config, "localhost",
464
+ %% [
465
+ %% {access, c2s, [{allow, admin}, {deny, all}]},
466
+ %% {access, register, [{deny, all}]}
467
+ %% ]
468
+ %%}.
469
+
470
+
471
+ %%%. ================
472
+ %%%' DEFAULT LANGUAGE
473
+
474
+ %%
475
+ %% language: Default language used for server messages.
476
+ %%
477
+ {language, "en"}.
478
+
479
+ %%
480
+ %% Set a different default language in a virtual host.
481
+ %%
482
+ %%{host_config, "localhost",
483
+ %% [{language, "ru"}]
484
+ %%}.
485
+
486
+
487
+ %%%. =======
488
+ %%%' CAPTCHA
489
+
490
+ %%
491
+ %% Full path to a script that generates the image.
492
+ %%
493
+ %%{captcha_cmd, "/lib/ejabberd/priv/bin/captcha.sh"}.
494
+
495
+ %%
496
+ %% Host for the URL and port where ejabberd listens for CAPTCHA requests.
497
+ %%
498
+ %%{captcha_host, "example.org:5280"}.
499
+
500
+ %%
501
+ %% Limit CAPTCHA calls per minute for JID/IP to avoid DoS.
502
+ %%
503
+ %%{captcha_limit, 5}.
504
+
505
+ %%%. =======
506
+ %%%' MODULES
507
+
508
+ %%
509
+ %% Modules enabled in all ejabberd virtual hosts.
510
+ %%
511
+ {modules,
512
+ [
513
+ {mod_adhoc, []},
514
+ {mod_announce, [{access, announce}]}, % recommends mod_adhoc
515
+ {mod_blocking,[]}, % requires mod_privacy
516
+ {mod_caps, []},
517
+ {mod_configure,[]}, % requires mod_adhoc
518
+ {mod_disco, []},
519
+ %%{mod_echo, [{host, "echo.localhost"}]},
520
+ {mod_irc, []},
521
+ {mod_http_bind, []},
522
+ %%{mod_http_fileserver, [
523
+ %% {docroot, "/var/www"},
524
+ %% {accesslog, "/var/log/ejabberd/access.log"}
525
+ %% ]},
526
+ {mod_last, []},
527
+ {mod_muc, [
528
+ %%{host, "conference.@HOST@"},
529
+ {access, muc},
530
+ {access_create, muc_create},
531
+ {access_persistent, muc_create},
532
+ {access_admin, muc_admin}
533
+ ]},
534
+ %%{mod_muc_log,[]},
535
+ {mod_offline, [{access_max_user_messages, max_user_offline_messages}]},
536
+ {mod_ping, []},
537
+ %%{mod_pres_counter,[{count, 5}, {interval, 60}]},
538
+ {mod_privacy, []},
539
+ {mod_private, []},
540
+ %%{mod_proxy65,[]},
541
+ {mod_pubsub, [
542
+ {access_createnode, pubsub_createnode},
543
+ {ignore_pep_from_offline, true}, % reduces resource comsumption, but XEP incompliant
544
+ %%{ignore_pep_from_offline, false}, % XEP compliant, but increases resource comsumption
545
+ {last_item_cache, false},
546
+ {plugins, ["flat", "hometree", "pep"]} % pep requires mod_caps
547
+ ]},
548
+ {mod_register, [
549
+ %%
550
+ %% Protect In-Band account registrations with CAPTCHA.
551
+ %%
552
+ %%{captcha_protected, true},
553
+
554
+ %%
555
+ %% Set the minimum informational entropy for passwords.
556
+ %%
557
+ %%{password_strength, 32},
558
+
559
+ %%
560
+ %% After successful registration, the user receives
561
+ %% a message with this subject and body.
562
+ %%
563
+ {welcome_message, {"Welcome!",
564
+ "Hi.\nWelcome to this XMPP server."}},
565
+
566
+ %%
567
+ %% When a user registers, send a notification to
568
+ %% these XMPP accounts.
569
+ %%
570
+ %%{registration_watchers, ["admin1@example.org"]},
571
+
572
+ %%
573
+ %% Only clients in the server machine can register accounts
574
+ %%
575
+ {ip_access, [{allow, "127.0.0.0/8"},
576
+ {deny, "0.0.0.0/0"}]},
577
+
578
+ %%
579
+ %% Local c2s or remote s2s users cannot register accounts
580
+ %%
581
+ %%{access_from, deny},
582
+
583
+ {access, register}
584
+ ]},
585
+ %%{mod_register_web, [
586
+ %%
587
+ %% When a user registers, send a notification to
588
+ %% these XMPP accounts.
589
+ %%
590
+ %%{registration_watchers, ["admin1@example.org"]}
591
+ %% ]},
592
+ {mod_roster, []},
593
+ %%{mod_service_log,[]},
594
+ {mod_shared_roster,[]},
595
+ {mod_stats, []},
596
+ {mod_time, []},
597
+ {mod_vcard, []},
598
+ {mod_sspresence, []},
599
+ {mod_admin_extra, []},
600
+ {mod_version, []}
601
+ ]}.
602
+
603
+
604
+
605
+ %%
606
+ %% Enable modules with custom options in a specific virtual host
607
+ %%
608
+ %%{host_config, "localhost",
609
+ %% [{{add, modules},
610
+ %% [
611
+ %% {mod_echo, [{host, "mirror.localhost"}]}
612
+ %% ]
613
+ %% }
614
+ %% ]}.
615
+
616
+
617
+ %%%.
618
+ %%%'
619
+
620
+ %%% $Id$
621
+
622
+ %%% Local Variables:
623
+ %%% mode: erlang
624
+ %%% End:
625
+ %%% vim: set filetype=erlang tabstop=8 foldmarker=%%%',%%%. foldmethod=marker: