diff options
-rw-r--r-- | src/common/identd.c | 28 | ||||
-rw-r--r-- | src/common/inbound.c | 2 | ||||
-rw-r--r-- | src/common/outbound.c | 24 | ||||
-rw-r--r-- | src/fe-gtk/menu.c | 14 | ||||
-rw-r--r-- | src/fe-gtk/setup.c | 13 |
5 files changed, 38 insertions, 43 deletions
diff --git a/src/common/identd.c b/src/common/identd.c index 6dde6a5f..c4050929 100644 --- a/src/common/identd.c +++ b/src/common/identd.c @@ -36,6 +36,7 @@ identd (char *username) char *p; char buf[256]; char outbuf[256]; + char ipbuf[INET_ADDRSTRLEN]; struct sockaddr_in addr; sok = socket (AF_INET, SOCK_STREAM, 0); @@ -80,7 +81,8 @@ identd (char *username) #if 0 /* causes random crashes, probably due to CreateThread */ EMIT_SIGNAL (XP_TE_IDENTD, current_sess, inet_ntoa (addr.sin_addr), username, NULL, NULL, 0); #endif - snprintf (outbuf, sizeof (outbuf), "*\tServicing ident request from %s as %s\n", inet_ntoa (addr.sin_addr), username); + inet_ntop (AF_INET, &addr.sin_addr, ipbuf, sizeof (ipbuf)); + snprintf (outbuf, sizeof (outbuf), "*\tServicing ident request from %s as %s\n", ipbuf, username); PrintText (current_sess, outbuf); recv (read_sok, buf, sizeof (buf) - 1, 0); @@ -103,23 +105,20 @@ identd (char *username) } #ifdef USE_IPV6 -#define IPV6BUFLEN 60 static int identd_ipv6 (char *username) { int sok, read_sok, len; char *p; char buf[256]; - char outbuf[256]; - LPSTR ipv6buf = (LPSTR) malloc (IPV6BUFLEN); + char outbuf[256]; + char ipbuf[INET6_ADDRSTRLEN]; struct sockaddr_in6 addr; sok = socket (AF_INET6, SOCK_STREAM, 0); - if (sok == INVALID_SOCKET) { free (username); - free (ipv6buf); return 0; } @@ -134,7 +133,6 @@ identd_ipv6 (char *username) { closesocket (sok); free (username); - free (ipv6buf); return 0; } @@ -142,39 +140,28 @@ identd_ipv6 (char *username) { closesocket (sok); free (username); - free (ipv6buf); return 0; } len = sizeof (addr); read_sok = accept (sok, (struct sockaddr *) &addr, &len); closesocket (sok); - if (read_sok == INVALID_SOCKET) { free (username); - free (ipv6buf); return 0; } identd_ipv6_is_running = FALSE; - if (WSAAddressToString ((struct sockaddr *) &addr, sizeof (addr), NULL, ipv6buf, (LPDWORD) IPV6BUFLEN) == SOCKET_ERROR) - { - snprintf (ipv6buf, sizeof (ipv6buf) - 1, "[SOCKET ERROR: 0x%X]", WSAGetLastError ()); - } - -#if 0 /* causes random crashes, probably due to CreateThread */ - EMIT_SIGNAL (XP_TE_IDENTD, current_sess, ipv6buf, username, NULL, NULL, 0); -#endif - snprintf (outbuf, sizeof (outbuf), "*\tServicing ident request from %s as %s\n", ipv6buf, username); + inet_ntop (AF_INET6, &addr.sin6_addr, ipbuf, sizeof (ipbuf)); + snprintf (outbuf, sizeof (outbuf), "*\tServicing ident request from %s as %s\n", ipbuf, username); PrintText (current_sess, outbuf); recv (read_sok, buf, sizeof (buf) - 1, 0); buf[sizeof (buf) - 1] = 0; /* ensure null termination */ p = strchr (buf, ','); - if (p) { snprintf (outbuf, sizeof (outbuf) - 1, "%d, %d : USERID : UNIX : %s\r\n", atoi (buf), atoi (p + 1), username); @@ -185,7 +172,6 @@ identd_ipv6 (char *username) sleep (1); closesocket (read_sok); free (username); - free (ipv6buf); return 0; } diff --git a/src/common/inbound.c b/src/common/inbound.c index b5842b3f..b1b739e5 100644 --- a/src/common/inbound.c +++ b/src/common/inbound.c @@ -1286,7 +1286,7 @@ inbound_foundip (session *sess, char *ip) if (HostAddr) { prefs.dcc_ip = ((struct in_addr *) HostAddr->h_addr)->s_addr; - EMIT_SIGNAL (XP_TE_FOUNDIP, sess, + EMIT_SIGNAL (XP_TE_FOUNDIP, sess->server->server_session, inet_ntoa (*((struct in_addr *) HostAddr->h_addr)), NULL, NULL, NULL, 0); } diff --git a/src/common/outbound.c b/src/common/outbound.c index 1e90016e..120bb241 100644 --- a/src/common/outbound.c +++ b/src/common/outbound.c @@ -423,7 +423,7 @@ create_mask (session * sess, char *mask, char *mode, char *typestr, int deop) int type; struct User *user; char *at, *dot, *lastdot; - char username[64], fullhost[128], domain[128], tbuf[512], *p2; + char username[64], fullhost[128], domain[128], buf[512], *p2; user = userlist_find (sess, mask); if (user && user->hostname) /* it's a nickname, let's find a proper ban mask */ @@ -473,7 +473,7 @@ create_mask (session * sess, char *mask, char *mode, char *typestr, int deop) else type = prefs.hex_irc_ban_type; - tbuf[0] = 0; + buf[0] = 0; if (inet_addr (fullhost) != -1) /* "fullhost" is really a IP number */ { lastdot = strrchr (fullhost, '.'); @@ -487,19 +487,19 @@ create_mask (session * sess, char *mask, char *mode, char *typestr, int deop) switch (type) { case 0: - snprintf (tbuf, TBUFSIZE, "%s%s *!*@%s.*", mode, p2, domain); + snprintf (buf, sizeof (buf), "%s%s *!*@%s.*", mode, p2, domain); break; case 1: - snprintf (tbuf, TBUFSIZE, "%s%s *!*@%s", mode, p2, fullhost); + snprintf (buf, sizeof (buf), "%s%s *!*@%s", mode, p2, fullhost); break; case 2: - snprintf (tbuf, TBUFSIZE, "%s%s *!%s@%s.*", mode, p2, username, domain); + snprintf (buf, sizeof (buf), "%s%s *!%s@%s.*", mode, p2, username, domain); break; case 3: - snprintf (tbuf, TBUFSIZE, "%s%s *!%s@%s", mode, p2, username, fullhost); + snprintf (buf, sizeof (buf), "%s%s *!%s@%s", mode, p2, username, fullhost); break; } } else @@ -507,29 +507,29 @@ create_mask (session * sess, char *mask, char *mode, char *typestr, int deop) switch (type) { case 0: - snprintf (tbuf, TBUFSIZE, "%s%s *!*@*%s", mode, p2, domain); + snprintf (buf, sizeof (buf), "%s%s *!*@*%s", mode, p2, domain); break; case 1: - snprintf (tbuf, TBUFSIZE, "%s%s *!*@%s", mode, p2, fullhost); + snprintf (buf, sizeof (buf), "%s%s *!*@%s", mode, p2, fullhost); break; case 2: - snprintf (tbuf, TBUFSIZE, "%s%s *!%s@*%s", mode, p2, username, domain); + snprintf (buf, sizeof (buf), "%s%s *!%s@*%s", mode, p2, username, domain); break; case 3: - snprintf (tbuf, TBUFSIZE, "%s%s *!%s@%s", mode, p2, username, fullhost); + snprintf (buf, sizeof (buf), "%s%s *!%s@%s", mode, p2, username, fullhost); break; } } } else { - snprintf (tbuf, TBUFSIZE, "%s %s", mode, mask); + snprintf (buf, sizeof (buf), "%s %s", mode, mask); } - return g_strdup (tbuf); + return g_strdup (buf); } static void diff --git a/src/fe-gtk/menu.c b/src/fe-gtk/menu.c index 906a0fc6..3bd50b1a 100644 --- a/src/fe-gtk/menu.c +++ b/src/fe-gtk/menu.c @@ -1686,11 +1686,11 @@ static struct mymenu mymenu[] = { {N_("_Server"), 0, 0, M_NEWMENU, 0, 0, 1}, {N_("_Disconnect"), menu_disconnect, GTK_STOCK_DISCONNECT, M_MENUSTOCK, MENU_ID_DISCONNECT, 0, 1}, {N_("_Reconnect"), menu_reconnect, GTK_STOCK_CONNECT, M_MENUSTOCK, MENU_ID_RECONNECT, 0, 1}, - {N_("Join a Channel..."), menu_join, GTK_STOCK_JUMP_TO, M_MENUSTOCK, MENU_ID_JOIN, 0, 1}, - {N_("List of Channels..."), menu_chanlist, GTK_STOCK_INDEX, M_MENUITEM, 0, 0, 1}, + {N_("_Join a Channel..."), menu_join, GTK_STOCK_JUMP_TO, M_MENUSTOCK, MENU_ID_JOIN, 0, 1}, + {N_("_List of Channels..."), menu_chanlist, GTK_STOCK_INDEX, M_MENUITEM, 0, 0, 1}, {0, 0, 0, M_SEP, 0, 0, 0}, #define AWAY_OFFSET (39) - {N_("Marked Away"), menu_away, 0, M_MENUTOG, MENU_ID_AWAY, 0, 1, GDK_a}, + {N_("Marked _Away"), menu_away, 0, M_MENUTOG, MENU_ID_AWAY, 0, 1, GDK_a}, {N_("_Usermenu"), 0, 0, M_NEWMENU, MENU_ID_USERMENU, 0, 1}, /* 40 */ @@ -1708,14 +1708,14 @@ static struct mymenu mymenu[] = { {N_("Userlist Popup..."), menu_ulpopup, 0, M_MENUITEM, 0, 0, 1}, /* 52 */ {N_("_Window"), 0, 0, M_NEWMENU, 0, 0, 1}, - {N_("Ban List..."), menu_banlist, 0, M_MENUITEM, 0, 0, 1}, + {N_("_Ban List..."), menu_banlist, 0, M_MENUITEM, 0, 0, 1}, {N_("Character Chart..."), ascii_open, 0, M_MENUITEM, 0, 0, 1}, {N_("Direct Chat..."), menu_dcc_chat_win, 0, M_MENUITEM, 0, 0, 1}, - {N_("File Transfers..."), menu_dcc_win, 0, M_MENUITEM, 0, 0, 1}, + {N_("File _Transfers..."), menu_dcc_win, 0, M_MENUITEM, 0, 0, 1}, {N_("Friends List..."), notify_opengui, 0, M_MENUITEM, 0, 0, 1}, {N_("Ignore List..."), ignore_gui_open, 0, M_MENUITEM, 0, 0, 1}, - {N_("Plugins and Scripts..."), menu_pluginlist, 0, M_MENUITEM, 0, 0, 1}, - {N_("Raw Log..."), menu_rawlog, 0, M_MENUITEM, 0, 0, 1}, /* 61 */ + {N_("_Plugins and Scripts..."), menu_pluginlist, 0, M_MENUITEM, 0, 0, 1}, + {N_("_Raw Log..."), menu_rawlog, 0, M_MENUITEM, 0, 0, 1}, /* 61 */ {N_("URL Grabber..."), url_opengui, 0, M_MENUITEM, 0, 0, 1}, {0, 0, 0, M_SEP, 0, 0, 0}, {N_("Reset Marker Line"), menu_resetmarker, 0, M_MENUITEM, 0, 0, 1, GDK_m}, diff --git a/src/fe-gtk/setup.c b/src/fe-gtk/setup.c index 20783259..391004ee 100644 --- a/src/fe-gtk/setup.c +++ b/src/fe-gtk/setup.c @@ -217,10 +217,9 @@ static const setting inputbox_settings[] = #endif {ST_HEADER, N_("Nick Completion"),0,0,0}, - {ST_TOGGLE, N_("Automatic nick completion (without TAB key)"), P_OFFINTNL(hex_completion_auto), - 0,0,0}, {ST_ENTRY, N_("Nick completion suffix:"), P_OFFSETNL(hex_completion_suffix),0,0,sizeof prefs.hex_completion_suffix}, {ST_MENU, N_("Nick completion sorted:"), P_OFFINTNL(hex_completion_sort), 0, tabcompmenu, 0}, + {ST_NUMBER, N_("Nick completion amount:"), P_OFFINTNL(hex_completion_amount), N_("Threshold of nicks to start listing instead of completing"), (const char **)N_("nicks."), 1000}, #if 0 /* obsolete */ {ST_HEADER, N_("Input Box Codes"),0,0,0}, @@ -499,6 +498,15 @@ static const setting general_settings[] = {ST_END, 0, 0, 0, 0, 0} }; +static const char *const bantypemenu[] = +{ + N_("*!*@*.host"), + N_("*!*@domain"), + N_("*!*user@*.host"), + N_("*!*user@domain"), + NULL +}; + static const setting advanced_settings[] = { {ST_HEADER, N_("Auto Copy Behavior"),0,0,0}, @@ -523,6 +531,7 @@ static const setting advanced_settings[] = {ST_TOGGLE, N_("Automatically reconnect to servers on disconnect"), P_OFFINTNL(hex_net_auto_reconnect), 0, 0, 1}, {ST_NUMBER, N_("Auto reconnect delay:"), P_OFFINTNL(hex_net_reconnect_delay), 0, 0, 9999}, {ST_NUMBER, N_("Auto join delay:"), P_OFFINTNL(hex_irc_join_delay), 0, 0, 9999}, + {ST_MENU, N_("Ban Type:"), P_OFFINTNL(hex_irc_ban_type), N_("Attempt to use this banmask when banning or quieting. (requires irc_who_join)"), bantypemenu, 0}, {ST_END, 0, 0, 0, 0, 0} }; |