瀏覽代碼

upgrade irc-go to latest master

tags/v2.1.0-rc1
Shivaram Lingamneni 4 年之前
父節點
當前提交
3d13c1bc5f
共有 4 個檔案被更改,包括 23 行新增6 行删除
  1. 1
    1
      go.mod
  2. 3
    0
      go.sum
  3. 18
    4
      vendor/github.com/goshuirc/irc-go/ircmsg/message.go
  4. 1
    1
      vendor/modules.txt

+ 1
- 1
go.mod 查看文件

@@ -8,7 +8,7 @@ require (
8 8
 	github.com/go-ldap/ldap/v3 v3.1.7
9 9
 	github.com/go-sql-driver/mysql v1.5.0
10 10
 	github.com/goshuirc/e-nfa v0.0.0-20160917075329-7071788e3940 // indirect
11
-	github.com/goshuirc/irc-go v0.0.0-20190713001546-05ecc95249a0
11
+	github.com/goshuirc/irc-go v0.0.0-20200311142257-57fd157327ac
12 12
 	github.com/mattn/go-colorable v0.1.4
13 13
 	github.com/mattn/go-isatty v0.0.10 // indirect
14 14
 	github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b

+ 3
- 0
go.sum 查看文件

@@ -2,6 +2,7 @@ code.cloudfoundry.org/bytefmt v0.0.0-20190819182555-854d396b647c h1:2RuXx1+tSNWR
2 2
 code.cloudfoundry.org/bytefmt v0.0.0-20190819182555-854d396b647c/go.mod h1:wN/zk7mhREp/oviagqUXY3EwuHhWyOvAdsn5Y4CzOrc=
3 3
 code.cloudfoundry.org/bytefmt v0.0.0-20200131002437-cf55d5288a48 h1:/EMHruHCFXR9xClkGV/t0rmHrdhX4+trQUcBqjwc9xE=
4 4
 code.cloudfoundry.org/bytefmt v0.0.0-20200131002437-cf55d5288a48/go.mod h1:wN/zk7mhREp/oviagqUXY3EwuHhWyOvAdsn5Y4CzOrc=
5
+github.com/DanielOaks/go-idn v0.0.0-20160120021903-76db0e10dc65/go.mod h1:GYIaL2hleNQvfMUBTes1Zd/lDTyI/p2hv3kYB4jssyU=
5 6
 github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
6 7
 github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
7 8
 github.com/docopt/docopt-go v0.0.0-20180111231733-ee0de3bc6815 h1:bWDMxwH3px2JBh6AyO7hdCn/PkvCZXii8TGj7sbtEbQ=
@@ -22,6 +23,8 @@ github.com/goshuirc/e-nfa v0.0.0-20160917075329-7071788e3940 h1:KmRLPRstEJiE/9Oj
22 23
 github.com/goshuirc/e-nfa v0.0.0-20160917075329-7071788e3940/go.mod h1:VOmrX6cmj7zwUeexC9HzznUdTIObHqIXUrWNYS+Ik7w=
23 24
 github.com/goshuirc/irc-go v0.0.0-20190713001546-05ecc95249a0 h1:unxsR0de0MIS708eZI7lKa6HiP8FS0PhGCWwwEt9+vQ=
24 25
 github.com/goshuirc/irc-go v0.0.0-20190713001546-05ecc95249a0/go.mod h1:rhIkxdehxNqK9iwJXWzQnxlGuuUR4cHu7PN64VryKXk=
26
+github.com/goshuirc/irc-go v0.0.0-20200311142257-57fd157327ac h1:0JSojWrghcpK9/wx1RpV9Bv2d+3TbBWtHWubKjU2tao=
27
+github.com/goshuirc/irc-go v0.0.0-20200311142257-57fd157327ac/go.mod h1:BRnLblzpqH2T5ANCODHBZLytz0NZN2KaMJ+di8oh3EM=
25 28
 github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI=
26 29
 github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
27 30
 github.com/mattn/go-colorable v0.1.4 h1:snbPLB8fVfU9iwbbo30TPtbLRzwWu6aJS6Xh4eaaviA=

+ 18
- 4
vendor/github.com/goshuirc/irc-go/ircmsg/message.go 查看文件

@@ -52,10 +52,19 @@ type IrcMessage struct {
52 52
 	Prefix         string
53 53
 	Command        string
54 54
 	Params         []string
55
+	forceTrailing  bool
55 56
 	tags           map[string]string
56 57
 	clientOnlyTags map[string]string
57 58
 }
58 59
 
60
+// ForceTrailing ensures that when the message is serialized, the final parameter
61
+// will be encoded as a "trailing parameter" (preceded by a colon). This is
62
+// almost never necessary and should not be used except when having to interact
63
+// with broken implementations that don't correctly interpret IRC messages.
64
+func (msg *IrcMessage) ForceTrailing() {
65
+	msg.forceTrailing = true
66
+}
67
+
59 68
 // GetTag returns whether a tag is present, and if so, what its value is.
60 69
 func (msg *IrcMessage) GetTag(tagName string) (present bool, value string) {
61 70
 	if len(tagName) == 0 {
@@ -321,6 +330,10 @@ func (ircmsg *IrcMessage) LineBytesStrict(fromClient bool, truncateLen int) ([]b
321 330
 	return ircmsg.line(tagLimit, clientOnlyTagDataLimit, serverAddedTagDataLimit, truncateLen)
322 331
 }
323 332
 
333
+func paramRequiresTrailing(param string) bool {
334
+	return len(param) == 0 || strings.IndexByte(param, ' ') != -1 || param[0] == ':'
335
+}
336
+
324 337
 // line returns a sendable line created from an IrcMessage.
325 338
 func (ircmsg *IrcMessage) line(tagLimit, clientOnlyTagDataLimit, serverAddedTagDataLimit, truncateLen int) ([]byte, error) {
326 339
 	if len(ircmsg.Command) < 1 {
@@ -376,11 +389,12 @@ func (ircmsg *IrcMessage) line(tagLimit, clientOnlyTagDataLimit, serverAddedTagD
376 389
 
377 390
 	for i, param := range ircmsg.Params {
378 391
 		buf.WriteByte(' ')
379
-		if len(param) < 1 || strings.IndexByte(param, ' ') != -1 || param[0] == ':' {
380
-			if i != len(ircmsg.Params)-1 {
381
-				return nil, ErrorBadParam
382
-			}
392
+		requiresTrailing := paramRequiresTrailing(param)
393
+		lastParam := i == len(ircmsg.Params)-1
394
+		if (requiresTrailing || ircmsg.forceTrailing) && lastParam {
383 395
 			buf.WriteByte(':')
396
+		} else if requiresTrailing && !lastParam {
397
+			return nil, ErrorBadParam
384 398
 		}
385 399
 		buf.WriteString(param)
386 400
 	}

+ 1
- 1
vendor/modules.txt 查看文件

@@ -15,7 +15,7 @@ github.com/go-sql-driver/mysql
15 15
 # github.com/goshuirc/e-nfa v0.0.0-20160917075329-7071788e3940
16 16
 ## explicit
17 17
 github.com/goshuirc/e-nfa
18
-# github.com/goshuirc/irc-go v0.0.0-20190713001546-05ecc95249a0
18
+# github.com/goshuirc/irc-go v0.0.0-20200311142257-57fd157327ac
19 19
 ## explicit
20 20
 github.com/goshuirc/irc-go/ircfmt
21 21
 github.com/goshuirc/irc-go/ircmatch

Loading…
取消
儲存