~ubuntu-branches/ubuntu/saucy/steam/saucy-backports

« back to all changes in this revision

Viewing changes to server/net/telnet.pike

  • Committer: Package Import Robot
  • Author(s): Felix Geyer
  • Date: 2013-10-29 19:51:18 UTC
  • mfrom: (0.2.4) (3.2.1 trusty-proposed)
  • mto: This revision was merged to the branch mainline in revision 4.
  • Revision ID: package-import@ubuntu.com-20131029195118-b9bxciz5hwx5z459
Tags: 1:1.0.0.39-2ubuntu1
Add an epoch to the version number as there was an unrelated steam package
in the archive with a higher version number.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* Copyright (C) 2000-2004  Thomas Bopp, Thorsten Hampel, Ludger Merkens
2
 
 *
3
 
 *  This program is free software; you can redistribute it and/or modify
4
 
 *  it under the terms of the GNU General Public License as published by
5
 
 *  the Free Software Foundation; either version 2 of the License, or
6
 
 *  (at your option) any later version.
7
 
 *
8
 
 *  This program is distributed in the hope that it will be useful,
9
 
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
10
 
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11
 
 *  GNU General Public License for more details.
12
 
 *
13
 
 *  You should have received a copy of the GNU General Public License
14
 
 *  along with this program; if not, write to the Free Software
15
 
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16
 
 * 
17
 
 * $Id: telnet.pike,v 1.1.1.1 2006/03/27 12:40:15 exodusd Exp $
18
 
 */
19
 
 
20
 
constant cvs_version="$Id: telnet.pike,v 1.1.1.1 2006/03/27 12:40:15 exodusd Exp $";
21
 
 
22
 
inherit "/net/coal/login";
23
 
inherit "/net/base/readline";
24
 
inherit "/net/base/cmd";
25
 
 
26
 
#include <macros.h>
27
 
#include <config.h>
28
 
#include <database.h>
29
 
#include <events.h>
30
 
#include <client.h>
31
 
#include <attributes.h>
32
 
#include <classes.h>
33
 
 
34
 
#define MODE_CONNECT 0
35
 
#define MODE_LOGIN 1
36
 
#define MODE_PASS  2
37
 
#define MODE_CMD   3
38
 
#define MODE_MORE_INPUT 4
39
 
 
40
 
static int      iMode;
41
 
mapping         mMode= ([ "cmd":0 ]);
42
 
static int      passwdtries;
43
 
static object tmpUser;
44
 
static int      iCreate;
45
 
static mapping(string:string) mCreate = ([]);
46
 
 
47
 
void create(object f)
48
 
{
49
 
    ::create(f);
50
 
    iMode = MODE_CONNECT;
51
 
}
52
 
 
53
 
/**
54
 
 * creates an new user and activates him. adduser is called in Mode_Create several times.
55
 
 */
56
 
int cmd_adduser(string cmd, string|void args)
57
 
{
58
 
    if (iMode == MODE_CMD) {
59
 
        iMode = MODE_MORE_INPUT;
60
 
        iCreate = 1;
61
 
        mCreate["name"] = args;
62
 
        send_message("Weitere Daten werden zum Anlegen des Nutzers \"" + args + "\" ben�tigt.\n");
63
 
        send_message("Passwort des Nutzers:");
64
 
    } else {
65
 
        switch (iCreate) {
66
 
          case 0:
67
 
              mCreate["name"] = args;
68
 
              iCreate = 1;
69
 
              send_message("Passwort des Nutzers:");
70
 
              break;
71
 
          case 1:
72
 
              mCreate["pw"] = cmd;
73
 
              iCreate = 2;
74
 
              send_message("E-Mail des Nutzers:");
75
 
              break;
76
 
          case 2:
77
 
              mCreate["email"] = cmd;
78
 
              LOG("now fetching factory\n");
79
 
              object factory = _Server->get_factory(CLASS_USER);
80
 
              LOG("Now executing factory\n");
81
 
              object user = factory->execute(mCreate);
82
 
              LOG("Factory executed");
83
 
              if (user == 0) {
84
 
                  send_message("Ein Fehler ist aufgetreten. Nutzer wurde nicht angelegt\n");
85
 
              } else {
86
 
                  LOG("Now activating user.\n");
87
 
                  if (user->activate_user(factory->get_activation())) {
88
 
                      send_message("Nutzer wurde angelegt und aktiviert.\n");
89
 
                  } else {
90
 
                      send_message("Nutzer wurde angelegt, aber nicht aktiviert!\n");
91
 
                  }
92
 
              }
93
 
              iMode = MODE_CMD;
94
 
              iCreate = 0;
95
 
              break;
96
 
        }
97
 
    }
98
 
    return 1;
99
 
}
100
 
 
101
 
