Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use new IM-plugin support for "Bot.commandPrefixRequired" toggle [JENKINS-17380, JENKINS-58927] #214

Merged
merged 4 commits into from
Jan 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ buildPlugin(
useContainerAgent: true,
configurations: [
// Test the common case (i.e., a recent LTS release) on both Linux and Windows.
[ platform: 'linux', jdk: '11', jenkins: '2.375.1' ],
[ platform: 'windows', jdk: '11', jenkins: '2.375.1' ],
[ platform: 'linux', jdk: '11', jenkins: '2.387.3' ],
[ platform: 'windows', jdk: '11', jenkins: '2.387.3' ],

// Test the bleeding edge of the compatibility spectrum (i.e., the latest supported Java runtime).
// see also https://www.jenkins.io/doc/developer/plugin-development/choosing-jenkins-baseline/
[ platform: 'linux', jdk: '17', jenkins: '2.375.2' ],
[ platform: 'linux', jdk: '17', jenkins: '2.426.2' ],
])
8 changes: 4 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
<revision>3</revision>
<changelist>999999-SNAPSHOT</changelist>
<gitHubRepo>jenkinsci/${project.artifactId}-plugin</gitHubRepo>
<jenkins.version>2.375.1</jenkins.version>
<jenkins.version>2.387.3</jenkins.version>
<!-- Note: keep in sync with io.jenkins.tools.bom version below -->
<spotbugs.effort>Max</spotbugs.effort>
<spotbugs.threshold>Low</spotbugs.threshold>
Expand All @@ -42,8 +42,8 @@
<dependencies>
<dependency>
<groupId>io.jenkins.tools.bom</groupId>
<artifactId>bom-2.375.x</artifactId>
<version>2198.v39c76fc308ca</version>
<artifactId>bom-2.387.x</artifactId>
<version>2543.vfb_1a_5fb_9496d</version>
<scope>import</scope>
<type>pom</type>
</dependency>
Expand All @@ -64,7 +64,7 @@
<dependency>
<groupId>org.jvnet.hudson.plugins</groupId>
<artifactId>instant-messaging</artifactId>
<version>2.698.ve71a_06c95cec</version>
<version>2.772.vb_93c35128ff9</version>
<exclusions>
<!-- Provided by Jenkins core -->
<exclusion>
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/hudson/plugins/ircbot/v2/IRCChannel.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ public class IRCChannel implements IMChat {

private final String channelName;
private final PircListener listener;
private IRCConnection connection;
private boolean commandsAccepted;
private final IRCConnection connection;
private final boolean commandsAccepted;

public IRCChannel(String channelName, IRCConnection connection, PircListener listener, boolean commandsAccepted) {
this.channelName = channelName;
Expand All @@ -38,7 +38,7 @@ public boolean isMultiUserChat() {
return true;
}

//@Overrid
//@Override
public boolean isCommandsAccepted() {
return this.commandsAccepted;
}
Expand Down
13 changes: 9 additions & 4 deletions src/main/java/hudson/plugins/ircbot/v2/IRCConnection.java
Original file line number Diff line number Diff line change
Expand Up @@ -486,10 +486,15 @@
return;
}

IRCPrivateChat chat = new IRCPrivateChat(IRCConnection.this, listener, descriptor.getUserName(), message.getFrom());
Bot bot = new Bot(chat,
descriptor.getNick(), descriptor.getHost(),
descriptor.getCommandPrefix(), authentication);
IRCPrivateChat chat = new IRCPrivateChat(
IRCConnection.this, listener,
descriptor.getUserName(), message.getFrom());
Bot bot = new Bot(
chat,
descriptor.getNick(), descriptor.getHost(),
descriptor.getCommandPrefix(), authentication,

Check warning on line 495 in src/main/java/hudson/plugins/ircbot/v2/IRCConnection.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Not covered lines

Lines 489-495 are not covered by tests
false // Tell the bot to accept all messages, not requiring a prefix (still parsing it away if present)
);

privateChats.put(message.getFrom(), bot);

Expand Down
4 changes: 2 additions & 2 deletions src/main/java/hudson/plugins/ircbot/v2/IRCPrivateChat.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public class IRCPrivateChat implements IMChat {
private final PircListener listener;
private final String nick;
private final String chatPartner;
private IRCConnection connection;
private final IRCConnection connection;

public IRCPrivateChat(IRCConnection connection, PircListener listener, String nick, String chatPartner) {
this.connection = connection;
Expand All @@ -38,7 +38,7 @@ public boolean isMultiUserChat() {
return false;
}

//@Overrid
//@Override
public boolean isCommandsAccepted() {
return true;
}
Expand Down