diff options
| author | rburchell <rburchell@5417fbe8-f217-4b02-8779-1006273d7864> | 2008-11-14 20:57:20 +0000 |
|---|---|---|
| committer | rburchell <rburchell@5417fbe8-f217-4b02-8779-1006273d7864> | 2008-11-14 20:57:20 +0000 |
| commit | 6c55e0a529c7f1216ff6f63a4fc77ea06a2a3a38 (patch) | |
| tree | 91b0841faf23087ebe0c74dd4269d181a383f1e7 /src/tools | |
| parent | 069409cd99cf78ab8bf87a1fe69a833576414fd3 (diff) | |
Insane commit of doom: s/ \t/g
git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@1681 5417fbe8-f217-4b02-8779-1006273d7864
Diffstat (limited to 'src/tools')
| -rw-r--r-- | src/tools/anopesmtp.c | 680 | ||||
| -rw-r--r-- | src/tools/db-merger.c | 3414 | ||||
| -rw-r--r-- | src/tools/obsolete/epona2anope.c | 1162 | ||||
| -rw-r--r-- | src/tools/smtp.h | 18 |
4 files changed, 2637 insertions, 2637 deletions
diff --git a/src/tools/anopesmtp.c b/src/tools/anopesmtp.c index f5981a851..d00bcdc18 100644 --- a/src/tools/anopesmtp.c +++ b/src/tools/anopesmtp.c @@ -23,37 +23,37 @@ static int curday = 0; #ifdef _WIN32 int strcasecmp(const char *s1, const char *s2) { - register int c; - - while ((c = tolower(*s1)) == tolower(*s2)) { - if (c == 0) - return 0; - s1++; - s2++; - } - if (c < tolower(*s2)) - return -1; - return 1; + register int c; + + while ((c = tolower(*s1)) == tolower(*s2)) { + if (c == 0) + return 0; + s1++; + s2++; + } + if (c < tolower(*s2)) + return -1; + return 1; } #endif static int get_logname(char *name, int count, struct tm *tm) { - char timestamp[32]; + char timestamp[32]; - if (!tm) { - time_t t; + if (!tm) { + time_t t; - time(&t); - tm = localtime(&t); - } + time(&t); + tm = localtime(&t); + } - strftime(timestamp, count, "%Y%m%d", tm); - snprintf(name, count, "logs/%s.%s", "anopesmtp", timestamp); - curday = tm->tm_yday; + strftime(timestamp, count, "%Y%m%d", tm); + snprintf(name, count, "logs/%s.%s", "anopesmtp", timestamp); + curday = tm->tm_yday; - return 1; + return 1; } /*************************************************************************/ @@ -62,28 +62,28 @@ static int get_logname(char *name, int count, struct tm *tm) void close_log(void) { - if (!logfile) - return; - fclose(logfile); - logfile = NULL; + if (!logfile) + return; + fclose(logfile); + logfile = NULL; } /*************************************************************************/ static void remove_log(void) { - time_t t; - struct tm tm; + time_t t; + struct tm tm; - char name[PATH_MAX]; + char name[PATH_MAX]; - time(&t); - t -= (60 * 60 * 24 * 30); - tm = *localtime(&t); + time(&t); + t -= (60 * 60 * 24 * 30); + tm = *localtime(&t); - if (!get_logname(name, sizeof(name), &tm)) - return; - unlink(name); + if (!get_logname(name, sizeof(name), &tm)) + return; + unlink(name); } /*************************************************************************/ @@ -93,35 +93,35 @@ static void remove_log(void) int open_log(void) { - char name[PATH_MAX]; + char name[PATH_MAX]; - if (logfile) - return 0; + if (logfile) + return 0; - if (!get_logname(name, sizeof(name), NULL)) - return 0; - logfile = fopen(name, "a"); + if (!get_logname(name, sizeof(name), NULL)) + return 0; + logfile = fopen(name, "a"); - if (logfile) - setbuf(logfile, NULL); - return logfile != NULL ? 0 : -1; + if (logfile) + setbuf(logfile, NULL); + return logfile != NULL ? 0 : -1; } /*************************************************************************/ static void checkday(void) { - time_t t; - struct tm tm; + time_t t; + struct tm tm; - time(&t); - tm = *localtime(&t); + time(&t); + tm = *localtime(&t); - if (curday != tm.tm_yday) { - close_log(); - remove_log(); - open_log(); - } + if (curday != tm.tm_yday) { + close_log(); + remove_log(); + open_log(); + } } /*************************************************************************/ @@ -132,33 +132,33 @@ static void checkday(void) void alog(const char *fmt, ...) { - va_list args; - time_t t; - struct tm tm; - char buf[256]; - int errno_save = errno; - - if (!smtp_debug) { - return; - } - - checkday(); - - if (!fmt) { - return; - } - - va_start(args, fmt); - time(&t); - tm = *localtime(&t); - strftime(buf, sizeof(buf) - 1, "[%b %d %H:%M:%S %Y] ", &tm); - if (logfile && args) { - fputs(buf, logfile); - vfprintf(logfile, fmt, args); - fputc('\n', logfile); - } - va_end(args); - errno = errno_save; + va_list args; + time_t t; + struct tm tm; + char buf[256]; + int errno_save = errno; + + if (!smtp_debug) { + return; + } + + checkday(); + + if (!fmt) { + return; + } + + va_start(args, fmt); + time(&t); + tm = *localtime(&t); + strftime(buf, sizeof(buf) - 1, "[%b %d %H:%M:%S %Y] ", &tm); + if (logfile && args) { + fputs(buf, logfile); + vfprintf(logfile, fmt, args); + fputc('\n', logfile); + } + va_end(args); + errno = errno_save; } /*************************************************************************/ @@ -166,12 +166,12 @@ void alog(const char *fmt, ...) /* Remove a trailing \r\n */ char *strip(char *buf) { - char *c; - if ((c = strchr(buf, '\n'))) - *c = 0; - if ((c = strchr(buf, '\r'))) - *c = 0; - return buf; + char *c; + if ((c = strchr(buf, '\n'))) + *c = 0; + if ((c = strchr(buf, '\r'))) + *c = 0; + return buf; } /*************************************************************************/ @@ -181,11 +181,11 @@ char *strip(char *buf) */ char *lftocrlf(char *buf) { - char *result = (char *)malloc(strlen(buf) + 2); - strip(buf); - strcpy(result, buf); - strcat(result, "\r\n"); - return result; + char *result = (char *)malloc(strlen(buf) + 2); + strip(buf); + strcpy(result, buf); + strcat(result, "\r\n"); + return result; } /*************************************************************************/ @@ -193,18 +193,18 @@ char *lftocrlf(char *buf) /* Add a header to the list */ void smtp_add_header(char *header) { - struct smtp_header *head = (struct smtp_header *)malloc(sizeof(struct smtp_header)); - - head->header = lftocrlf(header); - head->next = NULL; - - if (!mail.smtp_headers) { - mail.smtp_headers = head; - } - if (mail.smtp_headers_tail) { - mail.smtp_headers_tail->next = head; - } - mail.smtp_headers_tail = head; + struct smtp_header *head = (struct smtp_header *)malloc(sizeof(struct smtp_header)); + + head->header = lftocrlf(header); + head->next = NULL; + + if (!mail.smtp_headers) { + mail.smtp_headers = head; + } + if (mail.smtp_headers_tail) { + mail.smtp_headers_tail->next = head; + } + mail.smtp_headers_tail = head; } /*************************************************************************/ @@ -212,14 +212,14 @@ void smtp_add_header(char *header) /* Is the buffer a header? */ int smtp_is_header(char *buf) { - char *tmp = strchr(buf, ' '); + char *tmp = strchr(buf, ' '); - if (!tmp) - return 0; + if (!tmp) + return 0; - if (*(tmp - 1) == ':') - return 1; - return 0; + if (*(tmp - 1) == ':') + return 1; + return 0; } /*************************************************************************/ @@ -227,12 +227,12 @@ int smtp_is_header(char *buf) /* Parse a header into a name and value */ void smtp_parse_header(char *buf, char **header, char **value) { - strip(buf); + strip(buf); - *header = strtok(buf, " "); - *value = strtok(NULL, ""); - if (*header) - (*header)[strlen(*header) - 1] = 0; + *header = strtok(buf, " "); + *value = strtok(NULL, ""); + if (*header) + (*header)[strlen(*header) - 1] = 0; } /*************************************************************************/ @@ -240,11 +240,11 @@ void smtp_parse_header(char *buf, char **header, char **value) /* Have we reached the end of input? */ int smtp_is_end(char *buf) { - if (*buf == '.') - if (*(buf + 1) == '\r' || *(buf + 1) == '\n') - return 1; + if (*buf == '.') + if (*(buf + 1) == '\r' || *(buf + 1) == '\n') + return 1; - return 0; + return 0; } /*************************************************************************/ @@ -252,7 +252,7 @@ int smtp_is_end(char *buf) /* Set who the email is from */ void smtp_set_from(char *from) { - mail.from = strdup(from); + mail.from = strdup(from); } /*************************************************************************/ @@ -260,13 +260,13 @@ void smtp_set_from(char *from) /* Set who the email is to */ void smtp_set_to(char *to) { - char *c; + char *c; - if ((c = strrchr(to, '<')) && *(c + 1)) { - to = c + 1; - to[strlen(to) - 1] = 0; - } - mail.to = strdup(to); + if ((c = strrchr(to, '<')) && *(c + 1)) { + to = c + 1; + to[strlen(to) - 1] = 0; + } + mail.to = strdup(to); } /*************************************************************************/ @@ -274,18 +274,18 @@ void smtp_set_to(char *to) /* Add a line of body text */ void smtp_add_body_line(char *line) { - struct smtp_body_line *body; + struct smtp_body_line *body; - body = (struct smtp_body_line *)malloc(sizeof(struct smtp_body_line)); + body = (struct smtp_body_line *)malloc(sizeof(struct smtp_body_line)); - body->line = lftocrlf(line); - body->next = NULL; + body->line = lftocrlf(line); + body->next = NULL; - if (!mail.smtp_body) - mail.smtp_body = body; - if (mail.smtp_body_tail) - mail.smtp_body_tail->next = body; - mail.smtp_body_tail = body; + if (!mail.smtp_body) + mail.smtp_body = body; + if (mail.smtp_body_tail) + mail.smtp_body_tail->next = body; + mail.smtp_body_tail = body; } @@ -294,25 +294,25 @@ void smtp_add_body_line(char *line) /* Establish a connection to the SMTP server */ int smtp_connect(char *host, unsigned short port) { - struct sockaddr_in addr; - - if ((mail.sock = socket(AF_INET, SOCK_STREAM, 0)) == SOCKET_ERROR) - return 0; - - if ((addr.sin_addr.s_addr = inet_addr(host)) == INADDR_NONE) { - struct hostent *hent; - if (!(hent = gethostbyname(host))) - return 0; - memcpy(&addr.sin_addr, hent->h_addr, hent->h_length); - } - addr.sin_family = AF_INET; - addr.sin_port = htons(port ? port : 25); - if (connect(mail.sock, (struct sockaddr *) &addr, sizeof(struct sockaddr_in)) == SOCKET_ERROR) { - ano_sockclose(mail.sock); - return 0; - } - - return 1; + struct sockaddr_in addr; + + if ((mail.sock = socket(AF_INET, SOCK_STREAM, 0)) == SOCKET_ERROR) + return 0; + + if ((addr.sin_addr.s_addr = inet_addr(host)) == INADDR_NONE) { + struct hostent *hent; + if (!(hent = gethostbyname(host))) + return 0; + memcpy(&addr.sin_addr, hent->h_addr, hent->h_length); + } + addr.sin_family = AF_INET; + addr.sin_port = htons(port ? port : 25); + if (connect(mail.sock, (struct sockaddr *) &addr, sizeof(struct sockaddr_in)) == SOCKET_ERROR) { + ano_sockclose(mail.sock); + return 0; + } + + return 1; } /*************************************************************************/ @@ -320,14 +320,14 @@ int smtp_connect(char *host, unsigned short port) /* Send a line of text */ int smtp_send(char *text) { - int result = ano_sockwrite(mail.sock, text, strlen(text)); + int result = ano_sockwrite(mail.sock, text, strlen(text)); - alog("SMTP: sent %s",text); + alog("SMTP: sent %s",text); - if (result == SOCKET_ERROR) - ano_sockclose(mail.sock); + if (result == SOCKET_ERROR) + ano_sockclose(mail.sock); - return result; + return result; } /*************************************************************************/ @@ -335,15 +335,15 @@ int smtp_send(char *text) /* Read a line of text */ int smtp_read(char *buf, int len) { - int result; + int result; - memset(buf, 0, len); - result = ano_sockread(mail.sock, buf, len); + memset(buf, 0, len); + result = ano_sockread(mail.sock, buf, len); - if (result == SOCKET_ERROR) - ano_sockclose(mail.sock); + if (result == SOCKET_ERROR) + ano_sockclose(mail.sock); - return result; + return result; } /*************************************************************************/ @@ -351,12 +351,12 @@ int smtp_read(char *buf, int len) /* Retrieve a response code */ int smtp_get_code(char *text) { - char *tmp = strtok(text, " "); + char *tmp = strtok(text, " "); - if (!tmp) - return 0; + if (!tmp) + return 0; - return atol(tmp); + return atol(tmp); } /*************************************************************************/ @@ -364,130 +364,130 @@ int smtp_get_code(char *text) /* Send the email */ int smtp_send_email() { - char buf[1024]; - struct smtp_header *head; - struct smtp_body_line *body; - int code; - int skip_done = 0; - - if (!smtp_read(buf, 1024)) { - alog("SMTP: error reading buffer"); - return 0; - } - - code = smtp_get_code(buf); - if (code != 220) { - alog("SMTP: error expected code 220 got %d",code); - return 0; - } - - if (!smtp_send("HELO anope\r\n")) { - alog("SMTP: error writting to socket"); - return 0; - } - - if (!smtp_read(buf, 1024)) { + char buf[1024]; + struct smtp_header *head; + struct smtp_body_line *body; + int code; + int skip_done = 0; + + if (!smtp_read(buf, 1024)) { + alog("SMTP: error reading buffer"); + return 0; + } + + code = smtp_get_code(buf); + if (code != 220) { + alog("SMTP: error expected code 220 got %d",code); + return 0; + } + + if (!smtp_send("HELO anope\r\n")) { + alog("SMTP: error writting to socket"); + return 0; + } + + if (!smtp_read(buf, 1024)) { alog("SMTP: error reading buffer"); - return 0; - } - - code = smtp_get_code(buf); - if (code != 250) { - alog("SMTP: error expected code 250 got %d",code); - return 0; - } - - strcpy(buf, "MAIL FROM: <"); - strcat(buf, mail.from); - strcat(buf, ">\r\n"); - - if (!smtp_send(buf)) { - alog("SMTP: error writting to socket"); - return 0; - } - - if (!smtp_read(buf, 1024)) { - alog("SMTP: error reading buffer"); - return 0; - } - - code = smtp_get_code(buf); - if (code != 250) - return 0; - - strcpy(buf, "RCPT TO: <"); - strcat(buf, mail.to); - strcat(buf, ">\r\n"); - - if (!smtp_send(buf)) { - alog("SMTP: error writting to socket"); - return 0; - } - - if (!smtp_read(buf, 1024)) { - alog("SMTP: error reading buffer"); - return 0; - } - - code = smtp_get_code(buf); - if (smtp_get_code(buf) != 250) { - alog("SMTP: error expected code 250 got %d",code); - return 0; - } - - if (!smtp_send("DATA\r\n")) { - alog("SMTP: error writting to socket"); - return 0; - } - - if (!smtp_read(buf, 1024)) { - alog("SMTP: error reading buffer"); - return 0; - } - - code = smtp_get_code(buf); - if (code != 354) { - alog("SMTP: error expected code 354 got %d",code); - return 0; - } - - for (head = mail.smtp_headers; head; head = head->next) { - if (!smtp_send(head->header)) { - alog("SMTP: error writting to socket"); - return 0; - } - } - - if (!smtp_send("\r\n")) { - alog("SMTP: error writting to socket"); - return 0; - } - - for (body = mail.smtp_body; body; body = body->next) { - if (skip_done) { - if (!smtp_send(body->line)) { - alog("SMTP: error writting to socket"); - return 0; - } - } else { - skip_done = 1; - } - } - - if (!smtp_send("\r\n.\r\n")) { - alog("SMTP: error writting to socket"); - return 0; - } - - return 1; + return 0; + } + + code = smtp_get_code(buf); + if (code != 250) { + alog("SMTP: error expected code 250 got %d",code); + return 0; + } + + strcpy(buf, "MAIL FROM: <"); + strcat(buf, mail.from); + strcat(buf, ">\r\n"); + + if (!smtp_send(buf)) { + alog("SMTP: error writting to socket"); + return 0; + } + + if (!smtp_read(buf, 1024)) { + alog("SMTP: error reading buffer"); + return 0; + } + + code = smtp_get_code(buf); + if (code != 250) + return 0; + + strcpy(buf, "RCPT TO: <"); + strcat(buf, mail.to); + strcat(buf, ">\r\n"); + + if (!smtp_send(buf)) { + alog("SMTP: error writting to socket"); + return 0; + } + + if (!smtp_read(buf, 1024)) { + alog("SMTP: error reading buffer"); + return 0; + } + + code = smtp_get_code(buf); + if (smtp_get_code(buf) != 250) { + alog("SMTP: error expected code 250 got %d",code); + return 0; + } + + if (!smtp_send("DATA\r\n")) { + alog("SMTP: error writting to socket"); + return 0; + } + + if (!smtp_read(buf, 1024)) { + alog("SMTP: error reading buffer"); + return 0; + } + + code = smtp_get_code(buf); + if (code != 354) { + alog("SMTP: error expected code 354 got %d",code); + return 0; + } + + for (head = mail.smtp_headers; head; head = head->next) { + if (!smtp_send(head->header)) { + alog("SMTP: error writting to socket"); + return 0; + } + } + + if (!smtp_send("\r\n")) { + alog("SMTP: error writting to socket"); + return 0; + } + + for (body = mail.smtp_body; body; body = body->next) { + if (skip_done) { + if (!smtp_send(body->line)) { + alog("SMTP: error writting to socket"); + return 0; + } + } else { + skip_done = 1; + } + } + + if (!smtp_send("\r\n.\r\n")) { + alog("SMTP: error writting to socket"); + return 0; + } + + return 1; } /*************************************************************************/ void smtp_disconnect() { - smtp_send("QUIT\r\n"); - ano_sockclose(mail.sock); + smtp_send("QUIT\r\n"); + ano_sockclose(mail.sock); } /*************************************************************************/ @@ -523,82 +523,82 @@ void mail_cleanup() int main(int argc, char *argv[]) { - char buf[8192]; + char buf[8192]; /* These are somehow unused - why are they here? -GD - struct smtp_body_line *b; - struct smtp_header *h; + struct smtp_body_line *b; + struct smtp_header *h; */ - int headers_done = 0; + int headers_done = 0; /* Win32 stuff */ #ifdef _WIN32 - WSADATA wsa; + WSADATA wsa; #endif - char *server, *aport; - short port; + char *server, *aport; + short port; - if (argc == 1) - return 0; + if (argc == 1) + return 0; - server = strtok(argv[1], ":"); - if ((aport = strtok(NULL, ""))) { - port = atoi(aport); - } else { - port = 25; - } + server = strtok(argv[1], ":"); + if ((aport = strtok(NULL, ""))) { + port = atoi(aport); + } else { + port = 25; + } if (!server) { - alog("No Server"); + alog("No Server"); /* Bad, bad, bad. This was a eturn from main with no value! -GD */ - return 0; - } else { - alog("SMTP: server %s port %d",server,port); - } + return 0; + } else { + alog("SMTP: server %s port %d",server,port); + } - memset(&mail, 0, sizeof(mail)); + memset(&mail, 0, sizeof(mail)); /* The WSAStartup function initiates use of WS2_32.DLL by a process. */ /* guessing we can skip it under *nix */ #ifdef _WIN32 - if (WSAStartup(MAKEWORD(1, 1), &wsa) != 0) - return 0; + if (WSAStartup(MAKEWORD(1, 1), &wsa) != 0) + return 0; #endif - /* Read the message and parse it */ - while (fgets(buf, 8192, stdin)) { - if (smtp_is_header(buf) && !headers_done) { - char *header, *value; - smtp_add_header(buf); - smtp_parse_header(buf, &header, &value); - if (!strcasecmp(header, "from")) { - alog("SMTP: from: %s",value); - smtp_set_from(value); - } else if (!strcasecmp(header, "to")) { - alog("SMTP: to: %s",value); - smtp_set_to(value); - } else if (smtp_is_end(buf)) { - break; - } else { - headers_done = 1; - smtp_add_body_line(buf); - } - } else { - smtp_add_body_line(buf); - } - } - - if (!smtp_connect(server, port)) { - alog("SMTP: failed to connect to %s:%d",server, port); + /* Read the message and parse it */ + while (fgets(buf, 8192, stdin)) { + if (smtp_is_header(buf) && !headers_done) { + char *header, *value; + smtp_add_header(buf); + smtp_parse_header(buf, &header, &value); + if (!strcasecmp(header, "from")) { + alog("SMTP: from: %s",value); + smtp_set_from(value); + } else if (!strcasecmp(header, "to")) { + alog("SMTP: to: %s",value); + smtp_set_to(value); + } else if (smtp_is_end(buf)) { + break; + } else { + headers_done = 1; + smtp_add_body_line(buf); + } + } else { + smtp_add_body_line(buf); + } + } + + if (!smtp_connect(server, port)) { + alog("SMTP: failed to connect to %s:%d",server, port); mail_cleanup(); - return 0; - } - if (!smtp_send_email()) { - alog("SMTP: error during sending of mail"); + return 0; + } + if (!smtp_send_email()) { + alog("SMTP: error during sending of mail"); mail_cleanup(); - return 0; - } - smtp_disconnect(); + return 0; + } + smtp_disconnect(); mail_cleanup(); - return 1; + return 1; } diff --git a/src/tools/db-merger.c b/src/tools/db-merger.c index a80508af5..dae44d74b 100644 --- a/src/tools/db-merger.c +++ b/src/tools/db-merger.c @@ -18,7 +18,7 @@ * that includes chanserv, nickserv, botserv and memoserv databases. * * - Certus - * February 11, 2005 + * February 11, 2005 * * * 0.2 beta: @@ -26,21 +26,21 @@ * to fix your broken nick dbs. * * - Certus - * August 04, 2005 + * August 04, 2005 * * * 0.3 beta: * Fixed win32 stuff. Merging should now work fine under windows. * * - Certus - * July 20, 2006 + * July 20, 2006 * * * 0.4 beta: * Fixed some compiler warnings about signed/unsigned ints. * * - Certus - * August 8, 2006 + * August 8, 2006 */ @@ -82,20 +82,20 @@ /* CONFIGURATION BLOCK */ -#define NICK_DB_1 "nick1.db" -#define NICK_DB_2 "nick2.db" +#define NICK_DB_1 "nick1.db" +#define NICK_DB_2 "nick2.db" #define NICK_DB_NEW "nick.db" -#define CHAN_DB_1 "chan1.db" -#define CHAN_DB_2 "chan2.db" +#define CHAN_DB_1 "chan1.db" +#define CHAN_DB_2 "chan2.db" #define CHAN_DB_NEW "chan.db" -#define BOT_DB_1 "bot1.db" -#define BOT_DB_2 "bot2.db" +#define BOT_DB_1 "bot1.db" +#define BOT_DB_2 "bot2.db" #define BOT_DB_NEW "bot.db" -#define HOST_DB_1 "hosts1.db" -#define HOST_DB_2 "hosts2.db" +#define HOST_DB_1 "hosts1.db" +#define HOST_DB_2 "hosts2.db" #define HOST_DB_NEW "hosts.db" /* END OF CONFIGURATION BLOCK */ @@ -118,15 +118,15 @@ #define read_int8(ret,f) ((*(ret)=fgetc((f)->fp))==EOF ? -1 : 0) #define write_int8(val,f) (fputc((val),(f)->fp)==EOF ? -1 : 0) #define SAFE(x) do { \ - if ((x) < 0) { \ + if ((x) < 0) { \ printf("Error, the database is broken, trying to continue... no guarantee.\n"); \ - } \ + } \ } while (0) #define READ(x) do { \ - if ((x) < 0) { \ - printf("Error, the database is broken, trying to continue... no guarantee.\n"); \ - exit(0); \ - } \ + if ((x) < 0) { \ + printf("Error, the database is broken, trying to continue... no guarantee.\n"); \ + exit(0); \ + } \ } while (0) typedef int16_t int16; @@ -143,126 +143,126 @@ typedef struct badword_ BadWord; typedef struct hostcore_ HostCore; struct memo_ { - uint32 number; /* Index number -- not necessarily array position! */ - uint16 flags; /* Flags */ - time_t time; /* When was it sent? */ - char sender[32]; /* Name of the sender */ - char *text; + uint32 number; /* Index number -- not necessarily array position! */ + uint16 flags; /* Flags */ + time_t time; /* When was it sent? */ + char sender[32]; /* Name of the sender */ + char *text; }; struct dbFILE_ { - int mode; /* 'r' for reading, 'w' for writing */ - FILE *fp; /* The normal file descriptor */ - char filename[1024]; /* Name of the database file */ + int mode; /* 'r' for reading, 'w' for writing */ + FILE *fp; /* The normal file descriptor */ + char filename[1024]; /* Name of the database file */ }; typedef struct { - int16 memocount; /* Current # of memos */ - int16 memomax; /* Max # of memos one can hold*/ - Memo *memos; /* Pointer to original memos */ + int16 memocount; /* Current # of memos */ + int16 memomax; /* Max # of memos one can hold*/ + Memo *memos; /* Pointer to original memos */ } MemoInfo; typedef struct { - uint16 in_use; /* 1 if this entry is in use, else 0 */ - int16 level; - NickCore *nc; /* Guaranteed to be non-NULL if in use, NULL if not */ - time_t last_seen; + uint16 in_use; /* 1 if this entry is in use, else 0 */ + int16 level; + NickCore *nc; /* Guaranteed to be non-NULL if in use, NULL if not */ + time_t last_seen; } ChanAccess; 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 in_use; /* Always 0 if not in use */ + int16 is_nick; /* 1 if a regged nickname, 0 if a nick!user@host mask */ uint16 flags; - union { - char *mask; /* Guaranteed to be non-NULL if in use, NULL if not */ + union { + char *mask; /* Guaranteed to be non-NULL if in use, NULL if not */ NickCore *nc; /* Same */ - } u; - char *reason; - char *creator; - time_t addtime; + } u; + char *reason; + char *creator; + time_t addtime; } AutoKick; struct nickalias_ { - NickAlias *next, *prev; - char *nick; /* Nickname */ - char *last_quit; /* Last quit message */ - char *last_realname; /* Last realname */ - 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 */ - uint16 status; /* See NS_* below */ - NickCore *nc; /* I'm an alias of this */ + NickAlias *next, *prev; + char *nick; /* Nickname */ + char *last_quit; /* Last quit message */ + char *last_realname; /* Last realname */ + 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 */ + uint16 status; /* See NS_* below */ + NickCore *nc; /* I'm an alias of this */ }; struct nickcore_ { NickCore *next, *prev; - char *display; /* How the nick is displayed */ - char pass[32]; /* Password of the nicks */ - char *email; /* E-mail associated to the nick */ - char *greet; /* Greet associated to the nick */ - uint32 icq; /* ICQ # associated to the nick */ - char *url; /* URL associated to the nick */ - uint32 flags; /* See NI_* below */ - uint16 language; /* Language selected by nickname owner (LANG_*) */ - uint16 accesscount; /* # of entries */ - char **access; /* Array of strings */ - MemoInfo memos; /* Memo information */ - uint16 channelcount; /* Number of channels currently registered */ - int unused; /* Used for nick collisions */ - int aliascount; /* How many aliases link to us? Remove the core if 0 */ + char *display; /* How the nick is displayed */ + char pass[32]; /* Password of the nicks */ + char *email; /* E-mail associated to the nick */ + char *greet; /* Greet associated to the nick */ + uint32 icq; /* ICQ # associated to the nick */ + char *url; /* URL associated to the nick */ + uint32 flags; /* See NI_* below */ + uint16 language; /* Language selected by nickname owner (LANG_*) */ + uint16 accesscount; /* # of entries */ + char **access; /* Array of strings */ + MemoInfo memos; /* Memo information */ + uint16 channelcount; /* Number of channels currently registered */ + int unused; /* Used for nick collisions */ + int aliascount; /* How many aliases link to us? Remove the core if 0 */ }; struct chaninfo_ { - ChannelInfo *next, *prev; - - char name[64]; /* Channel name */ - char *founder; /* Who registered the channel */ - char *successor; /* Who gets the channel if the founder nick is dropped or expires */ - char founderpass[32]; /* Channel password */ - char *desc; /* Description */ - char *url; /* URL */ - char *email; /* Email address */ - time_t time_registered; /* When was it registered */ - time_t last_used; /* When was it used hte last time */ - char *last_topic; /* Last topic on the channel */ - char last_topic_setter[32]; /* Who set the last topic */ - time_t last_topic_time; /* When the last topic was set */ - uint32 flags; /* Flags */ - char *forbidby; /* if forbidden: who did it */ - char *forbidreason; /* if forbidden: why */ - int16 bantype; /* Bantype */ - int16 *levels; /* Access levels for commands */ - uint16 accesscount; /* # of pple with access */ - ChanAccess *access; /* List of authorized users */ - uint16 akickcount; /* # of akicked pple */ - AutoKick *akick; /* List of users to kickban */ - uint32 mlock_on, mlock_off; /* See channel modes below */ - uint32 mlock_limit; /* 0 if no limit */ - char *mlock_key; /* NULL if no key */ - char *mlock_flood; /* NULL if no +f */ - char *mlock_redirect; /* NULL if no +L */ - char *entry_message; /* Notice sent on entering channel */ - MemoInfo memos; /* Memos */ - char *bi; /* Bot used on this channel */ - uint32 botflags; /* BS_* below */ - int16 *ttb; /* Times to ban for each kicker */ - uint16 bwcount; /* Badword count */ - BadWord *badwords; /* For BADWORDS kicker */ - int16 capsmin, capspercent; /* For CAPS kicker */ - int16 floodlines, floodsecs; /* For FLOOD kicker */ - int16 repeattimes; /* For REPEAT kicker */ + ChannelInfo *next, *prev; + + char name[64]; /* Channel name */ + char *founder; /* Who registered the channel */ + char *successor; /* Who gets the channel if the founder nick is dropped or expires */ + char founderpass[32]; /* Channel password */ + char *desc; /* Description */ + char *url; /* URL */ + char *email; /* Email address */ + time_t time_registered; /* When was it registered */ + time_t last_used; /* When was it used hte last time */ + char *last_topic; /* Last topic on the channel */ + char last_topic_setter[32]; /* Who set the last topic */ + time_t last_topic_time; /* When the last topic was set */ + uint32 flags; /* Flags */ + char *forbidby; /* if forbidden: who did it */ + char *forbidreason; /* if forbidden: why */ + int16 bantype; /* Bantype */ + int16 *levels; /* Access levels for commands */ + uint16 accesscount; /* # of pple with access */ + ChanAccess *access; /* List of authorized users */ + uint16 akickcount; |
