Zesstra | 83f011d | 2016-04-24 20:09:05 +0200 | [diff] [blame^] | 1 | #pragma strict_types, save_types, rtt_checks, pedantic |
| 2 | #pragma no_clone, no_shadow, no_inherit |
| 3 | |
| 4 | inherit __DIR__"i_service"; |
| 5 | |
| 6 | #include <intermud.h> |
| 7 | #include <regexp.h> |
| 8 | |
| 9 | string last_finger; |
| 10 | |
| 11 | public string service_name() |
| 12 | { |
| 13 | return "finger"; |
| 14 | } |
| 15 | |
| 16 | string QueryLastFinger() |
| 17 | { |
| 18 | return last_finger; |
| 19 | } |
| 20 | |
| 21 | // we received an intermud channel message |
| 22 | protected void recv_request(mapping data) |
| 23 | { |
| 24 | last_finger=capitalize(to_string(data[SENDER]))+"@"+data[NAME]; |
| 25 | INETD->send(data[NAME], ([ |
| 26 | REQUEST: REPLY, |
| 27 | RECIPIENT: data[SENDER], |
| 28 | ID: data[ID], |
| 29 | DATA: "/p/daemon/finger"->finger_single(data[DATA]) |
| 30 | ]) ); |
| 31 | } |
| 32 | |
| 33 | public int finger_remote(string name, string mud) |
| 34 | { |
| 35 | int ret = request(mud, name); |
| 36 | if (ret > 0) |
| 37 | write("Anfrage abgeschickt.\n"); |
| 38 | else |
| 39 | { |
| 40 | switch(ret) |
| 41 | { |
| 42 | default: |
| 43 | write("Es trat ein Fehler beim Versenden der Anfrage auf.\n"); |
| 44 | break; |
| 45 | } |
| 46 | } |
| 47 | return 1; |
| 48 | } |
| 49 | |