Subject: Re: [PATCH] send-email: support NNTP

From: [email-masked] (Łukasz Stelmach)
Date: Thu, 25 Apr 2013 08:56:26 +0200

It was <2013-04-24 śro 18:17>, when Junio C Hamano wrote:
> [email-masked] (Łukasz Stelmach) writes:
>
>> It was <2013-04-23 wto 17:02>, when Junio C Hamano wrote:
>>> Łukasz Stelmach <[email-masked]> writes:
>>>
>>>> Enable sending patches to NNTP servers (Usenet, Gmane).
>>>> ---
>>>>
>>>> The patch implements support for sending messages to groups on NNTP
>>>> serviers.
>>>
>>> Cute.
>>>
>>> A Perl guru might want to encapsulate the differences between $smtp
>>> and $nntp codepaths into two Perl modules, but it looks like a good
>>> starting point.
>>
>> You mean *one* perl module like Git::EmailTransport which hides the
>> differences.
>
> What I meant was one class to handle SMTP and another for NNTP.
>
> You look at the --protocol option, choose one of these classes, and
> initialize an instance of the chosen class.
>
> You can ask the chosen class to instantiate an instance without
> if/else cascade like this:
>
> +
> +# Transport specific setup
> +my ($email_authuser, $email_authpass);
> +if ($email_protocol eq 'nntp') {
> +    $email_authuser = $nntp_authuser;
> +    $email_authuser = $nntp_authuser;
> +    @initial_to = @initial_cc = @bcclist = ();
> +    $to_cmd = $cc_cmd = undef;
> +    $no_cc = $no_bcc = 1;
> +} else {
> +    $email_authuser = $smtp_authuser;
> +    $email_authpass = $smtp_authpass;
> +    $newsgroups_cmd = undef;
> +}
> +

[...]

OK, I see. Good point. Where would you recommend me to put these modules
and how to name them? I mean I don't want to make to much mess here (;

-- 
Łukasz Stelmach
Software wizzard
Samsung Poland R&D Center