Skip to content
Permalink
Browse files

Added "disallowPrivateChat" for disallow commands from private chat.

  • Loading branch information
askeing committed Mar 31, 2013
1 parent 323ab68 commit 7d853dbdb1b6adbadeb752ed568863d92ec99044
@@ -168,6 +168,8 @@ protected Object readResolve() {

private boolean ssl;

private boolean disallowPrivateChat;

private String login = "PircBotx";

String password = null;
@@ -274,6 +276,8 @@ public boolean configure(StaplerRequest req, JSONObject formData) throws FormExc
this.commandPrefix = req.getParameter("irc_publisher.commandPrefix");
this.commandPrefix = Util.fixEmptyAndTrim(commandPrefix);

this.disallowPrivateChat = "on".equals(req.getParameter("irc_publisher.disallowPrivateChat"));

String[] channelsNames = req.getParameterValues("irc_publisher.channel.name");
String[] channelsPasswords = req.getParameterValues("irc_publisher.channel.password");
// only checked state can be queried, unchecked state are ignored and the size of
@@ -461,6 +465,10 @@ public int getPort() {
public boolean isSsl() {
return this.ssl;
}

public boolean isDisallowPrivateChat() {
return this.disallowPrivateChat;
}

//@Override
public boolean isEnabled() {
@@ -306,6 +306,10 @@ public void setPresence(IMPresence presence, String statusMessage)

//@Override
public void onMessage(IMMessage message) {
if(descriptor.isDisallowPrivateChat()) {
return;
}

if(!message.getTo().equals(descriptor.getNick())) {
throw new IllegalStateException("Intercepted message to '" + message.getTo()
+ "'. That shouldn't happen!");
@@ -63,7 +63,9 @@
help="/plugin/ircbot/help-globalConfigCommandPrefix.html">
<f:textbox name="irc_publisher.commandPrefix" value="${descriptor.getCommandPrefix()}" />
</f:entry>

<f:entry title="Disallow Private Chat" description="Disallow bot commands from private chat.">
<f:checkbox name="irc_publisher.disallowPrivateChat" checked="${descriptor.disallowPrivateChat}"/>
</f:entry>
<super:global-jenkinsLogin />

<f:entry title="Notification charset" description="The character set to use for notifications">

0 comments on commit 7d853db

Please sign in to comment.
You can’t perform that action at this time.