social_stream 0.11.2 → 0.11.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (168) hide show
  1. data/Gemfile +0 -9
  2. data/base/app/assets/stylesheets/contacts.css.scss +8 -3
  3. data/base/app/assets/stylesheets/frontpage.css.scss +1 -1
  4. data/base/app/assets/stylesheets/search.css.scss +17 -1
  5. data/base/app/controllers/contacts_controller.rb +2 -5
  6. data/base/app/models/contact.rb +3 -2
  7. data/base/app/views/activities/_options.html.erb +1 -1
  8. data/base/app/views/contacts/_form.html.erb +14 -7
  9. data/base/app/views/frontpage/_social_networks.html.erb +3 -0
  10. data/base/app/views/groups/_new.html.erb +2 -2
  11. data/base/app/views/groups/_show.html.erb +1 -2
  12. data/base/app/views/groups/index.html.erb +1 -1
  13. data/base/app/views/layouts/_header_signed_out.erb +1 -3
  14. data/base/app/views/notifications/activities/_follow_subject.html.erb +5 -2
  15. data/base/app/views/notifications/activities/_like_subject.html.erb +6 -2
  16. data/base/app/views/notifications/activities/_make-friend_subject.html.erb +5 -2
  17. data/base/app/views/notifications/activities/_post_subject.html.erb +6 -1
  18. data/base/app/views/notifications/activities/_update_body.html.erb +5 -1
  19. data/base/app/views/notifications/activities/_update_subject.html.erb +5 -1
  20. data/base/app/views/posts/_post_focus_search.html.erb +37 -3
  21. data/base/app/views/posts/_post_global_search.html.erb +2 -0
  22. data/base/app/views/profiles/_contact.html.erb +1 -1
  23. data/base/app/views/search/index.js.erb +2 -0
  24. data/base/app/views/toolbar/_home.html.erb +4 -0
  25. data/base/config/locales/en.yml +26 -0
  26. data/base/config/locales/es.yml +26 -0
  27. data/base/lib/mailboxer/notification_decoder.rb +8 -6
  28. data/base/lib/social_stream-base.rb +1 -1
  29. data/base/lib/social_stream/base/version.rb +1 -1
  30. data/base/lib/social_stream/migrations/components.rb +1 -1
  31. data/base/lib/social_stream/toolbar_config/base.rb +12 -1
  32. data/base/social_stream-base.gemspec +1 -1
  33. data/base/spec/controllers/contacts_controller_spec.rb +4 -4
  34. data/events/app/assets/javascripts/social_stream-events.js +2 -2
  35. data/events/app/assets/stylesheets/social_stream-events.css +3 -0
  36. data/events/{app → vendor}/assets/javascripts/jquery.ad-gallery.js +0 -0
  37. data/events/{app → vendor}/assets/javascripts/jquery.ad-gallery.pack.js +0 -0
  38. data/events/{app → vendor}/assets/stylesheets/ad_next.png +0 -0
  39. data/events/{app → vendor}/assets/stylesheets/ad_prev.png +0 -0
  40. data/events/{app → vendor}/assets/stylesheets/ad_scroll_back.png +0 -0
  41. data/events/{app → vendor}/assets/stylesheets/ad_scroll_forward.png +0 -0
  42. data/events/{app → vendor}/assets/stylesheets/fullcalendar.css +0 -0
  43. data/events/{app → vendor}/assets/stylesheets/fullcalendar.print.css +0 -0
  44. data/events/{app → vendor}/assets/stylesheets/jquery.ad-gallery.css +0 -0
  45. data/events/{app → vendor}/assets/stylesheets/loader.gif +0 -0
  46. data/events/vendor/assets/stylesheets/social_stream-events.css +273 -0
  47. data/lib/social_stream.rb +0 -4
  48. data/lib/social_stream/version.rb +1 -1
  49. data/presence/.gitignore +4 -0
  50. data/presence/Gemfile +4 -0
  51. data/presence/Rakefile +1 -0
  52. data/presence/app/assets/audio/chat/onMessageAudio.mp3 +0 -0
  53. data/presence/app/assets/audio/chat/onMessageAudio.wav +0 -0
  54. data/presence/app/assets/images/arrow.png +0 -0
  55. data/presence/app/assets/images/black_arrow3.png +0 -0
  56. data/presence/app/assets/images/status/available.png +0 -0
  57. data/presence/app/assets/images/status/away.png +0 -0
  58. data/presence/app/assets/images/status/dnd.png +0 -0
  59. data/presence/app/assets/javascripts/jquery-ui-1.8.14.custom.min.js +789 -0
  60. data/presence/app/assets/javascripts/jquery.tools.min.js +17 -0
  61. data/presence/app/assets/javascripts/jquery.tools.tooltip.js +11 -0
  62. data/presence/app/assets/javascripts/jquery.ui.chatbox.js +260 -0
  63. data/presence/app/assets/javascripts/social_stream-presence.js +2 -0
  64. data/presence/app/assets/javascripts/store.js +27 -0
  65. data/presence/app/assets/javascripts/strophe.js +3612 -0
  66. data/presence/app/assets/javascripts/xmpp_client.js +498 -0
  67. data/presence/app/assets/stylesheets/chat.css +231 -0
  68. data/presence/app/assets/stylesheets/jquery.ui.chatbox.css +54 -0
  69. data/presence/app/assets/stylesheets/social_stream-presence.css +3 -0
  70. data/presence/app/controllers/xmpp_controller.rb +190 -0
  71. data/presence/app/helpers/xmpp_helper.rb +33 -0
  72. data/presence/app/views/xmpp/_chat.html.erb +59 -0
  73. data/presence/app/views/xmpp/_chat_connecting.html.erb +8 -0
  74. data/presence/app/views/xmpp/_chat_contacts.html.erb +46 -0
  75. data/presence/app/views/xmpp/_chat_off.html.erb +35 -0
  76. data/presence/app/views/xmpp/active_users.html.erb +33 -0
  77. data/presence/app/views/xmpp/chat.html.erb +13 -0
  78. data/presence/app/views/xmpp/index.html +19 -0
  79. data/presence/app/views/xmpp/test.html.erb +11 -0
  80. data/presence/config/routes.rb +15 -0
  81. data/presence/db/migrate/20110711111408_add_connected_column_to_user.rb +9 -0
  82. data/presence/db/migrate/20110928135031_add_status_column_to_user.rb +9 -0
  83. data/presence/ejabberd/conf/ejabberd.cfg +625 -0
  84. data/presence/ejabberd/conf/ejabberdctl.cfg +154 -0
  85. data/presence/ejabberd/conf/inetrc +3 -0
  86. data/presence/ejabberd/conf/server.pem +37 -0
  87. data/presence/ejabberd/conf/ssconfig.cfg +29 -0
  88. data/presence/ejabberd/ejabberd_scripts/authentication_script +117 -0
  89. data/presence/ejabberd/ejabberd_scripts/authentication_script_org +114 -0
  90. data/presence/ejabberd/ejabberd_scripts/compile_module +34 -0
  91. data/presence/ejabberd/ejabberd_scripts/generate_random_password +18 -0
  92. data/presence/ejabberd/ejabberd_scripts/kill_authentication_script.sh +13 -0
  93. data/presence/ejabberd/ejabberd_scripts/reset_connection_script +55 -0
  94. data/presence/ejabberd/ejabberd_scripts/reset_logs.sh +23 -0
  95. data/presence/ejabberd/ejabberd_scripts/set_connection_script +48 -0
  96. data/presence/ejabberd/ejabberd_scripts/set_presence_script +48 -0
  97. data/presence/ejabberd/ejabberd_scripts/show_config.sh +30 -0
  98. data/presence/ejabberd/ejabberd_scripts/start_ejabberd.sh +68 -0
  99. data/presence/ejabberd/ejabberd_scripts/stop_ejabberd.sh +12 -0
  100. data/presence/ejabberd/ejabberd_scripts/synchronize_presence_script +57 -0
  101. data/presence/ejabberd/ejabberd_scripts/unset_connection_script +48 -0
  102. data/presence/ejabberd/mod_admin_extra/mod_admin_extra.beam +0 -0
  103. data/presence/ejabberd/mod_admin_extra/mod_admin_extra.erl +1560 -0
  104. data/presence/ejabberd/mod_sspresence/mod_sspresence.erl +230 -0
  105. data/presence/lib/social_stream-presence.rb +13 -0
  106. data/presence/lib/social_stream/migrations/presence.rb +9 -0
  107. data/presence/lib/social_stream/presence/config.rb +9 -0
  108. data/presence/lib/social_stream/presence/engine.rb +49 -0
  109. data/presence/lib/social_stream/presence/models/buddy_manager.rb +67 -0
  110. data/presence/social_stream-presence.gemspec +28 -0
  111. data/presence/spec/demo/.gitignore +5 -0
  112. data/presence/spec/demo/.rspec +1 -0
  113. data/presence/spec/demo/README +261 -0
  114. data/presence/spec/demo/Rakefile +7 -0
  115. data/presence/spec/demo/app/assets/images/rails.png +0 -0
  116. data/presence/spec/demo/app/assets/javascripts/application.js +9 -0
  117. data/presence/spec/demo/app/assets/stylesheets/application.css +7 -0
  118. data/presence/spec/demo/app/controllers/application_controller.rb +3 -0
  119. data/presence/spec/demo/app/helpers/application_helper.rb +2 -0
  120. data/presence/spec/demo/app/mailers/.gitkeep +0 -0
  121. data/presence/spec/demo/app/models/.gitkeep +0 -0
  122. data/presence/spec/demo/app/views/layouts/application.html.erb +14 -0
  123. data/presence/spec/demo/autotest/discover.rb +2 -0
  124. data/presence/spec/demo/config.ru +4 -0
  125. data/presence/spec/demo/config/application.rb +41 -0
  126. data/presence/spec/demo/config/boot.rb +6 -0
  127. data/presence/spec/demo/config/database.yml +25 -0
  128. data/presence/spec/demo/config/environment.rb +5 -0
  129. data/presence/spec/demo/config/environments/development.rb +27 -0
  130. data/presence/spec/demo/config/environments/production.rb +54 -0
  131. data/presence/spec/demo/config/environments/test.rb +39 -0
  132. data/presence/spec/demo/config/initializers/backtrace_silencers.rb +7 -0
  133. data/presence/spec/demo/config/initializers/inflections.rb +10 -0
  134. data/presence/spec/demo/config/initializers/mime_types.rb +5 -0
  135. data/presence/spec/demo/config/initializers/secret_token.rb +7 -0
  136. data/presence/spec/demo/config/initializers/session_store.rb +8 -0
  137. data/presence/spec/demo/config/initializers/wrap_parameters.rb +12 -0
  138. data/presence/spec/demo/config/locales/en.yml +5 -0
  139. data/presence/spec/demo/config/routes.rb +58 -0
  140. data/presence/spec/demo/db/seeds.rb +7 -0
  141. data/presence/spec/demo/doc/README_FOR_APP +2 -0
  142. data/presence/spec/demo/lib/tasks/.gitkeep +0 -0
  143. data/presence/spec/demo/log/.gitkeep +0 -0
  144. data/presence/spec/demo/public/404.html +26 -0
  145. data/presence/spec/demo/public/422.html +26 -0
  146. data/presence/spec/demo/public/500.html +26 -0
  147. data/presence/spec/demo/public/favicon.ico +0 -0
  148. data/presence/spec/demo/public/index.html +241 -0
  149. data/presence/spec/demo/public/robots.txt +5 -0
  150. data/presence/spec/demo/script/rails +6 -0
  151. data/presence/spec/demo/spec/spec_helper.rb +27 -0
  152. data/presence/spec/demo/test/fixtures/.gitkeep +0 -0
  153. data/presence/spec/demo/test/functional/.gitkeep +0 -0
  154. data/presence/spec/demo/test/integration/.gitkeep +0 -0
  155. data/presence/spec/demo/test/performance/browsing_test.rb +12 -0
  156. data/presence/spec/demo/test/test_helper.rb +13 -0
  157. data/presence/spec/demo/test/unit/.gitkeep +0 -0
  158. data/presence/spec/demo/vendor/assets/stylesheets/.gitkeep +0 -0
  159. data/presence/spec/demo/vendor/plugins/.gitkeep +0 -0
  160. data/presence/spec/discover.rb +2 -0
  161. data/presence/spec/spec_helper.rb +27 -0
  162. data/social_stream.gemspec +9 -2
  163. data/spec/dummy/config/environments/{test_pg.rb → test_mysql.rb} +6 -2
  164. data/spec/dummy/config/environments/test_postgres.rb +39 -0
  165. data/spec/spec_helper.rb +1 -4
  166. metadata +135 -21
  167. data/base/app/views/groups/_new_activity.html.erb +0 -1
  168. data/base/app/views/groups/_new_activity_fields.html.erb +0 -7
