From 28e12bc24a9c85f4f0d1e37567618ec39cb501f6 Mon Sep 17 00:00:00 2001 From: Naram Qashat Date: Sun, 27 Jun 2010 23:15:05 -0400 Subject: The next of a few "CBX OCDing over code style" commits, maybe the last. NOTES: I have been unable to compile the db_mysql_* functions on my system here, so those are untested. db-convert seems to be badly programmed and needs more work in my opinion. --- src/tools/smtp.h | 95 +++++++++++++++++++++----------------------------------- 1 file changed, 36 insertions(+), 59 deletions(-) (limited to 'src/tools/smtp.h') diff --git a/src/tools/smtp.h b/src/tools/smtp.h index 1dc73eb6f..9f7140537 100644 --- a/src/tools/smtp.h +++ b/src/tools/smtp.h @@ -1,5 +1,4 @@ /* - * * (C) 2003-2010 Anope Team * Contact us at team@anope.org * @@ -7,27 +6,29 @@ * * Based on the original code of Epona by Lara. * Based on the original code of Services by Andy Church. - * - * */ #ifndef SMTP_H #define SMTP_H #include "sysconf.h" +#define CoreExport +#include "hashcomp.h" /*************************************************************************/ /* Some Linux boxes (or maybe glibc includes) require this for the * prototype of strsignal(). */ #ifndef _GNU_SOURCE -#define _GNU_SOURCE +# define _GNU_SOURCE #endif -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include /* Windows does not have: * unistd.h, grp.h, @@ -39,34 +40,30 @@ */ #ifndef _WIN32 -#include +# include #endif -#include -#include -#include -#include - #ifndef _WIN32 -#include -#include -#include -#include +# include +# include +# include +# include #else -#include -#include +# include +# define WIN32_LEAN_AND_MEAN +# include #endif #include #ifndef _WIN32 -#include +# include #endif #ifdef _AIX extern int strcasecmp(const char *, const char *); extern int strncasecmp(const char *, const char *, size_t); -# if 0 /* These break on some AIX boxes (4.3.1 reported). */ +# if 0 /* These break on some AIX boxes (4.3.1 reported). */ extern int socket(int, int, int); extern int connect(int, struct sockaddr *, int); # endif @@ -77,52 +74,32 @@ extern int connect(int, struct sockaddr *, int); /* Solaris specific code, types that do not exist in Solaris' * * sys/types.h * **/ -#ifndef INADDR_NONE -#define INADDR_NONE (-1) -#endif - +# ifndef INADDR_NONE +# define INADDR_NONE (-1) +# endif #endif - -/*#ifdef _WIN32 -#define PATH_MAX MAX_PATH -#define snprintf _snprintf -#endif*/ - - /*************************************************************************/ #ifdef _WIN32 -#include -typedef SOCKET ano_socket_t; -#define ano_sockclose(fd) closesocket(fd) -#define ano_sockread(fd, buf, len) recv(fd, buf, len, 0) -#define ano_sockwrite(fd, buf, len) send(fd, buf, len, 0) +typedef SOCKET ano_socket_t; +#define ano_sockclose(fd) closesocket(fd) +#define ano_sockread(fd, buf, len) recv(fd, buf, len, 0) +#define ano_sockwrite(fd, buf, len) send(fd, buf, len, 0) #else -typedef int ano_socket_t; -#define ano_sockclose(fd) close(fd) -#define ano_sockread(fd, buf, len) read(fd, buf, len) -#define ano_sockwrite(fd, buf, len) write(fd, buf, len) +typedef int ano_socket_t; +#define ano_sockclose(fd) close(fd) +#define ano_sockread(fd, buf, len) read(fd, buf, len) +#define ano_sockwrite(fd, buf, len) write(fd, buf, len) #define SOCKET_ERROR -1 #endif - /* Data structures */ -struct smtp_header { - char *header; - struct smtp_header *next; -}; - -struct smtp_body_line { - char *line; - struct smtp_body_line *next; -}; - -struct smtp_message { - struct smtp_header *smtp_headers, *smtp_headers_tail; - struct smtp_body_line *smtp_body, *smtp_body_tail; - char *from; - char *to; +struct smtp_message +{ + std::vector smtp_headers; + std::vector smtp_body; + ci::string from, to; ano_socket_t sock; }; @@ -131,4 +108,4 @@ struct smtp_message mail; /* set this to 1 if you want to get a log otherwise it runs silent */ int smtp_debug = 0; -#endif /* SMTP_H */ +#endif /* SMTP_H */ -- cgit