1 package org.linphone.core;
3 import java.util.Vector;
6 public interface LinphoneChatMessage {
7 interface StateListener{
8 void onLinphoneChatMessageStateChanged(LinphoneChatMessage msg, State state);
11 @SuppressWarnings("rawtypes")
12 static private Vector values = new Vector();
13 private final int mValue;
14 public final int value() {return mValue;}
16 private final String mStringValue;
20 public final static State Idle = new State(0,"Idle");
22 * Incoming call received.
24 public final static State InProgress = new State(1,"InProgress");
26 * Outgoing call initialiazed.
28 public final static State Delivered = new State(2,"Delivered");
30 * Outgoing call in progress.
32 public final static State NotDelivered = new State(3,"NotDelivered");
34 @SuppressWarnings("unchecked")
35 private State(int value,String stringValue) {
37 values.addElement(this);
38 mStringValue=stringValue;
41 public static State fromInt(int value) {
43 for (int i=0; i<values.size();i++) {
44 State state = (State) values.elementAt(i);
45 if (state.mValue == value) return state;
47 throw new RuntimeException("state not found ["+value+"]");
49 public String toString() {
64 * get text associated to this LinphoneChatMessage
66 * @return text sent along with the message
71 * get peer address associated to this LinphoneChatMessage
73 * @return LinphoneAddress peer address
75 LinphoneAddress getPeerAddress();
78 * get from address associated to this LinphoneChatMessage
80 * @return LinphoneAddress from address
82 LinphoneAddress getFrom();
85 * Linphone message can carry external body as defined by rfc2017
86 * @param message #LinphoneChatMessage
87 * @return return external body url null if not present.
89 String getExternalBodyUrl();
92 * Linphone message can carry external body as defined by rfc2017
93 * @param #LinphoneChatMessage
94 * @param url ex: access-type=URL; URL="http://www.foo.com/file"
96 void setExternalBodyUrl(String url);