@@ -0,0 +1,154 @@
1
+ #
2
+ # In this file you can configure options that are passed by ejabberdctl
3
+ # to the erlang runtime system when starting ejabberd
4
+ #
5
+
6
+ #' POLL: Kernel polling ([true|false])
7
+ #
8
+ # The kernel polling option requires support in the kernel.
9
+ # Additionally, you need to enable this feature while compiling Erlang.
10
+ #
11
+ # Default: true
12
+ #
13
+ #POLL=true
14
+
15
+ #.
16
+ #' SMP: SMP support ([enable|auto|disable])
17
+ #
18
+ # Explanation in Erlang/OTP documentation:
19
+ # enable: starts the Erlang runtime system with SMP support enabled.
20
+ # This may fail if no runtime system with SMP support is available.
21
+ # auto: starts the Erlang runtime system with SMP support enabled if it
22
+ # is available and more than one logical processor are detected.
23
+ # disable: starts a runtime system without SMP support.
24
+ #
25
+ # Default: auto
26
+ #
27
+ #SMP=auto
28
+
29
+ #.
30
+ #' ERL_MAX_PORTS: Maximum number of simultaneously open Erlang ports
31
+ #
32
+ # ejabberd consumes two or three ports for every connection, either
33
+ # from a client or from another Jabber server. So take this into
34
+ # account when setting this limit.
35
+ #
36
+ # Default: 32000
37
+ # Maximum: 268435456
38
+ #
39
+ #ERL_MAX_PORTS=32000
40
+
41
+ #.
42
+ #' FIREWALL_WINDOW: Range of allowed ports to pass through a firewall
43
+ #
44
+ # If Ejabberd is configured to run in cluster, and a firewall is blocking ports,
45
+ # it's possible to make Erlang use a defined range of port (instead of dynamic
46
+ # ports) for node communication.
47
+ #
48
+ # Default: not defined
49
+ # Example: 4200-4210
50
+ #
51
+ #FIREWALL_WINDOW=
52
+
53
+ #.
54
+ #' INET_DIST_INTERFACE: IP address where this Erlang node listens other nodes
55
+ #
56
+ # This communication is used by ejabberdctl command line tool,
57
+ # and in a cluster of several ejabberd nodes.
58
+ # Notice that the IP address must be specified in the Erlang syntax.
59
+ #
60
+ # Default: {127,0,0,1}
61
+ #
62
+ INET_DIST_INTERFACE={127,0,0,1}
63
+
64
+ #.
65
+ #' ERL_EPMD_ADDRESS: IP addresses where epmd listens for connections
66
+ #
67
+ # IMPORTANT: This option works only in Erlang/OTP R14B03 and newer.
68
+ #
69
+ # This environment variable may be set to a comma-separated
70
+ # list of IP addresses, in which case the epmd daemon
71
+ # will listen only on the specified address(es) and on the
72
+ # loopback address (which is implicitly added to the list if it
73
+ # has not been specified). The default behaviour is to listen on
74
+ # all available IP addresses.
75
+ #
76
+ # Default: 0.0.0.0
77
+ #
78
+ #ERL_EPMD_ADDRESS=127.0.0.1
79
+
80
+ #.
81
+ #' ERL_PROCESSES: Maximum number of Erlang processes
82
+ #
83
+ # Erlang consumes a lot of lightweight processes. If there is a lot of activity
84
+ # on ejabberd so that the maximum number of processes is reached, people will
85
+ # experience greater latency times. As these processes are implemented in
86
+ # Erlang, and therefore not related to the operating system processes, you do
87
+ # not have to worry about allowing a huge number of them.
88
+ #
89
+ # Default: 250000
90
+ # Maximum: 268435456
91
+ #
92
+ #ERL_PROCESSES=250000
93
+
94
+ #.
95
+ #' ERL_MAX_ETS_TABLES: Maximum number of ETS and Mnesia tables
96
+ #
97
+ # The number of concurrent ETS and Mnesia tables is limited. When the limit is
98
+ # reached, errors will appear in the logs:
99
+ # ** Too many db tables **
100
+ # You can safely increase this limit when starting ejabberd. It impacts memory
101
+ # consumption but the difference will be quite small.
102
+ #
103
+ # Default: 1400
104
+ #
105
+ #ERL_MAX_ETS_TABLES=1400
106
+
107
+ #.
108
+ #' ERL_OPTIONS: Additional Erlang options
109
+ #
110
+ # The next variable allows to specify additional options passed to erlang while
111
+ # starting ejabberd. Some useful options are -noshell, -detached, -heart. When
112
+ # ejabberd is started from an init.d script options -noshell and -detached are
113
+ # added implicitly. See erl(1) for more info.
114
+ #
115
+ # It might be useful to add "-pa /usr/local/lib/ejabberd/ebin" if you
116
+ # want to add local modules in this path.
117
+ #
118
+ # Default: ""
119
+ #
120
+ #ERL_OPTIONS=""
121
+
122
+ #.
123
+ #' ERLANG_NODE: Erlang node name
124
+ #
125
+ # The next variable allows to explicitly specify erlang node for ejabberd
126
+ # It can be given in different formats:
127
+ # ERLANG_NODE=ejabberd
128
+ # Lets erlang add hostname to the node (ejabberd uses short name in this case)
129
+ # ERLANG_NODE=ejabberd@hostname
130
+ # Erlang uses node name as is (so make sure that hostname is a real
131
+ # machine hostname or you'll not be able to control ejabberd)
132
+ # ERLANG_NODE=ejabberd@hostname.domainname
133
+ # The same as previous, but erlang will use long hostname
134
+ # (see erl (1) manual for details)
135
+ #
136
+ # Default: ejabberd
137
+ #
138
+ #ERLANG_NODE=ejabberd
139
+
140
+ #.
141
+ #' EJABBERD_PID_PATH: ejabberd PID file
142
+ #
143
+ # Indicate the full path to the ejabberd Process identifier (PID) file.
144
+ # If this variable is defined, ejabberd writes the PID file when starts,
145
+ # and deletes it when stops.
146
+ # Remember to create the directory and grant write permission to ejabberd.
147
+ #
148
+ # Default: don't write PID file
149
+ #
150
+ #EJABBERD_PID_PATH=/var/run/ejabberd/ejabberd.pid
151
+
152
+ #.
153
+ #'
154
+ # vim: foldmarker=#',#. foldmethod=marker:
@@ -0,0 +1,3 @@
1
+ {lookup,["file","native"]}.
2
+ {host,{127,0,0,1}, ["localhost","hostalias"]}.
3
+ {file, resolv, "/etc/resolv.conf"}.
@@ -0,0 +1,37 @@
1
+ -----BEGIN CERTIFICATE-----
2
+ MIIDvDCCAyWgAwIBAgIJAOBE76dYOsdsMA0GCSqGSIb3DQEBBAUAMIGbMQswCQYD
3
+ VQQGEwJGUjEMMAoGA1UECBMDSURGMQ4wDAYDVQQHEwVQYXJpczEXMBUGA1UEChMO
4
+ VGVzdCBTZXJ2ZXIgUDExFDASBgNVBAsTC1Byb2Nlc3Mtb25lMRcwFQYDVQQDEw5N
5
+ aWNrYWVsIFJlbW9uZDEmMCQGCSqGSIb3DQEJARYXY29udGFjdEBwcm9jZXNzLW9u
6
+ ZS5uZXQwHhcNMDYwMzAzMTYwNjQ2WhcNMTYwMjI5MTYwNjQ2WjCBmzELMAkGA1UE
7
+ BhMCRlIxDDAKBgNVBAgTA0lERjEOMAwGA1UEBxMFUGFyaXMxFzAVBgNVBAoTDlRl
8
+ c3QgU2VydmVyIFAxMRQwEgYDVQQLEwtQcm9jZXNzLW9uZTEXMBUGA1UEAxMOTWlj
9
+ a2FlbCBSZW1vbmQxJjAkBgkqhkiG9w0BCQEWF2NvbnRhY3RAcHJvY2Vzcy1vbmUu
10
+ bmV0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC8sZ/Wb2GqYPL43OBzBNz0
11
+ gFT1iDZMLLgpMYqBZElKul7GGCdLZElgqVYm8KRxPIiRd5BPbueNkhw/YhhcQAay
12
+ 4+Ef7Y6zdjXAsYGtYhdmms6icCk1RxIMa2TvJ6dZlraV2KJdNExxhMtSyj3NBVs4
13
+ 276RcZSukN2AR4/pziWysQIDAQABo4IBBDCCAQAwHQYDVR0OBBYEFMBW8llnB7AA
14
+ hu9u+ivBndDdbmLTMIHQBgNVHSMEgcgwgcWAFMBW8llnB7AAhu9u+ivBndDdbmLT
15
+ oYGhpIGeMIGbMQswCQYDVQQGEwJGUjEMMAoGA1UECBMDSURGMQ4wDAYDVQQHEwVQ
16
+ YXJpczEXMBUGA1UEChMOVGVzdCBTZXJ2ZXIgUDExFDASBgNVBAsTC1Byb2Nlc3Mt
17
+ b25lMRcwFQYDVQQDEw5NaWNrYWVsIFJlbW9uZDEmMCQGCSqGSIb3DQEJARYXY29u
18
+ dGFjdEBwcm9jZXNzLW9uZS5uZXSCCQDgRO+nWDrHbDAMBgNVHRMEBTADAQH/MA0G
19
+ CSqGSIb3DQEBBAUAA4GBAGtYeVL7BlksuXf79V/WfBPosKD4yVzs7P9GsgS/D10T
20
+ HMIRbjIOma4IVy8Es/UBJ0Q4gPojVg4lPo3xv/PSgSDJfbcJyWjSbAh0eGvHtNc5
21
+ 4GnYVx5ox0o0MBR8Mt0ChbwA5QMSo6bqc5tRK6+B+ib4ELix7MCSq3wdh7HcuL9D
22
+ -----END CERTIFICATE-----
23
+ -----BEGIN RSA PRIVATE KEY-----
24
+ MIICXQIBAAKBgQC8sZ/Wb2GqYPL43OBzBNz0gFT1iDZMLLgpMYqBZElKul7GGCdL
25
+ ZElgqVYm8KRxPIiRd5BPbueNkhw/YhhcQAay4+Ef7Y6zdjXAsYGtYhdmms6icCk1
26
+ RxIMa2TvJ6dZlraV2KJdNExxhMtSyj3NBVs4276RcZSukN2AR4/pziWysQIDAQAB
27
+ AoGADl1DOrK975dzx6gg2gCrxV0jmpFk+MWKu3APCCyXO74WSuQ50Y5v25Dogwxc
28
+ qFYgW1qLvNBHhkpyJg0Up6kkGUalWNgdX/D63QMA/HeSLIpuUsoTGt/F3yu5wcaJ
29
+ 8y+WVZ5fcNK+rSYyNdnxv0+euazr2HUpfe5zqscGMdT5kDECQQDop9vLcop4aPkd
30
+ h5e/AJt6irb/GQt7MBYZzxI+lof8SoASyL3EcMjZI002JCLXWirOX47eO7G7v/D1
31
+ v7feRz3dAkEAz6CIqd9nHPT1QNmhb6QANC6Cy1PzQdAOjxz+0CRHzPBOy+bnHI00
32
+ 921RQdCiJ/KEp4olDrTVOMkjbKa928kM5QJBAJspuBDLZ0Y+3EWxdKbSBN+JO9qO
33
+ HXYe795ul8BeLHs6RIhCkS09+vW18Xy2RPZTEFFqsaHNNg/9RvrezgXUhZECQQCp
34
+ Tk3Cv9J0cWeALzcOM1ybMIYlSVqmgwMsPkem8L6/5gFLEgnJZXgYf0LweTGRg5ga
35
+ inK3cEwilxnU4o8VJvflAkBcd/gsVklKfr0Z+vcfjoXsIAN5DoWQYozo7omUIudS
36
+ 5wjh6y5uYtkhazIJRxNUi9WMfKqhnrje0NfG+p+Sxs7J
37
+ -----END RSA PRIVATE KEY-----
@@ -0,0 +1,29 @@
1
+ #Social Stream Presence: ejabberd config
2
+
3
+ #Scripts Path
4
+ scripts_path=/home/aldo/ejabberd-2.1.8_scripts
5
+
6
+ #Source path: uncomment to compile ejabberd social stream module
7
+ source_path=/home/aldo/ejabberd-2.1.8_source/src
8
+
9
+ #It is also necessary to modify the file: /etc/ejabberd/ejabberd.cfg
10
+ #%%{auth_method, external}.
11
+ #%%{extauth_program, "scripts_path/authentication_script"}.
12
+
13
+ #API REST
14
+ auth_api=http://0.0.0.0:3000/users/sign_in
15
+ set_connection_api=http://0.0.0.0:3000/xmpp/setConnection
16
+ unset_connection_api=http://0.0.0.0:3000/xmpp/unsetConnection
17
+ reset_connection_api=http://0.0.0.0:3000/xmpp/resetConnection
18
+ synchronize_presence_api=http://0.0.0.0:3000/xmpp/synchronizePresence
19
+ set_presence_api=http://0.0.0.0:3000/xmpp/setPresence
20
+ unset_presence_api=http://0.0.0.0:3000/xmpp/unsetPresence
21
+
22
+ #Social Stream Login
23
+ ss_login=social_stream-presence
24
+
25
+ #Social Stream PASSWORD
26
+ ss_password=DnVCB8G|R$VGmZ@2?5=CYS8z)NrL@LuQ&LTCUh^9B(DF4gC&sQpfbCMbaNKEdNrGYkT4L5zxM0wNWs5q3?ww(b&0d5fK87z^BmgJMMF2SKXT9pEk^UEcch!GX!Avf5GT9)j@FpHe)4RH)BK7J98u!sUmJHUN(Je6aBmn!FtZ4Ab5h8$|nsvUt3Jkq?21HOH$r0sDyJZZvGOCgFS2EKw@0wXsJRHYVRPBe&Eb!1X55e55bQ^h2AW&^R70TK0m)Fu8
27
+
28
+ #Ejabberd Server Password
29
+ ejabberd_password=G&s6GBnO)anw2Ene%K12Cb=0quj@uDmA
@@ -0,0 +1,117 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'logger'
4
+ require 'rest_client'
5
+
6
+ $stdout.sync = true
7
+ $stdin.sync = true
8
+
9
+ path = "/var/log/ejabberd/auth.log"
10
+ file = File.open(path, File::WRONLY | File::APPEND | File::CREAT)
11
+ file.sync = true
12
+ $logger = Logger.new(file)
13
+ $logger.level = Logger::DEBUG
14
+
15
+ $logger.info "#{Process.pid}: Starting ejabberd authentication service"
16
+
17
+
18
+ def getOption(option)
19
+ File.open('/etc/ejabberd/ssconfig.cfg', 'r') do |f1|
20
+ while line = f1.gets
21
+ line = line.gsub(/\n/,'')
22
+ if line.match(/^#/)
23
+ #Comments
24
+ elsif line.match(/^#{option}/)
25
+ return line.gsub(/#{option}/,'')
26
+ end
27
+ end
28
+ end
29
+ return "Undefined"
30
+ end
31
+
32
+ $accessUrl = getOption("auth_api=")
33
+ $sslogin = getOption("ss_login=")
34
+ $sspass = getOption("ss_password=")
35
+
36
+
37
+ def auth(username, password)
38
+
39
+ #[TEST ONLY] Allow everybody
40
+ return true
41
+
42
+ #[TEST] Admin password
43
+ if username == "admin" and password == "pass"
44
+ return true
45
+ end
46
+
47
+ #Social Stream password
48
+ if username == $sslogin and password == $sspass
49
+ return true
50
+ end
51
+
52
+ begin
53
+ response = RestClient.post $accessUrl, :user => { :email => username , :password => password }
54
+
55
+ if response.code == 201
56
+ return true
57
+ else
58
+ return false
59
+ end
60
+
61
+ rescue => e
62
+
63
+ unless e.class.name == "RestClient::Unauthorized" and e.message == "401 Unauthorized"
64
+ $logger.error "#{Process.pid}: Exception in auth(username, password)"
65
+ $logger.error "#{Process.pid}: #{e.class.name}: #{e.message}"
66
+ end
67
+
68
+ return false
69
+ end
70
+
71
+ end
72
+
73
+
74
+ loop do
75
+ begin
76
+ $stdin.eof? # wait for input
77
+ start = Time.now
78
+
79
+ msg = $stdin.read(2)
80
+ length = msg.unpack('n').first
81
+
82
+ msg = $stdin.read(length)
83
+ cmd, *data = msg.split(":")
84
+
85
+ $logger.info "#{Process.pid}: Incoming Request: '#{cmd}'"
86
+ success = case cmd
87
+
88
+ when "auth"
89
+ $logger.info "#{Process.pid}: Authenticating #{data[0]}@#{data[1]}"
90
+ $logger.info "#{Process.pid}: With password #{data[2]}"
91
+ #password = data[2]
92
+
93
+ #Authorization condition for LOGIN
94
+ auth(data[0], data[2])
95
+
96
+
97
+ when "isuser"
98
+
99
+ $logger.info "#{Process.pid}: Isuser #{data[0]}@#{data[1]}"
100
+
101
+ #Authorization condition for ISUSER (Add buddys)
102
+ true
103
+
104
+ else
105
+ false
106
+ end
107
+
108
+ bool = success ? 1 : 0
109
+ $stdout.write [2, bool].pack("nn")
110
+ $logger.info "#{Process.pid}: Response: #{success ? "success" : "failure"}"
111
+ rescue => e
112
+ $logger.error "#{Process.pid}: #{e.class.name}: #{e.message}"
113
+ $logger.error "#{Process.pid}: " + e.backtrace.join("\n\t")
114
+ $logger.error "#{Process.pid}: Finish process"
115
+ break
116
+ end
117
+ end
@@ -0,0 +1,114 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'logger'
4
+ require 'rest_client'
5
+
6
+ $stdout.sync = true
7
+ $stdin.sync = true
8
+
9
+ path = "/var/log/ejabberd/auth.log"
10
+ file = File.open(path, File::WRONLY | File::APPEND | File::CREAT)
11
+ file.sync = true
12
+ $logger = Logger.new(file)
13
+ $logger.level = Logger::DEBUG
14
+
15
+ $logger.info "#{Process.pid}: Starting ejabberd authentication service"
16
+
17
+
18
+ def getOption(option)
19
+ File.open('/etc/ejabberd/ssconfig.cfg', 'r') do |f1|
20
+ while line = f1.gets
21
+ line = line.gsub(/\n/,'')
22
+ if line.match(/^#/)
23
+ #Comments
24
+ elsif line.match(/^#{option}/)
25
+ return line.gsub(/#{option}/,'')
26
+ end
27
+ end
28
+ end
29
+ return "Undefined"
30
+ end
31
+
32
+ $accessUrl = getOption("auth_api=")
33
+ $sslogin = getOption("ss_login=")
34
+ $sspass = getOption("ss_password=")
35
+
36
+
37
+ def auth(username, password)
38
+
39
+ #[TEST] Admin password
40
+ if username == "admin" and password == "pass"
41
+ return true
42
+ end
43
+
44
+ #Social Stream password
45
+ if username == $sslogin and password == $sspass
46
+ return true
47
+ end
48
+
49
+ begin
50
+ response = RestClient.post $accessUrl, :user => { :email => username , :password => password }
51
+
52
+ if response.code == 201
53
+ return true
54
+ else
55
+ return false
56
+ end
57
+
58
+ rescue => e
59
+
60
+ unless e.class.name == "RestClient::Unauthorized" and e.message == "401 Unauthorized"
61
+ $logger.error "#{Process.pid}: Exception in auth(username, password)"
62
+ $logger.error "#{Process.pid}: #{e.class.name}: #{e.message}"
63
+ end
64
+
65
+ return false
66
+ end
67
+
68
+ end
69
+
70
+
71
+ loop do
72
+ begin
73
+ $stdin.eof? # wait for input
74
+ start = Time.now
75
+
76
+ msg = $stdin.read(2)
77
+ length = msg.unpack('n').first
78
+
79
+ msg = $stdin.read(length)
80
+ cmd, *data = msg.split(":")
81
+
82
+ $logger.info "#{Process.pid}: Incoming Request: '#{cmd}'"
83
+ success = case cmd
84
+
85
+ when "auth"
86
+ $logger.info "#{Process.pid}: Authenticating #{data[0]}@#{data[1]}"
87
+ $logger.info "#{Process.pid}: With password #{data[2]}"
88
+ #password = data[2]
89
+
90
+ #Authorization condition for LOGIN
91
+ auth(data[0], data[2])
92
+
93
+
94
+ when "isuser"
95
+
96
+ $logger.info "#{Process.pid}: Isuser #{data[0]}@#{data[1]}"
97
+
98
+ #Authorization condition for ISUSER (Add buddys)
99
+ true
100
+
101
+ else
102
+ false
103
+ end
104
+
105
+ bool = success ? 1 : 0
106
+ $stdout.write [2, bool].pack("nn")
107
+ $logger.info "#{Process.pid}: Response: #{success ? "success" : "failure"}"
108
+ rescue => e
109
+ $logger.error "#{Process.pid}: #{e.class.name}: #{e.message}"
110
+ $logger.error "#{Process.pid}: " + e.backtrace.join("\n\t")
111
+ $logger.error "#{Process.pid}: Finish process"
112
+ break
113
+ end
114
+ end