summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/CMakeLists.txt4
-rw-r--r--src/angband.h1
-rw-r--r--src/cmd4.c2
-rw-r--r--src/defines.h6
-rw-r--r--src/dungeon.c21
-rw-r--r--src/externs.h10
-rw-r--r--src/files.c12
-rw-r--r--src/init2.c3
-rw-r--r--src/irc.c297
-rw-r--r--src/main-win.c4
-rw-r--r--src/main-x11.c6
-rw-r--r--src/main.c4
-rw-r--r--src/script.c46
-rw-r--r--src/spells2.c9
-rw-r--r--src/tables.c2
-rw-r--r--src/util.pkg2
-rw-r--r--src/xtra1.c68
-rw-r--r--src/xtra2.c2
-rw-r--r--src/z-sock.c787
-rw-r--r--src/z-sock.h127
-rw-r--r--src/z_pack.pkg295
21 files changed, 7 insertions, 1701 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 4bfad7ef..e2e62644 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -3,7 +3,7 @@ ADD_SUBDIRECTORY(lua)
SET(SRCS
main-gcu.c main-x11.c main-xaw.c main-sdl.c main-gtk2.c
- z-rand.c z-util.c z-form.c z-virt.c z-term.c z-sock.c
+ z-rand.c z-util.c z-form.c z-virt.c z-term.c
variable.c tables.c plots.c util.c cave.c dungeon.c
melee1.c melee2.c modules.c
object1.c object2.c randart.c squeltch.c traps.c
@@ -14,7 +14,7 @@ SET(SRCS
cmd1.c cmd2.c cmd3.c cmd4.c cmd5.c cmd6.c cmd7.c
help.c
generate.c gen_maze.c gen_evol.c wild.c levels.c store.c bldg.c
- cmovie.c irc.c
+ cmovie.c
wizard2.c init2.c birth.c wizard1.c init1.c main.c
# Lua bits:
lua_bind.c script.c w_mnster.c w_player.c w_play_c.c w_z_pack.c
diff --git a/src/angband.h b/src/angband.h
index 8e0ad1f9..0496a302 100644
--- a/src/angband.h
+++ b/src/angband.h
@@ -30,7 +30,6 @@
#include "z-form.h"
#include "z-rand.h"
#include "z-term.h"
-#include "z-sock.h"
/*
diff --git a/src/cmd4.c b/src/cmd4.c
index 21464caf..ec0b6540 100644
--- a/src/cmd4.c
+++ b/src/cmd4.c
@@ -65,7 +65,7 @@ void do_cmd_redraw(void)
p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER | PW_M_LIST);
/* Window stuff */
- p_ptr->window |= (PW_MESSAGE | PW_IRC | PW_OVERHEAD | PW_MONSTER | PW_OBJECT);
+ p_ptr->window |= (PW_MESSAGE | PW_OVERHEAD | PW_MONSTER | PW_OBJECT);
/* Hack -- update */
handle_stuff();
diff --git a/src/defines.h b/src/defines.h
index fa1eedeb..bddcb27b 100644
--- a/src/defines.h
+++ b/src/defines.h
@@ -318,7 +318,6 @@
#define MESSAGE_NONE 0
#define MESSAGE_MSG 1
-#define MESSAGE_IRC 2
/*
* OPTION: Maximum space for the message text buffer (see "io.c")
@@ -2317,7 +2316,7 @@
/* xxx */
#define PW_PLAYER 0x00000008L /* Display character */
#define PW_M_LIST 0x00000010L /* Show monster list */
-#define PW_IRC 0x00000020L /* Display irc messages */
+/* xxx */
#define PW_MESSAGE 0x00000040L /* Display messages */
#define PW_OVERHEAD 0x00000080L /* Display overhead view */
#define PW_MONSTER 0x00000100L /* Display monster recall */
@@ -4671,9 +4670,6 @@ extern int PlayerUID;
* end may have a system-specific encoding
*/
#define CMD_CLI_HELP -8192
-#define CMD_IRC_CONNECT -8191
-#define CMD_IRC_CHAT -8190
-#define CMD_IRC_DISCON -8189
#define CMD_SHOW_TIME -8188
#define CMD_SHOW_SKILL -8187
#define CMD_DUMP_HTML -8186
diff --git a/src/dungeon.c b/src/dungeon.c
index daff7499..53371beb 100644
--- a/src/dungeon.c
+++ b/src/dungeon.c
@@ -4297,27 +4297,6 @@ static void process_command(void)
break;
}
- /* Connect to IRC. */
- case CMD_IRC_CONNECT:
- {
- irc_connect();
- break;
- }
-
- /* Speak on IRC. */
- case CMD_IRC_CHAT:
- {
- irc_chat();
- break;
- }
-
- /* Disconnect from IRC. */
- case CMD_IRC_DISCON:
- {
- irc_disconnect();
- break;
- }
-
/* Game time. */
case CMD_SHOW_TIME:
{
diff --git a/src/externs.h b/src/externs.h
index 2460f2eb..81fa57da 100644
--- a/src/externs.h
+++ b/src/externs.h
@@ -1524,7 +1524,6 @@ extern bool private_check_user_directory(cptr dirpath);
#endif
/* xtra1.c */
-extern void fix_irc_message(void);
extern void fix_message(void);
extern void apply_flags(u32b f1, u32b f2, u32b f3, u32b f4, u32b f5, u32b esp, s16b pval, s16b tval, s16b to_h, s16b to_d, s16b to_a);
extern int luck(int min, int max);
@@ -1783,15 +1782,6 @@ extern bool do_cmd_disarm_aux(int y, int x, int dir, int do_pickup);
extern bool easy_floor;
-extern void irc_poll(void);
-extern void irc_connect(void);
-extern void irc_emote(char *buf);
-extern void irc_chat(void);
-extern void irc_disconnect(void);
-extern void irc_disconnect_aux(char *str, bool message);
-extern void irc_quit(char *str);
-
-
/* script.c */
extern void init_lua(void);
extern void init_lua_init(void);
diff --git a/src/files.c b/src/files.c
index 9fefcce4..b7d8d8f8 100644
--- a/src/files.c
+++ b/src/files.c
@@ -6221,16 +6221,8 @@ void close_game(void)
add_note_type(NOTE_WINNER);
}
- irc_disconnect_aux(format("Retired; %s rules",
- get_version_string()), FALSE);
kingly();
}
- else
- {
- irc_disconnect_aux(format("Killed by %s; %s rules",
- died_from, get_version_string()),
- FALSE);
- }
/* Wipe the saved levels */
wipe_saved();
@@ -6281,10 +6273,6 @@ void close_game(void)
add_note_type(NOTE_SAVE_GAME);
}
- irc_disconnect_aux(format("Alive... for the time being; %s rules",
- get_version_string()),
- FALSE);
-
/* Prompt for scores XXX XXX XXX */
prt("Press Return (or Escape).", 0, 40);
diff --git a/src/init2.c b/src/init2.c
index 6db66d28..7dab2d46 100644
--- a/src/init2.c
+++ b/src/init2.c
@@ -3153,9 +3153,6 @@ void init_angband(void)
/*** Initialise some arrays ***/
- /* Initilize the socket */
- zsock_init();
-
/* Initialise misc. values */
note("[Initialising values... (misc)]");
if (init_misc()) quit("Cannot initialise misc. values");
diff --git a/src/irc.c b/src/irc.c
deleted file mode 100644
index 7d87d38f..00000000
--- a/src/irc.c
+++ /dev/null
@@ -1,297 +0,0 @@
-/* File: irc.c */
-
-/* Purpose: irc chat */
-
-/*
- * Copyright (c) 2001 DarkGod, Andrew Sidwell
- *
- * This software may be copied and distributed for educational, research, and
- * not for profit purposes provided that this copyright and statement are
- * included in all such copies.
- */
-
-#include "angband.h"
-
-#define IRC_SERVER "irc.worldirc.org"
-#define IRC_PORT "6667"
-#define IRC_CHANNEL "#tome"
-
-/*
- * By the way, CTCP's for unique kills and artefact finds would be nice to
- * have, for example:
- *
- * *pelpel finds Long Sword 'Ringil' (4d5) (+22,+25) (+10 to speed) :)
- */
-
-ip_connection tome_irc_forge;
-ip_connection *tome_irc = &tome_irc_forge;
-bool irc_can_join = FALSE;
-char irc_nick[30];
-char irc_world[100];
-
-void irc_connect()
-{
- char buf[500], *s;
- int rnd_name = randint(999);
-
- if (tome_irc->connected) return;
-
- sprintf(irc_world, "%99s", IRC_CHANNEL);
- sprintf(irc_nick, "Dummy_%03d", rnd_name);
- get_string("Enter Nickname: ", irc_nick, 10);
-
- zsock.setup(tome_irc, IRC_SERVER, atoi(IRC_PORT), ZSOCK_TYPE_TCP, FALSE);
- zsock.open(tome_irc);
- zsock.write_simple(tome_irc, format("NICK %s\r\n", irc_nick));
- zsock.wait(tome_irc, 40);
- zsock.read_simple(tome_irc, buf, 500);
- s = strchr(buf, ':');
- zsock.write_simple(tome_irc, format("PONG %s\r\n", s));
- zsock.write_simple(tome_irc, format("USER tome 0 *BIRC :%s %d.%d.%d User\r\n",
- game_module, VERSION_MAJOR, VERSION_MINOR, VERSION_PATCH));
-#if 0 /* Pfft spoilsport */
- while (!irc_can_join)
- irc_poll();
-#endif
-
- zsock.write_simple(tome_irc, format("JOIN %s\r\n", irc_world));
-
- cmsg_print(TERM_L_GREEN, "Connected to IRC");
-
- zsock.add_timer(irc_poll);
-}
-
-void irc_change_nick()
-{
- return;
-}
-
-void irc_disconnect()
-{
- if (!tome_irc->connected) return;
- irc_can_join = FALSE;
-
- irc_quit(format("%s %d.%d.%d", game_module, VERSION_MAJOR, VERSION_MINOR, VERSION_PATCH));
-
- cmsg_print(TERM_L_RED, "Disconnected from IRC");
-}
-
-void irc_disconnect_aux(char *str, bool message)
-{
- if (!tome_irc->connected) return;
- irc_can_join = FALSE;
-
- irc_quit(str);
-
- if (message) cmsg_print(TERM_L_RED, "Disconnected from IRC");
-}
-
-void irc_emote(char *buf)
-{
- char *b;
- char *base = "PRIVMSG %s :%cACTION %s%c\r\n";
-
- if (!tome_irc->connected) return;
-
- C_MAKE(b, strlen(buf) + strlen(base) + 1, char);
- sprintf(b, base, irc_world, 1, buf, 1);
- zsock.write_simple(tome_irc, b);
- sprintf(b, "* %s %s", irc_nick, buf);
- message_add(MESSAGE_IRC, b, TERM_YELLOW);
- C_FREE(b, strlen(buf) + strlen(base) + 1, char);
- fix_irc_message();
-}
-
-void irc_chat()
-{
- char buf[80] = "";
-
- if (!tome_irc->connected) return;
- if (get_string("Say: ", buf, 80))
- {
- if (prefix(buf, "/me "))
- {
- irc_emote(buf + 4);
- }
- else if ((prefix(buf, "/join ")) && (buf[6] != '\0'))
- {
- zsock.write_simple(tome_irc, format("PART %s\r\n", irc_world));
- sprintf(irc_world, "%99s", buf + 6);
- zsock.write_simple(tome_irc, format("JOIN %s\r\n", irc_world));
- }
- else
- {
- zsock.write_simple(tome_irc, format("PRIVMSG %s :%s\r\n", irc_world, buf /*, 3, irc_world */));
- message_add(MESSAGE_IRC, format("<%s> #w%s", irc_nick, buf), TERM_L_BLUE);
- fix_irc_message();
- }
- }
-}
-
-#define TERM_CTCP TERM_L_GREEN
-#define TERM_SERVER TERM_L_BLUE
-#define TERM_CHAT1 TERM_YELLOW
-#define TERM_CHAT2 TERM_WHITE
-
-void irc_poll()
-{
- char buf[5000], *next, *nick, *space;
-
- if (tome_irc->connected && zsock.can_read(tome_irc))
- {
- zsock.read_simple(tome_irc, buf, 2500);
-
- if (prefix(buf, "PING "))
- {
- message_add(MESSAGE_IRC, format("*** Recieved a PING request from server %s.", buf + 6), TERM_SERVER);
- zsock.write_simple(tome_irc, format("PONG %s\r\n", buf + 5));
- return;
- }
- if (*buf != ':') return;
- nick = buf + 1;
-
- space = strchr(nick, ' ');
- if (space)
- {
- if (prefix(space + 1, "376"))
- irc_can_join = TRUE;
- }
-
- if (prefix(nick, "_"))
- {
- nick = buf + 6;
- }
-
- next = strchr(nick, '!');
- if (next == NULL) return;
- *next = '\0';
- next++;
- next = strchr(next, ' ');
- if (next == NULL) return;
- next++;
- if (prefix(next, "PRIVMSG"))
- {
- next = strchr(next, ':');
- if (next == NULL) return;
- *next = '\0';
- next++;
- if (*next == 1)
- {
- next++;
- if (prefix(next, "ACTION"))
- {
- u32b i = 0, j = 0, max = (79 - strlen(nick) - 3);
- bool nicked = FALSE;
- char tmp[90];
-
- next += 7;
- if (strlen(next)) next[strlen(next) - 1] = '\0';
-
- while (next[i])
- {
- tmp[j++] = next[i++];
- if (j > max)
- {
- tmp[j] = '\0';
- if (nicked)
- message_add(MESSAGE_IRC, format("%s", tmp), TERM_CHAT1);
- else
- message_add(MESSAGE_IRC, format("* %s %s", nick, tmp), TERM_CHAT1);
- nicked = TRUE;
- j = 0;
- }
- }
- if (j > 0)
- {
- tmp[j] = '\0';
- if (nicked)
- message_add(MESSAGE_IRC, format("%s", tmp), TERM_CHAT1);
- else
- message_add(MESSAGE_IRC, format("* %s %s", nick, tmp), TERM_CHAT1);
- }
-
- fix_irc_message();
- }
- else if (prefix(next, "PING"))
- {
- message_add(MESSAGE_IRC, format("*** PING request from %s", nick), TERM_CTCP);
- fix_irc_message();
-
- zsock.write_simple(tome_irc, format("NOTICE %s :%cPING %d%c\r\n", nick, 1, next, 1));
- }
- else if (prefix(next, "NICK"))
- {
- message_add(MESSAGE_IRC, format("*** NICK request from %s", nick), TERM_CTCP);
- fix_irc_message();
-
- zsock.write_simple(tome_irc, format("NOTICE %s :%cNICK %s%c\r\n", nick, 1, irc_nick, 1));
- }
- else if (prefix(next, "VERSION"))
- {
- message_add(MESSAGE_IRC, format("*** VERSION request from %s", nick), TERM_CTCP);
- fix_irc_message();
-
- zsock.write_simple(tome_irc, format("NOTICE %s :%cVERSION %s %d.%d.%d%c\r\n", nick, 1, game_module, VERSION_MAJOR, VERSION_MINOR, VERSION_PATCH, 1));
- }
- }
- else
- {
- u32b i = 0, j = 0, max = (79 - strlen(nick) - 3);
- bool nicked = FALSE;
- char tmp[90];
-
- while (next[i])
- {
- tmp[j++] = next[i++];
- if (j > max)
- {
- tmp[j] = '\0';
- if (nicked)
- message_add(MESSAGE_IRC, format("#w%s", tmp), TERM_CHAT1);
- else
- message_add(MESSAGE_IRC, format("#y<%s> #w%s", nick, tmp), TERM_CHAT1);
- nicked = TRUE;
- j = 0;
- }
- }
- if (j > 0)
- {
- tmp[j] = '\0';
- if (nicked)
- message_add(MESSAGE_IRC, format("#w%s", tmp), TERM_CHAT1);
- else
- message_add(MESSAGE_IRC, format("#y<%s> #w%s", nick, tmp), TERM_CHAT1);
- }
- fix_irc_message();
- }
- }
- if (prefix(next, "JOIN"))
- {
- message_add(MESSAGE_IRC, format("%s has entered the Chatroom", nick), TERM_YELLOW);
- fix_irc_message();
- }
- if (prefix(next, "QUIT"))
- {
- next = strchr(next, ':');
- if (next == NULL) return;
- *next = '\0';
- next++;
- message_add(MESSAGE_IRC, format("%s has quit the Chatroom (%s)", nick, next), TERM_YELLOW);
- fix_irc_message();
- }
- }
-}
-
-
-void irc_quit(char *str)
-{
- char buf[300];
-
- zsock.remove_timer(irc_poll);
-
- sprintf(buf, "QUIT :%s\r\n", str);
-
- zsock.write_simple(tome_irc, buf);
- zsock.close(tome_irc);
- zsock.unsetup(tome_irc);
-}
diff --git a/src/main-win.c b/src/main-win.c
index f1ca7d46..1958f85b 100644
--- a/src/main-win.c
+++ b/src/main-win.c
@@ -1796,8 +1796,6 @@ static errr Term_xtra_win_event(int v)
/* Check for an event */
else
{
- irc_poll();
-
/* Check */
if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
{
@@ -2002,8 +2000,6 @@ static errr Term_xtra_win(int n, int v)
/* Delay for some milliseconds */
case TERM_XTRA_DELAY:
{
- irc_poll();
-
return (Term_xtra_win_delay(v));
}
diff --git a/src/main-x11.c b/src/main-x11.c
index c15f5982..966c004a 100644
--- a/src/main-x11.c
+++ b/src/main-x11.c
@@ -2423,16 +2423,12 @@ static errr Term_xtra_x11(int n, int v)
/* Process random events XXX */
case TERM_XTRA_BORED:
{
- irc_poll();
-
return (CheckEvent(0));
}
/* Process Events XXX */
case TERM_XTRA_EVENT:
{
- irc_poll();
-
return (CheckEvent(v));
}
@@ -2447,8 +2443,6 @@ static errr Term_xtra_x11(int n, int v)
/* Delay for some milliseconds */
case TERM_XTRA_DELAY:
- irc_poll();
-
usleep(1000 * v);
return (0);
diff --git a/src/main.c b/src/main.c
index 0727e9f1..bbb50c54 100644
--- a/src/main.c
+++ b/src/main.c
@@ -687,10 +687,6 @@ usage:
quit_aux = quit_hook;
- /* Install the zsock hooks we cannot do it later because main-net needs them */
- zsock_init();
-
-
#ifdef USE_GLU
/* Attempt to use the "main-glu.c" support */
if (!done && (!mstr || (streq(mstr, "glu"))))
diff --git a/src/script.c b/src/script.c
index 4070e666..be4c8fb9 100644
--- a/src/script.c
+++ b/src/script.c
@@ -185,49 +185,6 @@ static const struct luaL_reg bitlib[] =
};
/*
- * Some special wrappers
- */
-static int lua_zsock_read(lua_State* L)
-{
- if (!tolua_istype(L, 1, tolua_tag(L, "zsock_hooks"), 0) ||
- !tolua_istype(L, 2, tolua_tag(L, "ip_connection"), 0) ||
- !tolua_istype(L, 3, LUA_TNUMBER, 0) ||
- !tolua_istype(L, 4, LUA_TNUMBER, 0) ||
- !tolua_isnoobj(L, 5)
- )
- {
- tolua_error(L, "#ferror in function 'read'.");
- return 0;
- }
- else
- {
- zsock_hooks* self = (zsock_hooks*) tolua_getusertype(L, 1, 0);
- ip_connection* conn = ((ip_connection*) tolua_getusertype(L, 2, 0));
- int len = ((int) tolua_getnumber(L, 3, 0));
- int start_len = len;
- bool raw = ((bool) tolua_getnumber(L, 4, 0));
- char *str;
-
- if (!self) tolua_error(L, "invalid 'self' in function 'read'");
- {
- bool toluaI_ret;
-
- C_MAKE(str, start_len + 1, char);
-
- toluaI_ret = (bool)self->read(conn, str, &len, raw);
- tolua_pushnumber(L, (long)toluaI_ret);
- tolua_pushstring(L, str);
- tolua_pushnumber(L, (long)len);
-
- C_FREE(str, start_len + 1, char);
-
- return 3;
- }
- return 0;
- }
-}
-
-/*
* Initialize lua scripting
*/
static bool init_lua_done = FALSE;
@@ -262,9 +219,6 @@ void init_lua()
tolua_spells_open(L);
tolua_quest_open(L);
tolua_dungeon_open(L);
-
- /* Register some special wrappers */
- tolua_function(L, "zsock_hooks", "read", lua_zsock_read);
}
void init_lua_init()
diff --git a/src/spells2.c b/src/spells2.c
index d902bf1d..4455112e 100644
--- a/src/spells2.c
+++ b/src/spells2.c
@@ -4333,9 +4333,6 @@ bool ident_spell(void)
/* Build note and write */
sprintf(note, "Found The %s", item_name);
add_note(note, 'A');
-
- sprintf(note, "has found The %s", item_name);
- irc_emote(note);
}
/* Process the appropriate hooks */
process_hooks(HOOK_IDENTIFY, "(d,s)", item, "normal");
@@ -4372,9 +4369,6 @@ bool ident_all(void)
/* Build note and write */
sprintf(note, "Found The %s", item_name);
add_note(note, 'A');
-
- sprintf(note, "has found The %s", item_name);
- irc_emote(note);
}
/* Process the appropriate hooks */
process_hooks(HOOK_IDENTIFY, "(d,s)", -i, "normal");
@@ -4466,9 +4460,6 @@ bool identify_fully(void)
/* Build note and write */
sprintf(note, "Found The %s", item_name);
add_note(note, 'A');
-
- sprintf(note, "has found The %s", item_name);
- irc_emote(note);
}
/* Describe it fully */
diff --git a/src/tables.c b/src/tables.c
index 5ed48b43..718fe139 100644
--- a/src/tables.c
+++ b/src/tables.c
@@ -1301,7 +1301,7 @@ cptr window_flag_desc[32] =
NULL,
"Display character",
"Show visible monsters",
- "Display IRC messages",
+ NULL,
"Display messages",
"Display overhead view",
"Display monster recall",
diff --git a/src/util.pkg b/src/util.pkg
index 1dd6000b..73dfdff8 100644
--- a/src/util.pkg
+++ b/src/util.pkg
@@ -1316,7 +1316,7 @@ extern void prt(cptr str, int row, int col);
* @brief Add a message "msg" of type "type" and colour "color" to the
* message array.\n
* @param type Number \n the type of message. MESSAGE_MSG for regular
- * messages, MESSAGE_IRC for IRC messages.
+ * messages.
* @brief Type
* @param msg String \n the message.
* @brief Message
diff --git a/src/xtra1.c b/src/xtra1.c
index 2543baab..8bc698b3 100644
--- a/src/xtra1.c
+++ b/src/xtra1.c
@@ -1250,67 +1250,6 @@ void fix_message(void)
/*
- * Hack -- display recent IRC messages in sub-windows
- *
- * XXX XXX XXX Adjust for width and split messages
- */
-void fix_irc_message(void)
-{
- int j, i, k;
- int w, h;
- int x, y;
-
- /* Scan windows */
- for (j = 0; j < 8; j++)
- {
- term *old = Term;
-
- /* No window */
- if (!angband_term[j]) continue;
-
- /* No relevant flags */
- if (!(window_flag[j] & (PW_IRC))) continue;
-
- /* Activate */
- Term_activate(angband_term[j]);
-
- /* Get size */
- Term_get_size(&w, &h);
-
- Term_clear();
-
- /* Dump messages */
- k = 0;
- for (i = 0; ; i++)
- {
- byte type = message_type((s16b)i);
-
- if (k >= h) break;
- if (MESSAGE_NONE == type) break;
- if (MESSAGE_IRC != type) continue;
-
- /* Dump the message on the appropriate line */
- display_message(0, (h - 1) - k, strlen(message_str((s16b)i)), message_color((s16b)i), message_str((s16b)i));
-
- /* Cursor */
- Term_locate(&x, &y);
-
- /* Clear to end of line */
- Term_erase(x, y, 255);
-
- k++;
- }
-
- /* Fresh */
- Term_fresh();
-
- /* Restore */
- Term_activate(old);
- }
-}
-
-
-/*
* Hack -- display overhead view in sub-windows
*
* Note that the "player" symbol does NOT appear on the map.
@@ -4452,13 +4391,6 @@ void window_stuff(void)
}
/* Display overhead view */
- if (p_ptr->window & (PW_IRC))
- {
- p_ptr->window &= ~(PW_IRC);
- fix_irc_message();
- }
-
- /* Display overhead view */
if (p_ptr->window & (PW_OVERHEAD))
{
p_ptr->window &= ~(PW_OVERHEAD);
diff --git a/src/xtra2.c b/src/xtra2.c
index e81db1da..90e71ce0 100644
--- a/src/xtra2.c
+++ b/src/xtra2.c
@@ -5146,7 +5146,7 @@ void resize_window(void)
p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
/* Window stuff */
- p_ptr->window |= (PW_M_LIST | PW_IRC | PW_MESSAGE | PW_OVERHEAD |
+ p_ptr->window |= (PW_M_LIST | PW_MESSAGE | PW_OVERHEAD |
PW_MONSTER | PW_OBJECT);
diff --git a/src/z-sock.c b/src/z-sock.c
deleted file mode 100644
index fcc6cd1c..00000000
--- a/src/z-sock.c
+++ /dev/null
@@ -1,787 +0,0 @@
-/* File: z-term.c */
-
-/*
- * Copyright (c) 1997 Ben Harrison
- *
- * This software may be copied and distributed for educational, research,
- * and not for profit purposes provided that this copyright and statement
- * are included in all such copies.
- */
-
-/* Purpose: a generic, IP connection package */
-
-#include "angband.h"
-#include "z-term.h"
-#include "z-virt.h"
-
-
-/*
- * System independant functions
- */
-
-/* Call all the callbacks */
-void zsock_handle_callbacks()
-{
- timer_callback_list *c = zsock.__timer_callbacks;
-
- while (c != NULL)
- {
- c->callback();
- c = c->next;
- }
-}
-
-/* Add a callback in the list */
-void zsock_add_timer_callback(timer_callback callback)
-{
- timer_callback_list *c;
-
- /* Create it */
- MAKE(c, timer_callback_list);
- c->callback = callback;
-
- /* Add it into the lsit */
- c->next = zsock.__timer_callbacks;
- zsock.__timer_callbacks = c;
-
- /* Increase the timer count */
- zsock.__timers++;
-}
-
-/* Remove a callback in the list */
-void zsock_remove_timer_callback(timer_callback callback)
-{
- timer_callback_list *c = zsock.__timer_callbacks, *old = NULL;
-
- /* Find it */
- while ((c != NULL) && (c->callback != callback))
- {
- old = c;
- c = c->next;
- }
-
- if (c->callback == callback)
- {
- /* Skip it */
- if (old == NULL)
- zsock.__timer_callbacks = c->next;
- else
- old->next = c->next;
-
- /* Delete it */
- FREE(c, timer_callback_list);
-
- /* Increase the timer count */
- zsock.__timers--;
- }
- else
- {
- cmsg_print(TERM_VIOLET, "WARNING: tried to remove a non existing timer callback!");
- }
-}
-
-/* Creates a connection struct */
-ip_connection *zsock_new_connection()
-{
- ip_connection *c;
-
- MAKE(c, ip_connection);
- return c;
-}
-void zsock_free_connection(ip_connection *c)
-{
- FREE(c, ip_connection);
-}
-
-
-/* Set the dying connection callback */
-void zsock_set_lose_connection(ip_connection *conn, lose_connection_hook hook)
-{
- conn->lost_conn = hook;
-}
-
-/* Send data on the connection -- easy to use */
-bool zsock_write_simple(ip_connection *conn, cptr str)
-{
- int len = 0;
-
- return zsock.write(conn, str, &len);
-}
-
-/* Read data on the connection -- easy to use */
-bool zsock_read_simple(ip_connection *conn, char *str, int len)
-{
- int rlen = len;
-
- return zsock.read(conn, str, &rlen, FALSE);
-}
-
-/*
- ******************************* Here comes the Windows socket part ********************************
- */
-#ifdef USE_WINSOCK
-#include <windows.h>
-#include <winsock2.h>
-
-/* Needed for timers -- pfft */
-extern HWND get_main_hwnd();
-
-#define ZSOCK_TIMER_ID 1
-
-VOID CALLBACK zsock_timer_callback_win(HWND hwnd, UINT message, UINT idTimer, DWORD dwTime)
-{
- zsock_handle_callbacks();
-}
-
-bool zsock_add_timer_win(timer_callback callback)
-{
- zsock_add_timer_callback(callback);
-
- /* Is it the first callback ? then we must create the timer */
- if (zsock.__timers == 1)
- {
- SetTimer(get_main_hwnd(), ZSOCK_TIMER_ID, ZSOCK_TIMER_DELAY, zsock_timer_callback_win);
- }
- return TRUE;
-}
-
-bool zsock_remove_timer_win(timer_callback callback)
-{
- zsock_remove_timer_callback(callback);
-
- /* No more callbacks ? no need for the timer then */
- if (!zsock.__timers)
- {
- KillTimer(get_main_hwnd(), ZSOCK_TIMER_ID);
- }
- return TRUE;
-}
-
-
-bool zsock_setup_win(ip_connection *conn, cptr conn_ip, int port, byte conn_type, bool server)
-{
- /* Already setup! */
- if (conn->setup) return FALSE;
-
- MAKE(conn->socket, SOCKET);
-
- if (!server)
- {
- struct hostent *host;
-
- host = gethostbyname(conn_ip);
- conn->conn_ip = ((struct in_addr *)(host->h_addr))->s_addr;
- }
- else
- conn->conn_ip = 0;
-
- conn->conn_type = conn_type;
- conn->conn_port = htons(port);
-
- conn->setup = TRUE;
- conn->server = server;
-
- conn->lost_conn = NULL;
-
- return TRUE;
-}
-
-bool zsock_unsetup_win(ip_connection *conn)
-{
- /* Already unsetup */
- if (!conn->setup) return FALSE;
-
- FREE(conn->socket, SOCKET);
-
- return TRUE;
-}
-
-bool zsock_open_win(ip_connection *conn)
-{
- struct sockaddr_in sin;
-
- /* Already connected */
- if (conn->connected) return FALSE;
-
- *((SOCKET*)conn->socket) = socket(AF_INET, SOCK_STREAM, 0);
-
- memset(&sin, 0, sizeof(sin));
- sin.sin_family = AF_INET;
- sin.sin_addr.s_addr = conn->conn_ip;
- sin.sin_port = conn->conn_port;
-
- if (conn->server)
- {
- if (SOCKET_ERROR == bind(*((SOCKET*)conn->socket), &sin, sizeof(sin)))
- return FALSE;
-
- if (SOCKET_ERROR == listen(*((SOCKET*)conn->socket), 10)) return FALSE;
- }
- else
- {
- if (connect(*((SOCKET*)conn->socket), &sin, sizeof sin) == SOCKET_ERROR)
- {
- /* could not connect to server */
- return (FALSE);
- }
- }
-
- conn->connected = TRUE;
- return TRUE;
-}
-
-bool zsock_can_read_win(ip_connection *conn)
-{
- struct timeval t;
- fd_set rd;
- SOCKET *c = conn->socket;
-
- if (!conn->connected) return FALSE;
-
- FD_ZERO(&rd);
- FD_SET(*c, &rd);
- t.tv_sec = 0;
- t.tv_usec = 0;
- select(*c + 1, &rd, NULL, NULL, &t);
- if (FD_ISSET(*c, &rd)) return TRUE;
- else return (FALSE);
-}
-
-bool zsock_wait_win(ip_connection *conn, int seconds)
-{
- struct timeval t;
- fd_set rd;
- SOCKET *c = conn->socket;
-
- if (!conn->connected) return FALSE;
-
- t.tv_sec = seconds;
- t.tv_usec = 0;
-
- FD_ZERO(&rd);
- FD_SET(*c, &rd);
- select(*c + 1, &rd, NULL, NULL, &t);
- if (FD_ISSET(*c, &rd)) return TRUE;
- else return (FALSE);
-}
-
-bool zsock_close_win(ip_connection *conn)
-{
- SOCKET *c = conn->socket;
-
- /* Already disconnected */
- if (!conn->connected) return FALSE;
-
- closesocket(*c);
- conn->connected = FALSE;
- return TRUE;
-}
-
-bool zsock_write_win(ip_connection *conn, cptr str, int *size)
-{
- SOCKET *c = conn->socket;
-
- if (!conn->connected) return FALSE;
-
- if ((*size = send(*c, str, (!*size) ? strlen(str) : *size, 0)) <= 0)
- {
- /* Oups connection died! */
- if (conn->lost_conn) conn->lost_conn(conn);
- zsock.close(conn);
- return FALSE;
- }
-
- return TRUE;
-}
-
-bool zsock_read_win(ip_connection *conn, char *str, int *len, bool raw)
-{
- char c;
- int l = 0;
- SOCKET *cc = conn->socket;
-
- if (!conn->connected) return FALSE;
-
- if (!raw)
- {
- /* This *IS* fucking slow */
- while ((l < *len) && zsock_can_read_win(conn))
- {
- if (recv(*cc, &c, 1, 0) <= 0)
- {
- /* Oups connection died! */
- if (conn->lost_conn) conn->lost_conn(conn);
- zsock.close(conn);
- return FALSE;
- }
- if (c == '\r') continue;
- if (c == '\n') break;
- str[l++] = c;
- }
- str[l] = '\0';
- *len = l;
- return TRUE;
- }
- else
- {
- if ((*len = recv(*cc, str, *len, 0)) <= 0)
- {
- /* Oups connection died! */
- if (conn->lost_conn) conn->lost_conn(conn);
- zsock.close(conn);
- return FALSE;
- }
- return TRUE;
- }
-}
-
-bool zsock_accept_win(ip_connection *conn, ip_connection *child)
-{
- SOCKET *s = conn->socket;
- SOCKET sock;
- struct sockaddr_in sin;
- int len;
-
- if (!conn->server) return FALSE;
- if (!conn->connected) return FALSE;
-
- len = sizeof(sin);
- sock = accept(*s, (struct sockaddr*) & sin, &len);
-
- if (sock == SOCKET_ERROR) return FALSE;
-
- /* Initialize the connection with a fake destination */
- zsock.setup(child, "127.0.0.1", 0, ZSOCK_TYPE_TCP, FALSE);
-
- /* Set the correct socket */
- *((SOCKET*)child->socket) = sock;
- child->connected = TRUE;
-
- return TRUE;
-}
-
-bool init_socks_win()
-{
- WSADATA wsaData;
- WORD version;
- int error;
-
- version = MAKEWORD( 2, 0 );
-
- error = WSAStartup( version, &wsaData );
-
- /* check for error */
- if ( error != 0 )
- {
- /* error occured */
- return FALSE;
- }
-
- /* check for correct version */
- if ( LOBYTE( wsaData.wVersion ) != 2 ||
- HIBYTE( wsaData.wVersion ) != 0 )
- {
- /* incorrect WinSock version */
- WSACleanup();
- return FALSE;
- }
-
- return TRUE;
-}
-#endif
-
-/*
- ****************************** And there is the unix sockets **************************
- */
-#ifdef USE_UNIXSOCK
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <sys/socket.h>
-#include <netdb.h>
-#include <signal.h>
-
-void handle_timer(int sig)
-{
- zsock_handle_callbacks();
-}
-
-static struct sigaction handle_old_alarm;
-bool zsock_add_timer_unix(timer_callback callback)
-{
- zsock_add_timer_callback(callback);
-
- /* Is it the first callback ? then we must create the timer */
- if (zsock.__timers == 1)
- {
- struct sigaction new_sig;
-
- /* Register the timer */
- new_sig.sa_handler = handle_timer;
- new_sig.sa_flags = 0;
- sigaction(SIGALRM, &new_sig, &handle_old_alarm);
-
- ualarm(ZSOCK_TIMER_DELAY * 1000, ZSOCK_TIMER_DELAY * 1000);
- }
- return TRUE;
-}
-
-bool zsock_remove_timer_unix(timer_callback callback)
-{
- zsock_remove_timer_callback(callback);
-
- /* No more callbacks ? no need for the timer then */
- if (!zsock.__timers)
- {
- alarm(0);
- sigaction(SIGALRM, &handle_old_alarm, NULL);
- }
- return TRUE;
-}
-
-bool zsock_setup_unix(ip_connection *conn, cptr conn_ip, int port, byte conn_type, bool server)
-{
- /* Already setup! */
- if (conn->setup) return FALSE;
-
- MAKE(conn->socket, int);
-
- if (!server)
- {
- struct hostent *host;
-
- host = gethostbyname(conn_ip);
- conn->conn_ip = ((struct in_addr *)(host->h_addr))->s_addr;
- }
- else
- conn->conn_ip = 0;
-
- conn->conn_type = conn_type;
- conn->conn_port = htons(port);
-
- conn->setup = TRUE;
- conn->server = server;
-
- conn->lost_conn = NULL;
-
- return TRUE;
-}
-
-bool zsock_unsetup_unix(ip_connection *conn)
-{
- /* Already unsetup */
- if (!conn->setup) return FALSE;
-
- FREE(conn->socket, int);
-
- return TRUE;
-}
-
-bool zsock_open_unix(ip_connection *conn)
-{
- struct sockaddr_in sin;
-
- /* Already connected */
- if (conn->connected) return FALSE;
-
- *((int*)conn->socket) = socket(AF_INET, SOCK_STREAM, 0);
-
- memset(&sin, 0, sizeof(sin));
- sin.sin_family = AF_INET;
- sin.sin_addr.s_addr = conn->conn_ip;
- sin.sin_port = conn->conn_port;
-
- if (conn->server)
- {
- int option = 1;
-
- /* Set this so we don't wait forever on startups */
- if ( -1 == setsockopt(*((int*)conn->socket), SOL_SOCKET, SO_REUSEADDR , (void*)&option, sizeof(int))) return FALSE;
-
- if ( -1 == bind(*((int*)conn->socket), (struct sockaddr*)&sin, sizeof(sin)))
- return FALSE;
-
- if ( -1 == listen(*((int*)conn->socket), 10)) return FALSE;
- }
- else
- {
- if (connect(*((int*)conn->socket), (struct sockaddr*)&sin, sizeof sin) == -1)
- {
- /* could not connect to server */
- return (FALSE);
- }
- }
-
- conn->connected = TRUE;
- return TRUE;
-}
-
-bool zsock_can_read_unix(ip_connection *conn)
-{
- struct timeval t;
- fd_set rd;
- int *c = conn->socket;
-
- if (!conn->connected) return FALSE;
-
- FD_ZERO(&rd);
- FD_SET(*c, &rd);
- t.tv_sec = 0;
- t.tv_usec = 0;
- select(*c + 1, &rd, NULL, NULL, &t);
- if (FD_ISSET(*c, &rd)) return TRUE;
- else return (FALSE);
-}
-
-bool zsock_wait_unix(ip_connection *conn, int seconds)
-{
- struct timeval t;
- fd_set rd;
- int *c = conn->socket;
-
- if (!conn->connected) return FALSE;
-
- t.tv_sec = seconds;
- t.tv_usec = 0;
-
- FD_ZERO(&rd);
- FD_SET(*c, &rd);
- select(*c + 1, &rd, NULL, NULL, &t);
- if (FD_ISSET(*c, &rd)) return TRUE;
- else return (FALSE);
-}
-
-bool zsock_close_unix(ip_connection *conn)
-{
- int *c = conn->socket;
-
- /* Already disconnected */
- if (!conn->connected) return FALSE;
-
- close(*c);
- conn->connected = FALSE;
- return TRUE;
-}
-
-bool zsock_write_unix(ip_connection *conn, cptr str, int *size)
-{
- int *c = conn->socket;
-
- if (conn->server) return FALSE;
- if (!conn->connected) return FALSE;
-
- if ((*size = send(*c, str, (!*size) ? (s32b)strlen(str) : *size, 0)) <= 0)
- {
- /* Oups connection died! */
- if (conn->lost_conn) conn->lost_conn(conn);
- zsock.close(conn);
- return FALSE;
- }
- return TRUE;
-}
-
-bool zsock_read_unix(ip_connection *conn, char *str, int *len, bool raw)
-{
- char c;
- int l = 0;
- int *cc = conn->socket;
-
- if (conn->server) return FALSE;
- if (!conn->connected) return FALSE;
-
- if (!raw)
- {
- /* This *IS* fucking slow */
- while ((l < *len) && zsock_can_read_unix(conn))
- {
- if (recv(*cc, &c, 1, 0) <= 0)
- {
- /* Oups connection died! */
- if (conn->lost_conn) conn->lost_conn(conn);
- zsock.close(conn);
- return FALSE;
- }
- if (c == '\r') continue;
- if (c == '\n') break;
- str[l++] = c;
- }
- str[l] = '\0';
- *len = l;
- return TRUE;
- }
- else
- {
- if ((*len = recv(*cc, str, *len, 0)) <= 0)
- {
- /* Oups connection died! */
- if (conn->lost_conn) conn->lost_conn(conn);
- zsock.close(conn);
- return FALSE;
- }
- return TRUE;
- }
-}
-
-bool zsock_accept_unix(ip_connection *conn, ip_connection *child)
-{
- int *s = conn->socket;
- int sock;
- struct sockaddr_in sin;
- unsigned int len;
-
- if (!conn->server) return FALSE;
- if (!conn->connected) return FALSE;
-
- len = sizeof(sin);
- sock = accept(*s, (struct sockaddr*) & sin, &len);
-
- if (sock == -1) return FALSE;
-
- /* Initialize the connection with a fake destination */
- zsock.setup(child, "127.0.0.1", 0, ZSOCK_TYPE_TCP, FALSE);
-
- /* Set the correct socket */
- *((int*)child->socket) = sock;
- child->connected = TRUE;
-
- return TRUE;
-}
-
-#endif
-
-/* The zsock hook list */
-zsock_hooks zsock;
-
-/*
- * Dummy hooks for systems without socks
- */
-bool zsock_setup_dummy(ip_connection *conn, cptr conn_ip, int port, byte conn_type, bool server)
-{
- return FALSE;
-}
-
-bool zsock_unsetup_dummy(ip_connection *conn)
-{
- return FALSE;
-}
-
-bool zsock_open_dummy(ip_connection *conn)
-{
- return FALSE;
-}
-
-bool zsock_can_read_dummy(ip_connection *conn)
-{
- return (FALSE);
-}
-
-bool zsock_wait_dummy(ip_connection *conn, int seconds)
-{
- return (FALSE);
-}
-
-bool zsock_close_dummy(ip_connection *conn)
-{
- return FALSE;
-}
-
-bool zsock_write_dummy(ip_connection *conn, cptr str, int *size)
-{
- return FALSE;
-}
-
-bool zsock_read_dummy(ip_connection *conn, char *str, int *len, bool raw)
-{
- return FALSE;
-}
-
-bool zsock_accept_dummy(ip_connection *conn, ip_connection *child)
-{
- return FALSE;
-}
-
-bool zsock_add_timer_dummy(timer_callback callback)
-{
- return TRUE;
-}
-
-bool zsock_remove_timer_dummy(timer_callback callback)
-{
- return TRUE;
-}
-
-void dummy_socks()
-{
- zsock.setup = zsock_setup_dummy;
- zsock.unsetup = zsock_unsetup_dummy;
- zsock.open = zsock_open_dummy;
- zsock.close = zsock_close_dummy;
- zsock.write = zsock_write_dummy;
- zsock.read = zsock_read_dummy;
- zsock.accept = zsock_accept_dummy;
- zsock.can_read = zsock_can_read_dummy;
- zsock.wait = zsock_wait_dummy;
- zsock.add_timer = zsock_add_timer_dummy;
- zsock.remove_timer = zsock_remove_timer_dummy;
-}
-
-/*
- * Initialize the hooks
- */
-static bool init_once = TRUE;
-bool zsock_init()
-{
- /* Sadly on some platforms we will be called 2 times ... */
- if (init_once)
- {
- /* Set the timers */
- zsock.__timers = 0;
- zsock.__timer_callbacks = NULL;
- init_once = FALSE;
- }
-
- /* Set the few system independants functions */
- zsock.new_connection = zsock_new_connection;
- zsock.free_connection = zsock_free_connection;
- zsock.set_lose_connection = zsock_set_lose_connection;
- zsock.write_simple = zsock_write_simple;
- zsock.read_simple = zsock_read_simple;
-
-#ifdef USE_WINSOCK
- if (init_socks_win())
- {
- zsock.setup = zsock_setup_win;
- zsock.unsetup = zsock_unsetup_win;
- zsock.open = zsock_open_win;
- zsock.close = zsock_close_win;
- zsock.write = zsock_write_win;
- zsock.read = zsock_read_win;
- zsock.accept = zsock_accept_win;
- zsock.can_read = zsock_can_read_win;
- zsock.wait = zsock_wait_win;
- zsock.add_timer = zsock_add_timer_win;
- zsock.remove_timer = zsock_remove_timer_win;
- return TRUE;
- }
- else
- {
- dummy_socks();
- return TRUE;
- }
-#elif defined(USE_UNIXSOCK)
-zsock.setup = zsock_setup_unix;
- zsock.unsetup = zsock_unsetup_unix;
- zsock.open = zsock_open_unix;
- zsock.close = zsock_close_unix;
- zsock.write = zsock_write_unix;
- zsock.read = zsock_read_unix;
- zsock.accept = zsock_accept_unix;
- zsock.can_read = zsock_can_read_unix;
- zsock.wait = zsock_wait_unix;
- zsock.add_timer = zsock_add_timer_unix;
- zsock.remove_timer = zsock_remove_timer_unix;
- return TRUE;
-#else
- dummy_socks();
- return TRUE;
-#endif
-}
diff --git a/src/z-sock.h b/src/z-sock.h
deleted file mode 100644
index c842668e..00000000
--- a/src/z-sock.h
+++ /dev/null
@@ -1,127 +0,0 @@
-/* File: z-sock.h */
-
-/*
- * Copyright (c) 2002 DarkGod
- *
- * This software may be copied and distributed for educational, research,
- * and not for profit purposes provided that this copyright and statement
- * are included in all such copies.
- */
-
-#ifndef INCLUDED_Z_SOCK_H
-#define INCLUDED_Z_SOCK_H
-
-#include "h-basic.h"
-
-/*
- * This represents an IP connection
- */
-typedef struct ip_connection ip_connection;
-
-/* A callback used when the connection suddently dies */
-typedef void (*lose_connection_hook)(ip_connection *conn);
-
-struct ip_connection
-{
- bool setup; /* Has it been setted up yet? */
-
- long conn_ip; /* The IP where to connect to */
- int conn_port; /* The port where to connect to */
- byte conn_type; /* Type of connection */
-
- bool connected; /* The connection status */
- void *socket; /* The socket for the connection */
-
- lose_connection_hook lost_conn; /* Called when the conenction dies */
-
- bool server; /* Is it a server socket ? */
-};
-
-/*
- * Possible connection types
- */
-#define ZSOCK_TYPE_TCP 1
-/* #define ZSOCK_TYPE_UDP 2 */
-
-
-/*
- * The time in milliseconds when to call the sockets callbacks for the timer
- */
-#define ZSOCK_TIMER_DELAY 100
-
-/* Timer callbacks */
-typedef void (*timer_callback)(void);
-typedef struct timer_callback_list timer_callback_list;
-struct timer_callback_list
-{
- timer_callback callback;
- timer_callback_list *next;
-};
-
-/*
- * Hooks needed for a main-foo.c to be sock-able
- */
-typedef struct zsock_hooks zsock_hooks;
-struct zsock_hooks
-{
- /* Creates a struct */
- ip_connection *(*new_connection)(void);
-
- /* Free it */
- void (*free_connection)(ip_connection *c);
-
- /* Setup a connection, but do NOT connect */
- bool (*setup)(ip_connection *conn, cptr conn_ip, int port, byte conn_type, bool server);
-
- /* Unsetup a connection, but and DO close before if needed */
- bool (*unsetup)(ip_connection *conn);
-
- /* Open(connect) a well setup-ed connection */
- bool (*open)(ip_connection *conn);
-
- /* Close a connected connection */
- bool (*close)(ip_connection *conn);
-
- /* Send data on the connection */
- bool (*write)(ip_connection *conn, cptr str, int *size);
-
- /* Read data on the connection */
- bool (*read)(ip_connection *conn, char *str, int *len, bool raw);
-
- /* Send data on the connection -- easy to use */
- bool (*write_simple)(ip_connection *conn, cptr str);
-
- /* Read data on the connection -- easy to use */
- bool (*read_simple)(ip_connection *conn, char *str, int len);
-
- /* Set the dying connection callback */
- void (*set_lose_connection)(ip_connection *conn, lose_connection_hook hook);
-
- /* Accept a connection */
- bool (*accept)(ip_connection *conn, ip_connection *child);
-
- /* Check if there is any data to be read and return instantly in any case */
- bool (*can_read)(ip_connection *conn);
-
- /* Wait until there is any data to be read and return after seconds time in any case */
- bool (*wait)(ip_connection *conn, int seconds);
-
-
- /*
- * Timer stuff, I hope I can make that look better
- */
- int __timers;
- timer_callback_list *__timer_callbacks;
-
- /* Setup the timer */
- bool (*add_timer)(timer_callback callback);
-
- /* Remove the timer */
- bool (*remove_timer)(timer_callback callback);
-};
-
-extern zsock_hooks zsock;
-
-extern bool zsock_init(void);
-
-#endif
diff --git a/src/z_pack.pkg b/src/z_pack.pkg
index c2582e45..5a46b3b2 100644
--- a/src/z_pack.pkg
+++ b/src/z_pack.pkg
@@ -396,298 +396,3 @@ extern s16b damroll(int num, int sides);
* @note (see file z-rand.c)
*/
extern s16b maxroll(int num, int sides);
-
-
-
-
-
-/*
- ****************** ZSOCKS ***************
- */
-
-/** @struct ip_connection
- * This represents an IP connection
- */
-struct ip_connection
-{
- /** @var setup
- * @brief Boolean
- * @note Has it been setted up yet?
- */
- bool setup;
-
- /** @var conn_ip
- * @brief Number
- * @note The IP where to connect to
- */
- long conn_ip;
-
- /** @var conn_port
- * @brief Number
- * @note The port where to connect to
- */
- int conn_port;
-
- /** @var conn_type
- * @brief Number
- * @note Type of connection
- */
- byte conn_type;
-
- /** @var connected
- * @brief Boolean
- * @note The connection status
- */
- bool connected;
-
- /** @var *socket
- * @brief void
- * @note The socket for the connection
- */
- void *socket;
-
- /** @var server
- * @brief Boolean
- * @note Is it a server socket ?
- */
- bool server;
-};
-
-/*
- * Possible connection types
- */
-/** @def ZSOCK_TYPE_TCP */
-#define ZSOCK_TYPE_TCP 1
-
-/* #define ZSOCK_TYPE_UDP 2 */
-
-
-/** @def ZSOCK_TIMER_DELAY
- * @note The time in milliseconds when to call the sockets callbacks for the
- * timer
- */
-#define ZSOCK_TIMER_DELAY 100
-
-
-/** @struct zsock_hooks
- * @note Hooks needed for a main-foo.c to be sock-able
- */
-struct zsock_hooks
-{
- /** @fn *new_connection()
- * @brief Creates an IP connection.
- * @return ip_connection \n An IP connection.
- * @note (see file z-sock.c)
- */
- ip_connection *new_connection();
-
- /** @fn free_connection(ip_connection *c)
- * @brief Free IP connection "c".\n
- * @param *c ip_connection \n an IP connection.
- * @brief Ip connection
- * @note (see file z-sock.c)
- */
- void free_connection(ip_connection *c);
-
- /** @fn setup(ip_connection *conn, cptr conn_ip, int port, byte conn_type, bool server)
- * @brief Setup a connection, but do NOT connect.\n
- * @param *conn ip_connection \n an IP connection.
- * @brief Ip connection
- * @param conn_ip String \n IP address of host machine.
- * @brief Host ip address
- * @param port Number \n port of host machine.
- * @brief Host port
- * @param conn_type Number \n type of connection.
- * @brief Connection type
- * @param server Boolean \n TRUE if this is a server socket,
- * otherwise FALSE.
- * @brief Server socket?
- * @return Boolean \n TRUE if socket setup successfully, otherwise FALSE.
- * @note
- * You can not setup a connection if it is setup.
- * @note (see file z-sock.c)
- */
- bool setup(ip_connection *conn, cptr conn_ip, int port, byte conn_type, bool server);
-
- /** @fn unsetup(ip_connection *conn)
- * @brief Unsetup a connection, but and DO close before if needed.\n
- * @param *conn ip_connection \n an IP connection.
- * @brief Ip connection
- * @return Boolean \n TRUE if socket was setup, otherwise FALSE.
- * @note
- * You can not unset a connection if it is not setup.
- * @note (see file z-sock.c)
- */
- bool unsetup(ip_connection *conn);
-
- /** @fn open(ip_connection *conn)
- * @brief Open(connect) a well setup-ed connection.\n
- * @param *conn ip_connection \n an IP connection.
- * @brief Ip connection
- * @return Boolean \n TRUE if connection was opened, otherwise FALSE.
- * @note
- * You can not open a connection if it is open.
- * @note (see file z-sock.c)
- */
- bool open(ip_connection *conn);
-
- /** @fn close(ip_connection *conn)
- * @brief Close a connected connection.\n
- * @param *conn ip_connection \n an IP connection.
- * @brief Ip connection
- * @return Boolean \n TRUE if connection was closed, otherwise FALSE.
- * @note
- * You can not close a connection if it is closed.
- * @note (see file z-sock.c)
- */
- bool close(ip_connection *conn);
-
- /** @fn write(ip_connection *conn, cptr str, int *size)
- * @brief Send data on the connection.\n
- * @param *conn ip_connection \n an IP connection.
- * @brief Ip connection
- * @param str String \n the string to send along the connection.
- * @brief String
- * @param *size Number
- * @brief Bytes sent
- * @return Boolean \n TRUE if string was sent successfully,
- * otherwise FALSE.
- * @return *size \n the number of bytes sent.
- * @note
- * This function will return FALSE if you write to a connection which
- * is not connected, or if the connection has died.
- * @note (see file z-sock.c)
- */
- bool write(ip_connection *conn, cptr str, int *size);
-
- /* Read data on the connection */
- /** @fn read(ip_connection *conn, char *str, int *len, bool raw)
- * @brief Read data on connection.\n
- * @param *conn ip_connection \n an IP connection.
- * @brief Ip connection
- * @param *str String
- * @brief String
- * @param *len Number \n the number of bytes to read.
- * @brief Bytes to read
- * @param raw Boolean \n TRUE if all data is to be read at once,
- * otherwise FALSE.
- * @brief Read raw data?
- * @return Boolean \n TRUE if a string was returned, otherwise FALSE.
- * @return *str String \n The string read.
- * @return *len Number \n The number of bytes read.
- * @note
- * @note (see file z-sock.c)
- */
- /* -- DG -- This is done in script.c since it needs a specific wrapper :(
- bool read(ip_connection *conn, char *str, int *len, bool raw);
- */
-
- /** @fn write_simple(ip_connection *conn, cptr str)
- * @brief Send data on the connection.\n
- * @param *conn ip_connection \n an IP connection.
- * @brief Ip connection
- * @param str String \n the string to send along the connection.
- * @brief String
- * @return Boolean \n TRUE if string was sent successfully,
- * otherwise FALSE.
- * @note
- * This is easy to use.
- * @note (see file z-sock.c)
- */
- bool write_simple(ip_connection *conn, cptr str);
-
- /* Read data on the connection -- easy to use */
- /** @fn read_simple(ip_connection *conn, char *str, int len)
- * @brief Read data on the connection.\n
- * @param *conn ip_connection \n an IP connection.
- * @brief Ip connection
- * @param *str String
- * @brief String
- * @param len Number \n the number of bytes to read.
- * @brief Bytes to read
- * @return Boolean \n TRUE if a string was returned, otherwise FALSE.
- * @return *str String \n The string read.
- * @note
- * This function will return FALSE if you read from a connection which
- * is not connected, or if the connection has died.
- * @note (see file z-sock.c)
- */
- bool read_simple(ip_connection *conn, char *str, int len);
-
- /* Accept a connection */
- /** @fn accept(ip_connection *conn, ip_connection *child)
- * @brief Allow "conn" to accept a connection from "child".\n
- * @param *conn ip_connection \n an IP connection.
- * @brief Parent ip connection
- * @param *child ip_connection \n another IP connection.
- * @brief Child ip connection
- * @return Boolean \n TRUE if child socket was accepted, otherwise
- * FALSE.
- * @note
- * "conn" must be a server and must be connected.
- * @note (see file z-sock.c)
- */
- bool accept(ip_connection *conn, ip_connection *child);
-
- /** @fn can_read(ip_connection *conn)
- * @brief Check if there is any data to be read and return instantly
- * in any case.\n
- * @param *conn ip_connection \n an IP connection.
- * @brief Ip connection
- * @return Boolean \n TRUE if there is something to read, otherwise
- * FALSE.
- * @note
- * This function will return FALSE if you read from a connection which
- * is not connected.
- * @note (see file z-sock.c)
- */
- bool can_read(ip_connection *conn);
-
- /** @fn wait(ip_connection *conn, int seconds)
- * @brief Wait for up to "seconds" seconds for data to read from
- * "conn".\n
- * @param *conn ip_connection \n an IP connection.
- * @brief Ip connection
- * @param seconds Number \n number of seconds to wait for something to
- * read.
- * @brief Seconds to wait
- * @return Boolean TRUE if there is something to read, otherwise
- * FALSE.
- * @note
- * This function will return FALSE if you wait for a connection which
- * is not connected.
- * @note (see file z-sock.c)
- */
- bool wait(ip_connection *conn, int seconds);
-
-
- /*
- * Timer stuff, I hope I can make that look better
- */
- /** @fn add_timer(timer_callback callback)
- * @brief Add "callback" to the list.\n
- * @param callback timer_callback \n a callback timer.
- * @brief Callback
- * @return Boolean \n TRUE (always).
- * @note
- * If this is the first callback, the timer will be created.
- * @note (see file z-sock.c)
- */
- bool add_timer(timer_callback callback);
-
- /** @fn remove_timer(timer_callback callback)
- * @brief Remove "callback" from the list.\n
- * @param callback timer_callback \n a callback timer.
- * @brief Callback
- * @return Boolean \n TRUE (always).
- * @note
- * If this is the last callback, the timer will be deleted.
- * @note (see file z-sock.c)
- */
- bool remove_timer(timer_callback callback);
-};
-
-/** @var zsock
- * @brief zsock_hooks
- */
-extern zsock_hooks zsock;