Browse Source

JNI-44 stripped Identity.me

JNI-44
Edouard Tisserant 8 years ago
parent
commit
22e4d9b8af
  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,10 +24,7 @@ JNIEXPORT jobject JNICALL Java_org_pEp_jniadapter_Engine_trustwords(
size_t wsize; size_t wsize;
if (_ident->fpr == NULL || _ident->fpr[0] == 0) { if (_ident->fpr == NULL || _ident->fpr[0] == 0) {
if (_ident->me) ::update_identity(session, _ident);
::myself(session, _ident);
else
::update_identity(session, _ident);
} }
if (_ident->fpr == NULL || _ident->fpr[0] == 0) { if (_ident->fpr == NULL || _ident->fpr[0] == 0) {
@ -88,10 +85,7 @@ JNIEXPORT void JNICALL Java_org_pEp_jniadapter_Engine_keyMistrusted(
pEp_identity *_ident = to_identity(env, ident); pEp_identity *_ident = to_identity(env, ident);
if (_ident->fpr == NULL || _ident->fpr[0] == 0) { if (_ident->fpr == NULL || _ident->fpr[0] == 0) {
if (_ident->me) ::update_identity(session, _ident);
::myself(session, _ident);
else
::update_identity(session, _ident);
} }
if (_ident->fpr == NULL || _ident->fpr[0] == 0) { if (_ident->fpr == NULL || _ident->fpr[0] == 0) {
@ -112,10 +106,7 @@ JNIEXPORT void JNICALL Java_org_pEp_jniadapter_Engine_keyResetTrust(
pEp_identity *_ident = to_identity(env, ident); pEp_identity *_ident = to_identity(env, ident);
if (_ident->fpr == NULL || _ident->fpr[0] == 0) { if (_ident->fpr == NULL || _ident->fpr[0] == 0) {
if (_ident->me) ::update_identity(session, _ident);
::myself(session, _ident);
else
::update_identity(session, _ident);
} }
if (_ident->fpr == NULL || _ident->fpr[0] == 0) { if (_ident->fpr == NULL || _ident->fpr[0] == 0) {
@ -136,10 +127,7 @@ JNIEXPORT void JNICALL Java_org_pEp_jniadapter_Engine_trustPersonalKey(
pEp_identity *_ident = to_identity(env, ident); pEp_identity *_ident = to_identity(env, ident);
if (_ident->fpr == NULL || _ident->fpr[0] == 0) { if (_ident->fpr == NULL || _ident->fpr[0] == 0) {
if (_ident->me) ::update_identity(session, _ident);
::myself(session, _ident);
else
::update_identity(session, _ident);
} }
if (_ident->fpr == NULL || _ident->fpr[0] == 0) { if (_ident->fpr == NULL || _ident->fpr[0] == 0) {

9
src/jniutils.cc

@ -440,9 +440,6 @@ namespace pEp {
_setStringField(env, classname, obj, "lang", ident->lang); _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"); jfieldID flags_id = getFieldID(env, classname, "flags", "I");
env->SetIntField(obj, flags_id, (jint) (int) ident->flags); env->SetIntField(obj, flags_id, (jint) (int) ident->flags);
} }
@ -472,9 +469,6 @@ namespace pEp {
_setStringField(env, classname, obj, "lang", ident->lang, identityClass); _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); jfieldID flags_id = getFieldID(env, classname, "flags", "I", identityClass);
env->SetIntField(obj, flags_id, (jint) (int) ident->flags); env->SetIntField(obj, flags_id, (jint) (int) ident->flags);
} }
@ -517,9 +511,6 @@ namespace pEp {
} }
free(lang); 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"); jfieldID flags_id = getFieldID(env, classname, "flags", "I");
ident->flags = (identity_flags_t) (int) env->GetIntField(obj, flags_id); ident->flags = (identity_flags_t) (int) env->GetIntField(obj, flags_id);

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

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

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

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

Loading…
Cancel
Save