summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--pttbbs/common/bbs/path.c18
-rw-r--r--pttbbs/include/cmbbs.h1
2 files changed, 18 insertions, 1 deletions
diff --git a/pttbbs/common/bbs/path.c b/pttbbs/common/bbs/path.c
index 560ac793..cfe88ad6 100644
--- a/pttbbs/common/bbs/path.c
+++ b/pttbbs/common/bbs/path.c
@@ -40,7 +40,6 @@ sethomeman(char *buf, const char *userid)
snprintf(buf, PATHLEN, str_home_file, userid[0], userid, "man");
}
-
void
sethomefile(char *buf, const char *userid, const char *fname)
{
@@ -49,6 +48,23 @@ sethomefile(char *buf, const char *userid, const char *fname)
snprintf(buf, PATHLEN, str_home_file, userid[0], userid, fname);
}
+void
+setuserhashedfile(char *buf, const char *filename)
+{
+#ifdef USERHASHSTORE_ROOTPATH
+ // hash designed by kcwu
+ unsigned hash = StringHash(cuser.userid) & 0xffff;
+ assert(is_validuserid(cuser.userid));
+ snprintf(buf, PATHLEN,
+ USERHASHSTORE_ROOTPATH "/%02x/%02x/%s.%s.%x",
+ (hash >> 8) & 0xff, hash & 0xff,
+ filename, cuser.userid, cuser.firstlogin);
+#else
+ assert(!"you must define and initialize USERHASHSTORE_ROOTPATH");
+#endif
+}
+
+
void
setapath(char *buf, const char *boardname)
{
diff --git a/pttbbs/include/cmbbs.h b/pttbbs/include/cmbbs.h
index 7cd6309c..393d849c 100644
--- a/pttbbs/include/cmbbs.h
+++ b/pttbbs/include/cmbbs.h
@@ -18,6 +18,7 @@ extern void sethomepath(char *buf, const char *userid);
extern void sethomedir (char *buf, const char *userid);
extern void sethomeman (char *buf, const char *userid);
extern void sethomefile(char *buf, const char *userid, const char *fname);
+extern void setuserhashedfile(char *buf, const char *filename);
// setbdir
// setuserfile