mirror of
https://github.com/ZoiteChat/zoitechat.git
synced 2026-06-24 23:09:25 +00:00
Compare commits
1 Commits
master
...
replace-de
| Author | SHA1 | Date | |
|---|---|---|---|
| 97fcf1d5fc |
@@ -1483,7 +1483,7 @@ inbound_foundip (session *sess, char *ip, const message_tags_data *tags_data)
|
||||
{
|
||||
sess->server->dcc_ip = addr.s_addr;
|
||||
EMIT_SIGNAL_TIMESTAMP (XP_TE_FOUNDIP, sess->server->server_session,
|
||||
inet_ntoa (addr),
|
||||
net_ip (ntohl (addr.s_addr)),
|
||||
NULL, NULL, NULL, 0, tags_data->timestamp);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -90,10 +90,26 @@ net_set_socket_options (int sok)
|
||||
char *
|
||||
net_ip (uint32_t addr)
|
||||
{
|
||||
static char buf[INET_ADDRSTRLEN];
|
||||
struct in_addr ia;
|
||||
|
||||
ia.s_addr = htonl (addr);
|
||||
return inet_ntoa (ia);
|
||||
if (!inet_ntop (AF_INET, &ia, buf, sizeof (buf)))
|
||||
buf[0] = 0;
|
||||
|
||||
return buf;
|
||||
}
|
||||
|
||||
int
|
||||
net_parse_ipv4 (const char *hostname, uint32_t *addr)
|
||||
{
|
||||
struct in_addr ia;
|
||||
|
||||
if (inet_pton (AF_INET, hostname, &ia) != 1)
|
||||
return FALSE;
|
||||
|
||||
*addr = ia.s_addr;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
int
|
||||
|
||||
@@ -39,6 +39,7 @@ int net_connect (netstore *ns, int sok4, int sok6, int *sok_return);
|
||||
char *net_resolve (netstore *ns, char *hostname, int port, char **real_host);
|
||||
void net_bind (netstore *tobindto, int sok4, int sok6);
|
||||
char *net_ip (uint32_t addr);
|
||||
int net_parse_ipv4 (const char *hostname, uint32_t *addr);
|
||||
int net_lookup_ipv4 (const char *hostname, uint32_t *addr);
|
||||
void net_sockets (int *sok4, int *sok6);
|
||||
|
||||
|
||||
@@ -468,7 +468,7 @@ create_mask (session * sess, char *mask, char *mode, char *typestr, int deop)
|
||||
type = prefs.hex_irc_ban_type;
|
||||
|
||||
buf[0] = 0;
|
||||
if (inet_addr (fullhost) != (guint32) -1) /* "fullhost" is really a IP number */
|
||||
if (net_parse_ipv4 (fullhost, &(guint32){0})) /* "fullhost" is really a IP number */
|
||||
{
|
||||
lastdot = strrchr (fullhost, '.');
|
||||
if (!lastdot)
|
||||
|
||||
@@ -932,7 +932,7 @@ server_read_child (GIOChannel *source, GIOCondition condition, server *serv)
|
||||
break;
|
||||
case '5': /* prefs ip discovered */
|
||||
waitline2 (source, tbuf, sizeof tbuf);
|
||||
prefs.local_ip = inet_addr (tbuf);
|
||||
net_parse_ipv4 (tbuf, &prefs.local_ip);
|
||||
break;
|
||||
case '7': /* prefs.hex_net_bind_host resolve failed */
|
||||
sprintf (outbuf,
|
||||
@@ -1106,7 +1106,7 @@ traverse_socks (int print_fd, int sok, char *serverAddr, int port)
|
||||
sc.version = 4;
|
||||
sc.type = 1;
|
||||
sc.port = htons (port);
|
||||
sc.address = inet_addr (serverAddr);
|
||||
net_parse_ipv4 (serverAddr, &sc.address);
|
||||
g_strlcpy (sc.username, prefs.hex_irc_user_name, sizeof (sc.username));
|
||||
|
||||
send (sok, (char *) &sc, 8 + strlen (sc.username) + 1, 0);
|
||||
|
||||
Reference in New Issue
Block a user