/[suikacvs]/messaging/suikawari/wari.pl
Suika

Diff of /messaging/suikawari/wari.pl

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.5 by wakaba, Wed Jul 24 12:14:48 2002 UTC revision 1.6 by wakaba, Thu Aug 29 12:12:04 2002 UTC
# Line 77  for (@module) { Line 77  for (@module) {
77    my $latest_time = $plog->field ($_, -new_item_unless_exist => 0);    my $latest_time = $plog->field ($_, -new_item_unless_exist => 0);
78    dprint 'Latest-Posted-Date: '.$latest_time;    dprint 'Latest-Posted-Date: '.$latest_time;
79    for ($b->make_msgs) {    for ($b->make_msgs) {
     $_->option (format => 'news-usefor', -recursive => 1);  
     $_->header->field ('x-shimbun-agent')->add ($MYNAME => $VERSION);  
80      my $t = $_->header->field ('date');      my $t = $_->header->field ('date');
81      next if $latest_time >= $t;      next if 0+$latest_time >= 0+$t;
     $nntp = open_nntp () unless ref $nntp;  
     vprint 'Date: '.$t;  
     #dprint 'Subject: '.$_->header->field ('subject');  
     send_msg ($_ => $nntp);  
82      $time = $t if $t > $time || !$time;      $time = $t if $t > $time || !$time;
83        vprint 'Date: '.$t;
84        
85        $_->header->field ('x-shimbun-agent')->add ($MYNAME => $VERSION);
86        
87        $_->option (format => 'news-usefor', -recursive => 1);
88        send_msg_nntp ($_ => $nntp);
89    }    }
90    $plog->replace ($_ => $time) if $time > $latest_time;    $plog->replace ($_ => $time) if $time > $latest_time;
91  }  }
# Line 96  open LOG, '> '.$posted_log or die "$0: $ Line 96  open LOG, '> '.$posted_log or die "$0: $
96    print LOG $plog;    print LOG $plog;
97  close LOG;  close LOG;
98    
99  sub send_msg ($$) {  sub send_msg_nntp ($$) {
100    my $msg = shift;    my $msg = shift;
101      $_[0] = open_nntp () unless ref $_[0];
102    my $nntp = shift;    my $nntp = shift;
103    dprint "Posting Message...";    dprint "Posting Message...";
104    my @m = map {$_."\n"} split /\x0D\x0A/, $msg;    my @m = map {$_."\n"} split /\x0D\x0A/, $msg;
# Line 123  sub open_nntp () { Line 124  sub open_nntp () {
124  sub close_nntp ($) {  sub close_nntp ($) {
125    my $nntp = shift;    my $nntp = shift;
126    return unless ref $nntp;    return unless ref $nntp;
127      vprint "Disconnect to $NNTP_SERVER";
128    $nntp->quit;    $nntp->quit;
129    vprint ${*$nntp}{'net_cmd_code'}, @{${*$nntp}{'net_cmd_resp'}};    vprint ${*$nntp}{'net_cmd_code'}, @{${*$nntp}{'net_cmd_resp'}};
130  }  }

Legend:
Removed from v.1.5  
changed lines
  Added in v.1.6

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24