Mercurial > hg > egg-tcls
changeset 432:124b97f5a19d
utillib: Add some comments, bump copyright.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Mon, 09 Jan 2017 03:55:53 +0200 |
parents | 5763716060a0 |
children | 2484f438b7d3 |
files | utillib.tcl |
diffstat | 1 files changed, 8 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/utillib.tcl Sun Jan 08 05:09:50 2017 +0200 +++ b/utillib.tcl Mon Jan 09 03:55:53 2017 +0200 @@ -1,7 +1,7 @@ ########################################################################## # # TCL functions library by Matti 'ccr' Hamalainen <ccr@tnsp.org> -# (C) Copyright 2015 Tecnic Software productions (TNSP) +# (C) Copyright 2015-2017 Tecnic Software productions (TNSP) # # This script is freely distributable under GNU GPL (version 2) license. # @@ -20,12 +20,16 @@ set utl_html_ent_list [split [encoding convertfrom "utf-8" $utl_html_ent_str] "|"] +# Convert given string, containing HTML/XML style entities into a normal +# UTF-8 Unicode string, using the above entity->character mapping proc utl_convert_html_ent {udata} { global utl_html_ent_list return [string map -nocase $utl_html_ent_list [string map $utl_html_ent_list $udata]] } +# Split given string "str" into a list of sub-strings of maximum length +# "maxlen", by attempting to split at "words", if possible. proc utl_str_split {str maxlen} { set pos 0 set len [string length $str] @@ -63,6 +67,8 @@ } +# Send IRC message with given message type, splitting the +# string to fit to IRCNet (etc.) max message length. proc utl_msg_do {upreferredmsg upublic unick uchan umsg} { foreach uline [utl_str_split $umsg 450] { if {$upublic == 1} { @@ -74,6 +80,7 @@ } +# Return formatted time for given UNIX timestamp proc utl_ctime {utime} { if {$utime == "" || $utime == "*"} { set utime 0