author | Nikita Kozlov <nikita@mbdsys.com> |
Tue, 07 Dec 2010 22:57:56 +0100 | |
changeset 815 | ca323cff3ac9 |
parent 810 | 0ff0059f2ec3 |
permissions | -rw-r--r-- |
810
0ff0059f2ec3
initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff
changeset
|
1 |
/* |
0ff0059f2ec3
initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff
changeset
|
2 |
* otr4j, the open source java otr library. |
0ff0059f2ec3
initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff
changeset
|
3 |
* |
0ff0059f2ec3
initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff
changeset
|
4 |
* Distributable under LGPL license. |
0ff0059f2ec3
initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff
changeset
|
5 |
* See terms of license at gnu.org. |
0ff0059f2ec3
initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff
changeset
|
6 |
*/ |
0ff0059f2ec3
initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff
changeset
|
7 |
package net.java.otr4j.session; |
0ff0059f2ec3
initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff
changeset
|
8 |
|
0ff0059f2ec3
initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff
changeset
|
9 |
/** |
0ff0059f2ec3
initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff
changeset
|
10 |
* |
0ff0059f2ec3
initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff
changeset
|
11 |
* @author George Politis |
0ff0059f2ec3
initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff
changeset
|
12 |
* |
0ff0059f2ec3
initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff
changeset
|
13 |
*/ |
0ff0059f2ec3
initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff
changeset
|
14 |
public final class SessionID { |
0ff0059f2ec3
initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff
changeset
|
15 |
|
0ff0059f2ec3
initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff
changeset
|
16 |
public SessionID(String accountID, String userID, String protocolName) { |
0ff0059f2ec3
initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff
changeset
|
17 |
this.setAccountID(accountID); |
0ff0059f2ec3
initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff
changeset
|
18 |
this.setUserID(userID); |
0ff0059f2ec3
initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff
changeset
|
19 |
this.setProtocolName(protocolName); |
0ff0059f2ec3
initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff
changeset
|
20 |
} |
0ff0059f2ec3
initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff
changeset
|
21 |
|
0ff0059f2ec3
initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff
changeset
|
22 |
private String accountID; |
0ff0059f2ec3
initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff
changeset
|
23 |
private String userID; |
0ff0059f2ec3
initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff
changeset
|
24 |
private String protocolName; |
0ff0059f2ec3
initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff
changeset
|
25 |
public static final SessionID Empty = new SessionID(null, null, null); |
0ff0059f2ec3
initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff
changeset
|
26 |
|
0ff0059f2ec3
initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff
changeset
|
27 |
public void setAccountID(String accountID) { |
0ff0059f2ec3
initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff
changeset
|
28 |
this.accountID = accountID; |
0ff0059f2ec3
initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff
changeset
|
29 |
} |
0ff0059f2ec3
initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff
changeset
|
30 |
|
0ff0059f2ec3
initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff
changeset
|
31 |
public String getAccountID() { |
0ff0059f2ec3
initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff
changeset
|
32 |
return accountID; |
0ff0059f2ec3
initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff
changeset
|
33 |
} |
0ff0059f2ec3
initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff
changeset
|
34 |
|
0ff0059f2ec3
initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff
changeset
|
35 |
private void setUserID(String userID) { |
0ff0059f2ec3
initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff
changeset
|
36 |
this.userID = userID; |
0ff0059f2ec3
initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff
changeset
|
37 |
} |
0ff0059f2ec3
initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff
changeset
|
38 |
|
0ff0059f2ec3
initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff
changeset
|
39 |
public String getUserID() { |
0ff0059f2ec3
initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff
changeset
|
40 |
return userID; |
0ff0059f2ec3
initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff
changeset
|
41 |
} |
0ff0059f2ec3
initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff
changeset
|
42 |
|
0ff0059f2ec3
initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff
changeset
|
43 |
private void setProtocolName(String protocolName) { |
0ff0059f2ec3
initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff
changeset
|
44 |
this.protocolName = protocolName; |
0ff0059f2ec3
initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff
changeset
|
45 |
} |
0ff0059f2ec3
initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff
changeset
|
46 |
|
0ff0059f2ec3
initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff
changeset
|
47 |
public String getProtocolName() { |
0ff0059f2ec3
initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff
changeset
|
48 |
return protocolName; |
0ff0059f2ec3
initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff
changeset
|
49 |
} |
0ff0059f2ec3
initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff
changeset
|
50 |
|
0ff0059f2ec3
initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff
changeset
|
51 |
public String toString() { |
0ff0059f2ec3
initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff
changeset
|
52 |
return this.getAccountID() + "_" + this.getProtocolName() + "_" |
0ff0059f2ec3
initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff
changeset
|
53 |
+ this.getUserID(); |
0ff0059f2ec3
initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff
changeset
|
54 |
} |
0ff0059f2ec3
initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff
changeset
|
55 |
|
0ff0059f2ec3
initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff
changeset
|
56 |
public boolean equals(Object obj) { |
0ff0059f2ec3
initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff
changeset
|
57 |
if (obj == this) |
0ff0059f2ec3
initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff
changeset
|
58 |
return true; |
0ff0059f2ec3
initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff
changeset
|
59 |
if (obj == null || obj.getClass() != this.getClass()) |
0ff0059f2ec3
initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff
changeset
|
60 |
return false; |
0ff0059f2ec3
initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff
changeset
|
61 |
|
0ff0059f2ec3
initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff
changeset
|
62 |
SessionID sessionID = (SessionID) obj; |
0ff0059f2ec3
initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff
changeset
|
63 |
|
0ff0059f2ec3
initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff
changeset
|
64 |
return this.toString().equals(sessionID.toString()); |
0ff0059f2ec3
initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff
changeset
|
65 |
} |
0ff0059f2ec3
initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff
changeset
|
66 |
|
0ff0059f2ec3
initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff
changeset
|
67 |
public int hashCode() { |
0ff0059f2ec3
initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff
changeset
|
68 |
return this.toString().hashCode(); |
0ff0059f2ec3
initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff
changeset
|
69 |
} |
0ff0059f2ec3
initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff
changeset
|
70 |
} |