blob: 0c166366d04a47524fc7381625e9152db15ab2da [file] [log] [blame]
MG Mud User88f12472016-06-24 23:31:02 +02001/* 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
10private varargs string _query_ip_name(object player)
11{
12 object ob = player;
13 ob ||= efun::this_player();
14
MG Mud User88f12472016-06-24 23:31:02 +020015 return efun::interactive_info(ob, II_IP_NAME);
16}
17
18private varargs string _query_ip_number(object player)
19{
20 object ob = player;
21 ob ||= efun::this_player();
22
MG Mud User88f12472016-06-24 23:31:02 +020023 return efun::interactive_info(ob, II_IP_NUMBER);
24}
25
26// * Herkunfts-Ermittlung
27string query_ip_number(object ob)
28{
29 ob= ob || this_player();
30 if (!objectp(ob) || !interactive(ob)) return 0;
Zesstra4dbb9882019-11-26 21:26:36 +010031 if(ob->query_realip() && ob->query_realip()!="")
MG Mud User88f12472016-06-24 23:31:02 +020032 {
Zesstra4dbb9882019-11-26 21:26:36 +010033 return ob->query_realip();
MG Mud User88f12472016-06-24 23:31:02 +020034 }
35 return _query_ip_number(ob);
36}
37
38string query_ip_name(mixed ob)
39{
40 if ( !ob || objectp(ob) )
41 ob=query_ip_number(ob);
Zesstra4dbb9882019-11-26 21:26:36 +010042 return "/p/daemon/iplookup"->host(ob);
MG Mud User88f12472016-06-24 23:31:02 +020043}
44
45#endif
46