diff utillib.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 825cac46b1cb
children 04021e2e26c3
line wrap: on
line diff
--- a/utillib.tcl	Sun Jan 08 03:57:05 2017 +0200
+++ b/utillib.tcl	Sun Jan 08 04:04:35 2017 +0200
@@ -63,6 +63,17 @@
 }
 
 
+proc utl_msg_do {upreferredmsg upublic unick uchan umsg} {
+  foreach uline [utl_str_split $umsg 450] {
+    if {$apublic == 1} {
+      putserv "$upreferredmsg $uchan :$ulineg"
+    } else {
+      putserv "$upreferredmsg $unick :$uline"
+    }
+  }
+}
+
+
 proc utl_ctime {utime} {
   if {$utime == "" || $utime == "*"} {
     set utime 0