Changeset 4197

Show
Ignore:
Timestamp:
06/03/06 19:56:51 (2 years ago)
Author:
morris
Message:

Add new /timestamp command from christ25

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • wire/trunk/NEWS

    r4140 r4197  
    441.1.1 
    55- Add new /icon command, takes a path to an image file to use as icon 
     6- Add new /timestamp command, disables or changes format of timestamps 
    67- Fix a crash with parsing dates on some platforms 
    78- Fix a crash in /cd 
  • wire/trunk/README

    r3250 r4197  
    1414============ 
    1515 
    16 - Erik Tengblad, erik@tengblad.net 
     16- Erik Tengblad 
     17- christ25 
  • wire/trunk/man/wire.1

    r4107 r4197  
    263263.Pp 
    264264Example: /stop 1 
     265.It Nm timestamp Op Ar format 
     266Without arguments, disables the timestamps. With an argument, sets the timestamp format, a la 
     267.Xr strftime 3 . 
     268Default is  
     269.Sq %H:%M . 
     270.Pp 
     271Example: /timestamp %H:%M:%S 
    265272.It Nm topic Op Ar message 
    266273Without arguments, prints the current chat topic. With an argument, sets a new topic. 
  • wire/trunk/wire/client.c

    r4134 r4197  
    8888wi_string_t                                                     *wr_login; 
    8989wi_string_t                                                     *wr_password; 
     90 
     91wi_string_t                                                     *wr_timestamp_format; 
    9092 
    9193static const char                                       wr_default_icon[] = 
  • wire/trunk/wire/client.h

    r4107 r4197  
    7272extern wi_string_t                                              *wr_login; 
    7373extern wi_string_t                                              *wr_password; 
     74extern wi_string_t                                              *wr_timestamp_format; 
    7475 
    7576extern uint64_t                                                 wr_received_bytes; 
  • wire/trunk/wire/commands.c

    r4154 r4197  
    9090static void                                             wr_cmd_status(wi_array_t *); 
    9191static void                                             wr_cmd_stop(wi_array_t *); 
     92static void                                             wr_cmd_timestamp(wi_array_t *); 
    9293static void                                             wr_cmd_topic(wi_array_t *); 
    9394static void                                             wr_cmd_type(wi_array_t *); 
     
    295296          true, 1, -1, WR_COMPLETER_NONE, 
    296297          wr_cmd_stop }, 
     298        { "timestamp", 
     299          true, "[<format>]", 
     300          false, 0, 0, WR_COMPLETER_NONE, 
     301          wr_cmd_timestamp }, 
    297302        { "topic", 
    298303          true, "[<topic>]", 
     
    14121417 
    14131418/* 
     1419        /timestamp <format> 
     1420*/ 
     1421 
     1422static void wr_cmd_timestamp(wi_array_t *arguments) { 
     1423        if(wi_array_count(arguments) == 0) { 
     1424                wi_release(wr_timestamp_format); 
     1425                wr_timestamp_format = wi_retain(WI_STR("")); 
     1426        } else { 
     1427                wi_release(wr_timestamp_format); 
     1428                wr_timestamp_format = wi_retain(WI_ARRAY(arguments, 0)); 
     1429        } 
     1430} 
     1431 
     1432 
     1433 
     1434/* 
    14141435        /topic <topic> 
    14151436*/ 
  • wire/trunk/wire/main.c

    r4021 r4197  
    8080        wi_load(argc, argv); 
    8181         
    82         pool                    = wi_pool_init(wi_pool_alloc()); 
    83         wi_log_callback = wr_wi_log_callback; 
     82        pool                           = wi_pool_init(wi_pool_alloc()); 
     83        wi_log_callback        = wr_wi_log_callback; 
    8484         
    8585        /* init core systems */ 
    8686        wr_init_version(); 
    87         wr_start_date   = wi_date_init(wi_date_alloc()); 
     87        wr_start_date          = wi_date_init(wi_date_alloc()); 
    8888         
    8989        /* set defaults */ 
    90         wr_nick                 = wi_retain(wi_user_name()); 
    91         homepath                = wi_user_home(); 
     90        wr_nick                         = wi_retain(wi_user_name()); 
     91        homepath                        = wi_user_home(); 
     92        wr_timestamp_format     = wi_retain(WI_STR("%H:%M")); 
    9293 
    9394        /* parse command line switches */ 
  • wire/trunk/wire/windows.c

    r4028 r4197  
    383383        wi_string_t             *timestamp; 
    384384 
    385         timestamp = wi_date_string_with_format(wi_date(), WI_STR("%H:%M")); 
     385        timestamp = wi_date_string_with_format(wi_date(), wr_timestamp_format); 
    386386 
    387387        if(wi_terminal_buffer_printf(window->buffer, WI_STR("%@ %@"), timestamp, string)) {