void addlink(object to)
102
 
{
103
 
    mapping (string:object) mName = ([]);
104
 
    mName["link_to"] = to;
105
 
    object factory = _Server->get_factory(CLASS_LINK);
106
 
    object link = factory->execute(mName);
107
 
    if (link == 0) {
108
 
        send_message("Ein Fehler ist aufgetreten. Der Link konnte nicht angelegt werden.\n");
109
 
    } else {
110
 
        send_message("Der Link wurde angelegt. Seine ID ist " + link->get_object_id() );
111
 
    }
112
 
    
113
 
}
114
 
 
115
 
void create_object(string type, string name)
116
 
{
117
 
    mixed err;
118
 
    object newobject;
119
 
    mapping (string:string) mName = ([]);
120
 
    mName["name"] = name;
121
 
    object factory = _Server->get_factory(type);
122
 
    if(!factory)
123
 
    {
124
 
      send_message("Es gibt keine Klasse vom typ '"+type+"'.\n");
125
 
      return;
126
 
    }
127
 
    err = catch{ newobject = factory->execute(mName); };
128
 
    if (newobject == 0) 
129
 
    {
130
 
        send_message("Ein Fehler ist aufgetreten. Das Objekt konnte nicht angelegt werden:\n"+err[0]+"\n");
131
 
        LOG(sprintf("%O", err));
132
 
    } 
133
 
    else 
134
 
    {
135
 
        send_message("Das Objekt wurde angelegt. Seine ID ist " + newobject->get_object_id() );
136
 
        newobject->move(oUser->get_environment());
137
 
    }
138
 
}
139
 
 
140
 
 
141
 
/**
142
 
 * Shows the inventory of the given object
143
 
 * grouped by the object classes
144
 
 *
145
 
 * @param object obj - the target object
146
 
 * @return the inventory formatted as string
147
 
 * @author <a href="mailto:joergh@upb.de">Joerg Halbsgut</a>) 
148
 
 */
149
 
static string show_inventory(object obj) {
150
 
    string res = "";
151
 
 
152
 
    // NOT COMPLETE !(see also "classes.h")
153
 
    mapping classes_names = ([ CLASS_USER:CLASS_NAME_USER,
154
 
                               CLASS_OBJECT:CLASS_NAME_OBJECT,
155
 
                               CLASS_CONTAINER:CLASS_NAME_CONTAINER,
156
 
                               CLASS_ROOM:CLASS_NAME_ROOM,
157
 
                               CLASS_DOCUMENT:CLASS_NAME_DOCUMENT,
158
 
                               CLASS_LINK:CLASS_NAME_LINK,
159
 
                               CLASS_GROUP:CLASS_NAME_GROUP,
160
 
                               CLASS_EXIT:CLASS_NAME_EXIT,
161
 
                               CLASS_IMAGE:"Image",
162
 
                               CLASS_MESSAGEBOARD:"Messageboard",
163
 
                               CLASS_GHOST:CLASS_NAME_GHOST, 
164
 
                               CLASS_TRASHBIN:CLASS_NAME_TRASHBIN,
165
 
                               /*,CLASS_SHADOW:"Shadow"*/ ]);
166
 
 
167
 
    int flag = 0; 
168
 
    int counter = 0;
169
 
 
170
 
    if (arrayp(obj->get_inventory())) {
171
 
        res = res +"\nThis is the inventory of " 
172
 
                  + obj->get_identifier() +":\n";
173
 
        res += "----------------------------------------------------\n";
174
 
        foreach (indices(classes_names), int cl) {
175
 
            array(object) inventory_class = 
176
 
                obj->get_inventory_by_class(cl);
177
 
            flag = 0;
178
 
                        
179
 
            if (arrayp(inventory_class) && sizeof(inventory_class)>0) {
180
 
                res += "  " + classes_names[cl] +":\n";
181
 
                foreach (inventory_class, object inv_obj) {
182
 
                    counter++;
183
 
                    string ident = inv_obj->get_identifier();
184
 
                    int id = inv_obj->get_object_id();
185
 
                    if (flag!=0)
186
 
                        res += ", \n";
187
 
                    res += sprintf ("    %s[%d]", ident, id); 
188
 
                    flag = 1;           
189
 
                }
190
 
                res += "\n\n";
191
 
            }   
192
 
        }
193
 
        if (counter == 0)
194
 
            res += "\n No objects in the inventory.\n";
195
 
    }
196
 
    else
197
 
        res = res +"\""+obj->get_identifier()+"\" has no inventory.\n";
198
 
 
199
 
    return res;
200
 
}
201
 
 
202
 
 
203
 
