-
Notifications
You must be signed in to change notification settings - Fork 319
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: UnlockTroopNameLimit on 9.0.90 before
- Loading branch information
Showing
2 changed files
with
40 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,66 +1,51 @@ | ||
/* | ||
* QAuxiliary - An Xposed module for QQ/TIM | ||
* Copyright (C) 2019-2023 QAuxiliary developers | ||
* Copyright (C) 2019-2024 QAuxiliary developers | ||
* https://github.com/cinit/QAuxiliary | ||
* | ||
* This software is non-free but opensource software: you can redistribute it | ||
* and/or modify it under the terms of the qwq233 Universal License | ||
* as published on https://github.com/qwq233/license; either | ||
* version 2 of the License, or any later version and our EULA as published | ||
* This software is an opensource software: you can redistribute it | ||
* and/or modify it under the terms of the General Public License | ||
* as published by the Free Software Foundation; either | ||
* version 3 of the License, or any later version as published | ||
* by QAuxiliary contributors. | ||
* | ||
* This software is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
* See the qwq233 Universal License for more details. | ||
* See the General Public License for more details. | ||
* | ||
* See | ||
* <https://github.com/qwq233/license> | ||
* You should have received a copy of the General Public License | ||
* along with this software. | ||
* If not, see | ||
* <https://github.com/cinit/QAuxiliary/blob/master/LICENSE.md>. | ||
*/ | ||
|
||
package cc.hicore.hook; | ||
package cc.hicore.hook | ||
|
||
import static io.github.qauxv.util.HostInfo.requireMinQQVersion; | ||
import static io.github.qauxv.util.QQVersion.QQ_8_9_0; | ||
|
||
import android.text.Spanned; | ||
import androidx.annotation.NonNull; | ||
import cc.ioctl.util.HookUtils; | ||
import io.github.qauxv.base.annotation.FunctionHookEntry; | ||
import io.github.qauxv.base.annotation.UiItemAgentEntry; | ||
import io.github.qauxv.dsl.FunctionEntryRouter; | ||
import io.github.qauxv.hook.CommonSwitchFunctionHook; | ||
import io.github.qauxv.util.Initiator; | ||
import android.text.Spanned | ||
import com.github.kyuubiran.ezxhelper.utils.hookReplace | ||
import io.github.qauxv.base.annotation.FunctionHookEntry | ||
import io.github.qauxv.base.annotation.UiItemAgentEntry | ||
import io.github.qauxv.dsl.FunctionEntryRouter | ||
import io.github.qauxv.hook.CommonSwitchFunctionHook | ||
import io.github.qauxv.util.QQVersion | ||
import io.github.qauxv.util.dexkit.DexKit | ||
import io.github.qauxv.util.dexkit.UnlockTroopNameLimitClass | ||
import io.github.qauxv.util.requireMaxQQVersion | ||
import xyz.nextalone.util.throwOrTrue | ||
|
||
@FunctionHookEntry | ||
@UiItemAgentEntry | ||
public class UnlockTroopNameLimit extends CommonSwitchFunctionHook { | ||
|
||
public static final UnlockTroopNameLimit INSTANCE = new UnlockTroopNameLimit(); | ||
|
||
private UnlockTroopNameLimit() { | ||
} | ||
|
||
@NonNull | ||
@Override | ||
public String getName() { | ||
return "允许群名带表情"; | ||
} | ||
|
||
@NonNull | ||
@Override | ||
public String[] getUiItemLocation() { | ||
return FunctionEntryRouter.Locations.Auxiliary.EXPERIMENTAL_CATEGORY; | ||
} | ||
|
||
@Override | ||
protected boolean initOnce() throws Exception { | ||
var clazzName = requireMinQQVersion(QQ_8_9_0) ? "n" : "EmojiFilter"; | ||
HookUtils.hookBeforeIfEnabled(this, | ||
Initiator.loadClass("com.tencent.mobileqq.activity.editservice.EditTroopMemberNickService$" + clazzName) | ||
.getDeclaredMethod("filter", CharSequence.class, int.class, int.class, Spanned.class, int.class, int.class), | ||
param -> param.setResult(null)); | ||
return true; | ||
object UnlockTroopNameLimit : CommonSwitchFunctionHook( | ||
targets = arrayOf(UnlockTroopNameLimitClass) | ||
) { | ||
override val name = "允许群名带表情" | ||
override val uiItemLocation = FunctionEntryRouter.Locations.Auxiliary.EXPERIMENTAL_CATEGORY | ||
override val isAvailable = requireMaxQQVersion(QQVersion.QQ_9_0_90) | ||
|
||
override fun initOnce() = throwOrTrue { | ||
DexKit.requireClassFromCache(UnlockTroopNameLimitClass) | ||
.getDeclaredMethod("filter", CharSequence::class.java, Int::class.java, Int::class.java, Spanned::class.java, Int::class.java, Int::class.java) | ||
.hookReplace { null } | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters