diff options
author | piaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2007-12-04 00:43:26 +0800 |
---|---|---|
committer | piaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2007-12-04 00:43:26 +0800 |
commit | c887ad307c98ffca2825f9489b10eb442b1a6273 (patch) | |
tree | 5a86aef303dd40f403ca1c1975c030bd53fa4d72 | |
parent | 7226ce15690f667be736c3070a0f540978407fca (diff) | |
download | pttbbs-c887ad307c98ffca2825f9489b10eb442b1a6273.tar pttbbs-c887ad307c98ffca2825f9489b10eb442b1a6273.tar.gz pttbbs-c887ad307c98ffca2825f9489b10eb442b1a6273.tar.bz2 pttbbs-c887ad307c98ffca2825f9489b10eb442b1a6273.tar.lz pttbbs-c887ad307c98ffca2825f9489b10eb442b1a6273.tar.xz pttbbs-c887ad307c98ffca2825f9489b10eb442b1a6273.tar.zst pttbbs-c887ad307c98ffca2825f9489b10eb442b1a6273.zip |
- code refine, move uflags to outside struct header file
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@3622 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r-- | include/bbs.h | 1 | ||||
-rw-r--r-- | include/convert.h | 7 | ||||
-rw-r--r-- | include/pttstruct.h | 42 | ||||
-rw-r--r-- | include/uflags.h | 66 |
4 files changed, 75 insertions, 41 deletions
diff --git a/include/bbs.h b/include/bbs.h index 4c03621b..8d51000a 100644 --- a/include/bbs.h +++ b/include/bbs.h @@ -50,6 +50,7 @@ typedef time_t time4_t; #endif #include "ansi.h" #include "statistic.h" +#include "uflags.h" #include "pttstruct.h" #include "fav.h" #include "common.h" diff --git a/include/convert.h b/include/convert.h index cafa08b7..c5303d56 100644 --- a/include/convert.h +++ b/include/convert.h @@ -1,5 +1,8 @@ /* $Id: convert.h 1374 2003-11-27 14:11:40Z victor $ */ +#ifndef _BBS_CONVERT_H +#define _BBS_CONVERT_H + #ifdef CONVERT #define CONV_NORMAL 0 @@ -8,5 +11,7 @@ typedef ssize_t (*read_write_type)(int, void *, size_t); typedef ssize_t (*convert_type)(void *, ssize_t); +extern int bbs_convert_type; -#endif +#endif // CONVERT +#endif // _BBS_CONVERT_H diff --git a/include/pttstruct.h b/include/pttstruct.h index dfc6dc2f..9042cfca 100644 --- a/include/pttstruct.h +++ b/include/pttstruct.h @@ -2,7 +2,6 @@ #ifndef INCLUDE_STRUCT_H #define INCLUDE_STRUCT_H - #define IDLEN 12 /* Length of bid/uid */ /* 競標資訊 */ @@ -63,8 +62,8 @@ typedef struct userec_t { char nickname[24]; /* 暱稱 */ char passwd[PASSLEN]; /* 密碼 */ char padx; - unsigned int uflag; /* 習慣1 */ - unsigned int uflag2; /* 習慣2 */ + unsigned int uflag; /* 習慣1 , see uflags.h */ + unsigned int uflag2; /* 習慣2 , see uflags.h */ unsigned int userlevel; /* 權限 */ unsigned int numlogins; /* 上站次數 */ unsigned int numposts; /* 文章篇數 */ @@ -119,32 +118,6 @@ typedef struct userec_t { time4_t timeviolatelaw; /* 被開罰單時間 */ char pad[28]; } userec_t; -/* these are flags in userec_t.uflag */ -#define PAGER_FLAG 0x04 /* true if pager was OFF last session */ -#define CLOAK_FLAG 0x08 /* true if cloak was ON last session */ -#define FRIEND_FLAG 0x10 /* true if show friends only */ -#define BRDSORT_FLAG 0x20 /* true if the boards sorted alphabetical */ -#define MOVIE_FLAG 0x40 /* true if show movie */ - -/* useless flag */ -//#define COLOR_FLAG 0x80 /* true if the color mode open */ -//#define MIND_FLAG 0x100 /* true if mind search mode open <-Heat*/ - -#define DBCSAWARE_FLAG 0x200 /* true if DBCS-aware enabled. */ -/* please keep this even if you don't have DBCSAWARE features turned on */ - -/* these are flags in userec_t.uflag2 */ -#define WATER_MASK 0x003 /* water mask */ -#define WATER_ORIG 0x000 -#define WATER_NEW 0x001 -#define WATER_OFO 0x002 -#define WATERMODE(mode) ((cuser.uflag2 & WATER_MASK) == mode) -#define FAVNOHILIGHT 0x010 /* false if hilight favorite */ -#define FAVNEW_FLAG 0x020 /* true if add new board into one's fav */ -#define FOREIGN 0x100 /* true if a foreign */ -#define LIVERIGHT 0x200 /* true if get "liveright" already */ -#define REJ_OUTTAMAIL 0x400 /* true if don't accept outside mails */ -#define REJECT_OUTTAMAIL (cuser.uflag2 & REJ_OUTTAMAIL) /* flags in userec_t.withme */ #define WITHME_ALLFLAG 0x55555555 @@ -161,17 +134,6 @@ typedef struct userec_t { #define WITHME_GO 0x00000400 #define WITHME_NOGO 0x00000800 -#ifdef PLAY_ANGEL -#define REJ_QUESTION 0x800 /* true if don't want to be angel for a while */ -#define REJECT_QUESTION (cuser.uflag2 & REJ_QUESTION) -#define ANGEL_MASK 0x3000 -#define ANGEL_R_MAEL 0x1000 /* true if reject male */ -#define ANGEL_R_FEMAEL 0x2000 /* true if reject female */ -#define ANGEL_STATUS() ((cuser.uflag2 & ANGEL_MASK) >> 12) -#define ANGEL_SET(X) (cuser.uflag2 = (cuser.uflag2 & ~ANGEL_MASK) | \ - (((X) & 3) << 12)) -#endif - #define BTLEN 48 /* Length of board title */ /* TODO 動態更新的欄位不應該跟要寫入檔案的混在一起, diff --git a/include/uflags.h b/include/uflags.h new file mode 100644 index 00000000..48bcc326 --- /dev/null +++ b/include/uflags.h @@ -0,0 +1,66 @@ +/* $Id: uflags.h $ */ +/* PTT BBS User Flags */ + +#ifndef INCLUDE_UFLAGS_H +#define INCLUDE_UFLAGS_H + +/* -------------------- userec_t.uflag (unsigned int) */ + +/* UNKNOWN */ + +/* TRADITIONAL BBS UFLAG */ +//#define UNKNOWN_FLAG 0x00000001 // deprecated ? +//#define UNKNOWN_FLAG2 0x00000002 // deprecated ? +#define PAGER_FLAG 0x00000004 /* true if pager was OFF last session */ +#define CLOAK_FLAG 0x00000008 /* true if cloak was ON last session */ +#define FRIEND_FLAG 0x00000010 /* true if show friends only */ +#define BRDSORT_FLAG 0x00000020 /* true if the boards sorted alphabetical */ +#define MOVIE_FLAG 0x00000040 /* true if show movie */ +/* deprecated flag */ +//#define COLOR_FLAG 0x00000080 /* true if the color mode open */ +//#define MIND_FLAG 0x00000100 /* true if mind search mode open <-Heat*/ + +/* DBCS CONFIG */ +#define DBCSAWARE_FLAG 0x00000200 /* true if DBCS-aware enabled. */ +/* please keep this even if you don't have DBCSAWARE features turned on */ + +/* NEW ENTRY HERE */ +// #define ??__??? 0x00000400 + +/* -------------------- userec_t.uflag2 (unsigned int) */ + +#define WATER_ORIG 0x00000000 +#define WATER_NEW 0x00000001 +#define WATER_OFO 0x00000002 +#define WATERMODE(mode) ((cuser.uflag2 & WATER_MASK) == mode) +#define WATER_MASK 0x00000003 /* water mask */ +// #define WATER_??? 0x00000004 +// #define WATER_??? 0x00000008 + +/* MYFAV */ +#define FAVNOHILIGHT 0x00000010 /* false if hilight favorite */ +#define FAVNEW_FLAG 0x00000020 /* true if add new board into one's fav */ +// #define FAV_??? 0x00000040 +// #define FAV_??? 0x00000080 + +/* MISC */ +#define FOREIGN 0x00000100 /* true if a foreign */ +#define LIVERIGHT 0x00000200 /* true if get "liveright" already */ +#define REJ_OUTTAMAIL 0x00000400 /* true if don't accept outside mails */ +#define REJECT_OUTTAMAIL (cuser.uflag2 & REJ_OUTTAMAIL) + +/* ANGEL */ +#define REJ_QUESTION 0x00000800 /* true if don't want to be angel for a while */ +#define ANGEL_R_MAEL 0x00001000 /* true if reject male */ +#define ANGEL_R_FEMAEL 0x00002000 /* true if reject female */ +#define ANGEL_MASK 0x00003000 +#define ANGEL_STATUS() ((cuser.uflag2 & ANGEL_MASK) >> 12) +#define ANGEL_SET(X) (cuser.uflag2 = (cuser.uflag2 & ~ANGEL_MASK) | \ + (((X) & 3) << 12)) +// #define ANGEL_??? 0x00004000 +// #define ANGEL_??? 0x00008000 + +/* NEW ENTRY HERE */ +// #define ???_??? 0x00010000 + +#endif // INCLUDE_UFLAGS_H |