diff options
author | Timo Sirainen <cras@irssi.org> | 2002-05-20 04:12:12 +0000 |
---|---|---|
committer | cras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564> | 2002-05-20 04:12:12 +0000 |
commit | 4aa0b9111eb659954a19265d2c304e4fad93cb86 (patch) | |
tree | 96a6b61ef90fb6724e84b0ac2fe456347cb36e11 /src/core | |
parent | 09505d628c3bfee6eebabd34ccdba85d149b28d7 (diff) | |
download | irssi-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/core')
-rw-r--r-- | src/core/chat-commands.c | 4 | ||||
-rw-r--r-- | src/core/chat-protocols.h | 3 | ||||
-rw-r--r-- | src/core/server-connect-rec.h | 1 | ||||
-rw-r--r-- | src/core/servers-reconnect.c | 8 | ||||
-rw-r--r-- | src/core/servers.c | 20 | ||||
-rw-r--r-- | src/core/servers.h | 2 | ||||
-rw-r--r-- | src/core/session.c | 6 |
7 files changed, 26 insertions, 18 deletions
diff --git a/src/core/chat-commands.c b/src/core/chat-commands.c index debe6655..cc44a213 100644 --- a/src/core/chat-commands.c +++ b/src/core/chat-commands.c @@ -118,7 +118,7 @@ static void cmd_connect(const char *data) conn = get_server_connect(data, NULL, &rawlog_file); if (conn != NULL) { - server = CHAT_PROTOCOL(conn)->server_connect(conn); + server = server_connect(conn); server_connect_unref(conn); if (server != NULL && rawlog_file != NULL) @@ -224,7 +224,7 @@ static void cmd_server_connect(const char *data, SERVER_REC *server) if (conn != NULL) { if (!plus_addr) update_reconnection(conn, server); - server = CHAT_PROTOCOL(conn)->server_connect(conn); + server = server_connect(conn); server_connect_unref(conn); if (server != NULL && rawlog_file != NULL) diff --git a/src/core/chat-protocols.h b/src/core/chat-protocols.h index 95ab0937..8b7dc170 100644 --- a/src/core/chat-protocols.h +++ b/src/core/chat-protocols.h @@ -17,7 +17,8 @@ struct _CHAT_PROTOCOL_REC { SERVER_CONNECT_REC *(*create_server_connect) (void); void (*destroy_server_connect) (SERVER_CONNECT_REC *); - SERVER_REC *(*server_connect) (SERVER_CONNECT_REC *); + SERVER_REC *(*server_init_connect) (SERVER_CONNECT_REC *); + void (*server_connect) (SERVER_REC *); CHANNEL_REC *(*channel_create) (SERVER_REC *, const char *, const char *, int); QUERY_REC *(*query_create) (const char *, const char *, int); diff --git a/src/core/server-connect-rec.h b/src/core/server-connect-rec.h index cc5afa57..3613759e 100644 --- a/src/core/server-connect-rec.h +++ b/src/core/server-connect-rec.h @@ -29,6 +29,5 @@ GIOChannel *connect_handle; /* connect using this handle */ unsigned int reconnection:1; /* we're trying to reconnect */ unsigned int no_autojoin_channels:1; /* don't autojoin any channels */ unsigned int unix_socket:1; /* Connect using named unix socket */ -unsigned int session_reconnect:1; /* Connected to this server with /UPGRADE */ char *channels; char *away_reason; diff --git a/src/core/servers-reconnect.c b/src/core/servers-reconnect.c index 1b17c921..93067b2b 100644 --- a/src/core/servers-reconnect.c +++ b/src/core/servers-reconnect.c @@ -99,7 +99,7 @@ static int server_reconnect_timeout(void) conn = rec->conn; server_connect_ref(conn); server_reconnect_destroy(rec); - CHAT_PROTOCOL(conn)->server_connect(conn); + server_connect(conn); server_connect_unref(conn); } } @@ -329,7 +329,7 @@ static void reconnect_all(void) while (list != NULL) { conn = list->data; - CHAT_PROTOCOL(conn)->server_connect(conn); + server_connect(conn); server_connect_unref(conn); list = g_slist_remove(list, conn); } @@ -351,7 +351,7 @@ static void cmd_reconnect(const char *data, SERVER_REC *server) signal_emit("command disconnect", 2, "* Reconnecting", server); conn->reconnection = TRUE; - CHAT_PROTOCOL(conn)->server_connect(conn); + server_connect(conn); server_connect_unref(conn); return; } @@ -383,7 +383,7 @@ static void cmd_reconnect(const char *data, SERVER_REC *server) conn = rec->conn; server_connect_ref(conn); server_reconnect_destroy(rec); - CHAT_PROTOCOL(conn)->server_connect(conn); + server_connect(conn); server_connect_unref(conn); } diff --git a/src/core/servers.c b/src/core/servers.c index e16d323c..4828750b 100644 --- a/src/core/servers.c +++ b/src/core/servers.c @@ -264,6 +264,18 @@ static void server_connect_callback_readpipe(SERVER_REC *server) g_free(iprec.errorstr); } +SERVER_REC *server_connect(SERVER_CONNECT_REC *conn) +{ + CHAT_PROTOCOL_REC *proto; + SERVER_REC *server; + + proto = CHAT_PROTOCOL(conn); + server = proto->server_init_connect(conn); + proto->server_connect(server); + + return server; +} + /* initializes server record but doesn't start connecting */ void server_connect_init(SERVER_REC *server) { @@ -305,16 +317,8 @@ int server_start_connect(SERVER_REC *server) if (!server->connrec->unix_socket && server->connrec->port <= 0) return FALSE; - server_connect_init(server); server->rawlog = rawlog_create(); - if (server->connrec->session_reconnect) { - /* /UPGRADE connection - the session_connect is meant - for us only once, move it into server->session_connect */ - server->connrec->session_reconnect = FALSE; - server->session_reconnect = TRUE; - } - if (server->connrec->connect_handle != NULL) { /* already connected */ GIOChannel *handle = server->connrec->connect_handle; diff --git a/src/core/servers.h b/src/core/servers.h index dddde263..3c2c8634 100644 --- a/src/core/servers.h +++ b/src/core/servers.h @@ -53,6 +53,8 @@ int server_start_connect(SERVER_REC *server); void server_connect_ref(SERVER_CONNECT_REC *conn); void server_connect_unref(SERVER_CONNECT_REC *conn); +SERVER_REC *server_connect(SERVER_CONNECT_REC *conn); + /* initializes server record but doesn't start connecting */ void server_connect_init(SERVER_REC *server); /* Connection to server finished, fill the rest of the fields */ diff --git a/src/core/session.c b/src/core/session.c index 94bedfb6..0f3d089c 100644 --- a/src/core/session.c +++ b/src/core/session.c @@ -277,10 +277,12 @@ static void session_restore_server(CONFIG_NODE *node) if (conn != NULL) { conn->reconnection = TRUE; conn->connect_handle = g_io_channel_unix_new(handle); - conn->session_reconnect = TRUE; - server = proto->server_connect(conn); + server = proto->server_init_connect(conn); + server->session_reconnect = TRUE; signal_emit("session restore server", 2, server, node); + + proto->server_connect(server); } } |