]> Cypherpunks.ru repositories - nncp.git/blobdiff - src/cypherpunks.ru/nncp/humanizer.go
Bundles feature
[nncp.git] / src / cypherpunks.ru / nncp / humanizer.go
index 06b33bd278783573e0db04579c46d0a21d062179..7830a31e764cccda52eab660aa38d958a81a9bf2 100644 (file)
@@ -150,6 +150,25 @@ func (ctx *Ctx) Humanize(s string) string {
                if err, exists := sds["err"]; exists {
                        msg += ": " + err
                }
+       case "nncp-bundle":
+               switch sds["xx"] {
+               case "rx":
+                       msg = "Bundle transfer, received from"
+               case "tx":
+                       msg = "Bundle transfer, sent to"
+               default:
+                       return s
+               }
+               if nodeS != "" {
+                       msg += " node " + nodeS
+               }
+               msg += " " + sds["pkt"]
+               if size != "" {
+                       msg += fmt.Sprintf(" (%s)", size)
+               }
+               if err, exists := sds["err"]; exists {
+                       msg += ": " + err
+               }
        case "call-start":
                msg = fmt.Sprintf("Connected to %s", nodeS)
        case "call-finish":
@@ -218,6 +237,27 @@ func (ctx *Ctx) Humanize(s string) string {
                default:
                        return s
                }
+       case "nncp-reass":
+               chunkNum, exists := sds["chunk"]
+               if exists {
+                       msg = fmt.Sprintf(
+                               "Reassembling chunked file \"%s\" (chunk %s): %s",
+                               sds["path"],
+                               chunkNum,
+                               rem,
+                       )
+               } else {
+                       msg = fmt.Sprintf(
+                               "Reassembling chunked file \"%s\": %s",
+                               sds["path"],
+                               rem,
+                       )
+               }
+               if err, exists := sds["err"]; exists {
+                       msg += ": " + err
+               }
+       case "lockdir":
+               msg = fmt.Sprintf("Acquire lock for %s: %s", sds["path"], sds["err"])
        default:
                return s
        }