MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame^] | 1 | /* |
| 2 | * mudlink tool, offers several commands as an interface to the |
| 3 | * MUDLINK system. |
| 4 | * |
| 5 | * Commands offered: |
| 6 | * rpeers |
| 7 | * rwho <remotemud> |
| 8 | * rtell <player>@<remotemud> |
| 9 | * |
| 10 | * Deepthought, 19-Jan-93 |
| 11 | */ |
| 12 | |
| 13 | #include <config.h> |
| 14 | #include <properties.h> |
| 15 | |
| 16 | inherit "/std/thing"; |
| 17 | |
| 18 | create() { |
| 19 | string name, foo; |
| 20 | |
| 21 | if (sizeof(old_explode(object_name(this_object()),"#")) != 2) return; |
| 22 | |
| 23 | thing::create(); |
| 24 | SetProp (P_SHORT,"a MUDLINK tool"); |
| 25 | SetProp (P_LONG, |
| 26 | "This tool is used for communicating with MUDLINK. Commands are:\n" |
| 27 | +"rpeers Get a list of muds connected to MUDLINK\n" |
| 28 | +"rwho <mud> Show a list of players on the remote mud\n" |
| 29 | +"rtell <player>@<mud> <message> Tell something to a player on another mud\n" |
| 30 | ); |
| 31 | AddId ("tool"); |
| 32 | AddId ("mudlink"); |
| 33 | AddAdjective("mudlink"); |
| 34 | SetInfo ("Mudlink Tool V0.1 by Deepthought"); |
| 35 | } |
| 36 | |
| 37 | _query_read_msg() { return 0; } |
| 38 | |
| 39 | /*------------------------------------------------------------------------- |
| 40 | ** Add and decode our commands. |
| 41 | */ |
| 42 | |
| 43 | init() { |
| 44 | thing::init(); |
| 45 | add_action("rpeers","rpeers"); |
| 46 | add_action("rwho","rwho"); |
| 47 | add_action("rtell","rtell"); |
| 48 | } |
| 49 | |
| 50 | rpeers() { |
| 51 | string u; |
| 52 | u = geteuid(this_player()); |
| 53 | if (stringp(u)) |
| 54 | tell_object(find_player("mudlink"),"rpeers "+u+"\n"); |
| 55 | return 1; |
| 56 | } |
| 57 | |
| 58 | rwho(str) { |
| 59 | string u; |
| 60 | if (!str || str == "") { |
| 61 | write("Usage: rwho <mud>\n"); |
| 62 | return 1; |
| 63 | } |
| 64 | if (stringp(u = geteuid(this_player()))) |
| 65 | tell_object(find_player("mudlink"),"rwho "+u+"="+str+"\n"); |
| 66 | return 1; |
| 67 | } |
| 68 | |
| 69 | rtell(str) { |
| 70 | string u; |
| 71 | string a, b, c, d; |
| 72 | |
| 73 | if (!str || str == "") { |
| 74 | write("Usage: rtell <player>@<mud> <message>\n"); |
| 75 | return 1; |
| 76 | } |
| 77 | if (sscanf(str, "%s@%s %s", a, b, c) != 3) { |
| 78 | write("Usage: rtell <player>@<mud> <message>\n"); |
| 79 | return 1; |
| 80 | } |
| 81 | if (stringp(u = geteuid(this_player()))) |
| 82 | tell_object(find_player("mudlink"),"rpage "+u+"@"+a+"@"+b+"="+c+"\n"); |
| 83 | return 1; |
| 84 | } |