mysqlConfig.h
-src/version.c
\ No newline at end of file
+src/version.c
+src/.deps
+src/.dirstamp
+src/*.o
+autom4te.cache
+aclocal.m4
+config.h.in~
+config.h.in
+config.h
+config.status
+config.log
+configure
+depcomp
+install-sh
+Makefile.in
+Makefile
+missing
+stamp-h1
+neonserv
+neonserv.exe
+libmysql.dll
\ No newline at end of file
src/cmd_neonserv_voiceall.c \
src/cmd_neonserv_wipeinfo.c
-neonserv_LDADD = $(MYSQL_LIBS)
\ No newline at end of file
+neonserv_LDADD = $(MYSQL_LIBS) $(WINSOCK_LIBS)
\ No newline at end of file
# Checks for libraries.
# Get MySQL library and include locations
-AC_ARG_WITH([mysql-include-path],
- [AS_HELP_STRING([--with-mysql-include-path],
+AC_ARG_WITH([mysql],
+ [AS_HELP_STRING([--with-mysql=DIR],
[location of the MySQL headers, defaults to /usr/include/mysql])],
[MYSQL_CFLAGS="-I$withval"],
[MYSQL_CFLAGS='-I/usr/include/mysql'])
AC_SUBST([MYSQL_CFLAGS])
-AC_ARG_WITH([mysql-lib-path],
- [AS_HELP_STRING([--with-mysql-lib-path], [location of the MySQL libraries])],
+AC_ARG_WITH([mysql-lib],
+ [AS_HELP_STRING([--with-mysql-lib=DIR], [location of the MySQL libraries])],
[MYSQL_LIBS="-L$withval -lmysqlclient"],
[MYSQL_LIBS='-lmysqlclient'])
AC_SUBST([MYSQL_LIBS])
+AC_ARG_WITH([winsock],
+ [AS_HELP_STRING([--with-winsock], [use winsock (WIN32 systems)])],
+ [WINSOCK_LIBS='-lws2_32'],
+ [WINSOCK_LIBS=''])
+AC_SUBST([WINSOCK_LIBS])
+
# Checks for header files.
-AC_CHECK_HEADERS([arpa/inet.h netdb.h netinet/in.h stdlib.h string.h sys/socket.h unistd.h])
+AC_CHECK_HEADERS([arpa/inet.h netdb.h netinet/in.h stdlib.h string.h sys/socket.h unistd.h windows.h winsock2.h])
# Checks for typedefs, structures, and compiler characteristics.
return client;
}
+#ifdef WIN32
+
+int connect_socket(struct ClientSocket *client) {
+ if((client->flags & SOCKET_FLAG_CONNECTED)) return 1;
+ struct hostent *host;
+ struct sockaddr_in addr;
+ int sock;
+ addr.sin_addr.s_addr = inet_addr(client->host);
+ if (addr.sin_addr.s_addr == INADDR_NONE) {
+ host = gethostbyname(client->host);
+ if(!host) {
+ return SOCKET_ERROR;
+ }
+ memcpy(&(addr.sin_addr), host->h_addr_list[0], 4);
+ }
+ sock = socket(PF_INET, SOCK_STREAM, 0);
+ if (sock == -1)
+ {
+ perror("socket() failed");
+ return 0;
+ }
+
+ addr.sin_port = htons(client->port);
+ addr.sin_family = AF_INET;
+
+ if (connect(sock, (struct sockaddr*)&addr, sizeof(addr)) == -1)
+ {
+ perror("connect() failed");
+ return 0;
+ }
+
+ client->sock = sock;
+ client->flags |= SOCKET_FLAG_CONNECTED;
+ client->connection_time = time(0);
+
+ //send the IRC Headers
+ char sendBuf[512];
+ int len;
+
+ if(client->pass) {
+ len = sprintf(sendBuf, "PASS :%s\n", client->pass);
+ write_socket(client, sendBuf, len);
+ }
+ len = sprintf(sendBuf, "USER %s 0 0 :%s\n", client->user->ident, client->user->realname);
+ write_socket(client, sendBuf, len);
+ len = sprintf(sendBuf, "NICK %s\n", client->user->nick);
+ write_socket(client, sendBuf, len);
+
+ return 1;
+}
+
+#else
+
int connect_socket(struct ClientSocket *client) {
if((client->flags & SOCKET_FLAG_CONNECTED)) return 1;
struct hostent *host;
host = gethostbyname(client->host);
if (!host)
{
- herror("gethostbyname() failed");
+ perror("gethostbyname() failed");
return 0;
}
addr.sin_addr = *(struct in_addr*)host->h_addr;
return 1;
}
+#endif
+
int close_socket(struct ClientSocket *client) {
if(client == NULL) return 0;
if((client->flags & SOCKET_FLAG_CONNECTED))
table_add(table, content);
content[0] = get_language_string(user, "NS_NETINFO_CHANNEL");
- sprintf(tmp, "%d %.2f kB (%d * %lu B = %.2f kB)", channel_count, channel_memory / 1024, channel_count, sizeof(struct ChanNode), channel_memory / 1024);
+ sprintf(tmp, "%d %.2f kB (%d * %u B = %.2f kB)", channel_count, channel_memory / 1024, channel_count, (unsigned int) sizeof(struct ChanNode), channel_memory / 1024);
content[1] = tmp;
table_add(table, content);
content[0] = get_language_string(user, "NS_NETINFO_CHANNEL_BAN");
- sprintf(tmp, "%d %.2f kB (%d * %lu B = %.2f kB)", channel_ban_count, channel_ban_memory / 1024, channel_ban_count, sizeof(struct BanNode), channel_ban_memory / 1024);
+ sprintf(tmp, "%d %.2f kB (%d * %u B = %.2f kB)", channel_ban_count, channel_ban_memory / 1024, channel_ban_count, (unsigned int) sizeof(struct BanNode), channel_ban_memory / 1024);
content[1] = tmp;
table_add(table, content);
content[0] = get_language_string(user, "NS_NETINFO_USER");
- sprintf(tmp, "%d %.2f kB (%d * %lu B = %.2f kB)", user_count, user_memory / 1024, user_count, sizeof(struct UserNode), user_memory / 1024);
+ sprintf(tmp, "%d %.2f kB (%d * %u B = %.2f kB)", user_count, user_memory / 1024, user_count, (unsigned int) sizeof(struct UserNode), user_memory / 1024);
content[1] = tmp;
table_add(table, content);
content[0] = get_language_string(user, "NS_NETINFO_CHANUSER");
- sprintf(tmp, "%d %.2f kB (%d * %lu B = %.2f kB)", chanuser_count, chanuser_memory / 1024, chanuser_count, sizeof(struct ChanUser), chanuser_memory / 1024);
+ sprintf(tmp, "%d %.2f kB (%d * %u B = %.2f kB)", chanuser_count, chanuser_memory / 1024, chanuser_count, (unsigned int) sizeof(struct ChanUser), chanuser_memory / 1024);
content[1] = tmp;
table_add(table, content);
{
start_time = time(0);
+ #ifdef WIN32
+ int res;
+ WSADATA wsadata;
+ // Start Windows Sockets.
+ res = WSAStartup(MAKEWORD(2, 0), &wsadata);
+ if (res)
+ {
+ perror("Unable to start Windows Sockets");
+ return 0;
+ }
+ #endif
+
init_mysql();
init_lang();
init_parser();
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
+#ifdef WIN32
+#include <windows.h>
+#include <winsock2.h>
+#else
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
-#include <unistd.h>
#include <netdb.h>
+#endif
+#include <unistd.h>
#include <stdarg.h>
#include <time.h>