summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorin2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2005-03-13 19:59:56 +0800
committerin2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2005-03-13 19:59:56 +0800
commit9f537c69f49981771442e49951a74dc3d6fa5269 (patch)
treecd65a06109e74fa6f01ecbb6605a0b7869e2c7f4
parentb66bcd428ebaa8b382e354f164f5b697c88704c3 (diff)
downloadpttbbs-9f537c69f49981771442e49951a74dc3d6fa5269.tar
pttbbs-9f537c69f49981771442e49951a74dc3d6fa5269.tar.gz
pttbbs-9f537c69f49981771442e49951a74dc3d6fa5269.tar.bz2
pttbbs-9f537c69f49981771442e49951a74dc3d6fa5269.tar.lz
pttbbs-9f537c69f49981771442e49951a74dc3d6fa5269.tar.xz
pttbbs-9f537c69f49981771442e49951a74dc3d6fa5269.tar.zst
pttbbs-9f537c69f49981771442e49951a74dc3d6fa5269.zip
use Copy() instead Link() for most cases
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@2613 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r--mbbsd/announce.c6
-rw-r--r--mbbsd/bbs.c27
-rw-r--r--mbbsd/mail.c36
3 files changed, 24 insertions, 45 deletions
diff --git a/mbbsd/announce.c b/mbbsd/announce.c
index c5c78f3e..84e89ad2 100644
--- a/mbbsd/announce.c
+++ b/mbbsd/announce.c
@@ -353,11 +353,7 @@ a_pasteitem(menu_t * pm, int mode)
memset(&item, 0, sizeof(fileheader_t));
strlcpy(item.filename, fname + 1, sizeof(item.filename));
memcpy(copytmp->copytitle, "◎", 2);
- if (HAS_PERM(PERM_BBSADM))
- Link(copytmp->copyfile, newpath);
- else {
- Copy(copytmp->copyfile, newpath);
- }
+ Copy(copytmp->copyfile, newpath);
} else if (dashf(copytmp->copyfile)) {
stampfile(newpath, &item);
memcpy(copytmp->copytitle, "◇", 2);
diff --git a/mbbsd/bbs.c b/mbbsd/bbs.c
index 9431f532..fff7418e 100644
--- a/mbbsd/bbs.c
+++ b/mbbsd/bbs.c
@@ -12,24 +12,6 @@ static char * const badpost_reason[] = {
};
#endif
-static void
-mail_by_link(char *owner, char *title, char *path)
-{
- char genbuf[200];
- fileheader_t mymail;
-
- sethomepath(genbuf, cuser.userid);
- stampfile(genbuf, &mymail);
- strlcpy(mymail.owner, owner, sizeof(mymail.owner));
- snprintf(mymail.title, sizeof(mymail.title), title);
- unlink(genbuf);
- Link(path, genbuf);
- sethomedir(genbuf, cuser.userid);
-
- append_record(genbuf, &mymail, sizeof(mymail));
-}
-
-
void
anticrosspost(void)
{
@@ -40,8 +22,8 @@ anticrosspost(void)
post_violatelaw(cuser.userid, "Ptt系統警察", "Cross-post", "罰單處份");
cuser.userlevel |= PERM_VIOLATELAW;
cuser.vl_count++;
- mail_by_link("Ptt警察部隊", "Cross-Post罰單",
- BBSHOME "/etc/crosspost.txt");
+ mail_id(cuser.userid, "Cross-Post罰單",
+ "etc/crosspost.txt", "Ptt警察部隊");
u_exit("Cross Post");
exit(0);
}
@@ -417,6 +399,7 @@ do_unanonymous_post(char *fpath)
if (dashd(genbuf)) {
stampfile(genbuf, &mhdr);
unlink(genbuf);
+ // XXX: Link should use ~/ or BBSHOME/blah
Link(fpath, genbuf);
strlcpy(mhdr.owner, cuser.userid, sizeof(mhdr.owner));
strlcpy(mhdr.title, save_title, sizeof(mhdr.title));
@@ -762,7 +745,7 @@ do_general(int isbid)
sethomepath(genbuf, quote_user);
stampfile(genbuf, &postfile);
unlink(genbuf);
- Link(fpath, genbuf);
+ Copy(fpath, genbuf);
strlcpy(postfile.owner, cuser.userid, sizeof(postfile.owner));
strlcpy(postfile.title, save_title, sizeof(postfile.title));
@@ -2415,7 +2398,7 @@ good_post(int ent, fileheader_t * fhdr, char *direct)
digest.filemode = 0;
snprintf(genbuf2, sizeof(genbuf2), "%s%s", buf, fhdr->filename);
- Link(genbuf2, genbuf);
+ Copy(genbuf2, genbuf);
strcpy(ptr, fn_mandex);
append_record(buf, &digest, sizeof(digest));
diff --git a/mbbsd/mail.c b/mbbsd/mail.c
index f25a73de..260ebc4c 100644
--- a/mbbsd/mail.c
+++ b/mbbsd/mail.c
@@ -82,21 +82,21 @@ mail_muser(userec_t muser, char *title, char *filename)
return mail_id(muser.userid, title, filename, cuser.userid);
}
-/* Heat: 用id來寄信,內容則link準備好的檔案 */
int
-mail_id(char *id, char *title, char *filename, char *owner)
+mail_id(char *id, char *title, char *src, char *owner)
{
fileheader_t mhdr;
- char genbuf[128];
- sethomepath(genbuf, id);
- if (stampfile(genbuf, &mhdr))
+ char dst[128], dirf[128];
+ sethomepath(dst, id);
+ if (stampfile(dst, &mhdr))
return 0;
strlcpy(mhdr.owner, owner, sizeof(mhdr.owner));
strncpy(mhdr.title, title, TTLEN);
mhdr.filemode = 0;
- Link(filename, genbuf);
- sethomedir(genbuf, id);
- append_record_forward(genbuf, &mhdr, sizeof(mhdr));
+ Copy(src, dst);
+
+ sethomedir(dirf, id);
+ append_record_forward(dirf, &mhdr, sizeof(mhdr));
mailalert(id);
return 0;
}
@@ -199,7 +199,7 @@ do_hold_mail(char *fpath, char *receiver, char *holder)
sethomedir(title, holder);
unlink(buf);
- Link(fpath, buf);
+ Copy(fpath, buf);
append_record_forward(title, &mymail, sizeof(mymail));
}
@@ -508,7 +508,7 @@ multi_send(char *title)
continue;
stampfile(genbuf, &mymail);
unlink(genbuf);
- Link(fpath, genbuf);
+ Copy(fpath, genbuf);
strlcpy(mymail.owner, cuser.userid, sizeof(mymail.owner));
strlcpy(mymail.title, save_title, sizeof(mymail.title));
@@ -589,7 +589,7 @@ mail_all(void)
sethomepath(genbuf, cuser.userid);
stampfile(genbuf, &mymail);
unlink(genbuf);
- Link(fpath, genbuf);
+ Copy(fpath, genbuf);
unlink(fpath);
strcpy(fpath, genbuf);
@@ -610,7 +610,7 @@ mail_all(void)
sethomepath(genbuf, userid);
stampfile(genbuf, &mymail);
unlink(genbuf);
- Link(fpath, genbuf);
+ Copy(fpath, genbuf);
strlcpy(mymail.owner, cuser.userid, sizeof(mymail.owner));
strlcpy(mymail.title, save_title, sizeof(mymail.title));
@@ -1131,7 +1131,7 @@ mail_cross_post(int ent, fileheader_t * fhdr, char *direct)
fclose(xptr);
} else {
unlink(xfpath);
- Link(fname, xfpath);
+ Copy(fname, xfpath);
}
setbdir(fname, xboard);
@@ -1437,7 +1437,7 @@ send_inner_mail(char *fpath, char *title, char *receiver)
strlcpy(mymail.owner, cuser.userid, sizeof(mymail.owner));
strncpy(mymail.title, title, TTLEN);
unlink(genbuf);
- Link(fpath, genbuf);
+ Copy(fpath, genbuf);
sethomedir(genbuf, receiver);
return append_record_forward(genbuf, &mymail, sizeof(mymail));
}
@@ -1537,7 +1537,7 @@ bsmtp(char *fpath, char *title, char *rcpt, int method)
for (;;) {
snprintf(buf + 4, sizeof(buf) - 4, "M.%d.A", (int)++chrono);
if (!dashf(buf)) {
- Link(fpath, buf);
+ Copy(fpath, buf);
break;
}
}
@@ -1725,11 +1725,11 @@ mail_justify(userec_t muser)
bsmtp(NULL, title, muser.email, MQ_JUSTIFY)
#endif
<0)
- Link("etc/bademail", buf1);
+ Link("~/etc/bademail", buf1);
else
- Link("etc/replyemail", buf1);
+ Link("~/etc/replyemail", buf1);
} else
- Link("etc/bademail", buf1);
+ Link("~/etc/bademail", buf1);
sethomedir(title, muser.userid);
append_record_forward(title, &mhdr, sizeof(mhdr));
}