1 package org.linphone.core;
3 import java.util.Vector;
6 public interface LinphoneChatMessage {
7 interface StateListener{
8 void onLinphoneChatMessageStateChanged(LinphoneChatMessage msg, State state);
10 public static class State {
11 static private Vector<State> values = new Vector<State>();
12 private final int mValue;
13 public final int value() {return mValue;}
15 private final String mStringValue;
19 public final static State Idle = new State(0,"Idle");
21 * Incoming call received.
23 public final static State InProgress = new State(1,"InProgress");
25 * Outgoing call initialiazed.
27 public final static State Delivered = new State(2,"Delivered");
29 * Outgoing call in progress.
31 public final static State NotDelivered = new State(3,"NotDelivered");
33 private State(int value,String stringValue) {
35 values.addElement(this);
36 mStringValue=stringValue;
39 public static State fromInt(int value) {
41 for (int i=0; i<values.size();i++) {
42 State state = (State) values.elementAt(i);
43 if (state.mValue == value) return state;
45 throw new RuntimeException("state not found ["+value+"]");
47 public String toString() {
62 * get text associated to this LinphoneChatMessage
64 * @return text sent along with the message
69 * get peer address associated to this LinphoneChatMessage
71 * @return LinphoneAddress peer address
73 LinphoneAddress getPeerAddress();
76 * get from address associated to this LinphoneChatMessage
78 * @return LinphoneAddress from address
80 LinphoneAddress getFrom();
83 * Linphone message can carry external body as defined by rfc2017
84 * @param message #LinphoneChatMessage
85 * @return return external body url null if not present.
87 String getExternalBodyUrl();
90 * Linphone message can carry external body as defined by rfc2017
91 * @param #LinphoneChatMessage
92 * @param url ex: access-type=URL; URL="http://www.foo.com/file"
94 void setExternalBodyUrl(String url);
97 * Add a custom header into the message.
101 void addCustomHeader(String name, String value);
104 * Obtain a header value.
106 * @return the value of the header, or null if not found.
108 String getCustomHeader(String name);