diff options
Diffstat (limited to 'mbbsd/mail.c')
-rw-r--r-- | mbbsd/mail.c | 106 |
1 files changed, 53 insertions, 53 deletions
diff --git a/mbbsd/mail.c b/mbbsd/mail.c index 85f4c142..49864cf6 100644 --- a/mbbsd/mail.c +++ b/mbbsd/mail.c @@ -12,7 +12,7 @@ setforward() char buf[80], ip[50] = "", yn[4]; FILE *fp; - sethomepath(buf, cuser.userid); + sethomepath(buf, cuser->userid); strcat(buf, "/.forward"); if ((fp = fopen(buf, "r"))) { fscanf(fp, "%s", ip); // XXX check buffer size @@ -58,7 +58,7 @@ built_mail_index() snprintf(genbuf, sizeof(genbuf), BBSHOME "/bin/buildir " BBSHOME "/home/%c/%s", - cuser.userid[0], cuser.userid); + cuser->userid[0], cuser->userid); move(22, 0); prints("\033[1;31m已經處理完畢!! 諸多不便 敬請原諒~\033[m"); pressanykey(); @@ -85,7 +85,7 @@ mailalert(char *userid) int mail_muser(userec_t muser, char *title, char *filename) { - return mail_id(muser.userid, title, filename, cuser.userid); + return mail_id(muser.userid, title, filename, cuser->userid); } /* Heat: 用id來寄信,內容則link準備好的檔案 */ @@ -140,7 +140,7 @@ m_internet() void m_init() { - sethomedir(currmaildir, cuser.userid); + sethomedir(currmaildir, cuser->userid); } int @@ -159,8 +159,8 @@ chkmailbox() mailsumlimit = 200; else mailsumlimit = 50; - mailsumlimit += cuser.exmailbox * 10; - mailmaxkeep = max_keepmail + cuser.exmailbox; + mailsumlimit += cuser->exmailbox * 10; + mailmaxkeep = max_keepmail + cuser->exmailbox; m_init(); if ((mailkeep = get_num_records(currmaildir, sizeof(fileheader_t))) > mailmaxkeep) { @@ -224,7 +224,7 @@ hold_mail(char *fpath, char *receiver) buf, sizeof(buf), LCECHO); if (buf[0] == 'y') - do_hold_mail(fpath, receiver, cuser.userid); + do_hold_mail(fpath, receiver, cuser->userid); } int @@ -289,7 +289,7 @@ do_send(char *userid, char *title) strlcpy(receiver, userid, sizeof(receiver)); sethomepath(genbuf, userid); stampfile(genbuf, &mhdr); - strlcpy(mhdr.owner, cuser.userid, sizeof(mhdr.owner)); + strlcpy(mhdr.owner, cuser->userid, sizeof(mhdr.owner)); strncpy(mhdr.title, save_title, TTLEN); if (vedit(genbuf, YEA, NULL) == -1) { unlink(genbuf); @@ -298,10 +298,10 @@ do_send(char *userid, char *title) } clear(); sethomefile(fpath, userid, FN_OVERRIDES); - i = belong(fpath, cuser.userid); + i = belong(fpath, cuser->userid); sethomefile(fpath, userid, FN_REJECT); - if (i || !belong(fpath, cuser.userid)) {/* Ptt: 用belong有點討厭 */ + if (i || !belong(fpath, cuser->userid)) {/* Ptt: 用belong有點討厭 */ sethomedir(fpath, userid); if (append_record_forward(fpath, &mhdr, sizeof(mhdr)) == -1) return -1; @@ -447,7 +447,7 @@ multi_send(char *title) strtok(ptr = genbuf + 3, " \n\r"); do { if (searchuser(ptr) && !InNameList(ptr) && - strcmp(cuser.userid, ptr)) { + strcmp(cuser->userid, ptr)) { AddNameList(ptr); reciper++; } @@ -525,7 +525,7 @@ multi_send(char *title) unlink(genbuf); Link(fpath, genbuf); - strlcpy(mymail.owner, cuser.userid, sizeof(mymail.owner)); + strlcpy(mymail.owner, cuser->userid, sizeof(mymail.owner)); strlcpy(mymail.title, save_title, sizeof(mymail.title)); mymail.filemode |= FILE_MULTI; /* multi-send flag */ sethomedir(genbuf, p->word); @@ -602,17 +602,17 @@ mail_all() setutmpmode(MAILALL); stand_title("寄信中..."); - sethomepath(genbuf, cuser.userid); + sethomepath(genbuf, cuser->userid); stampfile(genbuf, &mymail); unlink(genbuf); Link(fpath, genbuf); unlink(fpath); strcpy(fpath, genbuf); - strlcpy(mymail.owner, cuser.userid, sizeof(mymail.owner)); /* 站長 ID */ + strlcpy(mymail.owner, cuser->userid, sizeof(mymail.owner)); /* 站長 ID */ strlcpy(mymail.title, save_title, sizeof(mymail.title)); - sethomedir(genbuf, cuser.userid); + sethomedir(genbuf, cuser->userid); if (append_record_forward(genbuf, &mymail, sizeof(mymail)) == -1) outs(err_uid); @@ -622,13 +622,13 @@ mail_all() userid = SHM->userid[i]; if (strcmp(userid, STR_GUEST) && strcmp(userid, "new") && - strcmp(userid, cuser.userid)) { + strcmp(userid, cuser->userid)) { sethomepath(genbuf, userid); stampfile(genbuf, &mymail); unlink(genbuf); Link(fpath, genbuf); - strlcpy(mymail.owner, cuser.userid, sizeof(mymail.owner)); + strlcpy(mymail.owner, cuser->userid, sizeof(mymail.owner)); strlcpy(mymail.title, save_title, sizeof(mymail.title)); /* mymail.filemode |= FILE_MARKED; Ptt 公告改成不會mark */ sethomedir(genbuf, userid); @@ -649,8 +649,8 @@ mail_mbox() char cmd[100]; fileheader_t fhdr; - snprintf(cmd, sizeof(cmd), "/tmp/%s.uu", cuser.userid); - snprintf(fhdr.title, sizeof(fhdr.title), "%s 私人資料", cuser.userid); + snprintf(cmd, sizeof(cmd), "/tmp/%s.uu", cuser->userid); + snprintf(fhdr.title, sizeof(fhdr.title), "%s 私人資料", cuser->userid); doforward(cmd, &fhdr, 'Z'); return 0; } @@ -874,7 +874,7 @@ mail_del(int ent, fileheader_t * fhdr, char *direct) unlink(genbuf); if ((currmode & MODE_SELECT)) { int index; - sethomedir(genbuf, cuser.userid); + sethomedir(genbuf, cuser->userid); index = getindex(genbuf, fhdr->filename, sizeof(fileheader_t)); delete_record(genbuf, sizeof(fileheader_t), index); } @@ -1032,7 +1032,7 @@ mail_edit(int ent, fileheader_t * fhdr, char *direct) char genbuf[200]; if (!HAS_PERM(PERM_SYSOP) && - strcmp(cuser.userid, fhdr->owner) && + strcmp(cuser->userid, fhdr->owner) && strcmp("[備.忘.錄]", fhdr->owner)) return DONOTHING; @@ -1044,8 +1044,8 @@ mail_edit(int ent, fileheader_t * fhdr, char *direct) static int mail_nooutmail(int ent, fileheader_t * fhdr, char *direct) { - cuser.userlevel ^= PERM_NOOUTMAIL; - passwd_update(usernum, &cuser); + cuser->userlevel ^= PERM_NOOUTMAIL; +// passwd_update(usernum, &cuser); return FULLUPDATE; } @@ -1123,7 +1123,7 @@ mail_cross_post(int ent, fileheader_t * fhdr, char *direct) return FULLUPDATE; ent = 1; - if (HAS_PERM(PERM_SYSOP) || !strcmp(fhdr->owner, cuser.userid)) { + if (HAS_PERM(PERM_SYSOP) || !strcmp(fhdr->owner, cuser->userid)) { getdata(2, 0, "(1)原文轉載 (2)舊轉錄格式?[1] ", genbuf, 3, DOECHO); if (genbuf[0] != '2') { @@ -1154,7 +1154,7 @@ mail_cross_post(int ent, fileheader_t * fhdr, char *direct) if (author) strlcpy(xfile.owner, fhdr->owner, sizeof(xfile.owner)); else - strlcpy(xfile.owner, cuser.userid, sizeof(xfile.owner)); + strlcpy(xfile.owner, cuser->userid, sizeof(xfile.owner)); strlcpy(xfile.title, xtitle, sizeof(xfile.title)); if (genbuf[0] == 'l') { xfile.filemode = FILE_LOCAL; @@ -1170,7 +1170,7 @@ mail_cross_post(int ent, fileheader_t * fhdr, char *direct) write_header(xptr); strlcpy(currboard, xfpath, sizeof(currboard)); - fprintf(xptr, "※ [本文轉錄自 %s 信箱]\n\n", cuser.userid); + fprintf(xptr, "※ [本文轉錄自 %s 信箱]\n\n", cuser->userid); b_suckinfile(xptr, fname); addsignature(xptr, 0); @@ -1185,8 +1185,8 @@ mail_cross_post(int ent, fileheader_t * fhdr, char *direct) setbtotal(getbnum(xboard)); if (!xfile.filemode) outgo_post(&xfile, xboard); - cuser.numposts++; - passwd_update(usernum, &cuser); + cuser->numposts++; +// passwd_update(usernum, &cuser); outs("文章轉錄完成"); pressanykey(); currmode = currmode0; @@ -1202,8 +1202,8 @@ mail_man() int mode0 = currutmp->mode; int stat0 = currstat; - sethomeman(buf, cuser.userid); - snprintf(buf1, sizeof(buf1), "%s 的信件夾", cuser.userid); + sethomeman(buf, cuser->userid); + snprintf(buf1, sizeof(buf1), "%s 的信件夾", cuser->userid); a_menu(buf1, buf, 1); currutmp->mode = mode0; currstat = stat0; @@ -1227,7 +1227,7 @@ mail_cite(int ent, fileheader_t * fhdr, char *direct) title[TTLEN] = '\0'; a_copyitem(fpath, title, 0, 1); - if (cuser.userlevel >= PERM_BM) { + if (cuser->userlevel >= PERM_BM) { move(2, 0); clrtoeol(); move(3, 0); @@ -1269,8 +1269,8 @@ mail_save(int ent, fileheader_t * fhdr, char *direct) strncpy(title + 3, fhdr->title, TTLEN - 3); title[TTLEN] = '\0'; a_copyitem(fpath, title, fhdr->owner, 1); - sethomeman(fpath, cuser.userid); - a_menu(cuser.userid, fpath, 1); + sethomeman(fpath, cuser->userid); + a_menu(cuser->userid, fpath, 1); return FULLUPDATE; } return DONOTHING; @@ -1289,7 +1289,7 @@ mail_waterball(int ent, fileheader_t * fhdr, char *direct) return 1; } if (!address[0]) - strlcpy(address, cuser.email, sizeof(address)); + strlcpy(address, cuser->email, sizeof(address)); move(b_lines - 8, 0); outs("水球整理程式:\n" "系統將會按照和不同人丟的水球各自獨立\n" @@ -1337,16 +1337,16 @@ mail_waterball(int ent, fileheader_t * fhdr, char *direct) cmode = (fname[0] != '0' && fname[0] != '1') ? 1 : fname[0] - '0'; snprintf(fname, sizeof(fname), BBSHOME "/jobspool/water.src.%s-%d", - cuser.userid, (int)now); + cuser->userid, (int)now); snprintf(genbuf, sizeof(genbuf), "cp " BBSHOME "/home/%c/%s/%s %s", - cuser.userid[0], cuser.userid, fhdr->filename, fname); + cuser->userid[0], cuser->userid, fhdr->filename, fname); system(genbuf); /* dirty code ;x */ snprintf(fname, sizeof(fname), BBSHOME "/jobspool/water.des.%s-%d", - cuser.userid, (int)now); + cuser->userid, (int)now); fp = fopen(fname, "wt"); assert(fp); - fprintf(fp, "%s\n%s\n%d\n", cuser.userid, address, cmode); + fprintf(fp, "%s\n%s\n%d\n", cuser->userid, address, cmode); fclose(fp); vmsg("設定完成, 系統將在下一個整點(尖峰時段除外)將資料寄給您"); return FULLUPDATE; @@ -1454,7 +1454,7 @@ m_read() i_read(RMAIL, currmaildir, mailtitle, maildoent, mail_comms, -1); currbid = back_bid; curredit = 0; - currutmp->mailalert = load_mailalert(cuser.userid); + currutmp->mailalert = load_mailalert(cuser->userid); return 0; } else { outs("您沒有來信"); @@ -1473,11 +1473,11 @@ send_inner_mail(char *fpath, char *title, char *receiver) return -2; sethomepath(genbuf, receiver); stampfile(genbuf, &mymail); - if (!strcmp(receiver, cuser.userid)) { + if (!strcmp(receiver, cuser->userid)) { strlcpy(mymail.owner, "[" BBSNAME "]", sizeof(mymail.owner)); mymail.filemode = FILE_READ; } else - strlcpy(mymail.owner, cuser.userid, sizeof(mymail.owner)); + strlcpy(mymail.owner, cuser->userid, sizeof(mymail.owner)); strncpy(mymail.title, title, TTLEN); unlink(genbuf); Link(fpath, genbuf); @@ -1521,7 +1521,7 @@ bbs_sendmail(char *fpath, char *title, char *receiver) } else { snprintf(genbuf, sizeof(genbuf), "/usr/sbin/sendmail -f %s%s %s > /dev/null", - cuser.userid, str_mail_address, receiver); + cuser->userid, str_mail_address, receiver); fin = fopen(fpath, "r"); } fout = popen(genbuf, "w"); @@ -1530,9 +1530,9 @@ bbs_sendmail(char *fpath, char *title, char *receiver) if (fpath) fprintf(fout, "Reply-To: %s%s\nFrom: %s <%s%s>\n", - cuser.userid, str_mail_address, - cuser.username, - cuser.userid, str_mail_address); + cuser->userid, str_mail_address, + cuser->username, + cuser->userid, str_mail_address); fprintf(fout,"To: %s\nSubject: %s\n" "Mime-Version: 1.0\r\n" "Content-Type: text/plain; charset=\"big5\"\r\n" @@ -1593,8 +1593,8 @@ bsmtp(char *fpath, char *title, char *rcpt, int method) /* setup mail queue */ mqueue.mailtime = chrono; mqueue.method = method; - strlcpy(mqueue.sender, cuser.userid, sizeof(mqueue.sender)); - strlcpy(mqueue.username, cuser.username, sizeof(mqueue.username)); + strlcpy(mqueue.sender, cuser->userid, sizeof(mqueue.sender)); + strlcpy(mqueue.username, cuser->username, sizeof(mqueue.username)); strlcpy(mqueue.rcpt, rcpt, sizeof(mqueue.rcpt)); if (append_record("out/.DIR", (fileheader_t *) & mqueue, sizeof(mqueue)) < 0) return 0; @@ -1611,7 +1611,7 @@ doforward(char *direct, fileheader_t * fh, int mode) char genbuf[200]; if (!address[0]) - strlcpy(address, cuser.email, sizeof(address)); + strlcpy(address, cuser->email, sizeof(address)); if( mode == 'U' ){ move(b_lines - 2, 0); @@ -1658,7 +1658,7 @@ doforward(char *direct, fileheader_t * fh, int mode) char msg[200]; snprintf(msg, sizeof(msg), "%s mailforward to %s at %s", - cuser.userid, address, Cdate(&now)); + cuser->userid, address, Cdate(&now)); log_user(msg); } if (mode == 'Z') { @@ -1666,13 +1666,13 @@ doforward(char *direct, fileheader_t * fh, int mode) TAR_PATH " cfz /tmp/home.%s.tgz home/%c/%s; " MUTT_PATH " -a /tmp/home.%s.tgz -s 'home.%s.tgz' '%s' </dev/null;" "rm /tmp/home.%s.tgz", - cuser.userid, cuser.userid[0], cuser.userid, - cuser.userid, cuser.userid, address, cuser.userid); + cuser->userid, cuser->userid[0], cuser->userid, + cuser->userid, cuser->userid, address, cuser->userid); system(fname); return 0; snprintf(fname, sizeof(fname), TAR_PATH " cfz - home/%c/%s | " "/usr/bin/uuencode %s.tgz > %s", - cuser.userid[0], cuser.userid, cuser.userid, direct); + cuser->userid[0], cuser->userid, cuser->userid, direct); system(fname); strlcpy(fname, direct, sizeof(fname)); } else if (mode == 'U') { @@ -1748,7 +1748,7 @@ mail_justify(userec_t muser) sethomepath(buf1, muser.userid); stampfile(buf1, &mhdr); unlink(buf1); - strlcpy(mhdr.owner, cuser.userid, sizeof(mhdr.owner)); + strlcpy(mhdr.owner, cuser->userid, sizeof(mhdr.owner)); strncpy(mhdr.title, "[審核通過]", TTLEN); mhdr.filemode = 0; |