Changeset b7ff82eb


Ignore:
Timestamp:
Sep 26, 2018 2:16:05 PM (23 months ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
b82ace8
Parents:
f7ae675
Message:

IRC: Make inbound whitelist static

File:
1 edited

Legend:

Unmodified
Added
Removed
  • apps/i2ptunnel/java/src/net/i2p/i2ptunnel/irc/IRCFilter.java

    rf7ae675 rb7ff82eb  
    2525    private static final boolean ALLOW_ALL_CTCP_OUT = false;
    2626
    27     /*************************************************************************
    28      *
    29      *  Modify or filter a single inbound line.
    30      *
    31      *  @param helper may be null
    32      *  @return the original or modified line, or null if it should be dropped.
    33      */
    34     public static String inboundFilter(String s, StringBuffer expectedPong, DCCHelper helper) {
    35        
    36         String field[] = DataHelper.split(s, " ", 4);
    37         String command;
    38         int idx=0;
     27    private static final Set<String> _allowedInbound;
     28    static {
    3929        final String[] allowedCommands =
    4030        {
     
    5848                "AWAY"
    5949        };
     50        _allowedInbound = new HashSet<String>(Arrays.asList(allowedCommands));
     51    }
     52
     53    /*************************************************************************
     54     *
     55     *  Modify or filter a single inbound line.
     56     *
     57     *  @param helper may be null
     58     *  @return the original or modified line, or null if it should be dropped.
     59     */
     60    public static String inboundFilter(String s, StringBuffer expectedPong, DCCHelper helper) {
     61       
     62        String field[] = DataHelper.split(s, " ", 4);
     63        String command;
     64        int idx=0;
    6065       
    6166
     
    95100       
    96101        // Allow all allowedCommands
    97         for(int i=0;i<allowedCommands.length;i++) {
    98             if(allowedCommands[i].equals(command))
     102        if (_allowedInbound.contains(command)) {
    99103                return s;
    100104        }
Note: See TracChangeset for help on using the changeset viewer.