summaryrefslogtreecommitdiffstats
path: root/mbbsd/talk.c
diff options
context:
space:
mode:
authorkcwu <kcwu@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2002-09-04 23:08:42 +0800
committerkcwu <kcwu@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2002-09-04 23:08:42 +0800
commitfdf99c241042aed3c36c8e8bee62c24bc7fb8732 (patch)
tree8250ec182211bfee0736b84c900484e8114c57de /mbbsd/talk.c
parent77f08a35715ec3dc1bddfc832c7addae4d296b9d (diff)
downloadpttbbs-fdf99c241042aed3c36c8e8bee62c24bc7fb8732.tar
pttbbs-fdf99c241042aed3c36c8e8bee62c24bc7fb8732.tar.gz
pttbbs-fdf99c241042aed3c36c8e8bee62c24bc7fb8732.tar.bz2
pttbbs-fdf99c241042aed3c36c8e8bee62c24bc7fb8732.tar.lz
pttbbs-fdf99c241042aed3c36c8e8bee62c24bc7fb8732.tar.xz
pttbbs-fdf99c241042aed3c36c8e8bee62c24bc7fb8732.tar.zst
pttbbs-fdf99c241042aed3c36c8e8bee62c24bc7fb8732.zip
only read friend description when he is my friend
git-svn-id: http://opensvn.csie.org/pttbbs/pttbbs/trunk/pttbbs@511 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'mbbsd/talk.c')
-rw-r--r--mbbsd/talk.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/mbbsd/talk.c b/mbbsd/talk.c
index 845c25e8..e7c1d8f8 100644
--- a/mbbsd/talk.c
+++ b/mbbsd/talk.c
@@ -1,4 +1,4 @@
-/* $Id: talk.c,v 1.88 2002/09/04 13:33:45 kcwu Exp $ */
+/* $Id: talk.c,v 1.89 2002/09/04 15:08:42 kcwu Exp $ */
#include "bbs.h"
#define QCAST int (*)(const void *, const void *)
@@ -1396,32 +1396,35 @@ t_showhelp()
/* Kaede show friend description */
static char *
-friend_descript(char *uident)
+friend_descript(userinfo_t * uentp)
{
- static char *space_buf = " ";
+ static char *space_buf = "";
static char desc_buf[80];
char fpath[80], name[IDLEN + 2], *desc, *ptr;
int len, flag;
FILE *fp;
char genbuf[200];
+ if((set_friend_bit(currutmp,uentp)|IFH)==0)
+ return space_buf;
+
setuserfile(fpath, friend_file[0]);
if ((fp = fopen(fpath, "r"))) {
- snprintf(name, sizeof(name), "%s ", uident);
+ snprintf(name, sizeof(name), "%s ", uentp->userid);
len = strlen(name);
desc = genbuf + 13;
+ /* TODO maybe none linear search, or fread, or cache */
while ((flag = (int)fgets(genbuf, STRLEN, fp))) {
if (!memcmp(genbuf, name, len)) {
if ((ptr = strchr(desc, '\n')))
ptr[0] = '\0';
- if (desc)
- break;
+ break;
}
}
fclose(fp);
- if (desc && flag)
+ if (flag)
strlcpy(desc_buf, desc, sizeof(desc_buf));
else
return space_buf;
@@ -1431,12 +1434,13 @@ friend_descript(char *uident)
return space_buf;
}
+/* XXX ¬°¤°»ò diff ¬O time_t */
static char *
descript(int show_mode, userinfo_t * uentp, time_t diff)
{
switch (show_mode) {
case 1:
- return friend_descript(uentp->userid);
+ return friend_descript(uentp);
case 0:
return (((uentp->pager != 2 && uentp->pager != 3 && diff) ||
HAS_PERM(PERM_SYSOP)) ?