src/net/java/otr4j/OtrEngineImpl.java
author Nikita Kozlov <nikita@elyzion.net>
Sat, 05 Nov 2011 22:27:58 +0100
changeset 921 319ce14e4826
parent 815 ca323cff3ac9
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 librar
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
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
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
     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
import java.security.PublicKey;
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
import java.util.Hashtable;
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
import java.util.List;
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
import java.util.Map;
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
import java.util.Vector;
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
import net.java.otr4j.session.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
    17
import net.java.otr4j.session.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
    18
import net.java.otr4j.session.SessionImpl;
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
import net.java.otr4j.session.SessionStatus;
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
 * 
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
 * @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
    24
 * 
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
 */
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
public class OtrEngineImpl implements OtrEngine {
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
815
ca323cff3ac9 I have reimplemented the BeemOtrService in a more "centralized" way.
Nikita Kozlov <nikita@mbdsys.com>
parents: 810
diff changeset
    28
	public OtrEngineImpl(OtrEngineHost host) {
ca323cff3ac9 I have reimplemented the BeemOtrService in a more "centralized" way.
Nikita Kozlov <nikita@mbdsys.com>
parents: 810
diff changeset
    29
		if (host == null)
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
    30
			throw new IllegalArgumentException("OtrEgineHost is required.");
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
815
ca323cff3ac9 I have reimplemented the BeemOtrService in a more "centralized" way.
Nikita Kozlov <nikita@mbdsys.com>
parents: 810
diff changeset
    32
		this.setHost(host);
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
    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
815
ca323cff3ac9 I have reimplemented the BeemOtrService in a more "centralized" way.
Nikita Kozlov <nikita@mbdsys.com>
parents: 810
diff changeset
    35
	private OtrEngineHost host;
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
    36
	private Map<SessionID, Session> sessions;
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
	private Session getSession(SessionID 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
    39
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
		if (sessionID == null || sessionID.equals(SessionID.Empty))
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
			throw new IllegalArgumentException();
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
		if (sessions == 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
    44
			sessions = new Hashtable<SessionID, 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
    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
		if (!sessions.containsKey(sessionID)) {
815
ca323cff3ac9 I have reimplemented the BeemOtrService in a more "centralized" way.
Nikita Kozlov <nikita@mbdsys.com>
parents: 810
diff changeset
    47
			Session session = new SessionImpl(sessionID, getHost());
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
    48
			sessions.put(sessionID, 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
    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
			session.addOtrEngineListener(new OtrEngineListener() {
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
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
				public void sessionStatusChanged(SessionID 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
    53
					for (OtrEngineListener l : listeners)
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
						l.sessionStatusChanged(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
    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
			});
815
ca323cff3ac9 I have reimplemented the BeemOtrService in a more "centralized" way.
Nikita Kozlov <nikita@mbdsys.com>
parents: 810
diff changeset
    57
			return session;
ca323cff3ac9 I have reimplemented the BeemOtrService in a more "centralized" way.
Nikita Kozlov <nikita@mbdsys.com>
parents: 810
diff changeset
    58
		} else
ca323cff3ac9 I have reimplemented the BeemOtrService in a more "centralized" way.
Nikita Kozlov <nikita@mbdsys.com>
parents: 810
diff changeset
    59
			return sessions.get(sessionID);
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
    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
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
	public SessionStatus getSessionStatus(SessionID 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
    63
		return this.getSession(sessionID).getSessionStatus();
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
815
ca323cff3ac9 I have reimplemented the BeemOtrService in a more "centralized" way.
Nikita Kozlov <nikita@mbdsys.com>
parents: 810
diff changeset
    66
	public String transformReceiving(SessionID sessionID, String msgText)
ca323cff3ac9 I have reimplemented the BeemOtrService in a more "centralized" way.
Nikita Kozlov <nikita@mbdsys.com>
parents: 810
diff changeset
    67
			throws OtrException {
ca323cff3ac9 I have reimplemented the BeemOtrService in a more "centralized" way.
Nikita Kozlov <nikita@mbdsys.com>
parents: 810
diff changeset
    68
		return this.getSession(sessionID).transformReceiving(msgText);
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
    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
815
ca323cff3ac9 I have reimplemented the BeemOtrService in a more "centralized" way.
Nikita Kozlov <nikita@mbdsys.com>
parents: 810
diff changeset
    71
	public String transformSending(SessionID sessionID, String msgText)
ca323cff3ac9 I have reimplemented the BeemOtrService in a more "centralized" way.
Nikita Kozlov <nikita@mbdsys.com>
parents: 810
diff changeset
    72
			throws OtrException {
ca323cff3ac9 I have reimplemented the BeemOtrService in a more "centralized" way.
Nikita Kozlov <nikita@mbdsys.com>
parents: 810
diff changeset
    73
		return this.getSession(sessionID).transformSending(msgText, null);
ca323cff3ac9 I have reimplemented the BeemOtrService in a more "centralized" way.
Nikita Kozlov <nikita@mbdsys.com>
parents: 810
diff changeset
    74
	}
ca323cff3ac9 I have reimplemented the BeemOtrService in a more "centralized" way.
Nikita Kozlov <nikita@mbdsys.com>
parents: 810
diff changeset
    75
ca323cff3ac9 I have reimplemented the BeemOtrService in a more "centralized" way.
Nikita Kozlov <nikita@mbdsys.com>
parents: 810
diff changeset
    76
	public void endSession(SessionID sessionID) throws OtrException {
ca323cff3ac9 I have reimplemented the BeemOtrService in a more "centralized" way.
Nikita Kozlov <nikita@mbdsys.com>
parents: 810
diff changeset
    77
		this.getSession(sessionID).endSession();
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
    78
	}
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
    79
815
ca323cff3ac9 I have reimplemented the BeemOtrService in a more "centralized" way.
Nikita Kozlov <nikita@mbdsys.com>
parents: 810
diff changeset
    80
	public void startSession(SessionID sessionID) throws OtrException {
ca323cff3ac9 I have reimplemented the BeemOtrService in a more "centralized" way.
Nikita Kozlov <nikita@mbdsys.com>
parents: 810
diff changeset
    81
		this.getSession(sessionID).startSession();
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
    82
	}
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
    83
815
ca323cff3ac9 I have reimplemented the BeemOtrService in a more "centralized" way.
Nikita Kozlov <nikita@mbdsys.com>
parents: 810
diff changeset
    84
	private void setHost(OtrEngineHost host) {
ca323cff3ac9 I have reimplemented the BeemOtrService in a more "centralized" way.
Nikita Kozlov <nikita@mbdsys.com>
parents: 810
diff changeset
    85
		this.host = host;
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
    86
	}
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
    87
815
ca323cff3ac9 I have reimplemented the BeemOtrService in a more "centralized" way.
Nikita Kozlov <nikita@mbdsys.com>
parents: 810
diff changeset
    88
	private OtrEngineHost getHost() {
ca323cff3ac9 I have reimplemented the BeemOtrService in a more "centralized" way.
Nikita Kozlov <nikita@mbdsys.com>
parents: 810
diff changeset
    89
		return host;
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
    90
	}
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
    91
815
ca323cff3ac9 I have reimplemented the BeemOtrService in a more "centralized" way.
Nikita Kozlov <nikita@mbdsys.com>
parents: 810
diff changeset
    92
	public void refreshSession(SessionID sessionID) throws OtrException {
ca323cff3ac9 I have reimplemented the BeemOtrService in a more "centralized" way.
Nikita Kozlov <nikita@mbdsys.com>
parents: 810
diff changeset
    93
		this.getSession(sessionID).refreshSession();
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
    94
	}
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
    95
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
    96
	public PublicKey getRemotePublicKey(SessionID 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
    97
		return this.getSession(sessionID).getRemotePublicKey();
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
    98
	}
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
    99
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
   100
	private List<OtrEngineListener> listeners = new Vector<OtrEngineListener>();
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
   101
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
   102
	public void addOtrEngineListener(OtrEngineListener l) {
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
   103
		synchronized (listeners) {
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
   104
			if (!listeners.contains(l))
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
   105
				listeners.add(l);
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
   106
		}
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
   107
	}
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
   108
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
   109
	public void removeOtrEngineListener(OtrEngineListener l) {
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
   110
		synchronized (listeners) {
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
   111
			listeners.remove(l);
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
   112
		}
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
   113
	}
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
   114
}