summary refs log tree commit diff stats
path: root/src/common/outbound.c
diff options
context:
space:
mode:
authorTingPing <tingping@tingping.se>2014-01-08 01:32:28 -0500
committerTingPing <tingping@tingping.se>2014-01-08 01:32:28 -0500
commit20d26aea943d8de63a61cb92f506dd51b934fe36 (patch)
treebb9f0377978fcc400e92a07f6ff53b1ec862199e /src/common/outbound.c
parent9cba22c38ab58e7e54258ce012a5e296f81f3f7b (diff)
Rewrite dns command
- Cross platform
- Doesn't depend on external tools
Diffstat (limited to 'src/common/outbound.c')
-rw-r--r--src/common/outbound.c18
1 files changed, 6 insertions, 12 deletions
diff --git a/src/common/outbound.c b/src/common/outbound.c
index 96425f8f..7d64e65f 100644
--- a/src/common/outbound.c
+++ b/src/common/outbound.c
@@ -1414,21 +1414,17 @@ cmd_discon (struct session *sess, char *tbuf, char *word[], char *word_eol[])
 static int
 cmd_dns (struct session *sess, char *tbuf, char *word[], char *word_eol[])
 {
-#ifdef WIN32
-	PrintText (sess, "DNS is not implemented in Windows.\n");
-	return TRUE;
-#else
 	char *nick = word[2];
 	struct User *user;
+	message_tags_data no_tags = MESSAGE_TAGS_DATA_INIT;
 
 	if (*nick)
 	{
-		if (strchr (nick, '.') == NULL)
+		user = userlist_find (sess, nick);
+		if (user)
 		{
-			user = userlist_find (sess, nick);
-			if (user && user->hostname)
+			if (user->hostname)
 			{
-				message_tags_data no_tags = MESSAGE_TAGS_DATA_INIT;
 				do_dns (sess, user->nick, user->hostname, &no_tags);
 			} else
 			{
@@ -1437,13 +1433,11 @@ cmd_dns (struct session *sess, char *tbuf, char *word[], char *word_eol[])
 			}
 		} else
 		{
-			snprintf (tbuf, TBUFSIZE, "exec -d %s %s", prefs.hex_dnsprogram, nick);
-			handle_command (sess, tbuf, FALSE);
+			do_dns (sess, NULL, nick, &no_tags);
 		}
 		return TRUE;
 	}
 	return FALSE;
-#endif
 }
 
 static int
@@ -3904,7 +3898,7 @@ const struct commands xc_cmds[] = {
 	{"DEVOICE", cmd_devoice, 1, 1, 1,
 	 N_("DEVOICE <nick>, removes voice status from the nick on the current channel (needs chanop)")},
 	{"DISCON", cmd_discon, 0, 0, 1, N_("DISCON, Disconnects from server")},
-	{"DNS", cmd_dns, 0, 0, 1, N_("DNS <nick|host|ip>, Finds a users IP number")},
+	{"DNS", cmd_dns, 0, 0, 1, N_("DNS <nick|host|ip>, Resolves an IP or hostname")},
 	{"ECHO", cmd_echo, 0, 0, 1, N_("ECHO <text>, Prints text locally")},
 #ifndef WIN32
 	{"EXEC", cmd_exec, 0, 0, 1,