Merge pull request #1543 from Steering7253/master

add ipaddr and family to perl SERVER_REC (and connrec)
This commit is contained in:
ailin-nemui 2025-04-08 06:05:42 +00:00 committed by GitHub
commit fca3e83e68
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 13 additions and 2 deletions

View File

@ -522,6 +522,8 @@ Connect->{}
address - Address where we connected (irc.blah.org)
port - Port where we connected
chatnet - Chat network
chosen_family - IP family chosen to connect to
ipaddr - IP address connected to
password - Password we used in connection.
wanted_nick - Nick which we would prefer to use

View File

@ -6,7 +6,7 @@
#define IRSSI_GLOBAL_CONFIG "irssi.conf" /* config file name in /etc/ */
#define IRSSI_HOME_CONFIG "config" /* config file name in ~/.irssi/ */
#define IRSSI_ABI_VERSION 54
#define IRSSI_ABI_VERSION 55
#define DEFAULT_SERVER_ADD_PORT 6667
#define DEFAULT_SERVER_ADD_TLS_PORT 6697

View File

@ -12,6 +12,7 @@ char *proxy_string, *proxy_string_after, *proxy_password;
unsigned short family; /* 0 = don't care, AF_INET or AF_INET6 */
unsigned short chosen_family; /* family actually chosen during name resolution */
char *ipaddr;
char *tag; /* try to keep this tag when connected to server */
char *address;
int port;

View File

@ -212,13 +212,18 @@ static void server_real_connect(SERVER_REC *server, IPADDR *ip,
g_return_if_fail(ip != NULL || unix_socket != NULL);
if (ip != NULL) {
server->connrec->chosen_family = ip->family;
net_ip2host(ip, ipaddr);
server->connrec->ipaddr = g_strdup(ipaddr);
}
signal_emit("server connecting", 2, server, ip);
if (server->connrec->no_connect)
return;
if (ip != NULL) {
server->connrec->chosen_family = ip->family;
own_ip = IPADDR_IS_V6(ip) ? server->connrec->own_ip6 : server->connrec->own_ip4;
port = server->connrec->proxy != NULL ?
server->connrec->proxy_port : server->connrec->port;
@ -637,6 +642,7 @@ void server_connect_unref(SERVER_CONNECT_REC *conn)
g_free_not_null(conn->proxy_string_after);
g_free_not_null(conn->proxy_password);
g_free_not_null(conn->ipaddr);
g_free_not_null(conn->tag);
g_free_not_null(conn->address);
g_free_not_null(conn->chatnet);

View File

@ -287,6 +287,8 @@ void perl_connect_fill_hash(HV *hv, SERVER_CONNECT_REC *conn)
(void) hv_store(hv, "type", 4, new_pv(type), 0);
(void) hv_store(hv, "chat_type", 9, new_pv(chat_type), 0);
(void) hv_store(hv, "chosen_family", 13, newSViv(conn->chosen_family), 0);
(void) hv_store(hv, "ipaddr", 6, new_pv(conn->ipaddr), 0);
(void) hv_store(hv, "tag", 3, new_pv(conn->tag), 0);
(void) hv_store(hv, "address", 7, new_pv(conn->address), 0);
(void) hv_store(hv, "port", 4, newSViv(conn->port), 0);