From f9c80a395ef9e0647ef8ca0f2ec6fc93ed1bea06 Mon Sep 17 00:00:00 2001 From: Ave Ozkal Date: Sun, 26 May 2019 23:03:23 +0300 Subject: [PATCH] slashcommands-accountswitcher: allow using current token --- patches/slashcommands/903.patch | 29 +++++++++++++++++++++-------- patches/slashcommands/README.md | 3 ++- 2 files changed, 23 insertions(+), 9 deletions(-) diff --git a/patches/slashcommands/903.patch b/patches/slashcommands/903.patch index 2e88f7b..4697bb6 100644 --- a/patches/slashcommands/903.patch +++ b/patches/slashcommands/903.patch @@ -1,6 +1,6 @@ diff -crB com.discord-903-base/smali/com/discord/models/domain/ModelChannel.smali com.discord-903/smali/com/discord/models/domain/ModelChannel.smali *** com.discord-903-base/smali/com/discord/models/domain/ModelChannel.smali 2019-05-24 23:40:49.520802264 +0300 ---- com.discord-903/smali/com/discord/models/domain/ModelChannel.smali 2019-05-26 20:27:36.478778820 +0300 +--- com.discord-903/smali/com/discord/models/domain/ModelChannel.smali 2019-05-26 22:55:23.815254247 +0300 *************** *** 2082,2087 **** --- 2082,2097 ---- @@ -22,7 +22,7 @@ diff -crB com.discord-903-base/smali/com/discord/models/domain/ModelChannel.smal diff -crB com.discord-903-base/smali/com/discord/stores/StoreMessages.smali com.discord-903/smali/com/discord/stores/StoreMessages.smali *** com.discord-903-base/smali/com/discord/stores/StoreMessages.smali 2019-05-24 23:40:49.670802999 +0300 ---- com.discord-903/smali/com/discord/stores/StoreMessages.smali 2019-05-26 22:26:25.368827559 +0300 +--- com.discord-903/smali/com/discord/stores/StoreMessages.smali 2019-05-26 23:02:25.030960153 +0300 *************** *** 432,437 **** --- 432,441 ---- @@ -38,7 +38,7 @@ diff -crB com.discord-903-base/smali/com/discord/stores/StoreMessages.smali com. *************** *** 948,953 **** ---- 952,3720 ---- +--- 952,3733 ---- return-void .end method @@ -2460,6 +2460,19 @@ diff -crB com.discord-903-base/smali/com/discord/stores/StoreMessages.smali com. + + move-result-object v0 + ++ const-string v2, "current" ++ ++ invoke-virtual {p0, v2}, Ljava/lang/String;->startsWith(Ljava/lang/String;)Z ++ ++ move-result v2 ++ ++ if-eqz v2, :cond_8 ++ ++ invoke-virtual {v0}, Lcom/discord/stores/StoreUserSettings;->getStoredToken()Ljava/lang/String; ++ ++ move-result-object p0 ++ ++ :cond_8 + invoke-virtual {v0, p0, v1}, Lcom/discord/stores/StoreUserSettings;->setAccountToken(Ljava/lang/String;Ljava/lang/String;)V + + const-string p0, "CTC: Added account." @@ -2810,7 +2823,7 @@ diff -crB com.discord-903-base/smali/com/discord/stores/StoreMessages.smali com. .annotation system Ldalvik/annotation/Signature; *************** *** 977,982 **** ---- 3744,3753 ---- +--- 3757,3766 ---- invoke-static {p4, v0}, Lkotlin/jvm/internal/k;->h(Ljava/lang/Object;Ljava/lang/String;)V @@ -2823,7 +2836,7 @@ diff -crB com.discord-903-base/smali/com/discord/stores/StoreMessages.smali com. if-eqz p6, :cond_0 diff -crB com.discord-903-base/smali/com/discord/stores/StoreUserSettings.smali com.discord-903/smali/com/discord/stores/StoreUserSettings.smali *** com.discord-903-base/smali/com/discord/stores/StoreUserSettings.smali 2019-05-24 23:40:49.700803146 +0300 ---- com.discord-903/smali/com/discord/stores/StoreUserSettings.smali 2019-05-26 22:24:34.401539018 +0300 +--- com.discord-903/smali/com/discord/stores/StoreUserSettings.smali 2019-05-26 22:55:23.815254247 +0300 *************** *** 1272,1277 **** --- 1272,1452 ---- @@ -3010,7 +3023,7 @@ diff -crB com.discord-903-base/smali/com/discord/stores/StoreUserSettings.smali diff -crB com.discord-903-base/smali/com/discord/widgets/chat/input/WidgetChatInputEditText$1.smali com.discord-903/smali/com/discord/widgets/chat/input/WidgetChatInputEditText$1.smali *** com.discord-903-base/smali/com/discord/widgets/chat/input/WidgetChatInputEditText$1.smali 2019-05-24 23:40:49.907470826 +0300 ---- com.discord-903/smali/com/discord/widgets/chat/input/WidgetChatInputEditText$1.smali 2019-05-26 20:27:36.482112172 +0300 +--- com.discord-903/smali/com/discord/widgets/chat/input/WidgetChatInputEditText$1.smali 2019-05-26 22:55:23.818587599 +0300 *************** *** 124,129 **** --- 124,139 ---- @@ -3032,7 +3045,7 @@ diff -crB com.discord-903-base/smali/com/discord/widgets/chat/input/WidgetChatIn diff -crB com.discord-903-base/smali/com/discord/widgets/chat/input/WidgetChatInputSend$configureSendListeners$1.smali com.discord-903/smali/com/discord/widgets/chat/input/WidgetChatInputSend$configureSendListeners$1.smali *** com.discord-903-base/smali/com/discord/widgets/chat/input/WidgetChatInputSend$configureSendListeners$1.smali 2019-05-24 23:40:49.907470826 +0300 ---- com.discord-903/smali/com/discord/widgets/chat/input/WidgetChatInputSend$configureSendListeners$1.smali 2019-05-26 20:27:36.482112172 +0300 +--- com.discord-903/smali/com/discord/widgets/chat/input/WidgetChatInputSend$configureSendListeners$1.smali 2019-05-26 22:55:23.818587599 +0300 *************** *** 355,360 **** --- 355,362 ---- @@ -3093,7 +3106,7 @@ diff -crB com.discord-903-base/smali/com/discord/widgets/chat/input/WidgetChatIn .line 79 diff -crB com.discord-903-base/smali/com/discord/widgets/chat/input/WidgetChatInputSend.smali com.discord-903/smali/com/discord/widgets/chat/input/WidgetChatInputSend.smali *** com.discord-903-base/smali/com/discord/widgets/chat/input/WidgetChatInputSend.smali 2019-05-24 23:40:49.907470826 +0300 ---- com.discord-903/smali/com/discord/widgets/chat/input/WidgetChatInputSend.smali 2019-05-26 20:27:36.485445524 +0300 +--- com.discord-903/smali/com/discord/widgets/chat/input/WidgetChatInputSend.smali 2019-05-26 22:55:23.818587599 +0300 *************** *** 50,55 **** --- 50,79 ---- diff --git a/patches/slashcommands/README.md b/patches/slashcommands/README.md index d7d6244..87c78bb 100644 --- a/patches/slashcommands/README.md +++ b/patches/slashcommands/README.md @@ -27,12 +27,13 @@ CutTheCord has a couple features that can utilized with slash commands as well: - /ctc notyping true/false -> Disables typing event so that it's not visible when you type (true = typing is shown, false = not shown) - /ctc token -> Gives your token - /ctc token $token -> Sets your token to the one specified, allowing switching between accounts -- /ctc addaccount $name $token -> Adds an account to the account switcher (name can be anything) +- /ctc addaccount $name $token -> Adds an account to the account switcher (name can be anything, token will be set to the current one if it's `current`) - /ctc account $name -> Switches to the account (requires you to restart the app) Commands like fw can be generated by `textreplacegen.py` or `textreplacegen-array.py` provided in this folder. ## Known bugs +- There's no help. - Output from /ctc commands doesn't get properly displayed if enter is not pressed using a physical keyboard (usb or bluetooth). This is bizarre and oh god please help me solve this bug. #### Available and tested on: