summaryrefslogtreecommitdiff
path: root/src/irc
diff options
context:
space:
mode:
authorTimo Sirainen <cras@irssi.org>2002-05-20 04:12:12 +0000
committercras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564>2002-05-20 04:12:12 +0000
commit4aa0b9111eb659954a19265d2c304e4fad93cb86 (patch)
tree96a6b61ef90fb6724e84b0ac2fe456347cb36e11 /src/irc
parent09505d628c3bfee6eebabd34ccdba85d149b28d7 (diff)
downloadirssi-4aa0b9111eb659954a19265d2c304e4fad93cb86.zip
/UPGRADE was broken, changed again the server connection code.
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@2821 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'src/irc')
-rw-r--r--src/irc/core/irc-core.c4
-rw-r--r--src/irc/core/irc-servers.c52
-rw-r--r--src/irc/core/irc-servers.h3
3 files changed, 33 insertions, 26 deletions
diff --git a/src/irc/core/irc-core.c b/src/irc/core/irc-core.c
index 9d441f09..5386f372 100644
--- a/src/irc/core/irc-core.c
+++ b/src/irc/core/irc-core.c
@@ -91,8 +91,8 @@ void irc_core_init(void)
rec->create_server_connect = create_server_connect;
rec->destroy_server_connect = destroy_server_connect;
- rec->server_connect = (SERVER_REC *(*) (SERVER_CONNECT_REC *))
- irc_server_connect;
+ rec->server_init_connect = irc_server_init_connect;
+ rec->server_connect = irc_server_connect;
rec->channel_create =
(CHANNEL_REC *(*) (SERVER_REC *, const char *,
const char *, int))
diff --git a/src/irc/core/irc-servers.c b/src/irc/core/irc-servers.c
index e294f9fc..5e5dba55 100644
--- a/src/irc/core/irc-servers.c
+++ b/src/irc/core/irc-servers.c
@@ -150,8 +150,9 @@ static void server_init(IRC_SERVER_REC *server)
server->cmdcount = 0;
}
-IRC_SERVER_REC *irc_server_connect(IRC_SERVER_CONNECT_REC *conn)
+SERVER_REC *irc_server_init_connect(SERVER_CONNECT_REC *conn)
{
+ IRC_SERVER_CONNECT_REC *ircconn;
IRC_SERVER_REC *server;
g_return_val_if_fail(IS_IRC_SERVER_CONNECT(conn), NULL);
@@ -161,34 +162,39 @@ IRC_SERVER_REC *irc_server_connect(IRC_SERVER_CONNECT_REC *conn)
server = g_new0(IRC_SERVER_REC, 1);
server->chat_type = IRC_PROTOCOL;
- server->connrec = conn;
- server_connect_ref(SERVER_CONNECT(conn));
+ ircconn = (IRC_SERVER_CONNECT_REC *) conn;
+ server->connrec = ircconn;
+ server_connect_ref(conn);
if (server->connrec->port <= 0)
server->connrec->port = 6667;
- server->cmd_queue_speed = conn->cmd_queue_speed > 0 ?
- conn->cmd_queue_speed : settings_get_int("cmd_queue_speed");
- server->max_cmds_at_once = conn->max_cmds_at_once > 0 ?
- conn->max_cmds_at_once : settings_get_int("cmds_max_at_once");
- server->max_query_chans = conn->max_query_chans > 0 ?
- conn->max_query_chans : DEFAULT_MAX_QUERY_CHANS;
-
- server->max_kicks_in_cmd = conn->max_kicks > 0 ?
- conn->max_kicks : DEFAULT_MAX_KICKS;
- server->max_modes_in_cmd = conn->max_modes > 0 ?
- conn->max_modes : DEFAULT_MAX_MODES;
- server->max_whois_in_cmd = conn->max_whois > 0 ?
- conn->max_whois : DEFAULT_MAX_WHOIS;
- server->max_msgs_in_cmd = conn->max_msgs > 0 ?
- conn->max_msgs : DEFAULT_MAX_MSGS;
-
- if (!server_start_connect((SERVER_REC *) server)) {
- server_connect_unref(SERVER_CONNECT(conn));
+ server->cmd_queue_speed = ircconn->cmd_queue_speed > 0 ?
+ ircconn->cmd_queue_speed : settings_get_int("cmd_queue_speed");
+ server->max_cmds_at_once = ircconn->max_cmds_at_once > 0 ?
+ ircconn->max_cmds_at_once : settings_get_int("cmds_max_at_once");
+ server->max_query_chans = ircconn->max_query_chans > 0 ?
+ ircconn->max_query_chans : DEFAULT_MAX_QUERY_CHANS;
+
+ server->max_kicks_in_cmd = ircconn->max_kicks > 0 ?
+ ircconn->max_kicks : DEFAULT_MAX_KICKS;
+ server->max_modes_in_cmd = ircconn->max_modes > 0 ?
+ ircconn->max_modes : DEFAULT_MAX_MODES;
+ server->max_whois_in_cmd = ircconn->max_whois > 0 ?
+ ircconn->max_whois : DEFAULT_MAX_WHOIS;
+ server->max_msgs_in_cmd = ircconn->max_msgs > 0 ?
+ ircconn->max_msgs : DEFAULT_MAX_MSGS;
+
+ server_connect_init((SERVER_REC *) server);
+ return (SERVER_REC *) server;
+}
+
+void irc_server_connect(SERVER_REC *server)
+{
+ if (!server_start_connect(server)) {
+ server_connect_unref(server->connrec);
g_free(server);
- return NULL;
}
- return server;
}
/* Returns TRUE if `command' is sent to `target' */
diff --git a/src/irc/core/irc-servers.h b/src/irc/core/irc-servers.h
index f6ee1821..ce6da564 100644
--- a/src/irc/core/irc-servers.h
+++ b/src/irc/core/irc-servers.h
@@ -97,7 +97,8 @@ struct _IRC_SERVER_REC {
void *chanqueries;
};
-IRC_SERVER_REC *irc_server_connect(IRC_SERVER_CONNECT_REC *conn);
+SERVER_REC *irc_server_init_connect(SERVER_CONNECT_REC *conn);
+void irc_server_connect(SERVER_REC *server);
/* Purge server output, either all or for specified target */
void irc_server_purge_output(IRC_SERVER_REC *server, const char *target);