PennMUSH Community

Changeset 1008

Show
Ignore:
Timestamp:
07/07/07 20:59:59 (1 year ago)
Author:
shawnw
Message:

#7222: @chan/recall timestamps.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • 1.8.3/branches/devel/CHANGES.183

    r1007 r1008  
    4646  * @search (and by relation search()) now has an 'elock' 
    4747    search class, permitting boolean expression searches. [GM] 
    48  
     48  * @channel/recall extended to support recalling by time. Example: 
     49    '@chan/recall Foo=1h' will recall lines only from the past 
     50    hour. Patch by Talvo. 
     51  
    4952Functions: 
    5053  * cond() works like an if, else if, else if ... ncond(), 
  • 1.8.3/branches/devel/game/txt/hlp/pennchat.hlp

    r938 r1008  
    174174  @channel/mute <channel> = <yes|no> 
    175175  @channel/gag <channel> = <yes|no> 
    176   @channel/recall <channel> [ = <lines>[,<start line>] ] 
     176  @channel/recall <channel> [ = <lines|duration>[,<start line>] ] 
    177177 
    178178  Some channels broadcast messages when players connect or disconnect from 
     
    191191  @channel/recall shows you the most recent messages on the channel; 
    192192  the number of messages depends on how the channel is configured, but 
    193   can be limited by specifying <lines> to show and a <start line> to start 
    194   display from. You must be on a channel to recall from it. 
     193  can be limited by specifying <lines> to show and a <start line> to 
     194  start display from.  If <lines> is an elapsed time, like '1h', 
     195  messages from within the given interval will be recalled.  You must 
     196  be on a channel to recall from it. 
    195197 
    196198  See "help @channel4" for more. 
  • 1.8.3/branches/devel/hdrs/lock.h

    r1007 r1008  
    9999extern lock_type Page_Lock; 
    100100extern lock_type Tport_Lock; 
    101 extern lock_type Speech_Lock;     /* Who can speak aloud in me */ 
    102 extern lock_type Listen_Lock;     /* Who can trigger ^s/ahears on me */ 
    103 extern lock_type Command_Lock;    /* Who can use $commands on me */ 
    104 extern lock_type Parent_Lock;     /* Who can @parent to me */ 
    105 extern lock_type Link_Lock;       /* Who can @link to me */ 
    106 extern lock_type Leave_Lock;      /* Who can leave me */ 
    107 extern lock_type Drop_Lock;       /* Who can drop me */ 
    108 extern lock_type Give_Lock;       /* Who can give me */ 
    109 extern lock_type Mail_Lock;       /* Who can @mail me */ 
    110 extern lock_type Follow_Lock;     /* Who can follow me */ 
    111 extern lock_type Examine_Lock;    /* Who can examine visual me */ 
    112 extern lock_type Chzone_Lock;     /* Who can @chzone to this object? */ 
    113 extern lock_type Forward_Lock;    /* Who can @forwardlist to object? */ 
    114 extern lock_type Control_Lock;    /* Who can control this object? */ 
    115 extern lock_type Dropto_Lock;     /* Who follows the dropto of this room? */ 
    116 extern lock_type Destroy_Lock;    /* Who can @dest me if I'm dest_ok? */ 
     101extern lock_type Speech_Lock;   /* Who can speak aloud in me */ 
     102extern lock_type Listen_Lock;   /* Who can trigger ^s/ahears on me */ 
     103extern lock_type Command_Lock;  /* Who can use $commands on me */ 
     104extern lock_type Parent_Lock;   /* Who can @parent to me */ 
     105extern lock_type Link_Lock;     /* Who can @link to me */ 
     106extern lock_type Leave_Lock;    /* Who can leave me */ 
     107extern lock_type Drop_Lock;     /* Who can drop me */ 
     108extern lock_type Give_Lock;     /* Who can give me */ 
     109extern lock_type Mail_Lock;     /* Who can @mail me */ 
     110extern lock_type Follow_Lock;   /* Who can follow me */ 
     111extern lock_type Examine_Lock;  /* Who can examine visual me */ 
     112extern lock_type Chzone_Lock;   /* Who can @chzone to this object? */ 
     113extern lock_type Forward_Lock;  /* Who can @forwardlist to object? */ 
     114extern lock_type Control_Lock;  /* Who can control this object? */ 
     115extern lock_type Dropto_Lock;   /* Who follows the dropto of this room? */ 
     116extern lock_type Destroy_Lock;  /* Who can @dest me if I'm dest_ok? */ 
    117117extern lock_type Interact_Lock; 
    118 extern lock_type MailForward_Lock;        /* Who can forward mail to me */ 
    119 extern lock_type Take_Lock;       /* Who can take from the contents of this object? */ 
     118extern lock_type MailForward_Lock;      /* Who can forward mail to me */ 
     119extern lock_type Take_Lock;     /* Who can take from the contents of this object? */ 
    120120 
    121121#endif                          /* __LOCK_H */ 
  • 1.8.3/branches/devel/src/extchat.c

    r963 r1008  
    30713071  CHAN *chan; 
    30723072  CHANUSER *u; 
    3073   int start = -1, num_lines = 10; 
     3073  int start = -1, num_lines; 
     3074  bool recall_timestring = false; 
     3075  time_t recall_from = 0; 
    30743076  char *p = NULL, *buf, *name; 
    30753077  time_t timestamp; 
     
    30883090 
    30893091  if (!args[1] || !*args[1]) { 
    3090     /* nothing */ 
     3092    num_lines = 10;             /* default */ 
    30913093  } else if (is_integer(args[1])) { 
    30923094    num_lines = parse_integer(args[1]); 
    30933095    if (num_lines == 0) 
    30943096      num_lines = INT_MAX; 
     3097  } else if (etime_to_secs(args[1], &num_lines)) { 
     3098    recall_timestring = 1; 
     3099    recall_from = (time_t) mudtime - num_lines; 
    30953100  } else { 
    30963101    safe_str(T(e_int), buff, bp); 
     
    31373142  } 
    31383143 
     3144  if (recall_timestring) { 
     3145    num_lines = 0; 
     3146    while ((buf = 
     3147            iter_bufferq(ChanBufferQ(chan), &p, &speaker, &type, &timestamp))) { 
     3148      if (timestamp >= recall_from) 
     3149        num_lines++; 
     3150    } 
     3151    p = NULL; 
     3152  } 
    31393153  if (start < 0) 
    31403154    start = BufferQNum(ChanBufferQ(chan)) - num_lines; 
     
    33873401  CHAN *chan; 
    33883402  CHANUSER *u; 
    3389   const char *lines; 
     3403  char *lines; 
    33903404  const char *startpos; 
    3391   int num_lines = 10;           /* Default if none is given */ 
     3405  int num_lines; 
    33923406  int start = -1; 
     3407  time_t recall_from = 0; 
     3408  bool recall_timestring = false; 
    33933409  int all; 
    33943410  char *p = NULL, *buf; 
     
    34153431      if (num_lines == 0) 
    34163432        num_lines = INT_MAX; 
     3433    } else if (etime_to_secs(lines, &num_lines)) { 
     3434      recall_timestring = 1; 
     3435      recall_from = (time_t) mudtime - num_lines; 
    34173436    } else { 
    34183437      notify(player, T("How many lines did you want to recall?")); 
    34193438      return; 
    34203439    } 
    3421   } 
     3440  } else { 
     3441    num_lines = 10;             /* default value */ 
     3442  } 
     3443 
    34223444  if (num_lines < 1) { 
    34233445    notify(player, T("How many lines did you want to recall?")); 
     
    34443466    return; 
    34453467  } 
     3468  if (recall_timestring) { 
     3469    num_lines = 0; 
     3470    while ((buf = 
     3471            iter_bufferq(ChanBufferQ(chan), &p, &speaker, &type, &timestamp))) { 
     3472      if (timestamp >= recall_from) 
     3473        num_lines++; 
     3474    } 
     3475    p = NULL; 
     3476  } 
    34463477  if (start < 0) 
    34473478    start = BufferQNum(ChanBufferQ(chan)) - num_lines; 
     
    34513482    return; 
    34523483  } 
    3453  
    34543484  all = (start <= 0 && num_lines >= BufferQNum(ChanBufferQ(chan))); 
    34553485  notify_format(player, T("CHAT: Recall from channel <%s>"), ChanName(chan)); 
  • 1.8.3/branches/devel/src/lock.c

    r1007 r1008  
    300300  newlock->key = TRUE_BOOLEXP; 
    301301  newlock->next = NULL; 
    302   hashadd((char*)newlock->type, newlock, &htab_locks); 
     302  hashadd((char *) newlock->type, newlock, &htab_locks); 
    303303} 
    304304