Skip to content

Commit

Permalink
update to 10.2.0 (4056)
Browse files Browse the repository at this point in the history
  • Loading branch information
dkaraush committed Oct 28, 2023
1 parent fea5ca9 commit b4dbcd1
Show file tree
Hide file tree
Showing 469 changed files with 40,328 additions and 12,735 deletions.
2 changes: 1 addition & 1 deletion TMessagesProj/jni/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@ target_include_directories(breakpad PUBLIC
#voip
include(${CMAKE_HOME_DIRECTORY}/voip/CMakeLists.txt)

set(NATIVE_LIB "tmessages.46")
set(NATIVE_LIB "tmessages.47")

#tmessages
add_library(${NATIVE_LIB} SHARED
Expand Down
10 changes: 7 additions & 3 deletions TMessagesProj/jni/TgNetWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,10 @@ void setUserId(JNIEnv *env, jclass c, jint instanceNum, int64_t id) {
ConnectionsManager::getInstance(instanceNum).setUserId(id);
}

void setUserPremium(JNIEnv *env, jclass c, jint instanceNum, bool premium) {
ConnectionsManager::getInstance(instanceNum).setUserPremium(premium);
}

void switchBackend(JNIEnv *env, jclass c, jint instanceNum, jboolean restart) {
ConnectionsManager::getInstance(instanceNum).switchBackend(restart);
}
Expand Down Expand Up @@ -384,7 +388,7 @@ void setSystemLangCode(JNIEnv *env, jclass c, jint instanceNum, jstring langCode
}
}

void init(JNIEnv *env, jclass c, jint instanceNum, jint version, jint layer, jint apiId, jstring deviceModel, jstring systemVersion, jstring appVersion, jstring langCode, jstring systemLangCode, jstring configPath, jstring logPath, jstring regId, jstring cFingerprint, jstring installerId, jstring packageId, jint timezoneOffset, jlong userId, jboolean enablePushConnection, jboolean hasNetwork, jint networkType, jint performanceClass) {
void init(JNIEnv *env, jclass c, jint instanceNum, jint version, jint layer, jint apiId, jstring deviceModel, jstring systemVersion, jstring appVersion, jstring langCode, jstring systemLangCode, jstring configPath, jstring logPath, jstring regId, jstring cFingerprint, jstring installerId, jstring packageId, jint timezoneOffset, jlong userId, jboolean userPremium, jboolean enablePushConnection, jboolean hasNetwork, jint networkType, jint performanceClass) {
const char *deviceModelStr = env->GetStringUTFChars(deviceModel, 0);
const char *systemVersionStr = env->GetStringUTFChars(systemVersion, 0);
const char *appVersionStr = env->GetStringUTFChars(appVersion, 0);
Expand All @@ -397,7 +401,7 @@ void init(JNIEnv *env, jclass c, jint instanceNum, jint version, jint layer, jin
const char *installerIdStr = env->GetStringUTFChars(installerId, 0);
const char *packageIdStr = env->GetStringUTFChars(packageId, 0);

ConnectionsManager::getInstance(instanceNum).init((uint32_t) version, layer, apiId, std::string(deviceModelStr), std::string(systemVersionStr), std::string(appVersionStr), std::string(langCodeStr), std::string(systemLangCodeStr), std::string(configPathStr), std::string(logPathStr), std::string(regIdStr), std::string(cFingerprintStr), std::string(installerIdStr), std::string(packageIdStr), timezoneOffset, userId, true, enablePushConnection, hasNetwork, networkType, performanceClass);
ConnectionsManager::getInstance(instanceNum).init((uint32_t) version, layer, apiId, std::string(deviceModelStr), std::string(systemVersionStr), std::string(appVersionStr), std::string(langCodeStr), std::string(systemLangCodeStr), std::string(configPathStr), std::string(logPathStr), std::string(regIdStr), std::string(cFingerprintStr), std::string(installerIdStr), std::string(packageIdStr), timezoneOffset, userId, userPremium, true, enablePushConnection, hasNetwork, networkType, performanceClass);

if (deviceModelStr != 0) {
env->ReleaseStringUTFChars(deviceModel, deviceModelStr);
Expand Down Expand Up @@ -457,7 +461,7 @@ static JNINativeMethod ConnectionsManagerMethods[] = {
{"native_setProxySettings", "(ILjava/lang/String;ILjava/lang/String;Ljava/lang/String;Ljava/lang/String;)V", (void *) setProxySettings},
{"native_getConnectionState", "(I)I", (void *) getConnectionState},
{"native_setUserId", "(IJ)V", (void *) setUserId},
{"native_init", "(IIIILjava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;IJZZII)V", (void *) init},
{"native_init", "(IIIILjava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;IJZZZII)V", (void *) init},
{"native_setLangCode", "(ILjava/lang/String;)V", (void *) setLangCode},
{"native_setRegId", "(ILjava/lang/String;)V", (void *) setRegId},
{"native_setSystemLangCode", "(ILjava/lang/String;)V", (void *) setSystemLangCode},
Expand Down
50 changes: 42 additions & 8 deletions TMessagesProj/jni/tgnet/ApiScheme.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -483,19 +483,19 @@ void TL_user::readParams(NativeByteBuffer *stream, int32_t instanceNum, bool &er
lang_code = stream->readString(&error);
}
if ((flags & 1073741824) != 0) {
uint32_t magic = stream->readUint32(&error);
if (magic == 0x2de11aae) {
emojiStatusMagic = stream->readUint32(&error);
if (emojiStatusMagic == 0x2de11aae) {
// emojiStatusEmpty
} else if (magic == 0x929b619d) {
} else if (emojiStatusMagic == 0x929b619d) {
// emojiStatus
int64_t document_id = stream->readInt64(&error);
} else if (magic == 0xfa30a8c7) {
emojiStatusDocumentId = stream->readInt64(&error);
} else if (emojiStatusMagic == 0xfa30a8c7) {
// emojiStatusUntil
int64_t document_id = stream->readInt64(&error);
int until = stream->readInt32(&error);
emojiStatusDocumentId = stream->readInt64(&error);
emojiStatusUntil = stream->readInt32(&error);
} else {
error = true;
if (LOGS_ENABLED) DEBUG_FATAL("wrong EmojiStatus magic, got %x", magic);
if (LOGS_ENABLED) DEBUG_FATAL("wrong EmojiStatus magic, got %x", emojiStatusMagic);
return;
}
}
Expand All @@ -518,6 +518,12 @@ void TL_user::readParams(NativeByteBuffer *stream, int32_t instanceNum, bool &er
if ((flags2 & 32) != 0) {
stories_max_id = stream->readInt32(&error);
}
if ((flags2 & 128) != 0) {
color = stream->readInt32(&error);
}
if ((flags2 & 64) != 0) {
background_emoji_id = stream->readInt64(&error);
}
}

void TL_user::serializeToStream(NativeByteBuffer *stream) {
Expand Down Expand Up @@ -563,6 +569,34 @@ void TL_user::serializeToStream(NativeByteBuffer *stream) {
if ((flags & 4194304) != 0) {
stream->writeString(lang_code);
}
if ((flags & 1073741824) != 0) {
stream->writeInt32(emojiStatusMagic);
if (emojiStatusMagic == 0x929b619d) {
// emojiStatus
stream->writeInt64(emojiStatusDocumentId);
} else if (emojiStatusMagic == 0xfa30a8c7) {
// emojiStatusUntil
stream->writeInt64(emojiStatusDocumentId);
stream->writeInt32(emojiStatusUntil);
}
}
if ((flags2 & 1) != 0) {
stream->writeInt32(0x1cb5c415);
int32_t count = (int32_t) usernames.size();
stream->writeInt32(count);
for (int a = 0; a < count; a++) {
usernames[a]->serializeToStream(stream);
}
}
if ((flags2 & 32) != 0) {
stream->writeInt32(stories_max_id);
}
if ((flags2 & 128) != 0) {
stream->writeInt32(color);
}
if ((flags2 & 64) != 0) {
stream->writeInt64(background_emoji_id);
}
}

InputPeer *InputPeer::TLdeserialize(NativeByteBuffer *stream, uint32_t constructor, int32_t instanceNum, bool &error) {
Expand Down
7 changes: 6 additions & 1 deletion TMessagesProj/jni/tgnet/ApiScheme.h
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,11 @@ class User : public TLObject {
std::string lang_code;
std::vector<std::unique_ptr<TL_username>> usernames;
int32_t stories_max_id;
int32_t emojiStatusMagic;
int64_t emojiStatusDocumentId;
int32_t emojiStatusUntil;
int32_t color;
int64_t background_emoji_id;

static User *TLdeserialize(NativeByteBuffer *stream, uint32_t constructor, int32_t instanceNum, bool &error);
};
Expand All @@ -352,7 +357,7 @@ class TL_userEmpty : public User {
class TL_user : public User {

public:
static const uint32_t constructor = 0xabb5f120;
static const uint32_t constructor = 0xeb602f25;

void readParams(NativeByteBuffer *stream, int32_t instanceNum, bool &error);
void serializeToStream(NativeByteBuffer *stream);
Expand Down
Loading

0 comments on commit b4dbcd1

Please sign in to comment.