summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/irc/proxy/dump.c18
-rw-r--r--src/irc/proxy/listen.c12
-rw-r--r--src/irc/proxy/module.h1
3 files changed, 15 insertions, 16 deletions
diff --git a/src/irc/proxy/dump.c b/src/irc/proxy/dump.c
index 0fe9ca4b..c693e953 100644
--- a/src/irc/proxy/dump.c
+++ b/src/irc/proxy/dump.c
@@ -200,12 +200,22 @@ static void dump_join(IRC_CHANNEL_REC *channel, CLIENT_REC *client)
}
}
+void proxy_client_reset_nick(CLIENT_REC *client)
+{
+ if (client->server == NULL ||
+ strcmp(client->nick, client->server->nick) == 0)
+ return;
+
+ proxy_outdata(client, ":%s!proxy NICK :%s\n",
+ client->nick, client->server->nick);
+
+ g_free(client->nick);
+ client->nick = g_strdup(client->server->nick);
+}
+
void proxy_dump_data(CLIENT_REC *client)
{
- if (client->server != NULL) {
- g_free(client->nick);
- client->nick = g_strdup(client->server->nick);
- }
+ proxy_client_reset_nick(client);
/* welcome info */
proxy_outdata(client, ":%s 001 %s :Welcome to the Internet Relay Network\n", client->proxy_address, client->nick);
diff --git a/src/irc/proxy/listen.c b/src/irc/proxy/listen.c
index 065d449b..c3d5a0b6 100644
--- a/src/irc/proxy/listen.c
+++ b/src/irc/proxy/listen.c
@@ -358,18 +358,6 @@ static void sig_server_event(IRC_SERVER_REC *server, const char *line,
g_free(event);
}
-static void proxy_client_reset_nick(CLIENT_REC *client)
-{
- if (strcmp(client->nick, client->server->nick) == 0)
- return;
-
- proxy_outdata(client, ":%s!proxy NICK :%s\n",
- client->nick, client->server->nick);
-
- g_free(client->nick);
- client->nick = g_strdup(client->server->nick);
-}
-
static void event_connected(IRC_SERVER_REC *server)
{
GSList *tmp;
diff --git a/src/irc/proxy/module.h b/src/irc/proxy/module.h
index 2e5d0213..dfc67be7 100644
--- a/src/irc/proxy/module.h
+++ b/src/irc/proxy/module.h
@@ -39,6 +39,7 @@ void proxy_listen_deinit(void);
void proxy_settings_init(void);
void proxy_dump_data(CLIENT_REC *client);
+void proxy_client_reset_nick(CLIENT_REC *client);
void proxy_outdata(CLIENT_REC *client, const char *data, ...);
void proxy_outdata_all(IRC_SERVER_REC *server, const char *data, ...);