// Path: src/fr/xtof54/jsgo/EventManager.java
// enum eventType {loginStarted, loginEnd, downloadListStarted, downloadListEnd, downloadListGamesEnd, downloadGameStarted, downloadGameEnd, GameOK, moveSentStart, moveSentEnd, gobanReady,
// 	msgSendStart, msgSendEnd, ladderStart, ladderEnd, ladderChallengeStart, ladderChallengeEnd, showMessage, copyEidogoStart, copyEidogoEnd};


import java.net.URLEncoder;
import java.util.ArrayList;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.DialogInterface;
import android.os.Bundle;
import android.support.v4.app.DialogFragment;
import android.text.method.ScrollingMovementMethod;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.TextView;
import fr.xtof54.jsgo.R;
import fr.xtof54.jsgo.EventManager.eventType;
package fr.xtof54.jsgo;





public class Message {
	private final static String cmdGetListOfMessages = "quick_do.php?obj=message&cmd=list&filter_folders=2&with=user_id";

	private static GoJsActivity c;
	private static JSONArray headers, jsonmsgs;
	private static int curmsg=0;
	private static ArrayList<Message> messages = new ArrayList<Message>();

	public int getMessageId() {return msgid;}

    public static void send(final ServerConnection server, final GoJsActivity main) {
        c=main;
        class EditMsgDialogFragment extends DialogFragment {
            @Override
            public Dialog onCreateDialog(Bundle savedInstanceState) {
                final AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
                LayoutInflater inflater = getActivity().getLayoutInflater();

                // Inflate and set the layout for the dialog
                // Pass null as the parent view because it's going in the dialog layout
                final View msgview = inflater.inflate(R.layout.editmsg, null);
                builder.setView(msgview);

                builder.setPositiveButton("send", new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int id) {
                        EditMsgDialogFragment.this.getDialog().dismiss();
                        TextView t = (TextView)msgview.findViewById(R.id.editMsgTo);
                        String touser = t.getText().toString();
                        t = (TextView)msgview.findViewById(R.id.editMsgSubj);
                        String subj = t.getText().toString();
                        t = (TextView)msgview.findViewById(R.id.editMsgTxt);
                        String txt = t.getText().toString();
                        String cmd = "quick_do.php?obj=message&cmd=send_msg&ouser="+
                        URLEncoder.encode(touser)+"&msg="+
                        URLEncoder.encode(txt)+"&subj="+
                        URLEncoder.encode(subj);
// Path: src/fr/xtof54/jsgo/EventManager.java
// enum eventType {loginStarted, loginEnd, downloadListStarted, downloadListEnd, downloadListGamesEnd, downloadGameStarted, downloadGameEnd, GameOK, moveSentStart, moveSentEnd, gobanReady,
// 	msgSendStart, msgSendEnd, ladderStart, ladderEnd, ladderChallengeStart, ladderChallengeEnd, showMessage, copyEidogoStart, copyEidogoEnd};


// Path: src/fr/xtof54/jsgo/Message.java
import java.net.URLEncoder;
import java.util.ArrayList;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.DialogInterface;
import android.os.Bundle;
import android.support.v4.app.DialogFragment;
import android.text.method.ScrollingMovementMethod;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.TextView;
import fr.xtof54.jsgo.R;
import fr.xtof54.jsgo.EventManager.eventType;

package fr.xtof54.jsgo;





public class Message {
	private final static String cmdGetListOfMessages = "quick_do.php?obj=message&cmd=list&filter_folders=2&with=user_id";

	private static GoJsActivity c;
	private static JSONArray headers, jsonmsgs;
	private static int curmsg=0;
	private static ArrayList<Message> messages = new ArrayList<Message>();

	public int getMessageId() {return msgid;}

    public static void send(final ServerConnection server, final GoJsActivity main) {
        c=main;
        class EditMsgDialogFragment extends DialogFragment {
            @Override
            public Dialog onCreateDialog(Bundle savedInstanceState) {
                final AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
                LayoutInflater inflater = getActivity().getLayoutInflater();

                // Inflate and set the layout for the dialog
                // Pass null as the parent view because it's going in the dialog layout
                final View msgview = inflater.inflate(R.layout.editmsg, null);
                builder.setView(msgview);

                builder.setPositiveButton("send", new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int id) {
                        EditMsgDialogFragment.this.getDialog().dismiss();
                        TextView t = (TextView)msgview.findViewById(R.id.editMsgTo);
                        String touser = t.getText().toString();
                        t = (TextView)msgview.findViewById(R.id.editMsgSubj);
                        String subj = t.getText().toString();
                        t = (TextView)msgview.findViewById(R.id.editMsgTxt);
                        String txt = t.getText().toString();
                        String cmd = "quick_do.php?obj=message&cmd=send_msg&ouser="+
                        URLEncoder.encode(touser)+"&msg="+
                        URLEncoder.encode(txt)+"&subj="+
                        URLEncoder.encode(subj);
                        server.sendCmdToServer(cmd, eventType.msgSendStart, eventType.msgSendEnd);