src/net/java/otr4j/OtrPolicy.java
author Nikita Kozlov <nikita@elyzion.net>
Sat, 05 Nov 2011 22:27:58 +0100
changeset 921 319ce14e4826
parent 810 0ff0059f2ec3
permissions -rw-r--r--
modify otr chat status for already openned chat when the participant goes offline
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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;
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 interface OtrPolicy {
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 static final int ALLOW_V1 = 0x01;
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
	public static final int ALLOW_V2 = 0x02;
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
	public static final int REQUIRE_ENCRYPTION = 0x04;
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
	public static final int SEND_WHITESPACE_TAG = 0x08;
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
	public static final int WHITESPACE_START_AKE = 0x10;
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
	public static final int ERROR_START_AKE = 0x20;
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
	public static final int VERSION_MASK = (ALLOW_V1 | ALLOW_V2);
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
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
	// The four old version 1 policies correspond to the following combinations
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
	// of flags (adding an allowance for version 2 of the protocol):
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 static final int NEVER = 0x00;
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
	public static final int OPPORTUNISTIC = (ALLOW_V1 | ALLOW_V2
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
			| SEND_WHITESPACE_TAG | WHITESPACE_START_AKE | ERROR_START_AKE);
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
	public static final int OTRL_POLICY_MANUAL = (ALLOW_V1 | ALLOW_V2);
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 static final int OTRL_POLICY_ALWAYS = (ALLOW_V1 | ALLOW_V2
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
			| REQUIRE_ENCRYPTION | WHITESPACE_START_AKE | ERROR_START_AKE);
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
	public static final int OTRL_POLICY_DEFAULT = OPPORTUNISTIC;
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
	public abstract boolean getAllowV1();
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
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
	public abstract boolean getAllowV2();
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 abstract boolean getRequireEncryption();
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
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
	public abstract boolean getSendWhitespaceTag();
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
	public abstract boolean getWhitespaceStartAKE();
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
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
	public abstract boolean getErrorStartAKE();
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 abstract int getPolicy();
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
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
	public abstract void setAllowV1(boolean value);
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 abstract void setAllowV2(boolean value);
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
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
	public abstract void setRequireEncryption(boolean value);
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
	public abstract void setSendWhitespaceTag(boolean value);
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
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
	public abstract void setWhitespaceStartAKE(boolean value);
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
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
	public abstract void setErrorStartAKE(boolean value);
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
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
	public abstract void setEnableAlways(boolean value);
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
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
	public abstract boolean getEnableAlways();
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
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
	public abstract void setEnableManual(boolean value);
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 abstract boolean getEnableManual();
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
}