Skip to content

Commit

Permalink
Merge branch 'dev' into m_10.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
omg-xtao committed Oct 29, 2023
2 parents 35f1abb + 16831b5 commit a9bcc59
Show file tree
Hide file tree
Showing 469 changed files with 40,255 additions and 12,685 deletions.
8 changes: 4 additions & 4 deletions TMessagesProj/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ import cn.hutool.core.util.RuntimeUtil
apply plugin: "com.android.application"
apply plugin: "kotlin-android"

def verName = "10.1.1"
def verCode = 1142
def verName = "10.2.0"
def verCode = 1144


def officialVer = "10.1.1"
def officialCode = 3926
def officialVer = "10.2.0"
def officialCode = 4056

def serviceAccountCredentialsFile = rootProject.file("service_account_credentials.json")

Expand Down
2 changes: 1 addition & 1 deletion TMessagesProj/jni/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,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
11 changes: 8 additions & 3 deletions TMessagesProj/jni/TgNetWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,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 @@ -443,7 +447,8 @@ void init(JNIEnv *env, jclass c, jint instanceNum, jint version, jint layer, jin
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) {
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 @@ -467,7 +472,7 @@ void init(JNIEnv *env, jclass c, jint instanceNum, jint version, jint layer, jin
std::string(regIdStr),
std::string(cFingerprintStr),
std::string(installerIdStr), std::string(packageIdStr), timezoneOffset,
userId, true, enablePushConnection,
userId, userPremium, true, enablePushConnection,
hasNetwork, networkType, performanceClass);

if (deviceModelStr != 0) {
Expand Down Expand Up @@ -533,7 +538,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 a9bcc59

Please sign in to comment.