slashcommands: add /ctc nodelete

This commit is contained in:
ave 2019-10-05 20:12:20 +03:00
parent 36e82810c7
commit 53cc185d94
No known key found for this signature in database
GPG key ID: 09356ABAA42C842B
2 changed files with 111 additions and 13 deletions

View file

@ -1,8 +1,31 @@
Only in com.discord-967: build
Only in com.discord-967: dist
diff -crB com.discord-967-base/smali/com/discord/gateway/io/IncomingParser.smali com.discord-967/smali/com/discord/gateway/io/IncomingParser.smali
*** com.discord-967-base/smali/com/discord/gateway/io/IncomingParser.smali 2019-10-05 16:18:59.987594346 +0300
--- com.discord-967/smali/com/discord/gateway/io/IncomingParser.smali 2019-10-05 19:58:29.938199601 +0300
***************
*** 703,708 ****
--- 703,719 ----
.line 73
:goto_4
+
+ invoke-static {}, Lcom/discord/stores/StoreStream;->getUserSettings()Lcom/discord/stores/StoreUserSettings;
+
+ move-result-object v0
+
+ invoke-virtual {v0}, Lcom/discord/stores/StoreUserSettings;->getNoDelete()Z
+
+ move-result v4
+
+ if-nez v4, :cond_b
+
new-instance v0, Lcom/discord/models/domain/ModelMessageDelete;
invoke-direct {v0}, Lcom/discord/models/domain/ModelMessageDelete;-><init>()V
diff -crB com.discord-967-base/smali/com/discord/models/domain/ModelChannel.smali com.discord-967/smali/com/discord/models/domain/ModelChannel.smali
*** com.discord-967-base/smali/com/discord/models/domain/ModelChannel.smali 2019-10-05 16:19:00.004261125 +0300
--- com.discord-967/smali/com/discord/models/domain/ModelChannel.smali 2019-10-05 19:10:43.321011414 +0300
--- com.discord-967/smali/com/discord/models/domain/ModelChannel.smali 2019-10-05 19:53:11.779466115 +0300
***************
*** 2193,2198 ****
--- 2193,2208 ----
@ -24,7 +47,7 @@ diff -crB com.discord-967-base/smali/com/discord/models/domain/ModelChannel.smal
diff -crB com.discord-967-base/smali/com/discord/stores/StoreMessages.smali com.discord-967/smali/com/discord/stores/StoreMessages.smali
*** com.discord-967-base/smali/com/discord/stores/StoreMessages.smali 2019-10-05 16:19:00.147595419 +0300
--- com.discord-967/smali/com/discord/stores/StoreMessages.smali 2019-10-05 19:46:25.046923530 +0300
--- com.discord-967/smali/com/discord/stores/StoreMessages.smali 2019-10-05 20:04:57.620820485 +0300
***************
*** 432,437 ****
--- 432,441 ----
@ -40,7 +63,7 @@ diff -crB com.discord-967-base/smali/com/discord/stores/StoreMessages.smali com.
***************
*** 954,959 ****
--- 958,3788 ----
--- 958,3823 ----
return-void
.end method
@ -2286,7 +2309,7 @@ diff -crB com.discord-967-base/smali/com/discord/stores/StoreMessages.smali com.
+
+ invoke-virtual {v0, v1}, Lcom/discord/stores/StoreUserSettings;->setLeakChannels(Z)V
+
+ const-string p0, "CTC: Successfully set leakchannels state."
+ const-string p0, "CTC: Successfully set channelleak state."
+
+ return-object p0
+
@ -2435,7 +2458,7 @@ diff -crB com.discord-967-base/smali/com/discord/stores/StoreMessages.smali com.
+
+ move-result v0
+
+ if-eqz v0, :cond_1
+ if-eqz v0, :cond_9
+
+ # Get value
+
@ -2504,8 +2527,43 @@ diff -crB com.discord-967-base/smali/com/discord/stores/StoreMessages.smali com.
+
+ return-object p0
+
+ :cond_9
+ const-string v0, "nodelete "
+
+ invoke-virtual {p0, v0}, Ljava/lang/String;->startsWith(Ljava/lang/String;)Z
+
+ move-result v0
+
+ if-eqz v0, :cond_1
+
+ # Move to config value interpretation
+
+ const/16 v0, 0x9
+
+ invoke-virtual {p0, v0}, Ljava/lang/String;->substring(I)Ljava/lang/String;
+
+ move-result-object p0
+
+ const-string v0, "true"
+
+ invoke-virtual {p0, v0}, Ljava/lang/String;->startsWith(Ljava/lang/String;)Z
+
+ move-result v1
+
+ # Set value
+
+ invoke-static {}, Lcom/discord/stores/StoreStream;->getUserSettings()Lcom/discord/stores/StoreUserSettings;
+
+ move-result-object v0
+
+ invoke-virtual {v0, v1}, Lcom/discord/stores/StoreUserSettings;->setNoDelete(Z)V
+
+ const-string p0, "CTC: Successfully set nodelete state."
+
+ return-object p0
+
+ :cond_1
+ const-string p0, "CTC: No known command supplied. (available: token, showtyping, channelleak, addaccount, account. Everything except specified token needs to be lowercase)"
+ const-string p0, "CTC: No known command supplied. (available: token, showtyping, channelleak, addaccount, account, nodelete. Everything except specified token needs to be lowercase)"
+
+ return-object p0
+ .end method
@ -2874,7 +2932,7 @@ diff -crB com.discord-967-base/smali/com/discord/stores/StoreMessages.smali com.
.annotation system Ldalvik/annotation/Signature;
***************
*** 983,988 ****
--- 3812,3821 ----
--- 3847,3856 ----
invoke-static {p4, v0}, Lkotlin/jvm/internal/k;->h(Ljava/lang/Object;Ljava/lang/String;)V
@ -2887,10 +2945,10 @@ diff -crB com.discord-967-base/smali/com/discord/stores/StoreMessages.smali com.
if-eqz p6, :cond_0
diff -crB com.discord-967-base/smali/com/discord/stores/StoreUserSettings.smali com.discord-967/smali/com/discord/stores/StoreUserSettings.smali
*** com.discord-967-base/smali/com/discord/stores/StoreUserSettings.smali 2019-10-05 16:19:00.170928909 +0300
--- com.discord-967/smali/com/discord/stores/StoreUserSettings.smali 2019-10-05 19:29:35.161160111 +0300
--- com.discord-967/smali/com/discord/stores/StoreUserSettings.smali 2019-10-05 19:54:29.323303188 +0300
***************
*** 1294,1299 ****
--- 1294,1510 ----
--- 1294,1547 ----
return v0
.end method
@ -2966,6 +3024,43 @@ diff -crB com.discord-967-base/smali/com/discord/stores/StoreUserSettings.smali
+ return-void
+ .end method
+
+
+ .method public getNoDelete()Z
+ .locals 3
+
+ iget-object v0, p0, Lcom/discord/stores/StoreUserSettings;->prefs:Landroid/content/SharedPreferences;
+
+ const-string v1, "CACHE_KEY_CTC_NO_DELETE"
+
+ const/4 v2, 0x0
+
+ invoke-interface {v0, v1, v2}, Landroid/content/SharedPreferences;->getBoolean(Ljava/lang/String;Z)Z
+
+ move-result v0
+
+ return v0
+ .end method
+
+ .method public setNoDelete(Z)V
+ .locals 2
+
+ iget-object v0, p0, Lcom/discord/stores/StoreUserSettings;->prefs:Landroid/content/SharedPreferences;
+
+ invoke-interface {v0}, Landroid/content/SharedPreferences;->edit()Landroid/content/SharedPreferences$Editor;
+
+ move-result-object v0
+
+ const-string v1, "CACHE_KEY_CTC_NO_DELETE"
+
+ invoke-interface {v0, v1, p1}, Landroid/content/SharedPreferences$Editor;->putBoolean(Ljava/lang/String;Z)Landroid/content/SharedPreferences$Editor;
+
+ move-result-object p1
+
+ invoke-interface {p1}, Landroid/content/SharedPreferences$Editor;->apply()V
+
+ return-void
+ .end method
+
+ .method public getShowTyping()Z
+ .locals 3
+
@ -3108,9 +3203,10 @@ diff -crB com.discord-967-base/smali/com/discord/stores/StoreUserSettings.smali
.method handleConnectionOpen(Lcom/discord/models/domain/ModelPayload;)V
.locals 0
Only in com.discord-967/smali/com/discord/widgets/auth: WidgetAuthLogin.smali.orig
diff -crB com.discord-967-base/smali/com/discord/widgets/chat/input/WidgetChatInputEditText$1.smali com.discord-967/smali/com/discord/widgets/chat/input/WidgetChatInputEditText$1.smali
*** com.discord-967-base/smali/com/discord/widgets/chat/input/WidgetChatInputEditText$1.smali 2019-10-05 16:19:00.327596627 +0300
--- com.discord-967/smali/com/discord/widgets/chat/input/WidgetChatInputEditText$1.smali 2019-10-05 19:10:43.327678122 +0300
--- com.discord-967/smali/com/discord/widgets/chat/input/WidgetChatInputEditText$1.smali 2019-10-05 19:53:11.789466180 +0300
***************
*** 55,60 ****
--- 55,70 ----
@ -3132,7 +3228,7 @@ diff -crB com.discord-967-base/smali/com/discord/widgets/chat/input/WidgetChatIn
diff -crB com.discord-967-base/smali/com/discord/widgets/chat/input/WidgetChatInputSend$configureSendListeners$1.smali com.discord-967/smali/com/discord/widgets/chat/input/WidgetChatInputSend$configureSendListeners$1.smali
*** com.discord-967-base/smali/com/discord/widgets/chat/input/WidgetChatInputSend$configureSendListeners$1.smali 2019-10-05 16:19:00.330929983 +0300
--- com.discord-967/smali/com/discord/widgets/chat/input/WidgetChatInputSend$configureSendListeners$1.smali 2019-10-05 19:10:43.327678122 +0300
--- com.discord-967/smali/com/discord/widgets/chat/input/WidgetChatInputSend$configureSendListeners$1.smali 2019-10-05 19:53:11.789466180 +0300
***************
*** 371,376 ****
--- 371,402 ----
@ -3170,7 +3266,7 @@ diff -crB com.discord-967-base/smali/com/discord/widgets/chat/input/WidgetChatIn
.line 74
diff -crB com.discord-967-base/smali/com/discord/widgets/chat/input/WidgetChatInputSend.smali com.discord-967/smali/com/discord/widgets/chat/input/WidgetChatInputSend.smali
*** com.discord-967-base/smali/com/discord/widgets/chat/input/WidgetChatInputSend.smali 2019-10-05 16:19:00.330929983 +0300
--- com.discord-967/smali/com/discord/widgets/chat/input/WidgetChatInputSend.smali 2019-10-05 19:10:43.327678122 +0300
--- com.discord-967/smali/com/discord/widgets/chat/input/WidgetChatInputSend.smali 2019-10-05 19:53:11.789466180 +0300
***************
*** 60,65 ****
--- 60,89 ----
@ -3206,7 +3302,7 @@ diff -crB com.discord-967-base/smali/com/discord/widgets/chat/input/WidgetChatIn
diff -crB com.discord-967-base/smali/okhttp3/MultipartBody$Part.smali com.discord-967/smali/okhttp3/MultipartBody$Part.smali
*** com.discord-967-base/smali/okhttp3/MultipartBody$Part.smali 2019-10-05 16:19:00.700932465 +0300
--- com.discord-967/smali/okhttp3/MultipartBody$Part.smali 2019-10-05 19:45:23.729878243 +0300
--- com.discord-967/smali/okhttp3/MultipartBody$Part.smali 2019-10-05 19:53:11.789466180 +0300
***************
*** 43,50 ****
return-void
@ -3274,4 +3370,5 @@ diff -crB com.discord-967-base/smali/okhttp3/MultipartBody$Part.smali com.discor
.line 256
invoke-static {v0, p1}, Lokhttp3/MultipartBody;->a(Ljava/lang/StringBuilder;Ljava/lang/String;)Ljava/lang/StringBuilder;
Only in com.discord-967/smali/okhttp3: MultipartBody$Part.smali.orig

View file

@ -26,6 +26,7 @@ Following commands are supported, but create less accessible text (so you should
CutTheCord has a couple features that can utilized with slash commands as well:
- /ctc channelleak true/false -> Shows all channels, even those you don't have permissions to view (might mess with channel editing or editing while it's enabled)
- /ctc notyping true/false -> Disables typing event so that it's not visible when you type (true = typing is shown, false = not shown)
- /ctc nodelete true/false -> Disables handling of message delete events. Currently deletes messages don't have anything changed about them, but I plan to append "(deleted)" to them eventually. (true = Deleted messages stay, false = they get deleted)
- /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, token will be set to the current one if it's `current`)