org/sonews/daemon/command/PostCommand.java
changeset 18 7e527fdf0fa8
parent 15 f2293e8566f5
child 19 91dc9acb03ed
     1.1 --- a/org/sonews/daemon/command/PostCommand.java	Thu Aug 20 22:18:45 2009 +0200
     1.2 +++ b/org/sonews/daemon/command/PostCommand.java	Fri Aug 21 17:33:15 2009 +0200
     1.3 @@ -178,48 +178,6 @@
     1.4              state = PostState.Finished;
     1.5              break;
     1.6            }
     1.7 -          
     1.8 -          // Check if this message is a MIME-multipart message and needs a
     1.9 -          // charset change
    1.10 -          /*try
    1.11 -          {
    1.12 -            line = line.toLowerCase(Locale.ENGLISH);
    1.13 -            if(line.startsWith(Headers.CONTENT_TYPE))
    1.14 -            {
    1.15 -              int idxStart = line.indexOf("charset=") + "charset=".length();
    1.16 -              int idxEnd   = line.indexOf(";", idxStart);
    1.17 -              if(idxEnd < 0)
    1.18 -              {
    1.19 -                idxEnd = line.length();
    1.20 -              }
    1.21 -
    1.22 -              if(idxStart > 0)
    1.23 -              {
    1.24 -                String charsetName = line.substring(idxStart, idxEnd);
    1.25 -                if(charsetName.length() > 0 && charsetName.charAt(0) == '"')
    1.26 -                {
    1.27 -                  charsetName = charsetName.substring(1, charsetName.length() - 1);
    1.28 -                }
    1.29 -
    1.30 -                try
    1.31 -                {
    1.32 -                  conn.setCurrentCharset(Charset.forName(charsetName));
    1.33 -                }
    1.34 -                catch(IllegalCharsetNameException ex)
    1.35 -                {
    1.36 -                  Log.msg("PostCommand: " + ex, false);
    1.37 -                }
    1.38 -                catch(UnsupportedCharsetException ex)
    1.39 -                {
    1.40 -                  Log.msg("PostCommand: " + ex, false);
    1.41 -                }
    1.42 -              } // if(idxStart > 0)
    1.43 -            }
    1.44 -          }
    1.45 -          catch(Exception ex)
    1.46 -          {
    1.47 -            ex.printStackTrace();
    1.48 -          }*/
    1.49          }
    1.50          break;
    1.51        }
    1.52 @@ -292,6 +250,15 @@
    1.53      }
    1.54      else // Post the article regularily
    1.55      {
    1.56 +      // Circle check; note that Path can already contain the hostname here
    1.57 +      String host = Config.inst().get(Config.HOSTNAME, "localhost");
    1.58 +      if(article.getHeader(Headers.PATH)[0].contains(host + "!"))
    1.59 +      {
    1.60 +        Log.get().info(article.getMessageID() + " skipped for host " + host);
    1.61 +        conn.println("441 I know this article already");
    1.62 +        return;
    1.63 +      }
    1.64 +
    1.65        // Try to create the article in the database or post it to
    1.66        // appropriate mailing list
    1.67        try