MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame^] | 1 | /* This sefun is to provide a replacement for the efuns query_ip_name() and |
| 2 | * query_ip_number(). |
| 3 | * Feel free to add it to your mudlibs, if you have much code relying on that. |
| 4 | */ |
| 5 | |
| 6 | #if ! __EFUN_DEFINED__(query_ip_name) |
| 7 | |
| 8 | #include <interactive_info.h> |
| 9 | |
| 10 | private varargs string _query_ip_name(object player) |
| 11 | { |
| 12 | object ob = player; |
| 13 | ob ||= efun::this_player(); |
| 14 | |
| 15 | player = efun::interactive_info(ob, II_IP_ADDRESS); |
| 16 | return efun::interactive_info(ob, II_IP_NAME); |
| 17 | } |
| 18 | |
| 19 | private varargs string _query_ip_number(object player) |
| 20 | { |
| 21 | object ob = player; |
| 22 | ob ||= efun::this_player(); |
| 23 | |
| 24 | player = efun::interactive_info(ob, II_IP_ADDRESS); |
| 25 | return efun::interactive_info(ob, II_IP_NUMBER); |
| 26 | } |
| 27 | |
| 28 | // * Herkunfts-Ermittlung |
| 29 | string query_ip_number(object ob) |
| 30 | { |
| 31 | ob= ob || this_player(); |
| 32 | if (!objectp(ob) || !interactive(ob)) return 0; |
| 33 | if(ob->query_realip() && (string)ob->query_realip()!="") |
| 34 | { |
| 35 | return (string)ob->query_realip(); |
| 36 | } |
| 37 | return _query_ip_number(ob); |
| 38 | } |
| 39 | |
| 40 | string query_ip_name(mixed ob) |
| 41 | { |
| 42 | if ( !ob || objectp(ob) ) |
| 43 | ob=query_ip_number(ob); |
| 44 | return (string)"/p/daemon/iplookup"->host(ob); |
| 45 | } |
| 46 | |
| 47 | #endif |
| 48 | |