{
int opt;
int normal = 0, digest = 0, nomail = 0, subbed;
- int confirmunsub = 0, unsubconfirm = 0, notifysub = 0;
+ int unsubconfirm = 0, notifysub = 0;
int changeuid = 1, quiet = 0;
- int nogennotsubscribed = 0;
+ bool inform_not_subscribed = true;
+ bool send_goodbye_mail = false;
char *address = NULL;
const char *subdir;
enum subtype typesub = SUB_ALL;
address = optarg;
break;
case 'c':
- confirmunsub = 1;
+ send_goodbye_mail = true;
break;
case 'C':
unsubconfirm = 1;
reasonsub = SUB_CONFIRM;
break;
case 's':
- nogennotsubscribed = 1;
+ inform_not_subscribed = false;
break;
case 'U':
changeuid = 0;
typesub = SUB_NORMAL;
- if(confirmunsub && unsubconfirm) {
+ if(send_goodbye_mail && unsubconfirm) {
errx(EXIT_FAILURE, "Cannot specify both -C and -c\n"
"%s -h for help", argv[0]);
}
if(!subbed) {
/* Address is not subscribed */
- if(!nogennotsubscribed)
+ if(inform_not_subscribed)
generate_subscription(&ml, address, typesub, false);
exit(EXIT_SUCCESS);
}
unsubscribe(ml.fd, address, typesub);
- if(confirmunsub)
- confirm_sub(&ml, address, typesub, reasonsub, false);
+ if(send_goodbye_mail)
+ send_confirmation_mail(&ml, address, typesub, reasonsub, false);
notifysub = !quiet && statctrl(ml.ctrlfd, "notifysub");
ATF_TC_WITHOUT_HEAD(send_single_mail);
ATF_TC_WITHOUT_HEAD(generate_subscription);
ATF_TC_WITHOUT_HEAD(generate_subconfirm);
-ATF_TC_WITHOUT_HEAD(confirm_sub);
+ATF_TC_WITHOUT_HEAD(send_confirmation_mail);
ATF_TC_WITHOUT_HEAD(listcontrol);
ATF_TC_WITHOUT_HEAD(send_help);
ATF_TC_WITHOUT_HEAD(requeuemail);
}
}
-ATF_TC_BODY(confirm_sub, tc)
+ATF_TC_BODY(send_confirmation_mail, tc)
{
char *dir;
const char *path;
ATF_REQUIRE(socketpair(AF_UNIX, SOCK_STREAM, 0, smtppipe) >= 0);
pid_t p2 = single_mail_reception(smtppipe[1]);
atf_utils_readline(smtppipe[0]);
- confirm_sub(&ml, "test@plop", SUB_NORMAL, SUB_ADMIN, true);
+ send_confirmation_mail(&ml, "test@plop", SUB_NORMAL, SUB_ADMIN, true);
atf_utils_wait(p2, 0, "save:mailout.txt", "");
path = "mailout.txt";
if (!atf_utils_grep_file(".*An administrator has subscribed you to the normal version of the list.*", path)) {
p2 = single_mail_reception(smtppipe[1]);
atf_utils_readline(smtppipe[0]);
- confirm_sub(&ml, "test@plop", SUB_DIGEST, SUB_ADMIN, true);
+ send_confirmation_mail(&ml, "test@plop", SUB_DIGEST, SUB_ADMIN, true);
atf_utils_wait(p2, 0, "save:mailout.txt", "");
if (!atf_utils_grep_file(".*An administrator has subscribed you to the digest version of the list.*", path)) {
atf_utils_cat_file(path, "");
p2 = single_mail_reception(smtppipe[1]);
atf_utils_readline(smtppipe[0]);
- confirm_sub(&ml, "test@plop", SUB_NOMAIL, SUB_CONFIRM, true);
+ send_confirmation_mail(&ml, "test@plop", SUB_NOMAIL, SUB_CONFIRM, true);
atf_utils_wait(p2, 0, "save:mailout.txt", "");
if (!atf_utils_grep_file(".*Thank you for confirming your subscription. You have now been added to the.*", path)) {
atf_utils_cat_file(path, "");
p2 = single_mail_reception(smtppipe[1]);
atf_utils_readline(smtppipe[0]);
- confirm_sub(&ml, "test@plop", SUB_BOTH, SUB_REQUEST, true);
+ send_confirmation_mail(&ml, "test@plop", SUB_BOTH, SUB_REQUEST, true);
atf_utils_wait(p2, 0, "save:mailout.txt", "");
if (!atf_utils_grep_file(".*Thank you for your request to join us. You have now been added to the.*", path)) {
atf_utils_cat_file(path, "");
p2 = single_mail_reception(smtppipe[1]);
atf_utils_readline(smtppipe[0]);
- confirm_sub(&ml, "test@plop", SUB_NORMAL, SUB_ADMIN, false);
+ send_confirmation_mail(&ml, "test@plop", SUB_NORMAL, SUB_ADMIN, false);
atf_utils_wait(p2, 0, "save:mailout.txt", "");
if (!atf_utils_grep_file(".*An administrator has removed you from the list.*", path)) {
atf_utils_cat_file(path, "");
p2 = single_mail_reception(smtppipe[1]);
atf_utils_readline(smtppipe[0]);
- confirm_sub(&ml, "test@plop", SUB_DIGEST, SUB_ADMIN, false);
+ send_confirmation_mail(&ml, "test@plop", SUB_DIGEST, SUB_ADMIN, false);
atf_utils_wait(p2, 0, "save:mailout.txt", "");
if (!atf_utils_grep_file(".*An administrator has removed you from the list.*", path)) {
atf_utils_cat_file(path, "");
p2 = single_mail_reception(smtppipe[1]);
atf_utils_readline(smtppipe[0]);
- confirm_sub(&ml, "test@plop", SUB_NOMAIL, SUB_CONFIRM, false);
+ send_confirmation_mail(&ml, "test@plop", SUB_NOMAIL, SUB_CONFIRM, false);
atf_utils_wait(p2, 0, "save:mailout.txt", "");
if (!atf_utils_grep_file(".*Thank you for confirming your unsubscribe. You have now been removed from.*", path)) {
atf_utils_cat_file(path, "");
p2 = single_mail_reception(smtppipe[1]);
atf_utils_readline(smtppipe[0]);
- confirm_sub(&ml, "test@plop", SUB_BOTH, SUB_REQUEST, false);
+ send_confirmation_mail(&ml, "test@plop", SUB_BOTH, SUB_REQUEST, false);
atf_utils_wait(p2, 0, "save:mailout.txt", "");
if (!atf_utils_grep_file(".*You have now been removed from the list.*", path)) {
atf_utils_cat_file(path, "");
ATF_TP_ADD_TC(tp, send_single_mail);
ATF_TP_ADD_TC(tp, generate_subscription);
ATF_TP_ADD_TC(tp, generate_subconfirm);
- ATF_TP_ADD_TC(tp, confirm_sub);
+ ATF_TP_ADD_TC(tp, send_confirmation_mail);
ATF_TP_ADD_TC(tp, listcontrol);
ATF_TP_ADD_TC(tp, send_help);
ATF_TP_ADD_TC(tp, requeuemail);