summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2009-11-21 20:50:56 +0800
committerpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2009-11-21 20:50:56 +0800
commit3ae89828a2fab3c69c331a9c24e2a18fe63a00a5 (patch)
tree9196017a230c1920aef130616a95a0abf440cd59
parent8482058fb22b9505c6d051119063003b51e6e2bf (diff)
downloadpttbbs-3ae89828a2fab3c69c331a9c24e2a18fe63a00a5.tar
pttbbs-3ae89828a2fab3c69c331a9c24e2a18fe63a00a5.tar.gz
pttbbs-3ae89828a2fab3c69c331a9c24e2a18fe63a00a5.tar.bz2
pttbbs-3ae89828a2fab3c69c331a9c24e2a18fe63a00a5.tar.lz
pttbbs-3ae89828a2fab3c69c331a9c24e2a18fe63a00a5.tar.xz
pttbbs-3ae89828a2fab3c69c331a9c24e2a18fe63a00a5.tar.zst
pttbbs-3ae89828a2fab3c69c331a9c24e2a18fe63a00a5.zip
* remove set_mind restrictions
git-svn-id: http://opensvn.csie.org/pttbbs/trunk@5029 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r--pttbbs/include/proto.h1
-rw-r--r--pttbbs/mbbsd/talk.c13
-rw-r--r--pttbbs/mbbsd/user.c28
3 files changed, 20 insertions, 22 deletions
diff --git a/pttbbs/include/proto.h b/pttbbs/include/proto.h
index d0777dda..b8d38728 100644
--- a/pttbbs/include/proto.h
+++ b/pttbbs/include/proto.h
@@ -638,6 +638,7 @@ int topsong(void);
/* user */
int kill_user(int num, const char *userid);
int u_editcalendar(void);
+int u_set_mind();
void user_display(const userec_t *u, int real);
int isvalidemail(char *email);
void uinfo_query(const char *uid, int real, int unum);
diff --git a/pttbbs/mbbsd/talk.c b/pttbbs/mbbsd/talk.c
index a459f107..bf64f983 100644
--- a/pttbbs/mbbsd/talk.c
+++ b/pttbbs/mbbsd/talk.c
@@ -2526,17 +2526,8 @@ userlist(void)
break;
case 'i':
- if (HasUserPerm(PERM_BASIC|PERM_LOGINOK)) {
- char mindbuf[5];
- getdata(b_lines - 1, 0, "現在的心情? ",
- mindbuf, sizeof(mindbuf), DOECHO);
- if (strcmp(mindbuf, "通緝") == 0)
- vmsg("不可以把自己設通緝啦!");
- else if (strcmp(mindbuf, "壽星") == 0)
- vmsg("你不是今天生日欸!");
- else
- memcpy(currutmp->mind, mindbuf, 4);
- }
+ if (HasUserPerm(PERM_BASIC|PERM_LOGINOK))
+ u_set_mind();
redrawall = redraw = 1;
break;
diff --git a/pttbbs/mbbsd/user.c b/pttbbs/mbbsd/user.c
index fae69e0a..f6daefdd 100644
--- a/pttbbs/mbbsd/user.c
+++ b/pttbbs/mbbsd/user.c
@@ -38,6 +38,22 @@ kill_user(int num, const char *userid)
passwd_sync_update(num, &u);
return 0;
}
+
+int
+u_set_mind()
+{
+ char mindbuf[sizeof(currutmp->mind)+1] = "";
+
+ // XXX 以往有 check 通緝/壽星,但我實在看不出這有什麼意義
+ memcpy(mindbuf, currutmp->mind, sizeof(mindbuf));
+ getdata_buf(b_lines - 1, 0, "現在的心情? ", mindbuf, sizeof(mindbuf), DOECHO);
+ if (memcmp(mindbuf, currutmp->mind, sizeof(currutmp->mind)) == 0)
+ return 0;
+
+ memcpy(currutmp->mind, mindbuf, sizeof(currutmp->mind));
+ return 1;
+}
+
int
u_loginview(void)
{
@@ -527,18 +543,8 @@ void Customize(void)
}
continue;
case 1:
- {
- char mindbuf[6] = "";
- getdata(b_lines - 1, 0, "現在的心情? ",
- mindbuf, 5, DOECHO);
- if (strcmp(mindbuf, "通緝") == 0)
- vmsg("不可以把自己設通緝啦!");
- else if (strcmp(mindbuf, "壽星") == 0)
- vmsg("你不是今天生日欸!");
- else
- memcpy(currutmp->mind, mindbuf, 4);
+ if (HasUserPerm(PERM_BASIC|PERM_LOGINOK) && u_set_mind())
dirty = 1;
- }
continue;
}
#ifdef PLAY_ANGEL