1
0
forked from bip/bip

Add subcategory in help commands.

This commit is contained in:
Loïc Gomez 2007-12-29 01:35:11 +01:00 committed by Arnaud Cornet
parent e0170c8144
commit b020e895a8
2 changed files with 132 additions and 38 deletions

View File

@ -61,17 +61,20 @@ also find an example configuration file along with BIP.
.SH GLOBAL OPTIONS .SH GLOBAL OPTIONS
.TP
\fBbacklog_always\fP (default: \fBfalse\fP)
If true, clients will always receive \fBbacklog_lines\fP log lines, even if
they were already sent before. This option should of course not be enabled if
\fBbacklog_lines\fP is 0 !
.TP .TP
\fBbacklog\fP (default: \fBtrue\fP) \fBbacklog\fP (default: \fBtrue\fP)
Enable or disable the whole backlog system, which allows clients to see a Enable or disable the whole backlog system, which allows clients to see a
log replay upon connection. log replay upon connection.
.TP
\fBbacklog_always\fP (default: \fBfalse\fP)
If true, clients will always receive \fBbacklog_lines\fP log lines, even if
they were already sent before. That means :
If \fBbacklog_always\fP is false, backlog will be starts when there
is no more client connected to a network.
This option should not be set to true if \fBbacklog_lines\fP is 0 !
If you still want to do so, don't forget to /BIP BLRESET sometimes.
.TP .TP
\fBbacklog_lines\fP (default: \fB10\fP) \fBbacklog_lines\fP (default: \fB10\fP)
If set to 0, BIP will replay all the logs since last client disconnect. Else, If set to 0, BIP will replay all the logs since last client disconnect. Else,
@ -86,10 +89,9 @@ If true, backlogged line won't include the timestamp.
.TP .TP
\fBbacklog_reset_on_talk\fP (default: \fBfalse\fP) \fBbacklog_reset_on_talk\fP (default: \fBfalse\fP)
When true, backlog will not be reset upon client disconnection but upon client When true, backlog will be reset upon client talk (channel/private message or
talk (channel/private message or action). It means that next time you log to action). It means that next time you log to your bip session, the backlogging
your bip session the backlogging will start at the time right after your last will start at the time right after your last words on that specific network.
words on irc.
.TP .TP
\fBbacklog_msg_only\fP (default: \fBfalse\fP) \fBbacklog_msg_only\fP (default: \fBfalse\fP)
@ -99,6 +101,8 @@ change, nick change, user quit/part/join will be backlogged upon connection.
.TP .TP
\fBclient_side_ssl\fP (default: \fBfalse\fP) \fBclient_side_ssl\fP (default: \fBfalse\fP)
When true, clients will need to connect to BIP using SSL. When true, clients will need to connect to BIP using SSL.
You'll also need to generate a SSL cert/key pair in <bipdir>/bip.pem (usually
~bip/.bip/bip.pem or /var/lib/bip/bip.pem).
.TP .TP
\fBip\fP \fBip\fP
@ -245,7 +249,7 @@ once.
.TP .TP
\fBaway_nick\fP (default: \fBnot set\fP) \fBaway_nick\fP (default: \fBnot set\fP)
If true, and if there are no more client attached, BIP will change nickname to If set, and if there are no more client attached, BIP will change nickname to
this \fBaway_nick\fP. Your nickname will be restored upon client connect. this \fBaway_nick\fP. Your nickname will be restored upon client connect.
.TP .TP

144
src/bip.c
View File

