mirror of
https://github.com/irssi/irssi.git
synced 2024-11-03 04:27:19 -05:00
Use ircnet name as the proxy's "real address".
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@825 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
parent
9895d0cc11
commit
4211d1e80b
@ -141,10 +141,11 @@ void proxy_outserver_all_except(CLIENT_REC *client, const char *data, ...)
|
||||
static void create_names_start(GString *str, IRC_CHANNEL_REC *channel,
|
||||
CLIENT_REC *client)
|
||||
{
|
||||
g_string_sprintf(str, ":proxy 353 %s %c %s :", client->nick,
|
||||
channel_mode_is_set(channel, 'p') ? '*' :
|
||||
channel_mode_is_set(channel, 's') ? '@' : '=',
|
||||
channel->name);
|
||||
g_string_sprintf(str, ":%s 353 %s %c %s :",
|
||||
client->proxy_address, client->nick,
|
||||
channel_mode_is_set(channel, 'p') ? '*' :
|
||||
channel_mode_is_set(channel, 's') ? '@' : '=',
|
||||
channel->name);
|
||||
}
|
||||
|
||||
static void dump_join(IRC_CHANNEL_REC *channel, CLIENT_REC *client)
|
||||
@ -189,11 +190,12 @@ static void dump_join(IRC_CHANNEL_REC *channel, CLIENT_REC *client)
|
||||
proxy_outdata(client, str->str);
|
||||
g_string_free(str, TRUE);
|
||||
|
||||
proxy_outdata(client, ":proxy 366 %s %s :End of /NAMES list.\n",
|
||||
client->nick, channel->name);
|
||||
proxy_outdata(client, ":%s 366 %s %s :End of /NAMES list.\n",
|
||||
client->proxy_address, client->nick, channel->name);
|
||||
if (channel->topic != NULL) {
|
||||
proxy_outdata(client, ":proxy 332 %s %s :%s\n",
|
||||
client->nick, channel->name, channel->topic);
|
||||
proxy_outdata(client, ":%s 332 %s %s :%s\n",
|
||||
client->proxy_address, client->nick,
|
||||
channel->name, channel->topic);
|
||||
}
|
||||
}
|
||||
|
||||
@ -211,23 +213,25 @@ void plugin_proxy_dump_data(CLIENT_REC *client)
|
||||
}
|
||||
|
||||
/* welcome info */
|
||||
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);
|
||||
proxy_outdata(client, ":%s 001 %s :Welcome to the Internet Relay Network\n", client->proxy_address, client->nick);
|
||||
proxy_outdata(client, ":%s 002 %s :Your host is irssi-proxy, running version %s\n", client->proxy_address, client->nick, VERSION);
|
||||
proxy_outdata(client, ":%s 003 %s :This server was created ...\n", client->nick);
|
||||
if (client->server == NULL || !client->server->emode_known)
|
||||
proxy_outdata(client, ":proxy 004 %s proxy %s oirw abiklmnopqstv\n", client->nick, VERSION);
|
||||
proxy_outdata(client, ":%s 004 %s proxy %s oirw abiklmnopqstv\n", client->proxy_address, client->nick, VERSION);
|
||||
else
|
||||
proxy_outdata(client, ":proxy 004 %s proxy %s oirw abeIiklmnopqstv\n", client->nick, VERSION);
|
||||
proxy_outdata(client, ":proxy 251 %s :There are 0 users and 0 invisible on 1 servers\n", client->nick);
|
||||
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);
|
||||
proxy_outdata(client, ":%s 004 %s proxy %s oirw abeIiklmnopqstv\n", client->proxy_address, client->nick, VERSION);
|
||||
proxy_outdata(client, ":%s 251 %s :There are 0 users and 0 invisible on 1 servers\n", client->proxy_address, client->nick);
|
||||
proxy_outdata(client, ":%s 255 %s :I have 0 clients, 0 services and 0 servers\n", client->proxy_address, client->nick);
|
||||
proxy_outdata(client, ":%s 422 %s :MOTD File is missing\n", client->proxy_address, 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);
|
||||
if (client->server->usermode_away) {
|
||||
proxy_outdata(client, ":%s 306 %s :You have been marked as being away\n",
|
||||
client->proxy_address, client->nick);
|
||||
}
|
||||
|
||||
/* Send channel joins */
|
||||
g_slist_foreach(client->server->channels, (GFunc) dump_join, client);
|
||||
|
@ -41,6 +41,7 @@ static void remove_client(CLIENT_REC *rec)
|
||||
|
||||
proxy_clients = g_slist_remove(proxy_clients, rec);
|
||||
|
||||
g_free(rec->proxy_address);
|
||||
net_disconnect(rec->handle);
|
||||
g_source_remove(rec->tag);
|
||||
line_split_free(rec->buffer);
|
||||
@ -144,17 +145,18 @@ static void handle_client_cmd(CLIENT_REC *client, char *cmd, char *args)
|
||||
}
|
||||
if (strcmp(cmd, "PING") == 0) {
|
||||
char *server = strchr(args, ':');
|
||||
if (server == NULL || strcmp(server+1, "proxy") == 0) {
|
||||
if (server == NULL ||
|
||||
strcmp(server+1, client->proxy_address) == 0) {
|
||||
if (server != NULL) *server = '\0';
|
||||
if (*args == '\0') args = client->nick;
|
||||
proxy_outserver(client, "PONG proxy :%s\n", args);
|
||||
proxy_outdata(client, ":%s PONG proxy :%s", client->proxy_address, args);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (client->server == NULL || !client->server->connected) {
|
||||
proxy_outserver(client, "NOTICE %s :Not connected to server",
|
||||
client->nick);
|
||||
proxy_outdata(client, ":%s NOTICE %s :Not connected to server",
|
||||
client->proxy_address, client->nick);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -237,7 +239,7 @@ static void handle_client_cmd(CLIENT_REC *client, char *cmd, char *args)
|
||||
&target, &msg);
|
||||
proxy_outserver_all_except(client, "PRIVMSG %s", args);
|
||||
signal_emit("message public", 5, client->server, msg,
|
||||
client->nick, "proxy", target);
|
||||
client->nick, client->proxy_address, target);
|
||||
g_free(params);
|
||||
}
|
||||
}
|
||||
@ -291,6 +293,7 @@ static void sig_listen(LISTEN_REC *listen)
|
||||
rec = g_new0(CLIENT_REC, 1);
|
||||
rec->listen = listen;
|
||||
rec->handle = handle;
|
||||
rec->proxy_address = g_strdup(listen->ircnet);
|
||||
rec->server = IRC_SERVER(server_find_chatnet(listen->ircnet));
|
||||
rec->tag = g_input_add(handle, G_INPUT_READ,
|
||||
(GInputFunction) sig_listen_client, rec);
|
||||
@ -377,7 +380,8 @@ static void event_connected(IRC_SERVER_REC *server)
|
||||
|
||||
if (rec->connected && rec->server == NULL &&
|
||||
g_strcasecmp(server->connrec->chatnet, rec->listen->ircnet) == 0) {
|
||||
proxy_outserver(rec, "NOTICE %s :Connected to server", rec->nick);
|
||||
proxy_outdata(rec, ":%s NOTICE %s :Connected to server",
|
||||
rec->proxy_address, rec->nick);
|
||||
rec->server = server;
|
||||
}
|
||||
}
|
||||
@ -388,8 +392,9 @@ static void proxy_server_disconnected(CLIENT_REC *client,
|
||||
{
|
||||
GSList *tmp;
|
||||
|
||||
proxy_outdata(client, ":proxy NOTICE %s :Connection lost to server %s\n",
|
||||
client->nick, server->connrec->address);
|
||||
proxy_outdata(client, ":%s NOTICE %s :Connection lost to server %s\n",
|
||||
client->proxy_address, client->nick,
|
||||
server->connrec->address);
|
||||
|
||||
for (tmp = server->channels; tmp != NULL; tmp = tmp->next) {
|
||||
IRC_CHANNEL_REC *rec = tmp->data;
|
||||
|
@ -21,6 +21,7 @@ typedef struct {
|
||||
int handle;
|
||||
int tag;
|
||||
|
||||
char *proxy_address;
|
||||
LISTEN_REC *listen;
|
||||
IRC_SERVER_REC *server;
|
||||
int pass_sent:1;
|
||||
|
Loading…
Reference in New Issue
Block a user