Move nohiddenchannels into slashcommands

This commit is contained in:
ave 2019-05-25 05:43:28 +03:00
parent a7f878d29f
commit bcd2c620e9
No known key found for this signature in database
GPG key ID: 09356ABAA42C842B
4 changed files with 158 additions and 70 deletions

View file

@ -1,49 +0,0 @@
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-25 02:48:42.334585852 +0300
***************
*** 431,437 ****
.end method
.method private computeName()Ljava/lang/String;
! .locals 1
.line 272
invoke-virtual {p0}, Lcom/discord/models/domain/ModelChannel;->isPrivate()Z
--- 431,437 ----
.end method
.method private computeName()Ljava/lang/String;
! .locals 2
.line 272
invoke-virtual {p0}, Lcom/discord/models/domain/ModelChannel;->isPrivate()Z
***************
*** 2083,2095 ****
.end annotation
.line 246
! iget-object v0, p0, Lcom/discord/models/domain/ModelChannel;->permissionOverwrites:Ljava/util/Map;
! if-eqz v0, :cond_0
! return-object v0
! :cond_0
sget-object v0, Lcom/discord/models/domain/ModelChannel;->EMPTY_PERMISSION_OVERWRITES:Ljava/util/Map;
return-object v0
--- 2083,2095 ----
.end annotation
.line 246
! #iget-object v0, p0, Lcom/discord/models/domain/ModelChannel;->permissionOverwrites:Ljava/util/Map;
! #if-eqz v0, :cond_0
! #return-object v0
! #:cond_0
sget-object v0, Lcom/discord/models/domain/ModelChannel;->EMPTY_PERMISSION_OVERWRITES:Ljava/util/Map;
return-object v0

View file

@ -1,11 +0,0 @@
## DisTok CutTheCord: No Hidden Channels Patch
This patch shows all channels in the channel list, even those you lack permissions to view.
#### Side effects / bugs
- May break channel edits/creates, not sure
- Currently no indicator is given if you can view a channel or not, I plan to prepend their name with smth later
- Currently you can't turn this on or off, I'll also change that eventually
#### Available and tested on:
- 9.0.3

View file