static void send_room(object room)
204
 
{
205
 
    if ( objectp(room) ) {
206
 
        send_message(
207
 
            "[#"+room->get_object_id() + ","+_FILEPATH->object_to_filename(room)+"]\n"+
208
 
            "You are in a large area called " + room->get_identifier() + ".\n"+
209
 
            "There are the following exits:\n");
210
 
        array(object) inv = room->get_inventory();
211
 
        foreach(inv, object o) {
212
 
            if ( o->get_object_class() & CLASS_EXIT )
213
 
                send_message(o->get_identifier()+",");
214
 
        }
215
 
        send_message("\nThere are the following people:\n");
216
 
        array(object) users = room->get_inventory_by_class(CLASS_USER);
217
 
        foreach(users, object u) {
218
 
            send_message(u->get_identifier()+",");
219
 
        }
220
 
        send_message("\n");
221
 
    }
222
 
    else {
223
 
        send_message("You are in the big black void.\n");
224
 
    }
225
 
}
226
 
 
227
 
static void enter_room(object room, void|object from)
228
 
{
229
 
    if ( objectp(from) )
230
 
        oUser->dispose_event(EVENT_SAY|EVENT_LEAVE_INVENTORY|EVENT_ENTER_INVENTORY, from);
231
 
 
232
 
    oUser->listen_to_event(EVENT_SAY, room);
233
 
    oUser->listen_to_event(EVENT_LEAVE_INVENTORY, room);
234
 
    oUser->listen_to_event(EVENT_ENTER_INVENTORY, room);
235
 
}
236
 
 
237
 
void notify(int event, mixed ... args)
238
 
{
239
 
    LOG("SAY: "+sprintf("%O\n", args));
240
 
    object user = this_user();
241
 
    LOG("oUser="+sprintf("%O", oUser));
242
 
    LOG("user="+sprintf("%O", user));
243
 
    if ( !objectp(oUser) || !objectp(user) )
244
 
        return;
245
 
    LOG("sending event response !");
246
 
 
247
 
    switch(event) {
248
 
    case EVENT_TELL:
249
 
        send_message(user->get_identifier() + " tells you: " + args[2]+"\n");
250
 
        break;
251
 
    case EVENT_SAY:
252
 
        if ( user == oUser )
253
 
            send_message("You say: "+args[2]+"\n");
254
 
        else
255
 
            send_message(user->get_identifier() + " says: "+args[2]+"\n");
256
 
        break;
257
 
    case EVENT_ENTER_INVENTORY:
258
 
        if ( args[1] == oUser ) {
259
 
            send_message("You move to " + args[0]->get_identifier()+"\n");
260
 
        }
261
 
        else {
262
 
            send_message(args[1]->get_identifier() + " enters the room.\n");
263
 
            send_message("%O:%O\n", args[1]->get_status(), args[1]->get_status()& CLIENT_FEATURES_MOVE);
264
 
        }
265
 
        break;
266
 
    case EVENT_LEAVE_INVENTORY:
267
 
        send_message(args[1]->get_identifier() +  " leaves the room.\n");
268
 
        break;
269
 
    }
270
 
}
271
 
 
272
 
int cmd_delete(string cmd, string args)
273
 
{
274
 
    int id; 
275
 
    sscanf(args,"#%i %*",id);
276
 
 
277
 
    object oTmp=find_object(id);
278
 
    if (objectp(oTmp)) 
279
 
    {
280
 
        mixed err = catch { oTmp->delete(); };
281
 
        if (err!=0) send_message("Failed to delete Object #"+id+"\r\n");
282
 
        else send_message("Deleted Object #"+id+"\r\n");
283
 
    }
284
 
    else send_message("Unable to find Object #"+id+"\r\n");
285
 
    return 1;
286
 
}
287
 
 
288
 
int cmd_take(string cmd, string args)
289
 
