Skip to content
This repository has been archived by the owner on Jul 27, 2019. It is now read-only.

Commit

Permalink
Added new log-private-chat option. #118
Browse files Browse the repository at this point in the history
  • Loading branch information
cnaude committed Dec 2, 2015
1 parent 68fa5de commit 28484f8
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/main/java/com/cnaude/purpleirc/PurpleBot.java
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ public final class PurpleBot {
public boolean showMOTD;
public boolean channelCmdNotifyEnabled;
public boolean relayPrivateChat;
public boolean logPrivateChat;
public boolean partInvalidChannels;
public boolean pingFix;
public int botServerPort;
Expand Down Expand Up @@ -703,6 +704,7 @@ private boolean loadConfig() {
sendRawMessageOnConnect = config.getBoolean("raw-message-on-connect", false);
rawMessage = config.getString("raw-message", "");
relayPrivateChat = config.getBoolean("relay-private-chat", false);
logPrivateChat = config.getBoolean("log-private-chat", false);
partInvalidChannels = config.getBoolean("part-invalid-channels", false);
pingFix = config.getBoolean("zero-width-space", false);
partInvalidChannelsMsg = config.getString("part-invalid-channels-message", "");
Expand Down Expand Up @@ -2911,6 +2913,9 @@ public void playerChat(User user, org.pircbotx.Channel channel, String target, S
plugin.logDebug("Tokenized message: " + t);
player.sendMessage(t);
ircPrivateMsgMap.put(pName, user.getNick());
if (logPrivateChat) {
plugin.logInfo("Private message from IRC: " + user.getNick() + " -> " + pName + ": " + msg);
}
} else {
asyncIRCMessage(target, "Player is offline: " + pName);
}
Expand Down Expand Up @@ -3272,6 +3277,9 @@ public void msgPlayer(Player sender, String nick, String message) {
plugin.getMsgTemplate(botNick, "", TemplateName.GAME_PCHAT), message);
asyncIRCMessage(nick, msg);
ircPrivateMsgMap.put(sender.getName(), nick);
if (logPrivateChat) {
plugin.logInfo("Private message from game: " + sender.getName() + " -> " + nick + ": " + message);
}
}

/**
Expand All @@ -3293,6 +3301,9 @@ public void msgRemotePlayer(Player sender, String remoteBot, String remotePlayer
} else {
sender.sendMessage(ChatColor.RED + "Not linked to " + ChatColor.WHITE + remoteBot);
}
if (logPrivateChat) {
plugin.logInfo("Private message from game: " + sender.getName() + " -> " + remotePlayer + ": " + message);
}
}

public void sendRemotePlayerInfo() {
Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/SampleBot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ raw-message-on-connect: false
raw-message: auth name pass
# relay-private-chat - Allow private chat to the bot to relay to the game
relay-private-chat: false
# Log private chat messages
log-private-chat: true
# notify channels or users when a player uses commands
command-notify:
enabled: false
Expand Down

0 comments on commit 28484f8

Please sign in to comment.