|
珞珈山水BBS →
电脑网络 →
BBS安装与维护 →
单文区文章阅读
|
| 单文区文章阅读 [返回] |
|---|
|
发信人: thdog@coa.cn-bbs.org (叶子的大狗·努力做好每一件事), 信区: BBSDev 标 题: 彩色id的实现办法(附diff) 发信站: BBS_天使之城站 (Tue Jun 17 22:00:00 2003) 转信站: WHUBBS!news.tiaozhan.com!news2.happynet.org!COA 最初的代码是来源于奇景bbs的veslin 开始用在我的fb2000v1.0423上有一些问题 我稍稍改了一点,然后改到smthbbs的时候我和outwit又试了试 发觉只要稍加改动就可以用了 基本思路是,在显示文章列表的时候,截获一下文章主人的状态 然后根据状态来决定用什么颜色来显示其id 下面是我 diff -urbB bbs.c.colorid bbs.c.origin 之后的东西 注意有折行哦,看不清的话,到我的ftp的bbs里有下载 --- bbs.c.origin 2003-05-11 08:01:46.000000000 +0800 +++ bbs.c.colorid 2003-06-17 21:57:51.000000000 +0800 @@ -96,6 +96,30 @@ extern struct screenline *big_picture; extern struct userec *user_data; +char * +getuserstatus(user) // added by outwit for colorized IDs at 03.06. 15 +char user[48]; +{ + char abuf[64]; //added by thdog + int tuid; + int nresult; + //char abuf[64]; + struct user_info uin; + extern int t_cmpuids(); + nresult = 0; + tuid=searchuser(user); + search_ulist(&uin,t_cmpuids,tuid); + if ( uin.active && uin.pid && !uin.invisible){ + sprintf(abuf,"%s",user); + nresult = 1; + } else if( uin.active && uin.pid && uin.invisible && (HAS_PERM(currentuser,PERM_SEECLOAK) || usernum == uin.uid)){ + sprintf(abuf,"%s",user); + nresult = 1; + } else + sprintf(abuf,"%s",user); + return abuf; +} + int check_readonly(char *checked) { /* Leeward 98.03.28 */ if (checkreadonly(checked)) { /* Checking if DIR access mode is "555" */ @@ -601,6 +625,7 @@ char *typeprefix; char *typesufix; char attachch; + char userstatus[64]; //added by outwit typesufix = typeprefix = ""; @@ -648,9 +673,10 @@ attachch = '@'; else attachch = ' '; + strcpy(userstatus, getuserstatus(ent->owner));//added by outwit at 03.06.15 TITLE = ent->title; /*文章标题TITLE */ if ((type == 'd') || (type == 'D')) { //置顶文章 - sprintf(buf, " \x1b[1;33m[提示]\x1b[m %-12.12s %s %c● %-44.44s ", ent->owner, date, attachch, TITLE); + sprintf(buf, " \x1b[1;33m[提示]\x1b[m %-20.20s %s %c● %-44.44s ", userstatus, date, attachch, TITLE); return buf; } @@ -658,37 +684,37 @@ if ((ent->groupid != ent->id) && (digestmode == DIR_MODE_THREAD || !strncasecmp(TITLE, "Re:", 3) || !strncmp(TITLE, "回复:", 5))) { /*Re的文章 */ if (ReadPostHeader.groupid == ent->groupid) /* 当前阅读主题 标识 */ if (DEFINE(currentuser, DEF_HIGHCOLOR)) - sprintf(buf, " %4d %s%c%s %-12.12s %s.%c%-47.47s ", num, typeprefix, type, typesufix, ent->owner, date, attachch, TITLE); + sprintf(buf, " %4d %s%c%s %-20.20s %s.%c%-47.47s ", num, typeprefix, type, typesufix, userstatus, date, attachch, TITLE); else - sprintf(buf, " %4d %s%c%s %-12.12s %s.%c%-47.47s ", num, typeprefix, type, typesufix, ent->owner, date, attachch, TITLE); + sprintf(buf, " %4d %s%c%s %-20.20s %s.%c%-47.47s ", num, typeprefix, type, typesufix, userstatus, date, attachch, TITLE); else - sprintf(buf, " %4d %s%c%s %-12.12s %s %c%-47.47s", num, typeprefix, type, typesufix, ent->owner, date, attachch, TITLE); + sprintf(buf, " %4d %s%c%s %-20.20s %s %c%-47.47s", num, typeprefix, type, typesufix, userstatus, date, attachch, TITLE); } else { if (ReadPostHeader.groupid == ent->groupid) /* 当前阅读主题 标识 */ if (DEFINE(currentuser, DEF_HIGHCOLOR)) - sprintf(buf, " %4d %s%c%s %-12.12s %s.%c● %-44.44s ", num, typeprefix, type, typesufix, ent->owner, date, attachch, TITLE); + sprintf(buf, " %4d %s%c%s %-20.20s %s.%c● %-44.44s ", num, typeprefix, type, typesufix, userstatus, date, attachch, TITLE); else - sprintf(buf, " %4d %s%c%s %-12.12s %s.%c● %-44.44s ", num, typeprefix, type, typesufix, ent->owner, date, attachch, TITLE); + sprintf(buf, " %4d %s%c%s %-20.20s %s.%c● %-44.44s ", num, typeprefix, type, typesufix, userstatus, date, attachch, TITLE); else - sprintf(buf, " %4d %s%c%s %-12.12s %s %c● %-44.44s ", num, typeprefix, type, typesufix, ent->owner, date, attachch, TITLE); + sprintf(buf, " %4d %s%c%s %-20.20s %s %c● %-44.44s ", num, typeprefix, type, typesufix, userstatus, date, attachch, TITLE); } } else /* 允许 相同主题标识 */ if (!strncmp("Re:", ent->title, 3)) { /*Re的文章 */ if (!strncmp(ReplyPost + 3, ent->title + 3, STRLEN - 3)) /* 当前阅读主题 标识 */ if (DEFINE(currentuser, DEF_HIGHCOLOR)) - sprintf(buf, " %4d %s%c%s %-12.12s %s*[1; 36m.%c%-47.47s ", num, typeprefix, type, typesufix, ent->owner, date, attachch, TITLE); + sprintf(buf, " %4d %s%c%s %-20.20s %s*[1; 36m.%c%-47.47s ", num, typeprefix, type, typesufix, userstatus, date, attachch, TITLE); else - sprintf(buf, " %4d %s%c%s %-12.12s %s. %c%-47.47s ", num, typeprefix, type, typesufix, ent->owner, date, attachch, TITLE); + sprintf(buf, " %4d %s%c%s %-20.20s %s. %c%-47.47s ", num, typeprefix, type, typesufix, userstatus, date, attachch, TITLE); else - sprintf(buf, " %4d %s%c%s %-12.12s %s %c%-47.47s", num, typeprefix, type, typesufix, ent->owner, date, attachch, TITLE); + sprintf(buf, " %4d %s%c%s %-20.20s %s %c%-47.47s", num, typeprefix, type, typesufix, userstatus, date, attachch, TITLE); } else { if (strcmp(ReadPost, ent->title) == 0) /* 当前阅读主题 标识 */ if (DEFINE(currentuser, DEF_HIGHCOLOR)) - sprintf(buf, " %4d %s%c%s %-12.12s %s*[1; 33m.%c● %-44.44s ", num, typeprefix, type, typesufix, ent->owner, date, attachch, TITLE); + sprintf(buf, " %4d %s%c%s %-20.20s %s*[1; 33m.%c● %-44.44s ", num, typeprefix, type, typesufix, userstatus, date, attachch, TITLE); else - sprintf(buf, " %4d %s%c%s %-12.12s %s.%c● %-44.44s ", num, typeprefix, type, typesufix, ent->owner, date, attachch, TITLE); + sprintf(buf, " %4d %s%c%s %-20.20s %s.%c● %-44.44s ", num, typeprefix, type, typesufix, userstatus, date, attachch, TITLE); else - sprintf(buf, " %4d %s%c%s %-12.12s %s %c● %-44.44s ", num, typeprefix, type, typesufix, ent->owner, date, attachch, TITLE); + sprintf(buf, " %4d %s%c%s %-20.20s %s %c● %-44.44s ", num, typeprefix, type, typesufix, userstatus, date, attachch, TITLE); } return buf; } -- ▲ ▲ ◣ ▲▼▼▼◣ ▲ ◤ ☉ ☉◣ ◢▇▇▇▇▇▇▎ ◣ ███████▍ ● ▎ ◥██████◣◣ ▁◢ ◥████◤◢ ▌ ▊ ▊ ★ ▊ █ █ █ ※ 来源:·BBS 天使之城站 COABBS·[FROM: 166.111.142.17] |
| [返回单文区目录] |
|
|