@ -1866,33 +1866,115 @@ void adm_away_nick(struct link_client *ic, char *val)
} }
} }
void adm_bip_help(struct link_client *ic, int admin) void adm_bip_help(struct link_client *ic, int admin, char *subhelp)
{ {
if (admin) { if (subhelp == NULL) {
bip_notify(ic, "/BIP RELOAD # Re-read bip configuration " if (admin) {
"and apply changes. /!\\ VERY UNSTABLE !"); bip_notify(ic, "/BIP RELOAD # Re-read bip configuration "
bip_notify(ic, "/BIP INFO user <username> # show a user's " "and apply changes. /!\\ VERY UNSTABLE !");
"configuration"); bip_notify(ic, "/BIP INFO user <username> # show a user's "
bip_notify(ic, "/BIP LIST networks|users|connections|all_links" "configuration");
"|all_connections"); bip_notify(ic, "/BIP LIST networks|users|connections|all_links"
bip_notify(ic, "/BIP ADD_CONN <connection name> <network>"); "|all_connections");
bip_notify(ic, "/BIP DEL_CONN <connection name>"); bip_notify(ic, "/BIP ADD_CONN <connection name> <network>");
} else { bip_notify(ic, "/BIP DEL_CONN <connection name>");
bip_notify(ic, "/BIP LIST networks|connections"); } else {
} bip_notify(ic, "/BIP LIST networks|connections");
bip_notify(ic, "/BIP JUMP # jump to next server (in same network)"); }
bip_notify(ic, "/BIP BLRESET # reset backlog (this connection only). Add -q flag and the operation is quiet."); bip_notify(ic, "/BIP JUMP # jump to next server (in same network)");
bip_notify(ic, "/BIP BLRESET # reset backlog (this connection only). Add -q flag and the operation is quiet.");
#ifdef HAVE_LIBSSL #ifdef HAVE_LIBSSL
bip_notify(ic, "/BIP TRUST # trust this server certificate"); bip_notify(ic, "/BIP TRUST # trust this server certificate");
#endif #endif
bip_notify(ic, "/BIP HELP # show this help..."); bip_notify(ic, "/BIP HELP [subhelp] # show this help...");
bip_notify(ic, "## Temporary changes for this connection:"); bip_notify(ic, "## Temporary changes for this connection:");
bip_notify(ic, "/BIP FOLLOW_NICK|IGNORE_FIRST_NICK TRUE|FALSE"); bip_notify(ic, "/BIP FOLLOW_NICK|IGNORE_FIRST_NICK TRUE|FALSE");
bip_notify(ic, "/BIP ON_CONNECT_SEND <str> # Adds a string to " bip_notify(ic, "/BIP ON_CONNECT_SEND <str> # Adds a string to "
"send on connect"); "send on connect");
bip_notify(ic, "/BIP ON_CONNECT_SEND # Clears on_connect_send"); bip_notify(ic, "/BIP ON_CONNECT_SEND # Clears on_connect_send");
bip_notify(ic, "/BIP AWAY_NICK <nick> # Set away nick"); bip_notify(ic, "/BIP AWAY_NICK <nick> # Set away nick");
bip_notify(ic, "/BIP AWAY_NICK # clear away nick"); bip_notify(ic, "/BIP AWAY_NICK # clear away nick");
} else if (admin && strcasecmp(subhelp, "RELOAD") == 0) {
bip_notify(ic, "/BIP RELOAD (admin only) :");
bip_notify(ic, " Reloads bip configuration file and apply "
"changes.");
bip_notify(ic, " Please note that changes to 'user' or "
"'realname' will not be applied without a JUMP.");
} else if (admin && strcasecmp(subhelp, "INFO") == 0) {
bip_notify(ic, "/BIP INFO <user> (admin only) :");
bip_notify(ic, " Show <user>'s current configuration.");
bip_notify(ic, " That means it may be different from the "
"configuration stored in bip.conf");
} else if (admin && strcasecmp(subhelp, "ADD_CONN") == 0) {
bip_notify(ic, "/BIP ADD_CONN <connection name> <network> "
"(admin only) :");
bip_notify(ic, " Add a connection named <connection name> to "
"the network <network> to your connection list");
bip_notify(ic, " <network> should already exist in bip's "
"configuration.");
} else if (admin && strcasecmp(subhelp, "DEL_CONN") == 0) {
bip_notify(ic, "/BIP DEL_CONN <connection name> (admin only) "
":");
bip_notify(ic, " Remove the connection named <connection "
"name> from your connection list.");
bip_notify(ic, " Removing a connection will cause "
"its disconnection.");
} else if (strcasecmp(subhelp, "JUMP") == 0) {
bip_notify(ic, "/BIP JUMP :");
bip_notify(ic, " Jump to next server in current network.");
} else if (strcasecmp(subhelp, "BLRESET") == 0) {
bip_notify(ic, "/BIP BLRESET :");
bip_notify(ic, " Reset backlog on this network.");
} else if (strcasecmp(subhelp, "TRUST") == 0) {
bip_notify(ic, "/BIP TRUST");
bip_notify(ic, " Trust current server's certificate.");
} else if (strcasecmp(subhelp, "FOLLOW_NICK") == 0) {
bip_notify(ic, "/BIP FOLLOW_NICK TRUE|FALSE :");
bip_notify(ic, " Change the value of the follow_nick option "
"for this connection.");
bip_notify(ic, " If set to true, when you change nick, "
"BIP stores the new nickname as the new default "
"nickname value.");
bip_notify(ic, " Thus, if you are disconnected from the "
"server, BIP will restore the correct nickname.");
} else if (strcasecmp(subhelp, "IGNORE_FIRST_NICK") == 0) {
bip_notify(ic, "/BIP IGNORE_FIRST_NICK TRUE|FALSE :");
bip_notify(ic, " Change the value of the ignore_first_nick "
"option for this connection.");
bip_notify(ic, " If set to TRUE, BIP will ignore the nickname"
"sent by the client upon connect.");
bip_notify(ic, " Further nickname changes will be processed "
"as usual.");
} else if (strcasecmp(subhelp, "ON_CONNECT_SEND") == 0) {
bip_notify(ic, "/BIP ON_CONNECT_SEND [some text] :");
bip_notify(ic, " BIP will send the text as is to the server "
"upon connection.");
bip_notify(ic, " You can call this command more than once.");
bip_notify(ic, " If [some text] is empty, this command will "
"remove any on_connect_send defined for this connection.");
} else if (strcasecmp(subhelp, "AWAY_NICK") == 0) {
bip_notify(ic, "/BIP AWAY_NICK [some_nick] :");
bip_notify(ic, " If [some_nick] is set, BIP will change "
"nickname to [some_nick] if there are no more client "
"attached");
bip_notify(ic, " If [some_nick] is empty, this command will "
"unset current connection's away_nick.");
} else if (strcasecmp(subhelp, "LIST") == 0) {
bip_notify(ic, "/BIP LIST <section> :");
bip_notify(ic, " List information from a these sections :");
bip_notify(ic, " - networks: list all available networks");
bip_notify(ic, " - connections: list all your configured "
"connections and their state.");
if (admin) {
bip_notify(ic, " - users: list all users (admin)");
bip_notify(ic, " - all_links: list all connected "
"sockets from and to BIP (admin)");
bip_notify(ic, " - all_connections: list all users' "
"configured connections (admin)");
}
} else {
bip_notify(ic, "-- No sub-help for '%s'", subhelp);
}
} }
int adm_bip(bip_t *bip, struct link_client *ic, struct line *line, int adm_bip(bip_t *bip, struct link_client *ic, struct line *line,
@ -1980,17 +2062,25 @@ int adm_bip(bip_t *bip, struct link_client *ic, struct line *line,
adm_blreset(ic); adm_blreset(ic);
} }
} else if (strcasecmp(line->elemv[privmsg + 1], "HELP") == 0) { } else if (strcasecmp(line->elemv[privmsg + 1], "HELP") == 0) {
adm_bip_help(ic, admin); if (line->elemc == privmsg + 2)
adm_bip_help(ic, admin, NULL);
else if (line->elemc == privmsg + 3)
adm_bip_help(ic, admin, line->elemv[privmsg + 2]);
else
bip_notify(ic,
"-- HELP command needs at most one argument");
} else if (strcasecmp(line->elemv[privmsg + 1], "FOLLOW_NICK") == 0) { } else if (strcasecmp(line->elemv[privmsg + 1], "FOLLOW_NICK") == 0) {
if (line->elemc != privmsg + 3) { if (line->elemc != privmsg + 3) {
bip_notify(ic, "-- FOLLOW_NICK command needs one argument"); bip_notify(ic,
"-- FOLLOW_NICK command needs one argument");
return OK_FORGET; return OK_FORGET;
} }
adm_follow_nick(ic, line->elemv[privmsg + 2]); adm_follow_nick(ic, line->elemv[privmsg + 2]);
} else if (strcasecmp(line->elemv[privmsg + 1], } else if (strcasecmp(line->elemv[privmsg + 1],
"IGNORE_FIRST_NICK") == 0) { "IGNORE_FIRST_NICK") == 0) {
if (line->elemc != privmsg + 3) { if (line->elemc != privmsg + 3) {
bip_notify(ic, "-- IGNORE_FIRST_NICK command needs one argument"); bip_notify(ic, "-- IGNORE_FIRST_NICK "
"command needs one argument");
return OK_FORGET; return OK_FORGET;
} }
adm_ignore_first_nick(ic, line->elemv[privmsg + 2]); adm_ignore_first_nick(ic, line->elemv[privmsg + 2]);