Skip to content

Commit

Permalink
enable message editing on IRC servers that support labeled-response cap
Browse files Browse the repository at this point in the history
  • Loading branch information
c99koder committed Dec 23, 2022
1 parent 69fb7bd commit 8af6e87
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ android {
testBuildType "mockdata"

defaultConfig {
versionCode 341
versionCode 342
versionName "4.29"
minSdkVersion 22
targetSdkVersion 31
Expand Down
2 changes: 1 addition & 1 deletion res/layout/activity_message.xml
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
android:background="?contentBackgroundColor"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="12dp"
android:paddingTop="8dp"
android:gravity="bottom">

<ImageButton
Expand Down
2 changes: 1 addition & 1 deletion src/com/irccloud/android/activity/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -5488,7 +5488,7 @@ public boolean onMessageLongClicked(Event event) {

boolean canEdit = event.self;
Server s = ServersList.getInstance().getServer(event.cid);
if(s == null || !(s.isSlack() || s.getOrgId() > 0))
if(s == null || !s.hasLabeledResponse())
canEdit = false;

showUserPopup(user, ColorFormatter.html_to_spanned(ColorFormatter.irc_to_html(timestamp + " " + html), true, ServersList.getInstance().getServer(event.cid)), null, msgid, canEdit, event);
Expand Down
4 changes: 4 additions & 0 deletions src/com/irccloud/android/data/model/Server.java
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,10 @@ public boolean hasCap(String cap) {
return false;
}

public boolean hasLabeledResponse() {
return hasCap("labeled-response") || hasCap("draft/labeled-response") || hasCap("draft/labeled-response-0.2");
}

public boolean clientTagDeny(String tagname) {
if(isupport == null || !isupport.has("CLIENTTAGDENY") || !isupport.get("CLIENTTAGDENY").isTextual())
return false;
Expand Down

0 comments on commit 8af6e87

Please sign in to comment.