Legend:
- Unmodified
- Added
- Removed
-
trunk/bridge.go
r292 r346 3 3 import ( 4 4 "gopkg.in/irc.v3" 5 "strings" 5 6 ) 6 7 … … 35 36 36 37 func sendNames(dc *downstreamConn, ch *upstreamChannel) { 37 // TODO: send multiple members in each message38 39 38 downstreamName := dc.marshalEntity(ch.conn.network, ch.Name) 40 39 40 emptyNameReply := &irc.Message{ 41 Prefix: dc.srv.prefix(), 42 Command: irc.RPL_NAMREPLY, 43 Params: []string{dc.nick, string(ch.Status), downstreamName, ""}, 44 } 45 maxLength := maxMessageLength - len(emptyNameReply.String()) 46 47 var buf strings.Builder 41 48 for nick, memberships := range ch.Members { 42 49 s := memberships.Format(dc) + dc.marshalEntity(ch.conn.network, nick) 43 50 51 if buf.Len() != 0 && maxLength < buf.Len()+1+len(s) { 52 // There's not enough space for the next space + nick. 53 dc.SendMessage(&irc.Message{ 54 Prefix: dc.srv.prefix(), 55 Command: irc.RPL_NAMREPLY, 56 Params: []string{dc.nick, string(ch.Status), downstreamName, buf.String()}, 57 }) 58 buf.Reset() 59 } 60 61 if buf.Len() != 0 { 62 buf.WriteByte(' ') 63 } 64 buf.WriteString(s) 65 } 66 67 if buf.Len() != 0 { 44 68 dc.SendMessage(&irc.Message{ 45 69 Prefix: dc.srv.prefix(), 46 70 Command: irc.RPL_NAMREPLY, 47 Params: []string{dc.nick, string(ch.Status), downstreamName, s},71 Params: []string{dc.nick, string(ch.Status), downstreamName, buf.String()}, 48 72 }) 49 73 } -
trunk/irc.go
r303 r346 16 16 err_invalidcapcmd = "410" 17 17 ) 18 19 const maxMessageLength = 512 18 20 19 21 type userModes string
Note:
See TracChangeset
for help on using the changeset viewer.