Mercurial > hg > egg-tcls
diff weather.tcl @ 426:84d3d7abeb8a
Add utl_msg_do() function into utillib and refactor out similar things in quotedb and weather scripts.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Sun, 08 Jan 2017 04:04:35 +0200 |
parents | 0f7524550aa2 |
children | 1ada0cb9bdd9 |
line wrap: on
line diff
--- a/weather.tcl Sun Jan 08 03:57:05 2017 +0200 +++ b/weather.tcl Sun Jan 08 04:04:35 2017 +0200 @@ -41,23 +41,14 @@ } -proc weather_msg_do {apublic anick achan amsg} { +proc weather_msg {apublic anick achan amsg {aargs {}}} { global weather_preferredmsg - if {$apublic == 1} { - putserv "$weather_preferredmsg $achan :$amsg" - } else { - putserv "$weather_preferredmsg $anick :$amsg" - } -} - - -proc weather_msg {apublic anick achan amsg {aargs {}}} { set narg 1 foreach marg $aargs { set amsg [string map [list "%$narg" $marg] $amsg] incr narg } - weather_msg_do $apublic $anick $achan $amsg + utl_msg_do $weather_preferredmsg $apublic $anick $achan $amsg }