{
290
 
    int id;
291
 
    sscanf(args,"#%i %*",id);
292
 
 
293
 
    object oTmp=find_object(id);
294
 
    if (objectp(oTmp))
295
 
    {
296
 
        mixed err = catch { oTmp->move(oUser); };
297
 
        if (err!=0) send_message("Cannot take object #"+id+"\r\n");
298
 
        else send_message("Object #"+id+" is now in your inventory!\r\n");
299
 
    }
300
 
    else send_message("Can't find Object #"+id+"\r\n");
301
 
    return 1;
302
 
}
303
 
 
304
 
int cmd_drop(string cmd, string args)
305
 
{
306
 
    int id;
307
 
    sscanf(args,"#%i %*",id);
308
 
 
309
 
    object oTmp=find_object(id);
310
 
 
311
 
    if(objectp(oTmp))
312
 
    {
313
 
        //check if object is in user's inventory
314
 
        array(object) oaInv = oUser->get_inventory();
315
 
        foreach( oaInv, object item )
316
 
        {
317
 
            if ( item->get_object_id() == id )
318
 
            {
319
 
                mixed err = catch { oTmp->move(oUser->get_environment()); };
320
 
                if (err!=0) send_message("Cannot drop object #"+id+"\r\n");
321
 
                else send_message("Dropped Object #"+id+"\r\n");
322
 
                return 1;
323
 
            }
324
 
        }
325
 
        // foreach did not find object in user's inventory
326
 
        send_message("Object #"+id+" is not in your inventory!\r\n");
327
 
    }
328
 
    else send_message("Can't find Object #"+id+"\r\n");
329
 
    return 1;
330
 
}
331
 
 
332
 
int cmd_quit(string cmd, string args)
333
 
{
334
 
  if(readln)
335
 
    oUser->set_attribute("telnet_history", readln->readline->historyobj->encode()/"\n");
336
 
  send_message("Bye %s, see you again soon!\n", oUser->get_identifier());
337
 
  oUser->disconnect();
338
 
  disconnect();
339
 
  return -1; 
340
 
}
341
 
 
342
 
int cmd_look(string cmd, string args)
343
 
{
344
 
        //send_room(oUser->get_environment());
345
 
        object oRoom = oUser->get_environment();
346
 
        send_message(show_inventory(oRoom));
347
 
        return 1;
348
 
}
349
 
 
350
 
int cmd_inv(string cmd, string args)
351
 
{
352
 
        int oid;
353
 
        object obj;
354
 
        if ( sscanf(args, "#%d",oid) == 1)
355
 
            obj = find_object(oid);     
356
 
        else {
357
 
            obj = oUser;
358
 
            LOG("Inventory of User");
359
 
        }
360
 
 
361
 
        send_message(show_inventory(obj));
362
 
        return 1;
363
 
}
364
 
 
365
 
int cmd_say(string cmd, string args)
366
 
{
367
 
        object env = oUser->get_environment();
368
 
        env->message(args);
369
 
        return 1;
370
 
}
371
 
 
372
 
int cmd_tell(string cmd, string args)
373
 
{
374
 
        string user, msg;
375
 
        object    target;
376
 
 
377
 
        if ( sscanf(args, "%s %s", user, msg) != 2 ) {
378
 
            send_message("Usage is tell <user> <message>.\n");
379
 
            return 1;
380
 
        }
381
 
        target = _Persistence->lookup_user(user);
382
 
        if ( !objectp(target) ){
383
 
            send_message("Failed to find user '"+user+"'.\n");
384
 
            return 1;
385
 
        }
386
 
        target->message(msg);
387
 
        send_message("You told " + user + ": "+msg+"\n");
388
 
        return 1;
389
 
}
390
 
 
391
 
int cmd_move(string cmd, string args)
392
 
