]> jfr.im git - irc/evilnet/x3.git/commitdiff
Added a map link to the geoip city results
authorsirvulcan <redacted>
Tue, 8 Aug 2006 15:03:14 +0000 (15:03 +0000)
committersirvulcan <redacted>
Tue, 8 Aug 2006 15:03:14 +0000 (15:03 +0000)
ChangeLog
src/opserv.c

index 3f5e8cc87d89638f42a3ce191a293f1e30d42269..dd59388fd9a55db3fc5699794137adf6b1a5b401 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,13 @@
 /***********************************************************************
  X3 ChangeLog
 
+2006-08-09  Neil Spierling  <sirvulcan@gmail.com>
+
+       * src/opserv.c: If we have a city, latitude and longitude returned
+       then show a map url. Some results have no city but a latitude and
+       a longitude. The coordinates are useless in this case and most
+       people would know where the country is around abouts.
+
 2006-08-08  Neil Spierling  <sirvulcan@gmail.com>
 
        * src/hash.c: Speed up city and country lookups significantly.
index a1d489f9295770a2d58d8d0ec4b7dce4e96f23f3..64fbac5715d986280e82704f39a56ab70dc98a0d 100644 (file)
@@ -186,6 +186,7 @@ static const struct message_entry msgtab[] = {
     { "OSMSG_WHOIS_POSTAL_CODE","Postal Code  : %s" },
     { "OSMSG_WHOIS_LATITUDE",   "Latitude     : %f" },
     { "OSMSG_WHOIS_LONGITUDE",  "Longitude    : %f" },
+    { "OSMSG_WHOIS_MAP",        "Map          : %s" },
     { "OSMSG_WHOIS_DMA_CODE",   "DMA Code     : %d" },
     { "OSMSG_WHOIS_AREA_CODE",  "Area Code    : %d" },
     { "OSMSG_WHOIS_MODES",      "Modes        : +%s " },
@@ -1775,6 +1776,16 @@ static MODCMD_FUNC(cmd_whois)
         reply("OSMSG_WHOIS_POSTAL_CODE", target->postal_code);
         reply("OSMSG_WHOIS_LATITUDE", target->latitude);
         reply("OSMSG_WHOIS_LONGITUDE", target->longitude);
+        /* Only show a map url if we have a city, latitude and longitude.
+         * Theres not much point of latitude and longitude coordinates are
+         * returned but no city, the coordinates are useless.
+         */
+        if (target->latitude && target->longitude && target->city) {
+            char map_url[MAXLEN];
+            snprintf(map_url, sizeof(map_url), "http://www.mapquest.com/maps/map.adp?searchtype=address&formtype=address&latlongtype=decimal&latitude=%f&longitude=%f",
+                     target->latitude, target->longitude);
+            reply("OSMSG_WHOIS_MAP", map_url);
+        }
         reply("OSMSG_WHOIS_DMA_CODE", target->dma_code);
         reply("OSMSG_WHOIS_AREA_CODE", target->area_code);
     } else if (target->country_name) {