]> sjero.net Git - linphone/blob - java/common/org/linphone/core/LinphoneChatMessage.java
forgot to commit a file
[linphone] / java / common / org / linphone / core / LinphoneChatMessage.java
1 package org.linphone.core;
2
3 import java.util.Vector;
4
5
6 public interface LinphoneChatMessage {
7         interface StateListener{
8                 void onLinphoneChatMessageStateChanged(LinphoneChatMessage msg, State state);
9         }
10         static class State {
11                 static private Vector values = new Vector();
12                 private final int mValue;
13                 public final int value() {return mValue;}
14                 
15                 private final String mStringValue;
16                 /**
17                  * Idle
18                  */
19                 public final static State Idle = new State(0,"Idle");
20                 /**
21                  * Incoming call received.
22                  */
23                 public final static State InProgress = new State(1,"InProgress");
24                 /**
25                  * Outgoing call initialiazed.
26                  */
27                 public final static State Delivered = new State(2,"Delivered");
28                 /**
29                  * Outgoing call in progress. 
30                  */
31                 public final static State NotDelivered = new State(3,"NotDelivered");
32                 
33                 private State(int value,String stringValue) {
34                         mValue = value;
35                         values.addElement(this);
36                         mStringValue=stringValue;
37                 }
38                 
39                 public static State fromInt(int value) {
40
41                         for (int i=0; i<values.size();i++) {
42                                 State state = (State) values.elementAt(i);
43                                 if (state.mValue == value) return state;
44                         }
45                         throw new RuntimeException("state not found ["+value+"]");
46                 }
47                 public String toString() {
48                         return mStringValue;
49                 }
50         }
51         Object getUserData();
52         void setUserData();
53 }