commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Albretch Mueller <lbrt...@gmail.com>
Subject SimpleNNTPHdr HeaderFields ...
Date Sun, 23 Sep 2012 13:32:50 GMT
 I have been using commons-net for a long time (lately 3.1) and
sometimes they tell me on newsgroups that I am not replying to the
specific comment by a user or something. I always thought they meant
my comments are not threaded/addressed to specific users (I tend to
just reply to all comments at once), but they may mean that either the
newsgroup servers I use are messing with the headers of my messages or
the way I set "References" and "In-Reply-To" in the SimpleNNTP object
is not right (see my code bellow).
~
 You can see what I mean on that post: comp.unix.shell: "trying to
parametrize find's name filter ..."
~
~
 I think all I have to do is reply to the message ID of the user's
post, which you can get by going:
~
 1) Click on the particular message
~
 2) click on ("more options") then on "Show original"
~
 3) get the message id (from the "Message-ID:
<27c7bdd0-5dc8-4bf1-a60f-9428a2860904@u2g2000pbl.googlegroups.com>"
one liner, the "<27c7bdd0-5dc8-4bf1-a60f-9428a2860904@u2g2000pbl.googlegroups.com>"
part
~
 4) to set it as the value for the "In-Reply-To" header field, a la
~
 What am I doing wrong?
~
 Could you point me to good example of how to do it right?
~
 thanks
 lbrtchx
~
~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ CODE ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
~
...
  SimpleNNTPHdr = new SimpleNNTPHeader(aFrom, aSubject);
  SimpleNNTPHdr.addNewsgroup(aNewsGroup);

  if(aOrg != null && aOrg.length() >
0){SimpleNNTPHdr.addHeaderField("Organization", aOrg);}

  if(aRefs != null && aRefs.length() >
0){SimpleNNTPHdr.addHeaderField("References",aRefs); }

  if(aReply2 != null && aReply2.length() > 0){
SimpleNNTPHdr.addHeaderField("In-Reply-To", aReply2); }

  SimpleNNTPHdr.addHeaderField("X-Newsreader", "NetComponents");

// __ then I establish the actual connection and send the message

    NNTPClnt = new NNTPClient();
    NNTPClnt.addProtocolCommandListener(new PrintCommandListener(new
PrintWriter(System.err)));

    NNTPClnt.connect(aSrvr);

    if(NNTPReply.isPositiveCompletion(NNTPClnt.getReplyCode())){
     if(NNTPClnt.isAllowedToPost()){
      FRdr = new FileReader(IFl); // local text file with the comment
I want to post
      Writer Wrtr = NNTPClnt.postArticle();
      if(Wrtr != null){
       Wrtr.write(SimpleNNTPHdr.toString());
       Util.copyReader(FRdr, Wrtr);
       Wrtr.close();
       NNTPClnt.completePendingCommand();
      }
     }
// __
     NNTPClnt.logout(); NNTPClnt.disconnect();
     FRdr.close();
    }
    else{
     NNTPClnt.disconnect();
     System.err.println("NNTP " + aSrvr + " refused connection!");
    }

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


Mime
View raw message