summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/proto.h1
-rw-r--r--mbbsd/cal.c14
-rw-r--r--mbbsd/talk.c27
3 files changed, 15 insertions, 27 deletions
diff --git a/include/proto.h b/include/proto.h
index 7475042d..57388817 100644
--- a/include/proto.h
+++ b/include/proto.h
@@ -183,6 +183,7 @@ int x_file(void);
int give_money(void);
int p_sysinfo(void);
int do_give_money(char *id, int uid, int money);
+int give_money_ui(const char *userid);
int p_give(void);
int p_cloak(void);
int p_from(void);
diff --git a/mbbsd/cal.c b/mbbsd/cal.c
index 22d34d29..74dcaf4d 100644
--- a/mbbsd/cal.c
+++ b/mbbsd/cal.c
@@ -413,6 +413,13 @@ int do_give_money(char *id, int uid, int money)
int
p_give(void)
{
+ give_money_ui(NULL);
+ return -1;
+}
+
+int
+give_money_ui(const char *userid)
+{
int uid;
char id[IDLEN + 1], money_buf[20];
char passbuf[PASSLEN];
@@ -422,7 +429,12 @@ p_give(void)
// like user pw/id/...
clear();
stand_title("給予金錢");
- usercomplete("這位幸運兒的id: ", id);
+ if (!userid || !*userid)
+ usercomplete("這位幸運兒的id: ", id);
+ else {
+ strlcpy(id, userid, sizeof(id));
+ prints("這位幸運兒的id: %s\n", id);
+ }
move(2, 0); clrtobot();
if (!id[0] || !strcasecmp(cuser.userid, id))
diff --git a/mbbsd/talk.c b/mbbsd/talk.c
index 6e6dea5e..122bf6ea 100644
--- a/mbbsd/talk.c
+++ b/mbbsd/talk.c
@@ -2933,32 +2933,7 @@ userlist(void)
case 'g':
if (HasUserPerm(PERM_LOGINOK) &&
strcmp(uentp->userid, cuser.userid) != 0) {
- char genbuf[10];
- char userid[IDLEN + 1];
- int touid=uentp->uid;
- strlcpy(userid, uentp->userid, sizeof(userid));
- move(b_lines - 2, 0);
- prints("要給 %s 多少錢呢? ", userid);
- if (getdata(b_lines - 1, 0, "[銀行轉帳]: ",
- genbuf, 7, LCECHO)) {
- clrtoeol();
- if ((ch = atoi(genbuf)) <= 0 || ch <= give_tax(ch)){
- redrawall = redraw = 1;
- break;
- }
- if (getans("確定要給 %s %d " MONEYNAME " 幣嗎? [N/y]",
- userid, ch) != 'y'){
- redrawall = redraw = 1;
- break;
- }
- if (do_give_money(userid, touid, ch) < 0)
- vmsgf("交易失敗,還剩下 %d 錢", SHM->money[usernum - 1]);
- else
- vmsgf("交易成功\,還剩下 %d 錢", SHM->money[usernum - 1]);
- } else {
- clrtoeol();
- vmsg(" 交易取消! ");
- }
+ give_money_ui(uentp->userid);
redrawall = redraw = 1;
}
break;