summaryrefslogtreecommitdiffstats
path: root/include/proto.h
diff options
context:
space:
mode:
authorscw <scw@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2005-02-05 23:40:30 +0800
committerscw <scw@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2005-02-05 23:40:30 +0800
commiteefc275d2541b5146dbeb8c1afdc241c4118799f (patch)
treeaeed6591c44758139ae39cd6b48ad4b470328a66 /include/proto.h
parentb5158ac3a4014ecd88d4d9f78ecbcf6ec3f6b6ce (diff)
downloadpttbbs-eefc275d2541b5146dbeb8c1afdc241c4118799f.tar
pttbbs-eefc275d2541b5146dbeb8c1afdc241c4118799f.tar.gz
pttbbs-eefc275d2541b5146dbeb8c1afdc241c4118799f.tar.bz2
pttbbs-eefc275d2541b5146dbeb8c1afdc241c4118799f.tar.lz
pttbbs-eefc275d2541b5146dbeb8c1afdc241c4118799f.tar.xz
pttbbs-eefc275d2541b5146dbeb8c1afdc241c4118799f.tar.zst
pttbbs-eefc275d2541b5146dbeb8c1afdc241c4118799f.zip
* In generalnamecomplete(), complete as more as possible when space (' ')
is pressed. (As what <tab> does in most shell) * In all three completing functions (namecomplete, usercomplete and generalnamecomplete), return null string instead of partial matched name which makes users able to talk/annoy those they are not supposed to talk to (admins or cloaks). * Type of parameters of generalnamecomplete has typedefed and should be clearer. * New macro CompleteBoard and CompleteOnlineUser are defined since most of the usage of generalnamecomplete are the same. git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@2468 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'include/proto.h')
-rw-r--r--include/proto.h16
1 files changed, 14 insertions, 2 deletions
diff --git a/include/proto.h b/include/proto.h
index ab551ae6..4678b40a 100644
--- a/include/proto.h
+++ b/include/proto.h
@@ -367,6 +367,10 @@ void m_sob_brd(char *bname,char *fromdir);
int more(char *fpath, int promptend);
/* name */
+typedef int (*gnc_comp_func)(int, char*, int);
+typedef int (*gnc_perm_func)(int);
+typedef char* (*gnc_getname_func)(int);
+
void usercomplete(char *prompt, char *data);
void namecomplete(char *prompt, char *data);
void AddNameList(char *name);
@@ -378,8 +382,8 @@ void ShowNameList(int row, int column, char *prompt);
int RemoveNameList(char *name);
void ToggleNameList(int *reciper, char *listfile, char *msg);
int generalnamecomplete(char *prompt, char *data, int len, size_t nmemb,
- int (*compar)(int, char *, int),
- int (*permission)(int), char* (*getname)(int));
+ gnc_comp_func compar, gnc_perm_func permission,
+ gnc_getname_func getname);
int completeboard_compar(int where, char *str, int len);
int completeboard_permission(int where);
char *completeboard_getname(int where);
@@ -387,6 +391,14 @@ int completeutmp_compar(int where, char *str, int len);
int completeutmp_permission(int where);
char *completeutmp_getname(int where);
+#define CompleteBoard(MSG,BUF) \
+ generalnamecomplete(MSG, BUF, sizeof(BUF), SHM->Bnumber, \
+ &completeboard_compar, &completeboard_permission, \
+ &completeboard_getname)
+#define CompleteOnlineUser(MSG,BUF) \
+ generalnamecomplete(MSG, BUF, sizeof(BUF), SHM->UTMPnumber, \
+ &completeutmp_compar, &completeutmp_permission, \
+ &completeutmp_getname)
/* osdep */
int cpuload(char *str);