java.lang.Object
net.i2p.i2ptunnel.irc.IRCFilter
Static methods to filter individual lines. Moved from I2PTunnelIRCClient.java.
Field Summary
FieldsModifier and TypeFieldDescriptionCommands accepted from the remote side.Commands accepted from the local side.private static final booleanDoes not override DCC handling.private static final booleanDoes not override DCC handling.private static final booleanWhether inbound DCC connections are allowed at all.Constructor Summary
ConstructorsConstructorDescriptionConstructor for subclasses; the line filters in this base class are static.Method Summary
Modifier and TypeMethodDescriptionprivate static StringfilterDCCIn(String pfx, String msg, DCCHelper helper) DCC CHAT chat xxx.b32.i2p i2p-port -> DCC CHAT chat IP port DCC SEND file xxx.b32.i2p i2p-port length -> DCC SEND file IP port length DCC RESUME file i2p-port offset -> DCC RESUME file port offset DCC ACCEPT file i2p-port offset -> DCC ACCEPT file port offset DCC xxx -> null.private static StringfilterDCCOut(String pfx, String msg, DCCHelper helper) DCC CHAT chat IP port -> DCC CHAT chat xxx.b32.i2p i2p-port DCC SEND file IP port length -> DCC SEND file xxx.b32.i2p i2p-port length DCC RESUME file port offset -> DCC RESUME file i2p-port offset DCC ACCEPT file port offset -> DCC ACCEPT file i2p-port offset DCC xxx -> null.private static StringfilterPing(String[] field, int idx, StringBuffer expectedPong) Rewrite a PING so the server replies to a nonce we remember.private static StringfilterPrivmsgOrNotice(String s, String[] field, int idx, DCCHelper helper) Allow PRIVMSG/NOTICE, blocking CTCP (except ACTION, DCC, and XDCC).private static StringfilterUser(String s, String[] field, int idx) Sanitize a USER line, replacing hostname and servername.static StringinboundFilter(String s, StringBuffer expectedPong, DCCHelper helper) Modify or filter a single inbound line.static StringoutboundFilter(String s, StringBuffer expectedPong, DCCHelper helper) Modify or filter a single outbound line.
Field Details
ALLOW_ALL_DCC_IN
private static final boolean ALLOW_ALL_DCC_INWhether inbound DCC connections are allowed at all.- See Also:
ALLOW_ALL_CTCP_IN
private static final boolean ALLOW_ALL_CTCP_INDoes not override DCC handling.- See Also:
ALLOW_ALL_CTCP_OUT
private static final boolean ALLOW_ALL_CTCP_OUTDoes not override DCC handling.- See Also:
_allowedInbound
_allowedOutbound
Constructor Details
IRCFilter
IRCFilter()Constructor for subclasses; the line filters in this base class are static.
Method Details
inboundFilter
Modify or filter a single inbound line.- Parameters:
s- the single inbound line to filter, without its trailing newlineexpectedPong- holds the PONG token a three field PING expects back; reset on usehelper- may be null- Returns:
- the original or modified line, or null if it should be dropped.
outboundFilter
Modify or filter a single outbound line.- Parameters:
s- the single outbound line to filter, without its trailing newlineexpectedPong- cleared, then filled by filterPing with the PONG a 3-field PING expectshelper- may be null- Returns:
- the original or modified line, or null if it should be dropped.
filterPing
Rewrite a PING so the server replies to a nonce we remember. Rewriting avoids sending our proxy's IP address in the PONG.- Parameters:
field- the split lineidx- index of the command in fieldexpectedPong- filled with the expected PONG for a 3-field PING- Returns:
- the rewritten line, or null if it should be dropped
filterPrivmsgOrNotice
Allow PRIVMSG/NOTICE, blocking CTCP (except ACTION, DCC, and XDCC).- Parameters:
s- the original linefield- the split lineidx- index of the command in fieldhelper- may be null- Returns:
- the original or rewritten line, or null if it should be dropped
filterUser
filterDCCIn
DCC CHAT chat xxx.b32.i2p i2p-port -> DCC CHAT chat IP port DCC SEND file xxx.b32.i2p i2p-port length -> DCC SEND file IP port length DCC RESUME file i2p-port offset -> DCC RESUME file port offset DCC ACCEPT file i2p-port offset -> DCC ACCEPT file port offset DCC xxx -> null.
- Parameters:
pfx- the message through the "DCC " partmsg- the message after the "DCC " parthelper- may be null- Returns:
- the sanitized message or null to block
filterDCCOut
DCC CHAT chat IP port -> DCC CHAT chat xxx.b32.i2p i2p-port DCC SEND file IP port length -> DCC SEND file xxx.b32.i2p i2p-port length DCC RESUME file port offset -> DCC RESUME file i2p-port offset DCC ACCEPT file port offset -> DCC ACCEPT file i2p-port offset DCC xxx -> null.
- Parameters:
pfx- the message through the "DCC " partmsg- the message after the "DCC " parthelper- may be null- Returns:
- the sanitized message or null to block