{
393
 
  object env = oUser->get_environment();
394
 
  object exit;
395
 
  int      id;
396
 
  if(args == "home")
397
 
  {
398
 
    send_message("Going home now...");
399
 
    exit = oUser->query_attribute(USER_WORKROOM);
400
 
  }  
401
 
  else if ( sscanf(args, "#%d", id) ==  1 )
402
 
    exit = find_object(id);
403
 
  else if(sizeof(args))
404
 
    exit = env->get_object_byname(args);
405
 
  else
406
 
    send_message(cmd + " where?\n");
407
 
 
408
 
  if ( objectp(exit) ) 
409
 
  {
410
 
    mixed err = catch { oUser->move(exit); };
411
 
    if ( err != 0 ) 
412
 
    {
413
 
      send_message("Failed to move there...\n");
414
 
    }
415
 
    else 
416
 
    {
417
 
      enter_room(oUser->get_environment(), env);
418
 
      //send_room(oUser->get_environment());
419
 
      send_message(show_inventory(oUser->get_environment()));
420
 
    }
421
 
  }
422
 
  else if(sizeof(args))
423
 
    send_message("The exit '" + args + "' was not found.\n");
424
 
  return 1;
425
 
}
426
 
 
427
 
 
428
 
int cmd_create(string cmd, string args)
429
 
{
430
 
  array tmp=args/" ";
431
 
  create_object(tmp[0], tmp[1..]*" ");
432
 
  return 1;
433
 
}
434
 
 
435
 
int cmd_addroom(string cmd, string args)
436
 
{
437
 
  create_object("Room", args);
438
 
  return 1;
439
 
}
440
 
 
441
 
int cmd_addcontainer(string cmd, string args)
442
 
{
443
 
  create_object("Container", args);
444
 
  return 1;
445
 
}
446
 
 
447
 
int cmd_addlink(string cmd, string args)
448
 
{
449
 
  int objectid;
450
 
  object room;
451
 
  if ( sscanf(args, "#%d",objectid) == 1) {
452
 
    room = find_object(objectid);
453
 
    addlink (room);
454
 
  } else {
455
 
    send_message("Es gibt keinen Raum mit der Angegebenen ID.");
456
 
  }
457
 
  return 1;
458
 
}
459
 
 
460
 
int cmd_execute_cmd(string cmd, string args)
461
 
{
462
 
  send_message("\n"+execute(" "+args)+"\n");
463
 
  return 1;
464
 
}
465
 
 
466
 
// copied from masterlist.pike
467
 
 
468
 
int cmd_load(string cmd, string args)
469
 
{
470
 
  int iOID;
471
 
  sscanf(args,"#%i %*",iOID);
472
 
  
473
 
  find_object(iOID)->get_identifier();
474
 
  return 1;
475
 
}
476
 
 
477
 
int cmd_upgrade(string cmd, string args)
478
 
{
479
 
  string option;
480
 
  int iOID, force;
481
 
  [option, iOID] = array_sscanf(args,"%s#%i %*");
482
 
  
483
 
  if(option=="--force " || option=="-f ")
484
 
    force=1;
485
 
  
486
 
  object pOID;
487
 
  program target;
488
 
  
489
 
  pOID = find_object(iOID);
490
 
  
491
 
  if(!pOID && master()->programs[option])
492
 
    target=master()->programs[option];
493
 
  else if (pOID->status() <= PSTAT_DISK) {
494
 
    send_message("Use Load instead\n");
495
 
    return 0;
496
 
  }
497
 
  
498
 
  target=object_program(pOID->get_object());
499
 
  
500
 
  if(!target) {
501
 
    send_message("could not find program\n");
502
 
    return 0;
503
 
  }
504
 
  else
505
 
    send_message("upgrading...\n");
506
 
  
507
 
  mixed res = master()->upgrade(target, force);
508
 
  if(res==-1)
509
 
    send_message("Upgrade failed, try --force\n");
510
 
  else
511
 
    send_message("Result: %s\n", (string)res);
512
 
  
513
 
  return 1;
514
 
}
515
 
 
516
 
mapping(string:function) run_commands = ([ "l":cmd_look,
517
 
                                           "look":cmd_look,
518
 
                                           "inv":cmd_inv,
519
 
                                           "say":cmd_say,
520
 
                                           "tell":cmd_tell,
521
 
                                           "go":cmd_move,
522
 
                                           "move":cmd_move,
523
 
                                           "delete":cmd_delete,
524
 
                                           "take":cmd_take,
525
 
                                           "drop":cmd_drop,
526
 
                                           "adduser":cmd_adduser,
527
 
                                           "addroom":cmd_addroom,
528
 
                                           "addcontainer":cmd_addcontainer,
529
 
                                           "addlink":cmd_addlink,
530
 
                                           "create":cmd_create,
531
 
                                           "upgrade":cmd_upgrade,
532
 
                                           "load":cmd_load,
533
 
                                           "cmd":cmd_execute_cmd,
534
 
                                           "man":cmd_man,
535
 
                                           "?":cmd_help,
536
 
                                           "help":cmd_help,
537
 
                                           "quit":cmd_quit
538
 
                                          ]);