@ -1,13 +1,35 @@
Only in com.discord-900: build Only in com.discord-903: build
Only in com.discord-900: dist Only in com.discord-903: dist
diff -crB com.discord-900-base/smali/com/discord/stores/StoreMessages.smali com.discord-900/smali/com/discord/stores/StoreMessages.smali 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-900-base/smali/com/discord/stores/StoreMessages.smali 2019-05-19 21:52:46.439797252 +0300 *** com.discord-903-base/smali/com/discord/models/domain/ModelChannel.smali 2019-05-24 23:40:49.520802264 +0300
--- com.discord-900/smali/com/discord/stores/StoreMessages.smali 2019-05-21 19:28:27.037730466 +0300 --- com.discord-903/smali/com/discord/models/domain/ModelChannel.smali 2019-05-25 05:00:46.074702303 +0300
***************
*** 2082,2087 ****
--- 2082,2097 ----
}
.end annotation
+ invoke-static {}, Lcom/discord/stores/StoreStream;->getUserSettings()Lcom/discord/stores/StoreUserSettings;
+
+ move-result-object v0
+
+ invoke-virtual {v0}, Lcom/discord/stores/StoreUserSettings;->getLeakChannels()Z
+
+ move-result v0
+
+ if-eqz v0, :cond_0
+
.line 246
iget-object v0, p0, Lcom/discord/models/domain/ModelChannel;->permissionOverwrites:Ljava/util/Map;
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-25 05:39:51.367962305 +0300
*************** ***************
*** 432,437 **** *** 432,437 ****
--- 432,441 ---- --- 432,441 ----
invoke-static {p5, v0}, Lkotlin/jvm/internal/j;->h(Ljava/lang/Object;Ljava/lang/String;)V invoke-static {p5, v0}, Lkotlin/jvm/internal/k;->h(Ljava/lang/Object;Ljava/lang/String;)V
+ invoke-static {p5}, Lcom/discord/stores/StoreMessages;->interceptEditMessage(Ljava/lang/String;)Ljava/lang/String; + invoke-static {p5}, Lcom/discord/stores/StoreMessages;->interceptEditMessage(Ljava/lang/String;)Ljava/lang/String;
+ +
@ -18,7 +40,7 @@ diff -crB com.discord-900-base/smali/com/discord/stores/StoreMessages.smali com.
*************** ***************
*** 948,953 **** *** 948,953 ****
--- 952,3465 ---- --- 952,3537 ----
return-void return-void
.end method .end method
@ -2197,6 +2219,62 @@ diff -crB com.discord-900-base/smali/com/discord/stores/StoreMessages.smali com.
+ return-object p0 + return-object p0
+ .end method + .end method
+ +
+ .method public static final slashCtc(Ljava/lang/String;)Ljava/lang/String;
+ .locals 2
+
+ # Length of command + space
+ const/4 v0, 0x5
+
+ invoke-virtual {p0, v0}, Ljava/lang/String;->substring(I)Ljava/lang/String;
+
+ move-result-object p0
+
+ invoke-virtual {p0}, Ljava/lang/String;->toLowerCase()Ljava/lang/String;
+
+ move-result-object p0
+
+ # Move to second word interpretation
+
+ const-string v0, "channelleak "
+
+ 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, 0xc
+
+ invoke-virtual {p0, v0}, Ljava/lang/String;->substring(I)Ljava/lang/String;
+
+ move-result-object p0
+
+ const-string v0, "false"
+
+ 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;->setLeakChannels(Z)V
+
+ const-string p0, "CTC: Set leakchannels state. (Under ideal conditions this should only be visible to you, but the world isn't always that fair, is it now?)"
+
+ return-object p0
+
+ :cond_1
+ const-string p0, "CTC: No known command supplied. (Under ideal conditions this should only be visible to you, but the world isn't always that fair, is it now?)"
+
+ return-object p0
+ .end method
+
+ .method public static final slashCommands(Ljava/lang/String;)Ljava/lang/String; + .method public static final slashCommands(Ljava/lang/String;)Ljava/lang/String;
+ .locals 1 + .locals 1
+ +
@ -2474,7 +2552,7 @@ diff -crB com.discord-900-base/smali/com/discord/stores/StoreMessages.smali com.
+ +
+ move-result v0 + move-result v0
+ +
+ if-eqz v0, :cond_0 + if-eqz v0, :cond_17
+ +
+ invoke-static {p0}, Lcom/discord/stores/StoreMessages;->slashMorse(Ljava/lang/String;)Ljava/lang/String; + invoke-static {p0}, Lcom/discord/stores/StoreMessages;->slashMorse(Ljava/lang/String;)Ljava/lang/String;
+ +
@ -2482,6 +2560,22 @@ diff -crB com.discord-900-base/smali/com/discord/stores/StoreMessages.smali com.
+ +
+ goto :goto_0 + goto :goto_0
+ +
+ # ctc command
+ :cond_17
+ const-string v0, "/ctc "
+
+ invoke-virtual {p0, v0}, Ljava/lang/String;->startsWith(Ljava/lang/String;)Z
+
+ move-result v0
+
+ if-eqz v0, :cond_0
+
+ invoke-static {p0}, Lcom/discord/stores/StoreMessages;->slashCtc(Ljava/lang/String;)Ljava/lang/String;
+
+ move-result-object p0
+
+ goto :goto_0
+
+ :cond_0 + :cond_0
+ :goto_0 + :goto_0
+ # And finally, trim output before sending it back + # And finally, trim output before sending it back
@ -2535,9 +2629,9 @@ diff -crB com.discord-900-base/smali/com/discord/stores/StoreMessages.smali com.
.annotation system Ldalvik/annotation/Signature; .annotation system Ldalvik/annotation/Signature;
*************** ***************
*** 977,982 **** *** 977,982 ****
--- 3489,3498 ---- --- 3561,3570 ----
invoke-static {p4, v0}, Lkotlin/jvm/internal/j;->h(Ljava/lang/Object;Ljava/lang/String;)V invoke-static {p4, v0}, Lkotlin/jvm/internal/k;->h(Ljava/lang/Object;Ljava/lang/String;)V
+ invoke-static {p4}, Lcom/discord/stores/StoreMessages;->interceptSendMessage(Ljava/lang/String;)Ljava/lang/String; + invoke-static {p4}, Lcom/discord/stores/StoreMessages;->interceptSendMessage(Ljava/lang/String;)Ljava/lang/String;
+ +
@ -2546,3 +2640,54 @@ diff -crB com.discord-900-base/smali/com/discord/stores/StoreMessages.smali com.
const/4 v0, 0x1 const/4 v0, 0x1
if-eqz p6, :cond_0 if-eqz p6, :cond_0
Only in com.discord-903/smali/com/discord/stores: StoreMessages.smali.orig
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-25 04:41:00.951108339 +0300
***************
*** 1272,1277 ****
--- 1272,1315 ----
return v0
.end method
+ .method public getLeakChannels()Z
+ .locals 3
+
+ .line 179
+ iget-object v0, p0, Lcom/discord/stores/StoreUserSettings;->prefs:Landroid/content/SharedPreferences;
+
+ const-string v1, "CACHE_KEY_CTC_LEAK_CHANNELS"
+
+ const/4 v2, 0x1
+
+ invoke-interface {v0, v1, v2}, Landroid/content/SharedPreferences;->getBoolean(Ljava/lang/String;Z)Z
+
+ move-result v0
+
+ return v0
+ .end method
+
+ .method public setLeakChannels(Z)V
+ .locals 2
+
+ .line 331
+ 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_LEAK_CHANNELS"
+
+ 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 handleConnectionOpen(Lcom/discord/models/domain/ModelPayload;)V
.locals 0

View file

@ -22,6 +22,9 @@ Following commands are supported, but create less accessible text (so you should
- /flip -> Flips text (like "ʇɥıs") - /flip -> Flips text (like "ʇɥıs")
- /clap -> Please :clap: clap - /clap -> Please :clap: clap
CutTheCord has a couple features that can be enabled or disabled 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)
Commands like fw can be generated by `textreplacegen.py` or `textreplacegen-array.py` provided in this folder. Commands like fw can be generated by `textreplacegen.py` or `textreplacegen-array.py` provided in this folder.
#### Available and tested on: #### Available and tested on: