diff options
author | Timo Sirainen <cras@irssi.org> | 2000-05-09 11:42:42 +0000 |
---|---|---|
committer | cras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564> | 2000-05-09 11:42:42 +0000 |
commit | 93d603215114093b92837df0604c5fe285cc04a6 (patch) | |
tree | f128c498946922199a426d46574612b22c539f66 /servertest | |
parent | 90ff30fcd01cd15323a6d2d5fd9797660021b475 (diff) | |
download | irssi-93d603215114093b92837df0604c5fe285cc04a6.zip |
- Compiling fixes
- GNOME version isn't anymore build here so you don't need all that GTK and
GNOME crap to compile irssi-text.
- Some fixes to compile with -ansi -pedantic
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@200 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'servertest')
-rw-r--r-- | servertest/Makefile.am | 4 | ||||
-rw-r--r-- | servertest/server.c | 32 |
2 files changed, 9 insertions, 27 deletions
diff --git a/servertest/Makefile.am b/servertest/Makefile.am index 4eb03cdf..6ca9f0d3 100644 --- a/servertest/Makefile.am +++ b/servertest/Makefile.am @@ -3,11 +3,11 @@ bin_PROGRAMS = ircserver INCLUDES = $(GLIB_CFLAGS) -I$(top_srcdir)/src if BUILD_MEMDEBUG -memdebug_src=../src/irc-base/memdebug.o +memdebug_src=../src/core/memdebug.o else memdebug_src= endif -ircserver_LDADD = -lglib ../src/irc-base/network.o $(memdebug_src) +ircserver_LDADD = -lglib ../src/core/network.o $(memdebug_src) ircserver_SOURCES = server.c diff --git a/servertest/server.c b/servertest/server.c index 8e049816..677e6b32 100644 --- a/servertest/server.c +++ b/servertest/server.c @@ -1,8 +1,8 @@ #include <common.h> -#include <irc-base/network.h> +#include "core/network.h" -#define FLOOD_TIMEOUT 50000 +#define FLOOD_TIMEOUT 1 typedef struct { @@ -12,20 +12,10 @@ typedef struct CHANNEL_REC; GList *channels; -gchar *clientnick, *clienthost; +gchar *clientnick, clienthost[MAX_IP_LEN]; int clienth; -gint gui_input_add(gint handle, GUIInputCondition condition, - GUIInputFunction function, gpointer data) -{ - return -1; -} - -void gui_input_remove(gint tag) -{ -} - /* Read a line */ gint read_line(gboolean socket, gint handle, GString *output, GString *buffer) { @@ -135,7 +125,6 @@ void send_cmd(void) /* send msg to every channel */ str[511] = '\0'; - for (tmp = g_list_first(channels); tmp != NULL; tmp = tmp->next) { CHANNEL_REC *rec = tmp->data; @@ -246,12 +235,10 @@ void send_cmd(void) client_send(str); } - makerand(str, 511); str[0] = ':'; str[10] = '!'; str[20] = '@'; - switch (rand() % 11) { case 0: @@ -330,7 +317,7 @@ void send_cmd(void) break; case 7: /* invite */ - pos = 30+sprintf(str+30, " INVITE %s", clientnick); + pos = 30+sprintf(str+30, " INVITE %s ", clientnick); str[pos] = 'X'; break; case 8: @@ -360,11 +347,6 @@ void handle_command(char *str) } } -guint gui_timeout_add(guint32 interval, GUITimeoutFunction function, gpointer data) -{ - return -1; -} - int main(void) { static fd_set fdset; @@ -406,8 +388,8 @@ int main(void) tv.tv_usec = FLOOD_TIMEOUT; if (select((serverh > clienth ? serverh : clienth)+1, &fdset, NULL, NULL, &tv) <= 0) { - /* nothing happened, bug the client with some commands.. */ - if (clienth != -1 && clientnick != NULL) send_cmd(); + /* nothing happened, bug the client with some commands.. */ + if (clienth != -1 && clientnick != NULL) send_cmd(); } else { @@ -434,7 +416,7 @@ int main(void) clienth = net_accept(serverh, &clientip, &port); if (clienth != -1) { - clienthost = g_strdup(net_ip2host(&clientip)); + net_ip2host(&clientip, clienthost); client_send(":server 001 pla"); client_send(":server 002 plapla"); client_send(":server 003 plaplapla"); |