summaryrefslogtreecommitdiff
path: root/src/irc
diff options
context:
space:
mode:
authorTimo Sirainen <cras@irssi.org>2000-11-09 21:40:22 +0000
committercras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564>2000-11-09 21:40:22 +0000
commit4211d1e80bccd91c4d9ea0c1239d7c2c8769cf5b (patch)
treeffeffb8edc0dcd8641de1d69d7b90b115aad459a /src/irc
parent9895d0cc11f4a5650c8fccc5194b72ca8c839d28 (diff)
downloadirssi-4211d1e80bccd91c4d9ea0c1239d7c2c8769cf5b.zip
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
Diffstat (limited to 'src/irc')
-rw-r--r--src/irc/proxy/dump.c40
-rw-r--r--src/irc/proxy/listen.c21
-rw-r--r--src/irc/proxy/module.h1
3 files changed, 36 insertions, 26 deletions
diff --git a/src/irc/proxy/dump.c b/src/irc/proxy/dump.c
index 0f394b10..cb250da0 100644
--- a/src/irc/proxy/dump.c
+++ b/src/irc/proxy/dump.c
@@ -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);
diff --git a/src/irc/proxy/listen.c b/src/irc/proxy/listen.c
index 92fd65e8..6cac923c 100644
--- a/src/irc/proxy/listen.c
+++ b/src/irc/proxy/listen.c
@@ -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;
diff --git a/src/irc/proxy/module.h b/src/irc/proxy/module.h
index e0ccf856..ddf2f8fa 100644
--- a/src/irc/proxy/module.h
+++ b/src/irc/proxy/module.h
@@ -21,6 +21,7 @@ typedef struct {
int handle;
int tag;
+ char *proxy_address;
LISTEN_REC *listen;
IRC_SERVER_REC *server;
int pass_sent:1;