omit prefix for non-numeric replies from the server

This commit is contained in:
Jeremy Latt 2014-02-20 19:55:17 -08:00
parent 23f01ff9ee
commit 0ad05abf5f
1 changed files with 8 additions and 1 deletions

View File

@ -8,7 +8,14 @@ import (
func NewStringReply(source Identifier, code StringCode, func NewStringReply(source Identifier, code StringCode,
format string, args ...interface{}) string { format string, args ...interface{}) string {
header := fmt.Sprintf(":%s %s ", source, code) var header string
switch source.(type) {
case *Server:
// TODO only omit prefix for local server
header = fmt.Sprintf("%s ", code)
default:
header = fmt.Sprintf(":%s %s ", source, code)
}
message := fmt.Sprintf(format, args...) message := fmt.Sprintf(format, args...)
return header + message return header + message
} }