mirror of
https://github.com/ArcaneChat/android.git
synced 2026-07-03 14:05:24 +02:00
Introduce configure() functionality.
This commit is contained in:
@@ -54,7 +54,7 @@ JNIEXPORT jlong Java_org_telegram_messenger_MrMailbox_MrMailboxNew(JNIEnv *env,
|
||||
}
|
||||
|
||||
|
||||
/* MrMailbox - open/close/connect/fetch */
|
||||
/* MrMailbox - open/configure/connect/fetch */
|
||||
|
||||
JNIEXPORT jint Java_org_telegram_messenger_MrMailbox_MrMailboxOpen(JNIEnv *env, jclass c, jlong hMailbox, jstring dbfile, jstring blobdir)
|
||||
{
|
||||
@@ -73,6 +73,18 @@ JNIEXPORT void Java_org_telegram_messenger_MrMailbox_MrMailboxClose(JNIEnv *env,
|
||||
}
|
||||
|
||||
|
||||
JNIEXPORT jint Java_org_telegram_messenger_MrMailbox_MrMailboxConfigure(JNIEnv *env, jclass c, jlong hMailbox)
|
||||
{
|
||||
return mrmailbox_configure((mrmailbox_t*)hMailbox);
|
||||
}
|
||||
|
||||
|
||||
JNIEXPORT jint Java_org_telegram_messenger_MrMailbox_MrMailboxIsConfigured(JNIEnv *env, jclass c, jlong hMailbox)
|
||||
{
|
||||
return (jint)mrmailbox_is_configured((mrmailbox_t*)hMailbox);
|
||||
}
|
||||
|
||||
|
||||
JNIEXPORT jint Java_org_telegram_messenger_MrMailbox_MrMailboxConnect(JNIEnv *env, jclass c, jlong hMailbox)
|
||||
{
|
||||
return mrmailbox_connect((mrmailbox_t*)hMailbox);
|
||||
@@ -139,18 +151,6 @@ JNIEXPORT jstring Java_org_telegram_messenger_MrMailbox_MrMailboxGetConfig(JNIEn
|
||||
}
|
||||
|
||||
|
||||
JNIEXPORT jlong Java_org_telegram_messenger_MrMailbox_MrMailboxSuggestConfig(JNIEnv *env, jclass c, jlong hMailbox)
|
||||
{
|
||||
return (jlong)mrmailbox_suggest_config((mrmailbox_t*)hMailbox);
|
||||
}
|
||||
|
||||
|
||||
JNIEXPORT jint Java_org_telegram_messenger_MrMailbox_MrMailboxIsConfigured(JNIEnv *env, jclass c, jlong hMailbox)
|
||||
{
|
||||
return (jint)mrmailbox_is_configured((mrmailbox_t*)hMailbox);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* MrChatlist
|
||||
******************************************************************************/
|
||||
@@ -348,81 +348,6 @@ JNIEXPORT jint Java_org_telegram_messenger_MrMailbox_MrPoortextGetState(JNIEnv *
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* MrLoginparam
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
JNIEXPORT void Java_org_telegram_messenger_MrMailbox_MrLoginparamUnref(JNIEnv *env, jclass c, jlong hLoginparam)
|
||||
{
|
||||
return mrloginparam_unref((mrloginparam_t*)hLoginparam);
|
||||
}
|
||||
|
||||
|
||||
JNIEXPORT jstring Java_org_telegram_messenger_MrMailbox_MrLoginparamGetAddr(JNIEnv *env, jclass c, jlong hLoginparam)
|
||||
{
|
||||
mrloginparam_t* ths = (mrloginparam_t*)hLoginparam; if( ths == NULL ) { return JSTRING_NEW(NULL); }
|
||||
return JSTRING_NEW(ths->m_addr);
|
||||
}
|
||||
|
||||
|
||||
JNIEXPORT jstring Java_org_telegram_messenger_MrMailbox_MrLoginparamGetMailServer(JNIEnv *env, jclass c, jlong hLoginparam)
|
||||
{
|
||||
mrloginparam_t* ths = (mrloginparam_t*)hLoginparam; if( ths == NULL ) { return JSTRING_NEW(NULL); }
|
||||
return JSTRING_NEW(ths->m_mail_server);
|
||||
}
|
||||
|
||||
|
||||
JNIEXPORT jstring Java_org_telegram_messenger_MrMailbox_MrLoginparamGetMailUser(JNIEnv *env, jclass c, jlong hLoginparam)
|
||||
{
|
||||
mrloginparam_t* ths = (mrloginparam_t*)hLoginparam; if( ths == NULL ) { return JSTRING_NEW(NULL); }
|
||||
return JSTRING_NEW(ths->m_mail_user);
|
||||
}
|
||||
|
||||
|
||||
|
||||
JNIEXPORT jstring Java_org_telegram_messenger_MrMailbox_MrLoginparamGetMailPw(JNIEnv *env, jclass c, jlong hLoginparam)
|
||||
{
|
||||
mrloginparam_t* ths = (mrloginparam_t*)hLoginparam; if( ths == NULL ) { return JSTRING_NEW(NULL); }
|
||||
return JSTRING_NEW(ths->m_mail_pw);
|
||||
}
|
||||
|
||||
|
||||
JNIEXPORT jint Java_org_telegram_messenger_MrMailbox_MrLoginparamGetMailPort(JNIEnv *env, jclass c, jlong hLoginparam)
|
||||
{
|
||||
mrloginparam_t* ths = (mrloginparam_t*)hLoginparam; if( ths == NULL ) { return JSTRING_NEW(NULL); }
|
||||
return (jint)ths->m_mail_port;
|
||||
}
|
||||
|
||||
|
||||
JNIEXPORT jstring Java_org_telegram_messenger_MrMailbox_MrLoginparamGetSendServer(JNIEnv *env, jclass c, jlong hLoginparam)
|
||||
{
|
||||
mrloginparam_t* ths = (mrloginparam_t*)hLoginparam; if( ths == NULL ) { return JSTRING_NEW(NULL); }
|
||||
return JSTRING_NEW(ths->m_send_server);
|
||||
}
|
||||
|
||||
|
||||
JNIEXPORT jstring Java_org_telegram_messenger_MrMailbox_MrLoginparamGetSendUser(JNIEnv *env, jclass c, jlong hLoginparam)
|
||||
{
|
||||
mrloginparam_t* ths = (mrloginparam_t*)hLoginparam; if( ths == NULL ) { return JSTRING_NEW(NULL); }
|
||||
return JSTRING_NEW(ths->m_send_user);
|
||||
}
|
||||
|
||||
|
||||
JNIEXPORT jstring Java_org_telegram_messenger_MrMailbox_MrLoginparamGetSendPw(JNIEnv *env, jclass c, jlong hLoginparam)
|
||||
{
|
||||
mrloginparam_t* ths = (mrloginparam_t*)hLoginparam; if( ths == NULL ) { return JSTRING_NEW(NULL); }
|
||||
return JSTRING_NEW(ths->m_send_pw);
|
||||
}
|
||||
|
||||
|
||||
JNIEXPORT jint Java_org_telegram_messenger_MrMailbox_MrLoginparamGetSendPort(JNIEnv *env, jclass c, jlong hLoginparam)
|
||||
{
|
||||
mrloginparam_t* ths = (mrloginparam_t*)hLoginparam; if( ths == NULL ) { return JSTRING_NEW(NULL); }
|
||||
return (jint)ths->m_send_port;
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* Tools
|
||||
******************************************************************************/
|
||||
|
||||
@@ -86,6 +86,7 @@ public class MrMailbox {
|
||||
public 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)
|
||||
public native static int MrMailboxOpen (long hMailbox, String dbfile, String blobdir);
|
||||
public native static void MrMailboxClose (long hMailbox);
|
||||
public native static int MrMailboxConfigure (long hMailbox);
|
||||
public native static int MrMailboxConnect (long hMailbox);
|
||||
public native static void MrMailboxDisconnect (long hMailbox);
|
||||
public native static int MrMailboxFetch (long hMailbox);
|
||||
@@ -97,7 +98,6 @@ public class MrMailbox {
|
||||
|
||||
public native static int MrMailboxSetConfig (long hMailbox, String key, String value); // value may be NULL
|
||||
public native static String MrMailboxGetConfig (long hMailbox, String key, String def); // def may be NULL, returns empty string as NULL
|
||||
public native static long MrMailboxSuggestConfig (long hMailbox); // return hLoginparam which must be unref'd after usage
|
||||
public native static int MrMailboxIsConfigured (long hMailbox);
|
||||
|
||||
// MrChatlist objects
|
||||
@@ -136,18 +136,6 @@ public class MrMailbox {
|
||||
public native static long MrPoortextGetTimestamp (long hPoortext);
|
||||
public native static int MrPoortextGetState (long hPoortext);
|
||||
|
||||
// MrLoginparam objects
|
||||
public native static void MrLoginparamUnref (long hLoginparam);
|
||||
public native static String MrLoginparamGetAddr (long hLoginparam);
|
||||
public native static String MrLoginparamGetMailServer (long hLoginparam);
|
||||
public native static String MrLoginparamGetMailUser (long hLoginparam);
|
||||
public native static String MrLoginparamGetMailPw (long hLoginparam);
|
||||
public native static int MrLoginparamGetMailPort (long hLoginparam);
|
||||
public native static String MrLoginparamGetSendServer (long hLoginparam);
|
||||
public native static String MrLoginparamGetSendUser (long hLoginparam);
|
||||
public native static String MrLoginparamGetSendPw (long hLoginparam);
|
||||
public native static int MrLoginparamGetSendPort (long hLoginparam);
|
||||
|
||||
// Tools
|
||||
public native static void MrStockAddStr (int id, String str);
|
||||
public native static String MrGetVersionStr ();
|
||||
|
||||
@@ -154,7 +154,7 @@ public class DrawerProfileCell extends FrameLayout {
|
||||
addr = MrMailbox.MrMailboxGetConfig(MrMailbox.hMailbox, "addr", "");
|
||||
}
|
||||
else {
|
||||
addr = LocaleController.getString("NotLoggedIn", R.string.NotLoggedIn);
|
||||
addr = LocaleController.getString("AccountNotConfigured", R.string.AccountNotConfigured);
|
||||
}
|
||||
nameTextView.setText(displayname);
|
||||
phoneTextView.setText(addr);
|
||||
|
||||
@@ -237,6 +237,8 @@ public class MrAccountSettingsActivity extends BaseFragment {
|
||||
MrMailbox.MrMailboxSetConfig(MrMailbox.hMailbox, "send_pw", v.isEmpty() ? null : v);
|
||||
}
|
||||
|
||||
MrMailbox.MrMailboxConfigure(MrMailbox.hMailbox);
|
||||
|
||||
NotificationCenter.getInstance().postNotificationName(NotificationCenter.mainUserInfoChanged);
|
||||
}
|
||||
|
||||
|
||||
@@ -1452,7 +1452,7 @@ public class SettingsActivity extends BaseFragment implements NotificationCenter
|
||||
subtitle = MrMailbox.MrMailboxGetConfig(MrMailbox.hMailbox, "addr", "");
|
||||
}
|
||||
else {
|
||||
subtitle = LocaleController.getString("NotLoggedIn", R.string.NotLoggedIn);
|
||||
subtitle = LocaleController.getString("AccountNotConfigured", R.string.AccountNotConfigured);
|
||||
}
|
||||
|
||||
textCell.setTextAndValue(LocaleController.getString("AccountSettings", R.string.AccountSettings), subtitle, false);
|
||||
|
||||
@@ -660,8 +660,6 @@
|
||||
<string name="VideoCaption">Videobeschriftung</string>
|
||||
<string name="Caption">Beschriftung</string>
|
||||
<!--password view-->
|
||||
<string name="TwoStepVerification">Zweistufige Bestätigung</string>
|
||||
<string name="SetAdditionalPasswordInfo">Du kannst ein eigenes Kennwort festlegen, um dich an einem neuen Gerät anzumelden, zusätzlich zum SMS-Code.</string>
|
||||
<string name="YourPassword">Dein Kennwort</string>
|
||||
<string name="PleaseEnterCurrentPassword">Bitte aktuelles Kennwort eingeben</string>
|
||||
<string name="RestorePasswordNoEmailTitle">Tut uns leid</string>
|
||||
@@ -1076,7 +1074,6 @@
|
||||
<string name="formatterDay24H">HH:mm</string>
|
||||
<string name="formatterDay12H">h:mm a</string>
|
||||
<string name="formatDateAtTime">%1$s um %2$s</string>
|
||||
<string name="NotLoggedIn">Nicht angemeldet</string>
|
||||
<string name="AccountSettings">Kontoeinstellungen</string>
|
||||
<string name="MyAccount">Mein Konto</string>
|
||||
<string name="No">Nein</string>
|
||||
@@ -1100,4 +1097,5 @@
|
||||
<string name="InboxHeadline">Posteingang</string>
|
||||
<string name="MyAccountExplain">Für bekannte E-Mail-Anbieter werden die weiteren Einstellungen automatisch ermittelt.</string>
|
||||
<string name="MyAccountExplain2">Manchmal muss die IMAP-/SMTP-Funktion noch in der E-Mail-Weboberfläche eingeschaltet werden.\n\nBei Problemen kann der E-Mail-Anbieter oder ein Bekannter weiterhelfen.</string>
|
||||
<string name="AccountNotConfigured">Konto nicht konfiguriert</string>
|
||||
</resources>
|
||||
|
||||
@@ -660,8 +660,6 @@
|
||||
<string name="VideoCaption">Comentario de vídeo</string>
|
||||
<string name="Caption">Comentario</string>
|
||||
<!--password view-->
|
||||
<string name="TwoStepVerification">Verificación en dos pasos</string>
|
||||
<string name="SetAdditionalPasswordInfo">Puedes poner una contraseña, que será requerida cuando inicies sesión en un nuevo dispositivo, además del código que recibes vía SMS.</string>
|
||||
<string name="YourPassword">Tu contraseña</string>
|
||||
<string name="PleaseEnterCurrentPassword">Por favor, pon tu contraseña</string>
|
||||
<string name="RestorePasswordNoEmailTitle">Lo sentimos</string>
|
||||
|
||||
@@ -660,8 +660,6 @@
|
||||
<string name="VideoCaption">Didascalia video</string>
|
||||
<string name="Caption">Didascalia</string>
|
||||
<!--password view-->
|
||||
<string name="TwoStepVerification">Verifica in due passaggi</string>
|
||||
<string name="SetAdditionalPasswordInfo">Puoi impostare una password che ti verrà richiesta quando ti connetti da un nuovo dispositivo in aggiunta al codice che riceverai via SMS.</string>
|
||||
<string name="YourPassword">La tua password</string>
|
||||
<string name="PleaseEnterCurrentPassword">Inserisci la tua password</string>
|
||||
<string name="RestorePasswordNoEmailTitle">Spiacenti</string>
|
||||
|
||||
@@ -660,8 +660,6 @@
|
||||
<string name="VideoCaption">Video-onderschrift</string>
|
||||
<string name="Caption">Onderschrift</string>
|
||||
<!--password view-->
|
||||
<string name="TwoStepVerification">Twee-staps-verificatie</string>
|
||||
<string name="SetAdditionalPasswordInfo">Naast de code die je per SMS ontvangt kun je een extra wachtwoord instellen voor als je inlogt op een nieuw apparaat.</string>
|
||||
<string name="YourPassword">Je wachtwoord</string>
|
||||
<string name="PleaseEnterCurrentPassword">Wachtwoord invoeren</string>
|
||||
<string name="RestorePasswordNoEmailTitle">Sorry</string>
|
||||
|
||||
@@ -660,8 +660,6 @@
|
||||
<string name="VideoCaption">Legenda do Vídeo</string>
|
||||
<string name="Caption">Legenda</string>
|
||||
<!--password view-->
|
||||
<string name="TwoStepVerification">Verificação em duas etapas</string>
|
||||
<string name="SetAdditionalPasswordInfo">Você pode configurar uma senha que será requisitada quando você entrar em um novo aparelho, além do código que você receberá por SMS. </string>
|
||||
<string name="YourPassword">Sua senha</string>
|
||||
<string name="PleaseEnterCurrentPassword">Por favor, digite a sua senha</string>
|
||||
<string name="RestorePasswordNoEmailTitle">Desculpe</string>
|
||||
|
||||
@@ -660,8 +660,6 @@
|
||||
<string name="VideoCaption">Video Caption</string>
|
||||
<string name="Caption">Caption</string>
|
||||
<!--password view-->
|
||||
<string name="TwoStepVerification">Two-Step Verification</string>
|
||||
<string name="SetAdditionalPasswordInfo">You can set a password that will be required when you log in on a new device in addition to the code you get in the SMS.</string>
|
||||
<string name="YourPassword">Your Password</string>
|
||||
<string name="PleaseEnterCurrentPassword">Please enter your password</string>
|
||||
<string name="RestorePasswordNoEmailTitle">Sorry</string>
|
||||
@@ -1077,7 +1075,6 @@
|
||||
<string name="formatterDay24H">HH:mm</string>
|
||||
<string name="formatterDay12H">h:mm a</string>
|
||||
<string name="formatDateAtTime">%1$s at %2$s</string>
|
||||
<string name="NotLoggedIn">Not logged in</string>
|
||||
<string name="AccountSettings">Account settings</string>
|
||||
<string name="MyAccount">My account</string>
|
||||
<string name="Yes">Yes</string>
|
||||
@@ -1100,4 +1097,5 @@
|
||||
<string name="BasicSettings">Basic settings</string>
|
||||
<string name="MyAccountExplain">For known e-mail providers, the following settings are determinated automatically.</string>
|
||||
<string name="MyAccountExplain2" >Sometimes, IMAP/SMPT needs to be enabled in the e-mail web frontend.\n\nOn problems, ask your e-mail-provider or your friends.</string>
|
||||
<string name="AccountNotConfigured">Account not configured</string>
|
||||
</resources>
|
||||
|
||||
Reference in New Issue
Block a user