diff options
author | ptt <ptt@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2003-05-16 16:25:29 +0800 |
---|---|---|
committer | ptt <ptt@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2003-05-16 16:25:29 +0800 |
commit | cf62c6d70dcbe8cc6bb6cbf72377a60c2363e212 (patch) | |
tree | 9dfeccf0ebff5a565992d9b3ca4b40ffac86910a | |
parent | 968a86a3b520514f2957e0cec6be6ea1c34487ea (diff) | |
download | pttbbs-cf62c6d70dcbe8cc6bb6cbf72377a60c2363e212.tar pttbbs-cf62c6d70dcbe8cc6bb6cbf72377a60c2363e212.tar.gz pttbbs-cf62c6d70dcbe8cc6bb6cbf72377a60c2363e212.tar.bz2 pttbbs-cf62c6d70dcbe8cc6bb6cbf72377a60c2363e212.tar.lz pttbbs-cf62c6d70dcbe8cc6bb6cbf72377a60c2363e212.tar.xz pttbbs-cf62c6d70dcbe8cc6bb6cbf72377a60c2363e212.tar.zst pttbbs-cf62c6d70dcbe8cc6bb6cbf72377a60c2363e212.zip |
*** empty log message ***
git-svn-id: http://opensvn.csie.org/pttbbs/pttbbs/trunk/pttbbs@857 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r-- | include/proto.h | 4 | ||||
-rw-r--r-- | mbbsd/admin.c | 48 | ||||
-rw-r--r-- | mbbsd/friend.c | 17 | ||||
-rw-r--r-- | mbbsd/talk.c | 4 |
4 files changed, 52 insertions, 21 deletions
diff --git a/include/proto.h b/include/proto.h index e4bcf25c..a2bd7459 100644 --- a/include/proto.h +++ b/include/proto.h @@ -1,4 +1,4 @@ -/* $Id: proto.h,v 1.39 2003/04/28 01:02:46 in2 Exp $ */ +/* $Id: proto.h,v 1.40 2003/05/16 08:25:29 ptt Exp $ */ #ifndef INCLUDE_PROTO_H #define INCLUDE_PROTO_H @@ -211,7 +211,7 @@ void friend_edit(int type); void friend_load(); int t_override(); int t_reject(); -void friend_add(char *uident, int type); +void friend_add(char *uident, int type, char *des); void friend_delete(char *uident, int type); /* gamble */ diff --git a/mbbsd/admin.c b/mbbsd/admin.c index 15659d31..9ffe5a08 100644 --- a/mbbsd/admin.c +++ b/mbbsd/admin.c @@ -1,4 +1,4 @@ -/* $Id: admin.c,v 1.40 2003/05/12 12:47:18 victor Exp $ */ +/* $Id: admin.c,v 1.41 2003/05/16 08:25:10 ptt Exp $ */ #include "bbs.h" /* 使用者管理 */ @@ -32,8 +32,10 @@ search_key_user(char *passwdfile, int mode) userec_t user; int ch; int coun = 0; - FILE *fp1 = fopen(passwdfile, "r"); - char buf[128], key[22], genbuf[8]; + FILE *fp1 = fopen(passwdfile, "r"); + char friendfile[128]="",buf[128], key[22], genbuf[8], + *keymatch; + assert(fp1); clear(); @@ -46,12 +48,28 @@ search_key_user(char *passwdfile, int mode) outs(buf); refresh(); } - if (!strcasecmp(user.userid, key) || - (mode && ( - strstr(user.realname, key) || strstr(user.username, key) || - strstr(user.lasthost, key) || strstr(user.email, key) || - strstr(user.address, key) || strstr(user.justify, key) || - strstr(user.mychicken.name, key)))) { + keymatch=NULL; + if (!strcasecmp(user.userid, key)) + sprintf(keymatch,"id:%s",user.userid); + else if(mode) + { + if(strstr(user.realname, key)) + keymatch=user.realname; + else if(strstr(user.username, key)) + keymatch=user.username; + else if(strstr(user.lasthost, key)) + keymatch=user.lasthost; + else if(strstr(user.email, key)) + keymatch=user.email; + else if(strstr(user.address, key)) + keymatch=user.address; + else if(strstr(user.justify, key)) + keymatch=user.justify; + else if(strstr(user.mychicken.name, key)) + keymatch=user.mychicken.name; + } + if(keymatch) + { move(1, 0); snprintf(buf, sizeof(buf), "第 [%d] 筆資料\n", coun); outs(buf); @@ -61,10 +79,20 @@ search_key_user(char *passwdfile, int mode) uinfo_query(&user, 1, coun); outs("\033[44m 空白鍵\033[37m:搜尋下一個" " \033[33m Q\033[37m: 離開"); - outs(mode ? " \033[m " : + outs(mode ? + " A: add to namelist \033[m " : " S: 取用備份資料 \033[m "); while (1) { while ((ch = igetch()) == 0); + if (ch == 'a' || ch=='A' ) + { + if(!friendfile[0]) + { + friend_special(); + setfriendfile(friendfile, FRIEND_SPECIAL); + } + friend_add(user.userid, FRIEND_SPECIAL, keymatch); + } if (ch == ' ') break; if (ch == 'q' || ch == 'Q') { diff --git a/mbbsd/friend.c b/mbbsd/friend.c index e2616ec3..15fd35dc 100644 --- a/mbbsd/friend.c +++ b/mbbsd/friend.c @@ -1,4 +1,4 @@ -/* $Id: friend.c,v 1.17 2003/04/28 11:02:19 in2 Exp $ */ +/* $Id: friend.c,v 1.18 2003/05/16 08:25:10 ptt Exp $ */ #include "bbs.h" /* ------------------------------------- */ @@ -6,8 +6,8 @@ /* ------------------------------------- */ /* Ptt 其他特別名單的檔名 */ -static char special_list[] = "list.0"; -static char special_des[] = "ldes.0"; +char special_list[] = "list.0"; +char special_des[] = "ldes.0"; /* 特別名單的上限 */ static unsigned int friend_max[8] = { @@ -47,7 +47,7 @@ static char *friend_list[8] = { "看板好友名單" }; -static void +void setfriendfile(char *fpath, int type) { if (type <= 4) /* user list Ptt */ @@ -79,7 +79,7 @@ friend_count(char *fname) } void -friend_add(char *uident, int type) +friend_add(char *uident, int type, char* des) { char fpath[80]; @@ -96,7 +96,10 @@ friend_add(char *uident, int type) strlcpy(t_uident, uident, sizeof(t_uident)); if (type != FRIEND_ALOHA && type != FRIEND_POST) + if(!des) getdata(2, 0, friend_desc[type], buf, sizeof(buf), DOECHO); + else + getdata_str(2, 0, friend_desc[type], buf, sizeof(buf), DOECHO, des); if ((fp = fopen(fpath, "a"))) { flock(fileno(fp), LOCK_EX); @@ -107,7 +110,7 @@ friend_add(char *uident, int type) } } -static void +void friend_special() { char genbuf[70], i, fname[70]; @@ -370,7 +373,7 @@ friend_edit(int type) move(1, 0); usercomplete(msg_uid, uident); if (uident[0] && searchuser(uident) && !InNameList(uident)) { - friend_add(uident, type); + friend_add(uident, type, NULL); dirty = 1; } } else if (*uident == 'p') { diff --git a/mbbsd/talk.c b/mbbsd/talk.c index 273dd215..725300bc 100644 --- a/mbbsd/talk.c +++ b/mbbsd/talk.c @@ -1,4 +1,4 @@ -/* $Id: talk.c,v 1.108 2003/05/14 09:46:19 in2 Exp $ */ +/* $Id: talk.c,v 1.109 2003/05/16 08:25:10 ptt Exp $ */ #include "bbs.h" #define QCAST int (*)(const void *, const void *) @@ -2200,7 +2200,7 @@ userlist(void) break; case 'a': if (HAS_PERM(PERM_LOGINOK)) { - friend_add(uentp->userid, FRIEND_OVERRIDE); + friend_add(uentp->userid, FRIEND_OVERRIDE,uentp->username); friend_load(); redrawall = redraw = 1; } |