Compare commits
6 commits
042218080e
...
492d560ee1
Author | SHA1 | Date | |
---|---|---|---|
|
492d560ee1 | ||
|
2644dcd166 | ||
|
7a246575e5 | ||
|
93035e75d9 | ||
|
22ebfd257e | ||
|
18ac52f017 |
9 changed files with 97 additions and 20 deletions
|
@ -306,7 +306,7 @@ operator "god" {
|
|||
privset = "admin";
|
||||
};
|
||||
|
||||
// See connecting-servers.rst for an introduction to using these files.
|
||||
/* See connecting-servers.rst for an introduction to using these files. */
|
||||
|
||||
connect "irc.uplink.com" {
|
||||
host = "203.0.113.3";
|
||||
|
|
|
@ -20,8 +20,8 @@ NO PARAMETERS:
|
|||
messages is stripped.
|
||||
+g - Free invite. Everyone may invite users. Significantly
|
||||
weakens +i control.
|
||||
? +u - Unfiltered. Receive messages that are filtered server side based
|
||||
on content
|
||||
? +u - Unfiltered. Receive messages that would otherwise be filtered
|
||||
server side based on content.
|
||||
+z - Op moderated. Messages blocked by +m, +b and +q are instead
|
||||
sent to ops.
|
||||
+L - Large ban list. Increase maximum number of +beIq entries.
|
||||
|
|
|
@ -16,8 +16,8 @@ User modes: (* designates that the umode is oper only)
|
|||
* +a - Is marked as a server admin in whois.
|
||||
* +l - Can see oper locops (local wallops).
|
||||
* +s - Can see server notices (see /quote help snomask).
|
||||
? +u - Receive messages that are filtered server side based
|
||||
on content
|
||||
? +u - Receive messages that would otherwise be filtered server side
|
||||
based on content.
|
||||
* +z - Can see operwalls.
|
||||
? +C - Prevents you from receiving CTCPs other than ACTION.
|
||||
+D - Deaf - ignores all channel messages.
|
||||
|
|
|
@ -11,8 +11,8 @@ User modes: (? designates that the umode is provided by an extension
|
|||
? +h - Has a cloaked host. May be +x depending on cloaking module
|
||||
+g - Deny users not on your /ACCEPT list from messaging you and
|
||||
inviting you to channels.
|
||||
? +u - Receive messages that are filtered server side based
|
||||
on content.
|
||||
? +u - Receive messages that would otherwise be filtered server side
|
||||
based on content.
|
||||
+w - Can see oper wallops.
|
||||
? +C - Prevents you from receiving CTCPs other than ACTION.
|
||||
+D - Deaf - ignores all channel messages.
|
||||
|
|
|
@ -43,6 +43,8 @@
|
|||
|
||||
#include "stdinc.h"
|
||||
|
||||
struct Client;
|
||||
|
||||
enum {
|
||||
PRIV_NEEDOPER = 1
|
||||
};
|
||||
|
|
|
@ -40,6 +40,7 @@
|
|||
#include <openssl/rsa.h>
|
||||
#endif
|
||||
|
||||
struct Client;
|
||||
struct ConfItem;
|
||||
|
||||
extern rb_dlink_list cluster_conf_list;
|
||||
|
|
|
@ -685,23 +685,44 @@ time_t
|
|||
valid_temp_time(const char *p)
|
||||
{
|
||||
time_t result = 0;
|
||||
long current = 0;
|
||||
|
||||
while(*p)
|
||||
{
|
||||
if(IsDigit(*p))
|
||||
{
|
||||
result *= 10;
|
||||
result += ((*p) & 0xF);
|
||||
p++;
|
||||
}
|
||||
else
|
||||
while (*p) {
|
||||
char *endp;
|
||||
|
||||
errno = 0;
|
||||
current = strtol(p, &endp, 10);
|
||||
|
||||
if (errno == ERANGE)
|
||||
return -1;
|
||||
if (endp == p)
|
||||
return -1;
|
||||
|
||||
switch (*endp) {
|
||||
case '\0': /* No unit was given so send it back as minutes */
|
||||
case 'm':
|
||||
result += current * 60;
|
||||
break;
|
||||
case 'h':
|
||||
result += current * 3600;
|
||||
break;
|
||||
case 'd':
|
||||
result += current * 86400;
|
||||
break;
|
||||
case 'w':
|
||||
result += current * 604800;
|
||||
break;
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
|
||||
if(result > (60 * 24 * 7 * 52))
|
||||
result = (60 * 24 * 7 * 52);
|
||||
if (*endp == '\0')
|
||||
break;
|
||||
|
||||
return(result * 60);
|
||||
p = endp + 1;
|
||||
}
|
||||
|
||||
return MIN(result, 60 * 60 * 24 * 7 * 52);
|
||||
}
|
||||
|
||||
/* Propagated bans are expired elsewhere. */
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
check_PROGRAMS = runtests \
|
||||
chmode1 \
|
||||
match1 \
|
||||
misc \
|
||||
msgbuf_parse1 \
|
||||
msgbuf_unparse1 \
|
||||
hostmask1 \
|
||||
|
|
52
tests/misc.c
Normal file
52
tests/misc.c
Normal file
|
@ -0,0 +1,52 @@
|
|||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include "tap/basic.h"
|
||||
|
||||
#include "s_newconf.h"
|
||||
|
||||
#define MSG "%s:%d (%s)", __FILE__, __LINE__, __FUNCTION__
|
||||
|
||||
#define MINUTE (60)
|
||||
#define HOUR (MINUTE * 60)
|
||||
#define DAY (HOUR * 24)
|
||||
#define WEEK (DAY * 7)
|
||||
|
||||
static void valid_temp_time1(void)
|
||||
{
|
||||
time_t t;
|
||||
t = valid_temp_time("1");
|
||||
is_int(MINUTE, t, MSG);
|
||||
t = valid_temp_time("1m");
|
||||
is_int(MINUTE, t, MSG);
|
||||
t = valid_temp_time("1h");
|
||||
is_int(HOUR, t, MSG);
|
||||
t = valid_temp_time("1d");
|
||||
is_int(DAY, t, MSG);
|
||||
t = valid_temp_time("1w");
|
||||
is_int(WEEK, t, MSG);
|
||||
|
||||
t = valid_temp_time("2d");
|
||||
is_int(2 * DAY, t, MSG);
|
||||
|
||||
t = valid_temp_time("1w2d3h4m");
|
||||
is_int(1 * WEEK + 2 * DAY + 3 * HOUR + 4 * MINUTE, t, MSG);
|
||||
t = valid_temp_time("1w2d3h4");
|
||||
is_int(1 * WEEK + 2 * DAY + 3 * HOUR + 4 * MINUTE, t, MSG);
|
||||
|
||||
t = valid_temp_time("4m3h2d1w");
|
||||
is_int(1 * WEEK + 2 * DAY + 3 * HOUR + 4 * MINUTE, t, MSG);
|
||||
|
||||
t = valid_temp_time("7000w");
|
||||
is_int(52 * WEEK, t, MSG);
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
plan_lazy();
|
||||
|
||||
valid_temp_time1();
|
||||
|
||||
return 0;
|
||||
}
|
Loading…
Reference in a new issue