summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Changes1
-rw-r--r--include/extern.h5
-rw-r--r--include/services.h35
-rw-r--r--include/sysconf.h.in10
-rw-r--r--src/bahamut.c17
-rw-r--r--src/base64.c5
-rw-r--r--src/botserv.c2
-rw-r--r--src/chanserv.c86
-rw-r--r--src/dreamforge.c10
-rw-r--r--src/hostserv.c3
-rw-r--r--src/hybrid.c10
-rw-r--r--src/memory.c34
-rw-r--r--src/memoserv.c2
-rw-r--r--src/misc.c288
-rw-r--r--src/news.c2
-rw-r--r--src/nickserv.c4
-rw-r--r--src/operserv.c145
-rw-r--r--src/process.c9
-rw-r--r--src/ptlink.c10
-rw-r--r--src/rageircd.c18
-rw-r--r--src/servers.c8
-rw-r--r--src/sessions.c4
-rw-r--r--src/slist.c94
-rw-r--r--src/sockutil.c179
-rw-r--r--src/solidircd.c17
-rw-r--r--src/ultimate2.c10
-rw-r--r--src/ultimate3.c18
-rw-r--r--src/unreal31.c11
-rw-r--r--src/unreal32.c47
-rw-r--r--src/users.c11
-rw-r--r--src/viagra.c17
-rw-r--r--version.log15
32 files changed, 848 insertions, 279 deletions
diff --git a/Changes b/Changes
index 216000e16..6744a5795 100644
--- a/Changes
+++ b/Changes
@@ -13,6 +13,7 @@ Provided by Anope Dev. <dev@anope.org> - 2004
11/19 A Added anope_cmd_ctcp() to code API, for sending CTCP messages. [ #00]
11/18 A Unable to use registered nicknames as bot nicks from now on. [ #00]
11/18 A NSAddAccessOnReg to control access list on registration. [ #00]
+12/05 F CS CLEAR OPS strips +a/+q modes, and uses SVSMODE where possible [ #00]
12/05 F Ultimate3 not setting +a on channel admins [ #00]
12/04 F Cleaned up some memory warnings found with Valgrind [ #00]
12/03 F Unreal 391 TIME replies [ #00]
diff --git a/include/extern.h b/include/extern.h
index 5c8b3b6b9..4513fcf90 100644
--- a/include/extern.h
+++ b/include/extern.h
@@ -1033,6 +1033,7 @@ extern void anope_cmd_svsinfo(); /* SVSINFO */
extern void anope_cmd_svsjoin(char *source, char *nick,char *chan); /* SVSJOIN */
extern void anope_cmd_svskill(char *source,char *user, const char *fmt, ...); /* SVSKILL */
extern void anope_cmd_svsmode(User * u, int ac, char **av); /* SVSMODE */
+extern void anope_cmd_svsmode_chan(char *name, char *mode, char *nick); /* SVSMODE */
extern void anope_cmd_svsnick(char *nick,char *newnick, time_t when); /* SVSNICK */
extern void anope_cmd_svsnoop(char *server, int set); /* SVSNOOP */
extern void anope_cmd_svso(char *source,char *nick, char *flag); /* SVSO */
@@ -1134,8 +1135,8 @@ extern char *send_token(char *token1, char *token2);
extern char *base64enc(long i);
extern long base64dec(char *b64);
extern long base64dects(char *ts);
-extern int b64_encode(unsigned char const *src, size_t srclength, char *target, size_t targsize);
-extern int b64_decode(char const *src, unsigned char *target, size_t targsize);
+extern int b64_encode(char *src, size_t srclength, char *target, size_t targsize);
+extern int b64_decode(char *src, char *target, size_t targsize);
extern char *encode_ip(u_char *ip);
extern int decode_ip(char *buf);
diff --git a/include/services.h b/include/services.h
index 26ae68667..f420c0347 100644
--- a/include/services.h
+++ b/include/services.h
@@ -49,6 +49,7 @@
#include <sys/stat.h> /* for umask() on some systems */
#include <sys/types.h>
#include <sys/time.h>
+#include <fcntl.h>
#ifdef HAVE_BACKTRACE
#include <execinfo.h>
@@ -258,8 +259,7 @@ struct ircdvars_ {
int invitemode; /* +I */
int sjoinbanchar; /* use single quotes to define it */
int sjoinexchar; /* use single quotes to define it */
- uint32 servicesmode; /* Services Mode +S */
- int p10; /* P10 ircd */
+ int svsmode_ucmode; /* Can remove User Channel Modes with SVSMODE */
};
struct ircdcapab_ {
@@ -308,6 +308,7 @@ struct ircdcapab_ {
#define PRE_NICK_VERSION 1
#define OPER_VERSION 13
#define HELP_VERSION 1
+#define HOST_VERSION 3
/*************************************************************************/
@@ -330,7 +331,7 @@ struct ModuleData_ {
struct memo_ {
uint32 number; /* Index number -- not necessarily array position! */
- int16 flags;
+ uint16 flags;
time_t time; /* When it was sent */
char sender[NICKMAX];
char *text;
@@ -338,7 +339,7 @@ struct memo_ {
};
typedef struct {
- int16 memocount, memomax;
+ uint16 memocount, memomax;
Memo *memos;
} MemoInfo;
@@ -365,7 +366,7 @@ struct nickalias_ {
char *last_usermask; /* Last usermask */
time_t time_registered; /* When the nick was registered */
time_t last_seen; /* When it was seen online for the last time */
- int16 status; /* See NS_* below */
+ uint16 status; /* See NS_* below */
NickCore *nc; /* I'm an alias of this */
/* Not saved */
ModuleData *moduleData; /* Module saved data attached to the nick alias */
@@ -383,7 +384,7 @@ struct nickcore_ {
char *url; /* URL associated to the nick */
uint32 flags; /* See NI_* below */
uint16 language; /* Language selected by nickname owner (LANG_*) */
- int16 accesscount; /* # of entries */
+ uint16 accesscount; /* # of entries */
char **access; /* Array of strings */
MemoInfo memos;
uint16 channelcount; /* Number of channels currently registered */
@@ -426,8 +427,8 @@ struct botinfo_ {
/* Access levels for users. */
typedef struct {
- int16 in_use; /* 1 if this entry is in use, else 0 */
- int16 level;
+ uint16 in_use; /* 1 if this entry is in use, else 0 */
+ uint16 level;
NickCore *nc; /* Guaranteed to be non-NULL if in use, NULL if not */
time_t last_seen;
} ChanAccess;
@@ -451,9 +452,7 @@ typedef struct {
typedef struct {
int16 in_use; /* Always 0 if not in use */
int16 is_nick; /* 1 if a regged nickname, 0 if a nick!user@host mask */
-
- int16 flags;
-
+ uint16 flags;
union {
char *mask; /* Guaranteed to be non-NULL if in use, NULL if not */
NickCore *nc; /* Same */
@@ -471,9 +470,9 @@ typedef struct {
/* Structure used to contain bad words. */
struct badword_ {
- int16 in_use;
+ uint16 in_use;
char *word;
- int16 type; /* BW_* below */
+ uint16 type; /* BW_* below */
};
#define BW_ANY 0
@@ -506,9 +505,9 @@ struct chaninfo_ {
int16 bantype;
int16 *levels; /* Access levels for commands */
- int16 accesscount;
+ uint16 accesscount;
ChanAccess *access; /* List of authorized users */
- int16 akickcount;
+ uint16 akickcount;
AutoKick *akick; /* List of users to kickban */
uint32 mlock_on, mlock_off; /* See channel modes below */
@@ -532,7 +531,7 @@ struct chaninfo_ {
uint32 botflags; /* BS_* below */
int16 *ttb; /* Times to ban for each kicker */
- int16 bwcount;
+ uint16 bwcount;
BadWord *badwords; /* For BADWORDS kicker */
int16 capsmin, capspercent; /* For CAPS kicker */
int16 floodlines, floodsecs; /* For FLOOD kicker */
@@ -904,10 +903,8 @@ struct hostcore_ {
/*************************************************************************/
-
-
struct newsitem_ {
- int16 type;
+ uint16 type;
uint32 num; /* Numbering is separate for login and oper news */
char *text;
char who[NICKMAX];
diff --git a/include/sysconf.h.in b/include/sysconf.h.in
index 472075577..cfd1cd75c 100644
--- a/include/sysconf.h.in
+++ b/include/sysconf.h.in
@@ -217,6 +217,16 @@ int vfprintf(FILE *stream, const char *format, va_list ap);
int vsprintf(char *str, const char *format, va_list ap);
int vsnprintf(char *str, size_t size, const char *format, va_list ap);
+FILE *popen(const char *command, const char *type);
+int pclose(FILE *stream);
+FILE *fdopen(int fildes, const char *mode);
+int fileno(FILE *stream);
+int ftruncate(int fd, off_t length);
+
+#ifdef HAVE_STRSIGNAL
+char *strsignal(int sig);
+#endif
+
/* Freebsd 5.2.1 actually has u_char those it throws more
errors having it defined again - TSL */
#undef u_char
diff --git a/src/bahamut.c b/src/bahamut.c
index d4a2d1a30..772a716c8 100644
--- a/src/bahamut.c
+++ b/src/bahamut.c
@@ -102,8 +102,7 @@ IRCDVar ircd[] = {
1, /* +I support */
0, /* SJOIN ban char */
0, /* SJOIN except char */
- 0, /* Services Client mode */
- 0, /* not p10 */
+ 0, /* Can remove User Channel Modes with SVSMODE */
}
,
{NULL}
@@ -485,7 +484,19 @@ void anope_cmd_release_svshold(char *nick)
/* SVSMODE -b */
void anope_cmd_unban(char *name, char *nick)
{
- send_cmd(ServerName, "SVSMODE %s -b %s", name, nick);
+ anope_cmd_svsmode_chan(name, "-b", nick);
+}
+
+
+/* SVSMODE channel modes */
+
+void anope_cmd_svsmode_chan(char *name, char *mode, char *nick)
+{
+ if (nick) {
+ send_cmd(ServerName, "SVSMODE %s %s %s", name, mode, nick);
+ } else {
+ send_cmd(ServerName, "SVSMODE %s %s", name, mode);
+ }
}
void anope_cmd_bot_chan_mode(char *nick, char *chan)
diff --git a/src/base64.c b/src/base64.c
index 6349eebfd..6eb8e57ac 100644
--- a/src/base64.c
+++ b/src/base64.c
@@ -103,8 +103,7 @@ static const char Pad64 = '=';
characters followed by one "=" padding character.
*/
-int b64_encode(unsigned char const *src, size_t srclength, char *target,
- size_t targsize)
+int b64_encode(char *src, size_t srclength, char *target, size_t targsize)
{
size_t datalength = 0;
u_char input[3];
@@ -163,7 +162,7 @@ int b64_encode(unsigned char const *src, size_t srclength, char *target,
it returns the number of data bytes stored at the target, or -1 on error.
*/
-int b64_decode(char const *src, unsigned char *target, size_t targsize)
+int b64_decode(char *src, char *target, size_t targsize)
{
int tarindex, state, ch;
char *pos;
diff --git a/src/botserv.c b/src/botserv.c
index 1e9ad3067..8b1fc120f 100644
--- a/src/botserv.c
+++ b/src/botserv.c
@@ -611,7 +611,7 @@ void load_bs_dbase(void)
{
dbFILE *f;
int c, ver;
- int16 tmp16;
+ uint16 tmp16;
uint32 tmp32;
BotInfo *bi;
int failed = 0;
diff --git a/src/chanserv.c b/src/chanserv.c
index a4edae96e..7a855e5ee 100644
--- a/src/chanserv.c
+++ b/src/chanserv.c
@@ -635,7 +635,7 @@ void load_cs_dbase(void)
ver = get_file_version(f);
for (i = 0; i < 256 && !failed; i++) {
- int16 tmp16;
+ uint16 tmp16;
uint32 tmp32;
int n_levels;
char *s;
@@ -6004,18 +6004,62 @@ static int do_clear(User * u)
char *av[3];
struct c_userlist *cu, *next;
- for (cu = c->users; cu; cu = next) {
- next = cu->next;
- if (!chan_has_user_status(c, cu->user, CUS_OP))
- continue;
+ if (ircd->svsmode_ucmode) {
av[0] = sstrdup(chan);
- av[1] = sstrdup("-o");
- av[2] = sstrdup(cu->user->nick);
- anope_cmd_mode(whosends(ci), av[0], "%s :%s", av[1], av[2]);
- do_cmode(s_ChanServ, 3, av);
- free(av[2]);
- free(av[1]);
- free(av[0]);
+ anope_cmd_svsmode_chan(av[0], "-o", NULL);
+ if (ircd->owner) {
+ anope_cmd_svsmode_chan(av[0], "-q", NULL);
+ }
+ if (ircd->protect || ircd->admin) {
+ anope_cmd_svsmode_chan(av[0], "-a", NULL);
+ }
+ for (cu = c->users; cu; cu = next) {
+ next = cu->next;
+ av[0] = sstrdup(chan);
+ if (!chan_has_user_status(c, cu->user, CUS_OP)) {
+ if (!chan_has_user_status(c, cu->user, CUS_PROTECT)) {
+ if (!chan_has_user_status(c, cu->user, CUS_OWNER)) {
+ continue;
+ } else {
+ av[1] = sstrdup("-qo");
+ }
+ } else {
+ av[1] = sstrdup("-ao");
+ }
+ } else {
+ av[1] = sstrdup("-o");
+ }
+ av[2] = sstrdup(cu->user->nick);
+ do_cmode(s_ChanServ, 3, av);
+ free(av[2]);
+ free(av[1]);
+ free(av[0]);
+ }
+ } else {
+ for (cu = c->users; cu; cu = next) {
+ next = cu->next;
+ av[0] = sstrdup(chan);
+ if (!chan_has_user_status(c, cu->user, CUS_OP)) {
+ if (!chan_has_user_status(c, cu->user, CUS_PROTECT)) {
+ if (!chan_has_user_status(c, cu->user, CUS_OWNER)) {
+ continue;
+ } else {
+ av[1] = sstrdup("-qo");
+ }
+ } else {
+ av[1] = sstrdup("-ao");
+ }
+ } else {
+ av[1] = sstrdup("-o");
+ }
+ av[2] = sstrdup(cu->user->nick);
+ anope_cmd_mode(whosends(ci), av[0], "%s :%s", av[1],
+ av[2]);
+ do_cmode(s_ChanServ, 3, av);
+ free(av[2]);
+ free(av[1]);
+ free(av[0]);
+ }
}
notice_lang(s_ChanServ, u, CHAN_CLEARED_OPS, chan);
} else if (ircd->halfop && stricmp(what, "hops") == 0) {
@@ -6029,7 +6073,14 @@ static int do_clear(User * u)
av[0] = sstrdup(chan);
av[1] = sstrdup("-h");
av[2] = sstrdup(cu->user->nick);
- anope_cmd_mode(whosends(ci), av[0], "%s :%s", av[1], av[2]);
+ if (ircd->svsmode_ucmode) {
+ anope_cmd_svsmode_chan(av[0], av[1], NULL);
+ do_cmode(s_ChanServ, 3, av);
+ break;
+ } else {
+ anope_cmd_mode(whosends(ci), av[0], "%s :%s", av[1],
+ av[2]);
+ }
do_cmode(s_ChanServ, 3, av);
free(av[2]);
free(av[1]);
@@ -6047,7 +6098,14 @@ static int do_clear(User * u)
av[0] = sstrdup(chan);
av[1] = sstrdup("-v");
av[2] = sstrdup(cu->user->nick);
- anope_cmd_mode(whosends(ci), av[0], "%s :%s", av[1], av[2]);
+ if (ircd->svsmode_ucmode) {
+ anope_cmd_svsmode_chan(av[0], av[1], NULL);
+ do_cmode(s_ChanServ, 3, av);
+ break;
+ } else {
+ anope_cmd_mode(whosends(ci), av[0], "%s :%s", av[1],
+ av[2]);
+ }
do_cmode(s_ChanServ, 3, av);
free(av[2]);
free(av[1]);
diff --git a/src/dreamforge.c b/src/dreamforge.c
index a13e0ca7c..d16e744dd 100644
--- a/src/dreamforge.c
+++ b/src/dreamforge.c
@@ -100,8 +100,7 @@ IRCDVar ircd[] = {
0, /* +I support */
0, /* SJOIN ban char */
0, /* SJOIN except char */
- 0, /* Services Client mode */
- 0, /* not p10 */
+ 0, /* Can remove User Channel Modes with SVSMODE */
}
,
{NULL}
@@ -1262,6 +1261,13 @@ void anope_cmd_unban(char *name, char *nick)
/* Not Supported by this IRCD */
}
+/* SVSMODE channel modes */
+
+void anope_cmd_svsmode_chan(char *name, char *mode, char *nick)
+{
+ /* Not Supported by this IRCD */
+}
+
void anope_cmd_vhost_off(User * u)
{
/* Not Supported by this IRCD */
diff --git a/src/hostserv.c b/src/hostserv.c
index 11ee42984..1a3feb9b2 100644
--- a/src/hostserv.c
+++ b/src/hostserv.c
@@ -16,7 +16,6 @@
#include "services.h"
#include "pseudo.h"
-#define HOST_VERSION 3
#define HASH(nick) ((tolower((nick)[0])&31)<<5 | (tolower((nick)[1])&31))
void load_hs_dbase_v1(dbFILE * f);
@@ -700,6 +699,7 @@ int do_setall(User * u)
if (!isValidHost(hostmask, 3)) {
notice_lang(s_HostServ, u, HOST_SET_ERROR);
+ free(hostmask);
return MOD_CONT;
}
@@ -708,6 +708,7 @@ int do_setall(User * u)
if ((na = findnick(nick))) {
if (na->status & NS_VERBOTEN) {
notice_lang(s_HostServ, u, NICK_X_FORBIDDEN, nick);
+ free(hostmask);
return MOD_CONT;
}
if (vIdent && ircd->vident) {
diff --git a/src/hybrid.c b/src/hybrid.c
index 265d3260f..64008b387 100644
--- a/src/hybrid.c
+++ b/src/hybrid.c
@@ -100,8 +100,7 @@ IRCDVar ircd[] = {
0, /* +I support */
0, /* SJOIN ban char */
0, /* SJOIN except char */
- 0, /* Services Client mode */
- 0, /* not p10 */
+ 0, /* Can remove User Channel Modes with SVSMODE */
}
,
{NULL}
@@ -1374,6 +1373,13 @@ void anope_cmd_unban(char *name, char *nick)
/* Not Supported by this IRCD */
}
+/* SVSMODE channel modes */
+
+void anope_cmd_svsmode_chan(char *name, char *mode, char *nick)
+{
+ /* Not Supported by this IRCD */
+}
+
/* SVSMODE +d */
/* sent if svid is something weird */
void anope_cmd_svid_umode(char *nick, time_t ts)
diff --git a/src/memory.c b/src/memory.c
index 504bbaabe..38e734aab 100644
--- a/src/memory.c
+++ b/src/memory.c
@@ -14,9 +14,6 @@
#include "services.h"
-/*************************************************************************/
-/*************************************************************************/
-
/* smalloc, scalloc, srealloc, sstrdup:
* Versions of the memory allocation functions which will cause the
* program to terminate with an "Out of memory" error if the memory
@@ -24,6 +21,13 @@
* is never NULL.)
*/
+/*************************************************************************/
+
+/**
+ * malloc, replacement so we can trap for "out of memory"
+ * @param size to allocate
+ * @return void
+ */
void *smalloc(long size)
{
void *buf;
@@ -41,6 +45,14 @@ void *smalloc(long size)
return buf;
}
+/*************************************************************************/
+
+/**
+ * calloc, replacement so we can trap for "out of memory"
+ * @param elsize to allocate
+ * @param els size of members
+ * @return void
+ */
void *scalloc(long elsize, long els)
{
void *buf;
@@ -58,6 +70,14 @@ void *scalloc(long elsize, long els)
return buf;
}
+/*************************************************************************/
+
+/**
+ * realloc, replacement so we can trap for "out of memory"
+ * @param oldptr Old Pointer
+ * @param newsize Size of new pointer
+ * @return void
+ */
void *srealloc(void *oldptr, long newsize)
{
void *buf;
@@ -75,6 +95,14 @@ void *srealloc(void *oldptr, long newsize)
return buf;
}
+/*************************************************************************/
+
+/**
+ * strdup, replacement so we can trap for "out of memory"
+ * @param oldptr Old Pointer
+ * @param newsize Size of new pointer
+ * @return void
+ */
char *sstrdup(const char *src)
{
char *ret = NULL;
diff --git a/src/memoserv.c b/src/memoserv.c
index 0b32cff83..4210925fe 100644
--- a/src/memoserv.c
+++ b/src/memoserv.c
@@ -1106,7 +1106,7 @@ static int do_info(User * u)
notice_lang(s_MemoServ, u, MEMO_INFO_X_MEMOS_SOME_UNREAD,
name, mi->memocount, count);
}
- if (mi->memomax >= 0) {
+ if (mi->memomax) {
if (hardmax)
notice_lang(s_MemoServ, u, MEMO_INFO_X_HARD_LIMIT, name,
mi->memomax);
diff --git a/src/misc.c b/src/misc.c
index b2943a8de..0b2d5af10 100644
--- a/src/misc.c
+++ b/src/misc.c
@@ -27,38 +27,55 @@ struct arc4_stream {
/*************************************************************************/
-/* toupper/tolower: Like the ANSI functions, but make sure we return an
+/**
+ * toupper: Like the ANSI functions, but make sure we return an
* int instead of a (signed) char.
+ * @param c Char
+ * @return int
*/
-
int toupper(char c)
{
- if (islower(c))
+ if (islower(c)) {
return (unsigned char) c - ('a' - 'A');
- else
+ } else {
return (unsigned char) c;
+ }
}
+/*************************************************************************/
+
+/**
+ * tolower: Like the ANSI functions, but make sure we return an
+ * int instead of a (signed) char.
+ * @param c Char
+ * @return int
+ */
int tolower(char c)
{
- if (isupper(c))
+ if (isupper(c)) {
return (unsigned char) c + ('a' - 'A');
- else
+ } else {
return (unsigned char) c;
+ }
}
/*************************************************************************/
-/* strscpy: Copy at most len-1 characters from a string to a buffer, and
+/**
+ * strscpy: Copy at most len-1 characters from a string to a buffer, and
* add a null terminator after the last character copied.
+ * @param d Buffer to copy into
+ * @param s Data to copy int
+ * @param len Length of data
+ * @return updated buffer
*/
-
char *strscpy(char *d, const char *s, size_t len)
{
char *d_orig = d;
- if (!len)
+ if (!len) {
return d;
+ }
while (--len && (*d++ = *s++));
*d = '\0';
return d_orig;
@@ -66,11 +83,14 @@ char *strscpy(char *d, const char *s, size_t len)
/*************************************************************************/
-/* stristr: Search case-insensitively for string s2 within string s1,
+/**
+ * stristr: Search case-insensitively for string s2 within string s1,
* returning the first occurrence of s2 or NULL if s2 was not
* found.
+ * @param s1 String 1
+ * @param s2 String 2
+ * @return first occurrence of s2
*/
-
char *stristr(char *s1, char *s2)
{
register char *s = s1, *d = s2;
@@ -91,12 +111,17 @@ char *stristr(char *s1, char *s2)
/*************************************************************************/
-/* strnrepl: Replace occurrences of `old' with `new' in string `s'. Stop
+/**
+ * strnrepl: Replace occurrences of `old' with `new' in string `s'. Stop
* replacing if a replacement would cause the string to exceed
* `size' bytes (including the null terminator). Return the
* string.
+ * @param s String
+ * @param size size of s
+ * @param old character to replace
+ * @param new character to replace with
+ * @return updated s
*/
-
char *strnrepl(char *s, int32 size, const char *old, const char *new)
{
char *ptr = s;
@@ -124,13 +149,15 @@ char *strnrepl(char *s, int32 size, const char *old, const char *new)
}
/*************************************************************************/
-/*************************************************************************/
-/* merge_args: Take an argument count and argument vector and merge them
+/**
+ * merge_args: Take an argument count and argument vector and merge them
* into a single string in which each argument is separated by
* a space.
+ * @param int Number of Args
+ * @param argv Array
+ * @return string of the merged array
*/
-
char *merge_args(int argc, char **argv)
{
int i;
@@ -145,13 +172,16 @@ char *merge_args(int argc, char **argv)
}
/*************************************************************************/
-/*************************************************************************/
-/* match_wild: Attempt to match a string to a pattern which might contain
+/**
+ * do_match_wild: Attempt to match a string to a pattern which might contain
* '*' or '?' wildcards. Return 1 if the string matches the
* pattern, 0 if not.
+ * @param pattern To be matched
+ * @param str String in which the pattern is to be matched
+ * @param docase Case In/Senstive
+ * @return 1 if the string matches the pattern, 0 if not.
*/
-
static int do_match_wild(const char *pattern, const char *str, int docase)
{
char c;
@@ -195,21 +225,36 @@ static int do_match_wild(const char *pattern, const char *str, int docase)
}
}
+/*************************************************************************/
+/**
+ * match_wild: Case Senstive wild card search
+ * @param pattern To be matched
+ * @param str String in which the pattern is to be matched
+ * @return 1 if the string matches the pattern, 0 if not.
+ */
int match_wild(const char *pattern, const char *str)
{
return do_match_wild(pattern, str, 1);
}
+/*************************************************************************/
+
+/**
+ * match_wild: Case Insenstive wild card search
+ * @param pattern To be matched
+ * @param str String in which the pattern is to be matched
+ * @return 1 if the string matches the pattern, 0 if not.
+ */
int match_wild_nocase(const char *pattern, const char *str)
{
return do_match_wild(pattern, str, 0);
}
/*************************************************************************/
-/*************************************************************************/
-/* Process a string containing a number/range list in the form
+/**
+ * Process a string containing a number/range list in the form
* "n1[-n2][,n3[-n4]]...", calling a caller-specified routine for each
* number in the list. If the callback returns -1, stop immediately.
* Returns the sum of all nonnegative return values from the callback.
@@ -218,8 +263,13 @@ int match_wild_nocase(const char *pattern, const char *str)
*
* The callback should be of type range_callback_t, which is defined as:
* int (*range_callback_t)(User *u, int num, va_list args)
+ * @param numstr
+ * @param count_ret
+ * @param callback Call back function
+ * @param u User Struct
+ * @param ... various args
+ * @return int
*/
-
int process_numlist(const char *numstr, int *count_ret,
range_callback_t callback, User * u, ...)
{
@@ -279,15 +329,17 @@ int process_numlist(const char *numstr, int *count_ret,
/*************************************************************************/
-/* dotime: Return the number of seconds corresponding to the given time
+/**
+ * dotime: Return the number of seconds corresponding to the given time
* string. If the given string does not represent a valid time,
* return -1.
*
* A time string is either a plain integer (representing a number
* of seconds), or an integer followed by one of these characters:
* "s" (seconds), "m" (minutes), "h" (hours), or "d" (days).
+ * @param s String to convert
+ * @return int
*/
-
int dotime(const char *s)
{
int amount;
@@ -317,9 +369,15 @@ int dotime(const char *s)
/*************************************************************************/
-/* Expresses in a string the period of time represented by a given amount
- of seconds (with days/hours/minutes). */
-
+/**
+ * Expresses in a string the period of time represented by a given amount
+ * of seconds (with days/hours/minutes).
+ * @param na Nick Alias
+ * @param buf buffer to store result into
+ * @param bufsize Size of the buffer
+ * @param seconds time in seconds
+ * @return buffer
+ */
char *duration(NickAlias * na, char *buf, int bufsize, time_t seconds)
{
int days = 0, hours = 0, minutes = 0;
@@ -380,8 +438,14 @@ char *duration(NickAlias * na, char *buf, int bufsize, time_t seconds)
/*************************************************************************/
-/* Generates a human readable string of type "expires in ..." */
-
+/**
+ * Generates a human readable string of type "expires in ..."
+ * @param na Nick Alias
+ * @param buf buffer to store result into
+ * @param bufsize Size of the buffer
+ * @param seconds time in seconds
+ * @return buffer
+ */
char *expire_left(NickAlias * na, char *buf, int len, time_t expires)
{
time_t now = time(NULL);
@@ -429,17 +493,18 @@ char *expire_left(NickAlias * na, char *buf, int len, time_t expires)
return buf;
}
+
+/*************************************************************************/
+
/**
- * Return 1 if a host is valid, 0 if it isnt.
- * host = string to check
- * type = format, 1 = ip4addr, 2 = hostname
- *
+ * Validate the host
* shortname = ( letter / digit ) *( letter / digit / "-" ) *( letter / digit )
* hostname = shortname *( "." shortname )
* ip4addr = 1*3digit "." 1*3digit "." 1*3digit "." 1*3digit
- *
- **/
-
+ * @param host = string to check
+ * @param type = format, 1 = ip4addr, 2 = hostname
+ * @return 1 if a host is valid, 0 if it isnt.
+ */
int doValidHost(cons