1
0
mirror of https://github.com/irssi/irssi.git synced 2024-12-04 14:46:39 -05:00

Connecting to proxy when server connection was down didn't work correctly.

git-svn-id: http://svn.irssi.org/repos/irssi/trunk@811 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
Timo Sirainen 2000-11-06 23:27:46 +00:00 committed by cras
parent a8c139d5e2
commit 6cc6f90468
2 changed files with 23 additions and 16 deletions

View File

@ -182,7 +182,8 @@ static void dump_join(IRC_CHANNEL_REC *channel, CLIENT_REC *client)
void plugin_proxy_dump_data(CLIENT_REC *client)
{
if (strcmp(client->server->nick, client->nick) != 0) {
if (client->server != NULL &&
strcmp(client->server->nick, client->nick) != 0) {
/* change nick first so that clients won't try to eg. set
their own user mode with wrong nick.. hopefully works
with all clients. */
@ -196,7 +197,7 @@ void plugin_proxy_dump_data(CLIENT_REC *client)
proxy_outdata(client, ":proxy 001 %s :Welcome to the Internet Relay Network\n", client->nick);
proxy_outdata(client, ":proxy 002 %s :Your host is irssi-proxy, running version %s\n", client->nick, VERSION);
proxy_outdata(client, ":proxy 003 %s :This server was created ...\n", client->nick);
if (!client->server->emode_known)
if (client->server == NULL || !client->server->emode_known)
proxy_outdata(client, ":proxy 004 %s proxy %s oirw abiklmnopqstv\n", client->nick, VERSION);
else
proxy_outdata(client, ":proxy 004 %s proxy %s oirw abeIiklmnopqstv\n", client->nick, VERSION);
@ -204,12 +205,14 @@ void plugin_proxy_dump_data(CLIENT_REC *client)
proxy_outdata(client, ":proxy 255 %s :I have 0 clients, 0 services and 0 servers\n", client->nick);
proxy_outdata(client, ":proxy 422 %s :MOTD File is missing\n", client->nick);
/* user mode / away status */
proxy_outserver(client, "MODE %s :+%s", client->server->nick,
client->server->usermode);
if (client->server->usermode_away)
proxy_outdata(client, ":proxy 306 %s :You have been marked as being away\n", client->nick);
/* user mode / away status */
if (client->server != NULL) {
proxy_outserver(client, "MODE %s :+%s", client->server->nick,
client->server->usermode);
if (client->server->usermode_away)
proxy_outdata(client, ":proxy 306 %s :You have been marked as being away\n", client->nick);
/* Send channel joins */
g_slist_foreach(client->server->channels, (GFunc) dump_join, client);
/* Send channel joins */
g_slist_foreach(client->server->channels, (GFunc) dump_join, client);
}
}

View File

@ -147,6 +147,12 @@ static void handle_client_cmd(CLIENT_REC *client, char *cmd, char *args)
return;
}
if (client->server == NULL || !client->server->connected) {
proxy_outserver(client, "NOTICE %s :Not connected to server",
client->nick);
return;
}
server_handle = net_sendbuffer_handle(client->server->handle);
net_transmit(server_handle, cmd, strlen(cmd));
net_transmit(server_handle, " ", 1);
@ -247,10 +253,8 @@ static void sig_listen_client(CLIENT_REC *client)
break;
}
if (ret == 0) break;
if (client->server == NULL)
continue;
if (ret == 0)
break;
cmd = g_strdup(str);
args = strchr(cmd, ' ');
@ -353,7 +357,7 @@ static void sig_server_event(const char *line, IRC_SERVER_REC *server,
g_free(event);
}
static void sig_server_connected(IRC_SERVER_REC *server)
static void event_connected(IRC_SERVER_REC *server)
{
GSList *tmp;
@ -514,7 +518,7 @@ void plugin_proxy_listen_init(void)
signal_add("server incoming", (SIGNAL_FUNC) sig_incoming);
signal_add("server event", (SIGNAL_FUNC) sig_server_event);
signal_add("server connected", (SIGNAL_FUNC) sig_server_connected);
signal_add("event connected", (SIGNAL_FUNC) event_connected);
signal_add("server disconnected", (SIGNAL_FUNC) sig_server_disconnected);
signal_add("event nick", (SIGNAL_FUNC) event_nick);
signal_add("setup changed", (SIGNAL_FUNC) read_settings);
@ -530,7 +534,7 @@ void plugin_proxy_listen_deinit(void)
signal_remove("server incoming", (SIGNAL_FUNC) sig_incoming);
signal_remove("server event", (SIGNAL_FUNC) sig_server_event);
signal_remove("server connected", (SIGNAL_FUNC) sig_server_connected);
signal_remove("event connected", (SIGNAL_FUNC) event_connected);
signal_remove("server disconnected", (SIGNAL_FUNC) sig_server_disconnected);
signal_remove("event nick", (SIGNAL_FUNC) event_nick);
signal_remove("setup changed", (SIGNAL_FUNC) read_settings);