... | ... |
@@ -1,29 +1,28 @@ |
1 |
-require 'json/pure' |
|
1 |
+#require 'json/pure' |
|
2 | 2 |
require 'xmpp4r' |
3 | 3 |
require 'xmpp4r/roster' |
4 | 4 |
require 'cgi' |
5 | 5 |
|
6 | 6 |
module Signin |
7 |
- include Jabber |
|
7 |
+ include Jabber |
|
8 | 8 |
|
9 |
- def self.try_login(jid, pass) |
|
10 |
- @client = Client.new(jid) |
|
9 |
+ def self.try_login(jid, pass) |
|
10 |
+ @client = Client.new(jid) |
|
11 | 11 |
|
12 |
- Jabber::debug = (Rails.env == 'development') |
|
12 |
+ begin |
|
13 |
+ connect(pass) |
|
14 |
+ @client |
|
15 |
+ rescue |
|
16 |
+ raise LoginError |
|
17 |
+ end |
|
18 |
+ end |
|
13 | 19 |
|
14 |
- begin |
|
15 |
- connect(pass) |
|
16 |
- rescue |
|
17 |
- raise LoginError |
|
18 |
- end |
|
19 |
- end |
|
20 |
+ def self.connect(pass) |
|
21 |
+ @client.connect() |
|
22 |
+ @client.auth(pass) |
|
23 |
+ end |
|
20 | 24 |
|
21 |
- def self.connect(pass) |
|
22 |
- @client.connect() |
|
23 |
- @client.auth(pass) |
|
24 |
- end |
|
25 |
+ class LoginError < Exception |
|
25 | 26 |
|
26 |
- class LoginError < Exception |
|
27 |
- |
|
28 |
- end |
|
27 |
+ end |
|
29 | 28 |
end |
30 | 29 |
\ No newline at end of file |