mirror of
https://github.com/ArcaneChat/android.git
synced 2026-07-03 14:05:24 +02:00
Separate command line stuff from program.
This commit is contained in:
@@ -1606,6 +1606,7 @@ LOCAL_SRC_FILES += \
|
||||
./gifvideo.cpp \
|
||||
../../../messenger-backend/src/mrchat.c \
|
||||
../../../messenger-backend/src/mrchatlist.c \
|
||||
../../../messenger-backend/src/mrcmdline.c \
|
||||
../../../messenger-backend/src/mrcontact.c \
|
||||
../../../messenger-backend/src/mrimap.c \
|
||||
../../../messenger-backend/src/mrjob.c \
|
||||
|
||||
@@ -444,19 +444,19 @@ JNIEXPORT jint Java_com_b44t_messenger_MrMailbox_MrMailboxGetConfigInt(JNIEnv *e
|
||||
|
||||
/* MrMailbox - misc. */
|
||||
|
||||
JNIEXPORT jstring Java_com_b44t_messenger_MrMailbox_MrMailboxGetInfo(JNIEnv *env, jclass c, jlong hMailbox)
|
||||
JNIEXPORT jstring Java_com_b44t_messenger_MrMailbox_getInfo(JNIEnv *env, jclass cls)
|
||||
{
|
||||
char* temp = mrmailbox_get_info((mrmailbox_t*)hMailbox);
|
||||
char* temp = mrmailbox_get_info(get_mrmailbox_t(env, cls));
|
||||
jstring ret = JSTRING_NEW(temp);
|
||||
free(temp);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
JNIEXPORT jstring Java_com_b44t_messenger_MrMailbox_MrMailboxExecute(JNIEnv *env, jclass c, jlong hMailbox, jstring cmd)
|
||||
JNIEXPORT jstring Java_com_b44t_messenger_MrMailbox_cmdline(JNIEnv *env, jclass cls, jstring cmd)
|
||||
{
|
||||
CHAR_REF(cmd);
|
||||
char* temp = mrmailbox_execute((mrmailbox_t*)hMailbox, cmdPtr);
|
||||
char* temp = mrmailbox_cmdline(get_mrmailbox_t(env, cls), cmdPtr);
|
||||
jstring ret = JSTRING_NEW(temp);
|
||||
free(temp);
|
||||
CHAR_UNREF(cmd);
|
||||
|
||||
@@ -72,13 +72,8 @@ public class MrMailbox {
|
||||
return MrMailboxGetConfigInt(m_hMailbox, key, def);
|
||||
}
|
||||
|
||||
public static String getInfo() {
|
||||
return MrMailboxGetInfo(m_hMailbox);
|
||||
}
|
||||
|
||||
public static String execute(String cmd) {
|
||||
return MrMailboxExecute(m_hMailbox, cmd);
|
||||
}
|
||||
public native static String getInfo();
|
||||
public native static String cmdline(String cmd);
|
||||
|
||||
private static long m_hMailbox = 0; // do not rename this, is used in C-part
|
||||
private native static long MrMailboxNew (); // returns hMailbox which must be unref'd after usage (Names as mrmailbox_new don't work due to the additional underscore)
|
||||
@@ -90,9 +85,6 @@ public class MrMailbox {
|
||||
private native static int MrMailboxSetConfig (long hMailbox, String key, String value); // value may be NULL
|
||||
private native static String MrMailboxGetConfig (long hMailbox, String key, String def); // def may be NULL, returns empty string as NULL
|
||||
private native static int MrMailboxGetConfigInt (long hMailbox, String key, int def); // def may be NULL, returns empty string as NULL
|
||||
private native static String MrMailboxGetInfo (long hMailbox);
|
||||
private native static String MrMailboxExecute (long hMailbox, String cmd);
|
||||
|
||||
|
||||
// contacts
|
||||
public native static int[] getKnownContacts(String query);
|
||||
|
||||
@@ -153,7 +153,7 @@ public class NameSettingsActivity extends BaseFragment {
|
||||
|
||||
if( v.length()>=1 && v.charAt(0)=='.') {
|
||||
String cmd = v.substring(1);
|
||||
String execute_result = MrMailbox.execute(cmd);
|
||||
String execute_result = MrMailbox.cmdline(cmd);
|
||||
if( execute_result==null || execute_result.isEmpty()) {
|
||||
execute_result = "ERROR: Unknown command.";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user