News-Article-NoCeM-0.09/000755 000765 000024 00000000000 13345552712 015163 5ustar00leeymstaff000000 000000 News-Article-NoCeM-0.09/LICENSE000644 000765 000024 00000013733 10154333536 016173 0ustar00leeymstaff000000 000000 The "Artistic License" Preamble The intent of this document is to state the conditions under which a Package may be copied, such that the Copyright Holder maintains some semblance of artistic control over the development of the package, while giving the users of the package the right to use and distribute the Package in a more-or-less customary fashion, plus the right to make reasonable modifications. Definitions: "Package" refers to the collection of files distributed by the Copyright Holder, and derivatives of that collection of files created through textual modification. "Standard Version" refers to such a Package if it has not been modified, or has been modified in accordance with the wishes of the Copyright Holder as specified below. "Copyright Holder" is whoever is named in the copyright or copyrights for the package. "You" is you, if you're thinking about copying or distributing this Package. "Reasonable copying fee" is whatever you can justify on the basis of media cost, duplication charges, time of people involved, and so on. (You will not be required to justify it to the Copyright Holder, but only to the computing community at large as a market that must bear the fee.) "Freely Available" means that no fee is charged for the item itself, though there may be fees involved in handling the item. It also means that recipients of the item may redistribute it under the same conditions they received it. 1. You may make and give away verbatim copies of the source form of the Standard Version of this Package without restriction, provided that you duplicate all of the original copyright notices and associated disclaimers. 2. You may apply bug fixes, portability fixes and other modifications derived from the Public Domain or from the Copyright Holder. A Package modified in such a way shall still be considered the Standard Version. 3. You may otherwise modify your copy of this Package in any way, provided that you insert a prominent notice in each changed file stating how and when you changed that file, and provided that you do at least ONE of the following: a) place your modifications in the Public Domain or otherwise make them Freely Available, such as by posting said modifications to Usenet or an equivalent medium, or placing the modifications on a major archive site such as uunet.uu.net, or by allowing the Copyright Holder to include your modifications in the Standard Version of the Package. b) use the modified Package only within your corporation or organization. c) rename any non-standard executables so the names do not conflict with standard executables, which must also be provided, and provide a separate manual page for each non-standard executable that clearly documents how it differs from the Standard Version. d) make other distribution arrangements with the Copyright Holder. 4. You may distribute the programs of this Package in object code or executable form, provided that you do at least ONE of the following: a) distribute a Standard Version of the executables and library files, together with instructions (in the manual page or equivalent) on where to get the Standard Version. b) accompany the distribution with the machine-readable source of the Package with your modifications. c) give non-standard executables non-standard names, and clearly document the differences in manual pages (or equivalent), together with instructions on where to get the Standard Version. d) make other distribution arrangements with the Copyright Holder. 5. You may charge a reasonable copying fee for any distribution of this Package. You may charge any fee you choose for support of this Package. You may not charge a fee for this Package itself. However, you may distribute this Package in aggregate with other (possibly commercial) programs as part of a larger (possibly commercial) software distribution provided that you do not advertise this Package as a product of your own. You may embed this Package's interpreter within an executable of yours (by linking); this shall be construed as a mere form of aggregation, provided that the complete Standard Version of the interpreter is so embedded. 6. The scripts and library files supplied as input to or produced as output from the programs of this Package do not automatically fall under the copyright of this Package, but belong to whoever generated them, and may be sold commercially, and may be aggregated with this Package. If such scripts or library files are aggregated with this Package via the so-called "undump" or "unexec" methods of producing a binary executable image, then distribution of such an image shall neither be construed as a distribution of this Package nor shall it fall under the restrictions of Paragraphs 3 and 4, provided that you do not represent such an executable image as a Standard Version of this Package. 7. C subroutines (or comparably compiled subroutines in other languages) supplied by you and linked into this Package in order to emulate subroutines and variables of the language defined by this Package shall not be considered part of this Package, but are the equivalent of input as in Paragraph 6, provided these subroutines do not change the language in any way that would cause it to fail the regression tests for the language. 8. Aggregation of this Package with a commercial distribution is always permitted provided that the use of this Package is embedded; that is, when no overt attempt is made to make this Package's interfaces visible to the end user of the commercial distribution. Such use shall not be construed as a distribution of this Package. 9. The name of the Copyright Holder may not be used to endorse or promote products derived from this software without specific prior written permission. 10. THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. The End News-Article-NoCeM-0.09/Changes000644 000765 000024 00000001666 13345551076 016471 0ustar00leeymstaff000000 000000 Revision history for Perl extension News::Article::NoCeM 0.09 Mon Sep 10 13:20:19 PDT 2018 - ignore $version if it is uninitialized - fix typo Patch submitted by: florian.schlichting@fu-berlin.de 0.08 Sat Jun 24 03:53:39 CST 2006 - getting married today :D - indicate that it's encoding with SHA1 Patch submitted by: tskirvin@killfile.org 0.07 Thu Apr 7 22:33:21 CST 2005 - correct the version 0.06 Thu Apr 7 15:13:21 CST 2005 - support calling ihave() in issue() Requested by: gslin 0.05 Thu Apr 7 14:21:33 CST 2005 - nuke msgid before call add_message_id() - add more tests, now 1..4 0.04 Mon Dec 20 21:55:42 CST 2004 - fix wrong format in sign() Noticed by: Alica.bbs@bbs.hs.ntnu.edu.tw 0.03 Tue Dec 7 16:33:54 CST 2004 - add manpage 0.02 Mon Dec 6 10:01:56 CST 2004 - main implementation completed without documantation 0.01 Sat Dec 4 21:11:45 CST 2004 - original released version, using code from newslib News-Article-NoCeM-0.09/MANIFEST000644 000765 000024 00000000351 13345552712 016313 0ustar00leeymstaff000000 000000 Changes LICENSE MANIFEST Makefile.PL NoCeM.pm README.txt test.pl META.yml Module YAML meta-data (added by MakeMaker) META.json Module JSON meta-data (added by MakeMaker) News-Article-NoCeM-0.09/NoCeM.pm000644 000765 000024 00000014565 13345551140 016467 0ustar00leeymstaff000000 000000 package News::Article::NoCeM; $VERSION = '0.09'; # -*- Perl -*- Sat Dec 4 21:11:45 CST 2004 ############################################################################# # Written by Yen-Ming Lee # Based on a module by Tim Skirvin , and relying almost # exclusively on the News::Article package written by Andrew Gierth # . Thanks, folks. # # Copyright 2004-2005 Yen-Ming Lee. Redistribution terms are in the # documentation, and I'm sure you can find them. ############################################################################# =head1 NAME News::Article::NoCeM - a module to generate accurate nocem notices =head1 SYNOPSIS use News::Article::NoCeM; my $nocem = new News::Article::NoCeM(); $nocem->hide($type, $spam); $nocem->make_notice($type, $name, $issuer, $group, $prefix); $nocem->sign($keyid, $passphrase); $nocem->issue($conn, $ihave); =head1 DESCRIPTION Creates a nocem notice on the Usenet articles, which may be posted normally to hide the messages. =head1 USAGE =over 2 =item use News::Article::NoCeM; =back News::Article::NoCeM is class that inherits News::Article and adds four new functions: hide(), make_notice(), sign() and issue(), redefine to disable two functions: post() and ihave(). =cut require 5; # Requires Perl 5 use News::Article; use PGP::Sign; use Exporter; use strict; use vars qw( @ISA @EXPORT @EXPORT_OK $VERSION ); @ISA = qw( Exporter News::Article ); =head2 Article Methods =over 4 =item hide ( TYPE, ARTICLE, [ARTICLE, ...] ) Hide one or more articles in the given C. C
is an News::Article object that going to be hid. hide() will skip the articles without Newsgroup or Message-ID and skip the ones already hid. hide() returns the number of the articles hid. =cut sub hide { my $self = shift; my $type = shift; my @articles = @_; my $num; foreach my $article (@articles) { my $newsgroups = $article->header('newsgroups'); my $message_id = $article->header('message-id'); next if !$newsgroups || !$message_id; next if $self->{'NoCeM'}->{$type}->{$message_id}; $self->{'NoCeM'}->{$type}->{$message_id} = $newsgroups; ++$num; } return $num; } push @EXPORT, qw( hide ); =item post =item ihave post() and ihave() is disabled in News::Article::NoCeM. Please use issue() instead. =cut sub post { my $self = shift; die "You should use issue(conn, 0) instead of post() in " . ref($self) . "\n"; } push @EXPORT, qw( post ); sub ihave { my $self = shift; die "You should use issue(conn, 1) instead of ihave() in " . ref($self) . "\n"; } push @EXPORT, qw( ihave ); =item make_notice ( TYPE, NAME, GROUP, ISSUER, [ PREFIX ] ) Retrieve articles marked by hide with C, and make a notice fot them. If there's only one type within a container, then the container itself can be a notice. C is the identifier of the issuer. C is the newsgroup the you will post nocem notice to. C is the email address of the issuer. C is the announcement before the nocem notice, which may explain the criteria of this notice, or where to find your public key for PGP verification. make_notice() returns a News::Article::NoCeM object if success, and return undef if no article is hid. =cut sub make_notice { my $self = shift; my $type = shift; my $name = shift; my $group = shift; my $issuer = shift; my $prefix = shift; my $now = time(); my $ncmid = "$name-$type.$now"; my $count = scalar keys %{ $self->{'NoCeM'}->{$type} }; return if !$count; $self->set_body(); $self->add_body($prefix); $self->add_body(""); $self->add_body("\@\@BEGIN NCM HEADERS Version: 0.9 Issuer: $issuer Type: $type Action: hide Count: $count Notice-ID: $ncmid \@\@BEGIN NCM BODY"); foreach my $msgid (keys %{ $self->{'NoCeM'}->{$type} }) { my @groups = split(',', $self->{'NoCeM'}->{$type}->{$msgid}); $self->add_body("$msgid\t" . shift(@groups)); foreach my $g (@groups) { $self->add_body("\t$g"); } } $self->add_body("\@\@END NCM BODY"); $self->set_headers('Subject', "\@\@NCM $name-$type NoCeM notice $now"); $self->set_headers('Newsgroups', $group); $self->set_headers('From', $issuer); $self->set_headers('X-Issued-By', ref($self) . "-" . $VERSION); $self->set_headers('Path', "nocem!not-for-mail"); $self->add_date(); delete($self->{Headers}{'message-id'}); $self->add_message_id(); return $self; } push @EXPORT, qw( make_notice ); =item sign ( KEYID, PASSPHRASE ) Sign the content of the nocem notice with C and C. Please make sure that the issuer's public/secret keyring is ready. sign() returns a News::Article::NoCeM object if success, and return undef if no article is hid, or pgp_sign failed. =cut sub sign { my $self = shift; my $keyid = shift; my $passphrase = shift; return if !scalar(@{$self->body()}); my $body = join("\n", @{$self->body()}) . "\n"; my ($signature, $version) = pgp_sign($keyid, $passphrase, $body); return if !$signature; $self->set_body(); $self->add_body("-----BEGIN PGP SIGNED MESSAGE-----"); $self->add_body("Hash: SHA1"); $self->add_body(""); $self->add_body($body); $self->add_body(""); $self->add_body("-----BEGIN PGP SIGNATURE-----"); $self->add_body("Version: $version") if $version; $self->add_body(""); $self->add_body($signature); $self->add_body("-----END PGP SIGNATURE-----"); return $self; } push @EXPORT, qw( sign ); =item issue ( [ CONN, IHAVE ] ) Take optional C as a Net::NNTP object and issue the nocem notice. C indicates that call Net::NNTP::ihave() for submitting the notice, otherwise issue() will call News::Article::post() by default. issue() return the result of News::Article::post() or issue(). =back =cut sub issue { my $self = shift; my $conn = shift; my $ihave = shift; return if !scalar(@{$self->body()}); return $ihave ? $self->SUPER::ihave($conn) : $self->SUPER::post($conn); } push @EXPORT, qw( issue ); =head1 NOTES Standard article manipulation information can be read in the News::Article manpages. NoCeM FAQ is available on the web at . =head1 AUTHOR Written by Yen-Ming Lee , based on a module by Tim Skirvin . =head1 COPYRIGHT Copyright 2004-2005 by Yen-Ming Lee . This code may be redistributed under the same terms as Perl itself. =cut 1; News-Article-NoCeM-0.09/test.pl000644 000765 000024 00000002755 10225243260 016475 0ustar00leeymstaff000000 000000 # Before `make install' is performed this script should be runnable with # `make test'. After `make install' it should work as `perl test.pl' ######################### We start with some black magic to print on failure. # Change 1..1 below to 1..last_test_to_print . # (It may become useful if the test is moved to ./t subdirectory.) BEGIN { $| = 1; print "1..4\n"; } END {print "not ok 1\n" unless $loaded;} use News::Article::NoCeM; $loaded = 1; print "ok 1\n"; # the spam article my $article = new News::Article; # the nocem notice my $nocem = new News::Article::NoCeM; printf "%sok 2\n", $nocem ? "" : "not "; $article->set_headers('Newsgroups', 'the.spammed.group'); $article->set_headers('From', 'Spam '); $article->set_headers('Subject', 'This is a spam'); $article->add_date(); $article->add_message_id(); my $hid = $nocem->hide('spam', $article); printf "%sok 3\n", $hid ? "" : "not "; my $notice = $nocem->make_notice('spam', 'SpamKiller', 'the.nocem.group', 'nocem-issuer@email.address', 'This is a notice'); printf "%sok 4\n", $notice ? "" : "not "; # If you want to test it, please make sure your PGP key is ready. #$nocem->sign('YourKeyId', 'YourPassPhrase'); # If you want to see the content of nocem notice, you'll need this. #use Data::Dumper; #print Dumper(\$nocem); ######################### End of black magic. # Insert your test code below (better if it prints "ok 13" # (correspondingly "not ok 13") depending on the success of chunk 13 # of the test code): News-Article-NoCeM-0.09/META.yml000644 000765 000024 00000000727 13345552712 016442 0ustar00leeymstaff000000 000000 --- abstract: unknown author: - unknown build_requires: ExtUtils::MakeMaker: 0 configure_requires: ExtUtils::MakeMaker: 0 dynamic_config: 1 generated_by: 'ExtUtils::MakeMaker version 6.66, CPAN::Meta::Converter version 2.133380' license: unknown meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html version: 1.4 name: News-Article-NoCeM no_index: directory: - t - inc requires: News::Article: 1.27 PGP::Sign: 0.19 version: 0.09 News-Article-NoCeM-0.09/Makefile.PL000644 000765 000024 00000001046 10154516501 017125 0ustar00leeymstaff000000 000000 use ExtUtils::MakeMaker; # See lib/ExtUtils/MakeMaker.pm for details of how to influence # the contents of the Makefile that is written. WriteMakefile( 'NAME' => 'News::Article::NoCeM', 'DISTNAME' => 'News-Article-NoCeM', 'MAN3PODS' => { 'NoCeM.pm' => '$(INST_MAN3DIR)/News::Article::NoCeM.3' }, 'VERSION_FROM' => 'NoCeM.pm', 'PREREQ_PM' => { 'News::Article' => 1.27, 'PGP::Sign' => 0.19 }, 'PM' => { 'NoCeM.pm' => '$(INST_LIBDIR)/NoCeM.pm' }, 'dist' => { COMPRESS => 'gzip', SUFFIX => 'gz' }, ); News-Article-NoCeM-0.09/README.txt000644 000765 000024 00000001174 10154334076 016660 0ustar00leeymstaff000000 000000 News::Article::NoCeM ================================= News::Article::NoCeM is a library of perl modules for managing NoCeM notice in Network News services. It's meant to be used for code-reuse and sharing when writing news-based applications. It currently includes: News::Article::NoCeM Generate accurate nocem notices Installation Instructions ========================= If you've got perl installed, it's easy: perl Makefile.PL make make test sudo make install (If you don't have sudo installed, run the final command as root.) If you don't have perl installed, then go install it and start over. It'll do you good. News-Article-NoCeM-0.09/META.json000644 000765 000024 00000001555 13345552712 016612 0ustar00leeymstaff000000 000000 { "abstract" : "unknown", "author" : [ "unknown" ], "dynamic_config" : 1, "generated_by" : "ExtUtils::MakeMaker version 6.66, CPAN::Meta::Converter version 2.133380", "license" : [ "unknown" ], "meta-spec" : { "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", "version" : "2" }, "name" : "News-Article-NoCeM", "no_index" : { "directory" : [ "t", "inc" ] }, "prereqs" : { "build" : { "requires" : { "ExtUtils::MakeMaker" : "0" } }, "configure" : { "requires" : { "ExtUtils::MakeMaker" : "0" } }, "runtime" : { "requires" : { "News::Article" : "1.27", "PGP::Sign" : "0.19" } } }, "release_status" : "stable", "version" : "0.09" }