Permalink
Browse files

Fix tcl setuser botaddr field docs and functionality. Fixes #459

* Standardize setuser botaddr syntax with chaddr
.chaddr syntax changes both user and bot port if only one port is specified. .tcl setuser botaddr
syntax changed only the bot port if one port was entered. This patch standardize to the chaddr behavior
* Reset port to non-SSL when adding a non-SSL port with .tcl setuser
* Clarify BOTADDR docs
  • Loading branch information...
vanosg committed Oct 21, 2017
1 parent 98cee28 commit 185d23ff6b8c6e74251472f3e635aab96a332580
Showing with 41 additions and 21 deletions.
  1. +19 −9 doc/sphinx_source/mainDocs/tcl-commands.rst
  2. +22 −12 src/userent.c
@@ -208,7 +208,7 @@ getuser <handle> [entry-type] [extra info]
+----------+-------------------------------------------------------------------------------------+
| BOTFL | returns the current bot-specific flags for the user (bot-only) |
+----------+-------------------------------------------------------------------------------------+
| BOTADDR | returns a list containing the bot's address, telnet port, and relay port (bot-only) |
| BOTADDR | returns a list containing the bot's address, bot listen port, and user listen port |
+----------+-------------------------------------------------------------------------------------+
| HOSTS | returns a list of hosts for the user |
+----------+-------------------------------------------------------------------------------------+
@@ -240,20 +240,30 @@ setuser <handle> <entry-type> [extra info]
Description: this is the counterpart of getuser. It lets you set the various values. Other then the ones listed below, the entry-types are the same as getuser's.
+---------+---------------------------------------------------------------------------------------+
| PASS | sets a users password (no third arg will clear it) |
| Type | Extra Info |
+=========+=======================================================================================+
| PASS | <password> |
| | Password string (Empty value will clear the password) |
+---------+---------------------------------------------------------------------------------------+
| HOSTS | if used with no third arg, all hosts for the user will be cleared. Otherwise, *1* |
| | hostmask is added :P |
| BOTADDR | <address> [bot listen port] [user listen port] |
| | Sets address, bot listen port and user listen port. If no listen ports are |
| | specified, only the bot address is updated. If only the bot listen port is |
| | specified, both the bot and user listen ports are set to the bot listen port. |
+---------+---------------------------------------------------------------------------------------+
| HOSTS | [hostmask] |
| | If no value is specified, all hosts for the user will be cleared. Otherwise, only |
| | *1* hostmask is added :P |
+---------+---------------------------------------------------------------------------------------+
| LASTON | This setting has 3 forms. |
| | |
| | *setuser <handle> LASTON <unixtime> <place>* sets global LASTON time |
| | <unixtime> <place> |
| | sets global LASTON time |
| | |
| | *setuser <handle> LASTON <unixtime>* sets global LASTON time (leaving the place |
| | field empty) |
| | <unixtime> |
| | sets global LASTON time (leaving the place field empty) |
| | |
| | *setuser <handle> LASTON <unixtime> <channel>* sets a users LASTON time for a |
| | channel (if it is a valid channel) |
| | <unixtime> <channel> |
| | sets a user's LASTON time for a channel (if it is a valid channel) |
+---------+---------------------------------------------------------------------------------------+
Returns: nothing
View
@@ -680,26 +680,36 @@ static int botaddr_tcl_set(Tcl_Interp * irp, struct userrec *u,
nfree(bi->address);
bi->address = user_malloc(strlen(argv[3]) + 1);
strcpy(bi->address, argv[3]);
if (argc > 4)
if (argc > 4) {
#ifdef TLS
{
if (*argv[4] == '+')
/* If no user port set, use bot port for both entries */
if (*argv[4] == '+') {
bi->ssl |= TLS_BOT;
if (argc == 5) {
bi->ssl |= TLS_RELAY;
}
} else {
bi->ssl &= ~TLS_BOT;
if (argc == 5) {
bi->ssl &= ~TLS_RELAY;
}
}
#endif
bi->telnet_port = atoi(argv[4]);
if (argc == 5) {
bi->relay_port = atoi(argv[4]);
}
}
#else
bi->telnet_port = atoi(argv[4]);
#endif
if (argc > 5)
if (argc > 5) {
#ifdef TLS
{
if (*argv[5] == '+')
if (*argv[5] == '+') {
bi->ssl |= TLS_RELAY;
} else {
bi->ssl &= ~TLS_RELAY;
}
#endif
bi->relay_port = atoi(argv[5]);
}
#else
bi->relay_port = atoi(argv[5]);
#endif
if (!bi->telnet_port)
bi->telnet_port = 3333;
if (!bi->relay_port)

0 comments on commit 185d23f

Please sign in to comment.