X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=webcit%2Flistsub.c;h=66d03aac8faa70da74007dbfc0fb5eb6300369a2;hb=bc17ed696720ce8a4726f6aaa70171f061319763;hp=3f927a5b178e11df9a64f38587c6c1b4f6ecf021;hpb=c1b0b859188c2eee353d12d3a659efc36448084d;p=citadel.git diff --git a/webcit/listsub.c b/webcit/listsub.c index 3f927a5b1..66d03aac8 100644 --- a/webcit/listsub.c +++ b/webcit/listsub.c @@ -1,22 +1,10 @@ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +/* + * $Id$ + * + * Web forms for handling mailing list subscribe/unsubscribe requests. + * + */ + #include "webcit.h" @@ -26,11 +14,13 @@ */ void do_listsub(void) { - char cmd[SIZ]; - char room[SIZ]; - char token[SIZ]; - char email[SIZ]; - char subtype[SIZ]; + char cmd[256]; + char room[256]; + char token[256]; + char email[256]; + char subtype[256]; + char escaped_email[256]; + char escaped_room[256]; char buf[SIZ]; int self; @@ -40,7 +30,9 @@ void do_listsub(void) strcpy(WC->wc_password, ""); strcpy(WC->wc_roomname, ""); - wprintf("List subscription\n"); + wprintf(""); + wprintf(_("List subscription")); + wprintf("\n"); strcpy(cmd, bstr("cmd")); strcpy(room, bstr("room")); @@ -49,43 +41,48 @@ void do_listsub(void) strcpy(subtype, bstr("subtype")); wprintf("
" - "
" - "List subscribe/unsubscribe\n" - "

\n" - ); + "
" + ""); + wprintf(_("List subscribe/unsubscribe")); + wprintf("

\n"); /* * Subscribe command */ if (!strcasecmp(cmd, "subscribe")) { - serv_printf("SUBS subscribe|%s|%s|digest|%s/listsub", + serv_printf("SUBS subscribe|%s|%s|%s|%s://%s/listsub", room, email, + subtype, + (is_https ? "https" : "http"), WC->http_host ); - serv_gets(buf); + serv_getln(buf, sizeof buf); if (buf[0] == '2') { - wprintf("

Confirmation request sent

" - "You are subscribing "); - escputs(email); - wprintf(" to the ""); - escputs(room); - wprintf("" mailing list. The listserver has " + stresc(escaped_email, email, 0, 0); + stresc(escaped_room, room, 0, 0); + + wprintf("

"); + wprintf(_("Confirmation request sent")); + wprintf("

"); + wprintf(_("You are subscribing %s" + " to the %s mailing list. " + "The listserver has " "sent you an e-mail with one additional " "Web link for you to click on to confirm " "your subscription. This extra step is for " "your protection, as it prevents others from " "being able to subscribe you to lists " - "without your consent.

" + "without your consent.

" "Please click on the link which is being " "e-mailed to you and your subscription will " - "be confirmed.
\n" - ); + "be confirmed.
\n"), + escaped_email, escaped_room); + wprintf("%s
\n", _("Go back...")); } else { wprintf("ERROR: %s" - "

\n", + "

\n", &buf[4]); goto FORM; } @@ -95,12 +92,13 @@ void do_listsub(void) * Unsubscribe command */ else if (!strcasecmp(cmd, "unsubscribe")) { - serv_printf("SUBS unsubscribe|%s|%s|%s/listsub", + serv_printf("SUBS unsubscribe|%s|%s|%s://%s/listsub", room, email, + (is_https ? "https" : "http"), WC->http_host ); - serv_gets(buf); + serv_getln(buf, sizeof buf); if (buf[0] == '2') { wprintf("

Confirmation request sent

" "You are unsubscribing "); @@ -113,15 +111,16 @@ void do_listsub(void) "your unsubscription. This extra step is for " "your protection, as it prevents others from " "being able to unsubscribe you from " - "lists without your consent.

" + "lists without your consent.

" "Please click on the link which is being " "e-mailed to you and your unsubscription will " - "be confirmed.
\n" + "be confirmed.
\n" + "Back...
\n" ); } else { wprintf("ERROR: %s" - "

\n", + "

\n", &buf[4]); goto FORM; } @@ -135,21 +134,31 @@ void do_listsub(void) room, token ); - serv_gets(buf); + serv_getln(buf, sizeof buf); if (buf[0] == '2') { wprintf("

Confirmation successful!

"); } else { - wprintf("

Confirmation failed.

"); + wprintf("

Confirmation failed.

" + "This could mean one of two things:
    \n" + "
  • You waited too long to confirm your " + "subscribe/unsubscribe request (the " + "confirmation link is only valid for three " + "days)\n
  • You have already " + "successfully confirmed your " + "subscribe/unsubscribe request and are " + "attempting to do it again.
\n" + "The error returned by the server was: " + ); } - wprintf("%s

\n", &buf[4]); + wprintf("%s

\n", &buf[4]); } /* * Any other (invalid) command causes the form to be displayed */ else { -FORM: wprintf("
\n" +FORM: wprintf("\n" "\n" ); @@ -157,10 +166,10 @@ FORM: wprintf("\n" "
" + "(If subscribing) preferred format: " + "One message at a time  " + "Digest format  " + "
\n" "\n" "\n" "
\n" ); - wprintf("
When you attempt to subscribe or unsubscribe to " + wprintf("
When you attempt to subscribe or unsubscribe to " "a mailing list, you will receive an e-mail containing" " one additional web link to click on for final " "confirmation. This extra step is for your " "protection, as it prevents others from being able to " - "subscribe or unsubscribe you to lists.
\n" + "subscribe or unsubscribe you to lists.
\n" ); }