作者qazq.bbs@bbs.cs.nchu.edu.tw (*獨一無二*) 看板: plan
標題[功能] 好友名片檔。
時間中興資科 (2004/08/09 Mon 14:05:44) Updated: 2004/10/07
※ 引述《mdfh.bbs@processor.tfcis.org (惡魔黨)》之銘言:
> 不知道有沒有辦法做出這樣的東西
> 使用者建議的 ._.
> 名片檔分成兩種,在按ENTER查詢時可以選擇 一般名片檔 和 好友名片檔
> 如果對方有加入你為好友 就可以看到 好友名片檔的選項
: global.h
/* ----------------------------------------------------- */
/* 個人目錄檔名設定 */
/* ----------------------------------------------------- */
#define FN_ACCT ".ACCT" /* User account */
#define FN_BRH ".BRH" /* board reading history */
#define FN_CZH ".CZH" /* class zap history */
#define FN_PLANS "plans" /* 計畫檔 */
+ #define FN_GOODPLANS "GoodPlans" /* 好友名片檔 */ // 檔名自己改
: acct.c:u_xfile()
static char *desc[] =
{
"上站地點設定檔",
"名片檔",
+ "好友名片檔",
......
......
static char *path[] =
{
"acl",
"plans",
+ FN_GOODPLANS,
: maple.p
+ int is_hisgood(UTMP *up, char *userid);
: pal.c:is_hisgood() 新增此函式在 is_ogood() 後面
int
is_hisgood(up, userid)
UTMP *up;
char *userid;
{
int max;
char fpath[64];
int pool[PAL_MAX];
if (up)
return is_ogood(up);
usr_fpath(fpath, userid, fn_pal);
max = image_pal(fpath, pool);
return belong_pal(pool, max, cuser.userno);
}
: talk.c:do_query()
+ if (is_hispal(up, userid) && vans("是否看好友專屬名片(Y/N)?[N] ") == 'y')
+ showgoodplans(userid);
+ else
showplans(userid);
vmsg(NULL);
}
: talk.c:showgoodplans() 新增整支函式在 showplans() 下面
static void
showgoodplans(userid)
char *userid;
{
int i;
FILE *fp;
char buf[ANSILINELEN];
usr_fpath(buf, userid, FN_GOODPLANS);
if (fp = fopen(buf, "r"))
{
i = MAXQUERYLINES;
while (i-- && fgets(buf, sizeof(buf), fp))
outx(buf);
fclose(fp);
}
}
--
┌┼ Author: 中興資科˙中興資科 e資獨秀 csNCHU.twbbs.org
└┘ Origin: qazq 從 218-170-129-23.dynamic.hinet.net 發表精華選讀←離開[主題上]主題下(k)上篇(j)下篇S/a搜尋 G串列 TAB精華 ↑↓捲 Pg/Space翻