539
 
 
540
 
static int handle_command(string cmd)
541
 
{
542
 
    string args = "";
543
 
    sscanf(cmd, "%s %s", cmd, args);
544
 
    mMode->cmd=run_commands[cmd];
545
 
    if(run_commands[cmd])
546
 
      return run_commands[cmd](cmd, args);
547
 
    else return 0;
548
 
}
549
 
 
550
 
static void process_command(string cmd)
551
 
{
552
 
    switch ( iMode ) {
553
 
 
554
 
    case MODE_CONNECT:
555
 
        send_message("Welcome to sTeam\n: ");
556
 
        send_message("Login: ");
557
 
        iMode=MODE_LOGIN;
558
 
      break;
559
 
    case MODE_LOGIN:
560
 
        tmpUser = _Persistence->lookup_user(cmd);
561
 
        if ( !objectp(tmpUser) )
562
 
        {
563
 
            send_message("User '"+cmd+"' does not exist !\n");
564
 
            send_message("Login: ");
565
 
        }
566
 
        else {
567
 
            if(readln)
568
 
              readln->set_secret( 1 );
569
 
            send_message("Password for "+cmd+": ");
570
 
            iMode = MODE_PASS;
571
 
        }
572
 
        break;
573
 
    case MODE_PASS:
574
 
        if ( objectp(tmpUser) && tmpUser->check_user_password(cmd) ) {
575
 
            send_message("Hi, " + tmpUser->get_identifier() + " - last seen "+
576
 
                         "you on " +
577
 
                         ctime(tmpUser->query_attribute(USER_LAST_LOGIN)));
578
 
            login_user(tmpUser);
579
 
            iMode = MODE_CMD;
580
 
            enter_room(tmpUser->get_environment());
581
 
            //send_room(tmpUser->get_environment());
582
 
            send_message(show_inventory(tmpUser->get_environment()));
583
 
            if(readln)
584
 
              readln->set_secret( 0 );
585
 
            tmpUser->listen_to_event(EVENT_TELL, tmpUser);
586
 
            if(readln)
587
 
            {
588
 
              array history=tmpUser->query_attribute("telnet_history");
589
 
              if(!arrayp(history))
590
 
                history=({});
591
 
              readln->readline->historyobj=readln->readline->History(512, history+({ "" }));
592
 
              if(sizeof(history))
593
 
                readln->readline->historyobj->delta_history(sizeof(history));
594
 
            }
595
 
        }
596
 
        else
597
 
        {
598
 
          passwdtries++;
599
 
          if(passwdtries<3)
600
 
            send_message("Wrong password, please try again: ");
601
 
          else
602
 
          { 
603
 
            tmpUser->disconnect();
604
 
            disconnect();
605
 
          }
606
 
        }
607
 
        break;
608
 
    case MODE_MORE_INPUT:
609
 
        mMode->cmd(cmd);
610
 
        break;
611
 
    case MODE_CMD:
612
 
        if ( strlen(cmd) != 0 && !handle_command(cmd) )
613
 
            send_message("The command %O was not understood.\n", cmd);
614
 
        send_message("["+_FILEPATH->object_to_path(oUser)+"] > ");
615
 
        break;
616
 
    }
617
 
}
618
 
 
619
 
int get_client_features() { return CLIENT_FEATURES_ALL; }
620
 
string get_socket_name() { return "telnet"; }
621
 
 
622
 
// allow user to store stuff somewhere
623
 
mapping temp_cmd=([]);
624
 
 
625
 
int cmd_man(string cmd, string args)
626
 
{
627
 
                string filename = "server/net/manpages/" + args + ".man";
628
 
                if(Stdio.exist(filename))
629
 
                {
630
 
                        write ("\n" + Stdio.read_file(filename) + "\n");
631
 
                }
632
 
                else
633
 
                {                       
634
 
                        write("There is no command \"" + args + "\"\n");
635
 
                        write("usage : man <command>\n");
636
 
                }
637
 
 
638
 
  return 1;
639
 
}
640
 
 
641
 
int cmd_help(string cmd, string args)
642
 
{
643
 
  send_message("\nthe following commands are available:\n%s\n", 
644
 
        sort(indices(run_commands))*" ");
645
 
  return 1;
646
 
}
647