equal
deleted
inserted
replaced
|
1 /* |
|
2 * otr4j, the open source java otr library. |
|
3 * |
|
4 * Distributable under LGPL license. |
|
5 * See terms of license at gnu.org. |
|
6 */ |
|
7 package net.java.otr4j.io.messages; |
|
8 |
|
9 /** |
|
10 * |
|
11 * @author George Politis |
|
12 */ |
|
13 public abstract class AbstractEncodedMessage extends AbstractMessage { |
|
14 // Fields. |
|
15 public int protocolVersion; |
|
16 |
|
17 // Ctor. |
|
18 public AbstractEncodedMessage(int messageType, int protocolVersion) { |
|
19 super(messageType); |
|
20 this.protocolVersion = protocolVersion; |
|
21 } |
|
22 |
|
23 // Methods. |
|
24 @Override |
|
25 public int hashCode() { |
|
26 final int prime = 31; |
|
27 int result = super.hashCode(); |
|
28 result = prime * result + protocolVersion; |
|
29 return result; |
|
30 } |
|
31 |
|
32 @Override |
|
33 public boolean equals(Object obj) { |
|
34 if (this == obj) |
|
35 return true; |
|
36 if (!super.equals(obj)) |
|
37 return false; |
|
38 if (getClass() != obj.getClass()) |
|
39 return false; |
|
40 AbstractEncodedMessage other = (AbstractEncodedMessage) obj; |
|
41 if (protocolVersion != other.protocolVersion) |
|
42 return false; |
|
43 return true; |
|
44 } |
|
45 |
|
46 // Encoded Message Types |
|
47 public static final int MESSAGE_DH_COMMIT = 0x02; |
|
48 public static final int MESSAGE_DATA = 0x03; |
|
49 public static final int MESSAGE_DHKEY = 0x0a; |
|
50 public static final int MESSAGE_REVEALSIG = 0x11; |
|
51 public static final int MESSAGE_SIGNATURE = 0x12; |
|
52 } |