int do_sendmail(User * u, NickAlias * na) { MailInfo *mail = NULL; char buf[BUFSIZE]; if (!(na || u)) { return -1; } snprintf(buf, sizeof(buf), "SwiftIRC password change request for %s", na->nick); mail = MailBegin(u, na->nc, buf, s_NickServ); if (!mail) { return -1; } fprintf(mail->pipe, "Hi"); fprintf(mail->pipe, "\n\n"); fprintf(mail->pipe, "You or someone else has requested to reset the password for the account \"%s\" on the SwiftIRC network. If you did not request this action or no longer require it then please ignore this e-mail.", na->nc->display); fprintf(mail->pipe, "\n\n"); fprintf(mail->pipe, "To complete your password reset, please execute the following command in your IRC/Chat client:"); fprintf(mail->pipe, "\n\n"); fprintf(mail->pipe, "/ns confirmreset %s %s", na->nc->display, moduleGetData(&na->nc->moduleData, MODULEDATAKEY)); fprintf(mail->pipe, "\n\n"); fprintf(mail->pipe, "Upon doing this, you will be automatically e-mailed a new password for your account."); fprintf(mail->pipe, "\n\n"); fprintf(mail->pipe, "Kind regards, "); fprintf(mail->pipe, "\n\n"); fprintf(mail->pipe, "The SwiftIRC administration"); fprintf(mail->pipe, "\n.\n"); MailEnd(mail); return 0; }
int do_sendpassword(User* u, NickCore *nc, const char *password) { MailInfo *mail = NULL; char buf[BUFSIZE]; if (!(nc || u)) { return -1; } snprintf(buf, sizeof(buf), "New SwiftIRC password for %s", nc->display); mail = MailBegin(u, nc, buf, s_NickServ); if (!mail) { return -1; } fprintf(mail->pipe, "Hi %s", nc->display); fprintf(mail->pipe, "\n\n"); fprintf(mail->pipe, "Per your recent request password change request, please find your new password below:"); fprintf(mail->pipe, "\n\n"); fprintf(mail->pipe, "%s", password); fprintf(mail->pipe, "\n\n"); fprintf(mail->pipe, "We recommend changing your password to something easier to remember as soon as possible. After logging in to your account, you can change your password with the following command:\n\n"); fprintf(mail->pipe, "/ns set password <current password> <new password> <repeat new password>"); fprintf(mail->pipe, "\n\n"); fprintf(mail->pipe, "Kind regards, "); fprintf(mail->pipe, "\n\n"); fprintf(mail->pipe, "The SwiftIRC administration"); fprintf(mail->pipe, "\n.\n"); MailEnd(mail); return 0; }
static void new_memo_mail(NickCore * nc, Memo * m) { MailInfo *mail = NULL; if (!nc || !m) return; mail = MailMemoBegin(nc); if (!mail) { return; } fprintf(mail->pipe, getstring2(NULL, MEMO_MAIL_TEXT1), nc->display); fprintf(mail->pipe, "\n"); fprintf(mail->pipe, getstring2(NULL, MEMO_MAIL_TEXT2), m->sender, m->number); fprintf(mail->pipe, "\n\n"); fprintf(mail->pipe, "%s", getstring2(NULL, MEMO_MAIL_TEXT3)); fprintf(mail->pipe, "\n\n"); fprintf(mail->pipe, "%s", m->text); fprintf(mail->pipe, "\n"); MailEnd(mail); return; }