Browse Source

backout 3086ac9d262c7726336f585a2a5b1d8be819f557 to unstrip identity->me

JNI-76
Hussein Kasem 7 years ago
parent
commit
81cee0aea7
  1. 20
      src/basic_api.cc
  2. 9
      src/jniutils.cc
  3. 8
      src/org/pEp/jniadapter/Identity.java
  4. 7
      src/org/pEp/jniadapter/_Identity.java

20
src/basic_api.cc

@ -24,7 +24,10 @@ JNIEXPORT jobject JNICALL Java_org_pEp_jniadapter_Engine_trustwords(
size_t wsize;
if (_ident->fpr == NULL || _ident->fpr[0] == 0) {
::update_identity(session, _ident);
if (_ident->me)
::myself(session, _ident);
else
::update_identity(session, _ident);
}
if (_ident->fpr == NULL || _ident->fpr[0] == 0) {
@ -101,7 +104,10 @@ JNIEXPORT void JNICALL Java_org_pEp_jniadapter_Engine_keyMistrusted(
pEp_identity *_ident = to_identity(env, ident);
if (_ident->fpr == NULL || _ident->fpr[0] == 0) {
::update_identity(session, _ident);
if (_ident->me)
::myself(session, _ident);
else
::update_identity(session, _ident);
}
if (_ident->fpr == NULL || _ident->fpr[0] == 0) {
@ -122,7 +128,10 @@ JNIEXPORT void JNICALL Java_org_pEp_jniadapter_Engine_keyResetTrust(
pEp_identity *_ident = to_identity(env, ident);
if (_ident->fpr == NULL || _ident->fpr[0] == 0) {
::update_identity(session, _ident);
if (_ident->me)
::myself(session, _ident);
else
::update_identity(session, _ident);
}
if (_ident->fpr == NULL || _ident->fpr[0] == 0) {
@ -143,7 +152,10 @@ JNIEXPORT void JNICALL Java_org_pEp_jniadapter_Engine_trustPersonalKey(
pEp_identity *_ident = to_identity(env, ident);
if (_ident->fpr == NULL || _ident->fpr[0] == 0) {
::update_identity(session, _ident);
if (_ident->me)
::myself(session, _ident);
else
::update_identity(session, _ident);
}
if (_ident->fpr == NULL || _ident->fpr[0] == 0) {

9
src/jniutils.cc

@ -460,6 +460,9 @@ namespace pEp {
_setStringField(env, classname, obj, "lang", ident->lang);
jfieldID me_id = getFieldID(env, classname, "me", "Z");
env->SetBooleanField(obj, me_id, (jboolean) ident->me);
jfieldID flags_id = getFieldID(env, classname, "flags", "I");
env->SetIntField(obj, flags_id, (jint) (int) ident->flags);
}
@ -489,6 +492,9 @@ namespace pEp {
_setStringField(env, classname, obj, "lang", ident->lang, identityClass);
jfieldID me_id = getFieldID(env, classname, "me", "Z", identityClass);
env->SetBooleanField(obj, me_id, (jboolean) ident->me);
jfieldID flags_id = getFieldID(env, classname, "flags", "I", identityClass);
env->SetIntField(obj, flags_id, (jint) (int) ident->flags);
}
@ -531,6 +537,9 @@ namespace pEp {
}
free(lang);
jfieldID me_id = getFieldID(env, classname, "me", "Z");
ident->me = (bool) env->GetBooleanField(obj, me_id);
jfieldID flags_id = getFieldID(env, classname, "flags", "I");
ident->flags = (identity_flags_t) (int) env->GetIntField(obj, flags_id);

8
src/org/pEp/jniadapter/Identity.java

@ -9,9 +9,16 @@ public class Identity implements Serializable{
public String username;
public CommType comm_type;
public String lang;
public boolean me;
public int flags;
public Identity() {
this.me = false;
comm_type = CommType.PEP_ct_unknown;
}
public Identity(boolean me) {
this.me = me;
comm_type = CommType.PEP_ct_unknown;
}
@ -22,6 +29,7 @@ public class Identity implements Serializable{
username = AbstractEngine.toUTF16(i.username);
comm_type = CommType.Management.tag.get(i.comm_type);
lang = AbstractEngine.toUTF16(i.lang);
me = i.me;
flags = i.flags;
}

7
src/org/pEp/jniadapter/_Identity.java

@ -7,9 +7,15 @@ public class _Identity {
public byte[] username;
public int comm_type;
public byte[] lang;
public boolean me;
public int flags;
public _Identity() {
this.me = false;
}
public _Identity(boolean me) {
this.me = me;
}
public _Identity(Identity i) {
@ -19,6 +25,7 @@ public class _Identity {
username = AbstractEngine.toUTF8(i.username);
comm_type = i.comm_type.value;
lang = AbstractEngine.toUTF8(i.lang);
me = i.me;
flags = i.flags;
}
}

Loading…
Cancel
Save