Skip to content

Commit 5471b47

Browse files
SessionHero01SessionHero01
authored andcommitted
Update libsession-util
1 parent 533626c commit 5471b47

File tree

5 files changed

+16
-3
lines changed

5 files changed

+16
-3
lines changed

library/src/main/cpp/contacts.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ session::config::contact_info deserialize_contact(JNIEnv *env, jobject info, ses
134134

135135
jobject serialize_blinded_contact(JNIEnv *env, const session::config::blinded_contact_info &info) {
136136
jni_utils::JavaLocalRef<jclass> clazz(env, env->FindClass("network/loki/messenger/libsession_util/util/BlindedContact"));
137-
auto constructor = env->GetMethodID(clazz.get(), "<init>", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;JLnetwork/loki/messenger/libsession_util/util/UserPic;)V");
137+
auto constructor = env->GetMethodID(clazz.get(), "<init>", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;JJLnetwork/loki/messenger/libsession_util/util/UserPic;)V");
138138

139139
return env->NewObject(
140140
clazz.get(),
@@ -144,6 +144,7 @@ jobject serialize_blinded_contact(JNIEnv *env, const session::config::blinded_co
144144
jni_utils::JavaLocalRef(env, env->NewStringUTF(info.community_pubkey_hex().data())).get(),
145145
jni_utils::JavaLocalRef(env, env->NewStringUTF(info.name.c_str())).get(),
146146
(jlong) (info.created.time_since_epoch().count()),
147+
(jlong) (info.profile_updated.time_since_epoch().count()),
147148
jni_utils::JavaLocalRef(env, util::serialize_user_pic(env, info.profile_picture)).get()
148149
);
149150
}
@@ -155,6 +156,7 @@ session::config::blinded_contact_info deserialize_blinded_contact(JNIEnv *env, j
155156
auto getCommunityServerPubKey = env->GetMethodID(clazz.get(), "getCommunityServerPubKey", "()[B");
156157
auto nameField = env->GetFieldID(clazz.get(), "name", "Ljava/lang/String;");
157158
auto createdEpochSecondsField = env->GetFieldID(clazz.get(), "createdEpochSeconds", "J");
159+
auto profileUpdatedEpochSecondsField = env->GetFieldID(clazz.get(), "profileUpdatedEpochSeconds", "J");
158160
auto profilePicField = env->GetFieldID(clazz.get(), "profilePic", "Lnetwork/loki/messenger/libsession_util/util/UserPic;");
159161

160162
session::config::blinded_contact_info info(
@@ -164,6 +166,7 @@ session::config::blinded_contact_info deserialize_blinded_contact(JNIEnv *env, j
164166
);
165167
info.created = std::chrono::sys_seconds{std::chrono::seconds{env->GetLongField(jInfo, createdEpochSecondsField)}};
166168
info.profile_picture = util::deserialize_user_pic(env, jni_utils::JavaLocalRef(env, env->GetObjectField(jInfo, profilePicField)).get());
169+
info.profile_updated = std::chrono::sys_seconds{std::chrono::seconds{env->GetLongField(jInfo, profileUpdatedEpochSecondsField)}};
167170

168171
return info;
169172
}

library/src/main/cpp/conversation.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ session::config::convo::blinded_one_to_one deserialize_blinded_one_to_one(JNIEnv
125125
auto unread_field_id = env->GetFieldID(clazz.get(), "unread", "Z");
126126

127127
session::config::convo::blinded_one_to_one r(
128-
jni_utils::JavaStringRef(env, jni_utils::JavaLocalRef(env, (jstring) env->GetObjectField(info, id_field_id)).get()).view(), true);
128+
jni_utils::JavaStringRef(env, jni_utils::JavaLocalRef(env, (jstring) env->GetObjectField(info, id_field_id)).get()).view());
129129

130130
r.last_read = env->GetLongField(info, last_read_field_id);
131131
r.unread = env->GetBooleanField(info, unread_field_id);
@@ -142,6 +142,8 @@ jobject serialize_any(JNIEnv *env, session::config::convo::any any) {
142142
return serialize_legacy_group(env, *lgc);
143143
} else if (auto* gc = std::get_if<session::config::convo::group>(&any)) {
144144
return serialize_closed_group(env, *gc);
145+
} else if (auto *bc = std::get_if<session::config::convo::blinded_one_to_one>(&any)) {
146+
return serialize_blinded_one_to_one(env, *bc);
145147
}
146148
return nullptr;
147149
}

library/src/main/cpp/user_profile.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,3 +99,10 @@ Java_network_loki_messenger_libsession_1util_UserProfile_isBlockCommunityMessage
9999
auto profile = ptrToProfile(env, thiz);
100100
return profile->get_blinded_msgreqs().has_value();
101101
}
102+
103+
extern "C"
104+
JNIEXPORT void JNICALL
105+
Java_network_loki_messenger_libsession_1util_UserProfile_setLastUpdated(JNIEnv *env, jobject thiz,
106+
jlong last_updated_epoch_seconds) {
107+
ptrToProfile(env, thiz)->set_profile_pic()
108+
}

library/src/main/java/network/loki/messenger/libsession_util/util/BlindedContact.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ data class BlindedContact(
66
val communityServerPubKeyHex: String,
77
var name: String,
88
var createdEpochSeconds: Long,
9+
var profileUpdatedEpochSeconds: Long,
910
var profilePic: UserPic
1011
) {
1112
@OptIn(ExperimentalStdlibApi::class)

0 commit comments

Comments
 (0)