source: code/trunk/bridge.go@ 139

Last change on this file since 139 was 139, checked in by delthas, 5 years ago

Add MODE arguments support

  • Add RPL_ISUPPORT support with CHANMODES, CHANTYPES, PREFIX parsing
  • Add support for channel mode state with mode arguments
  • Add upstream support for RPL_UMODEIS, RPL_CHANNELMODEIS
  • Request channel MODE on upstream channel JOIN
  • Use sane default channel mode and channel mode types
File size: 1.1 KB
RevLine 
[98]1package soju
[32]2
3import (
4 "gopkg.in/irc.v3"
5)
6
7func forwardChannel(dc *downstreamConn, ch *upstreamChannel) {
8 if !ch.complete {
9 panic("Tried to forward a partial channel")
10 }
11
[69]12 downstreamName := dc.marshalChannel(ch.conn, ch.Name)
13
[32]14 if ch.Topic != "" {
[54]15 dc.SendMessage(&irc.Message{
[32]16 Prefix: dc.srv.prefix(),
17 Command: irc.RPL_TOPIC,
[69]18 Params: []string{dc.nick, downstreamName, ch.Topic},
[54]19 })
[32]20 } else {
[54]21 dc.SendMessage(&irc.Message{
[32]22 Prefix: dc.srv.prefix(),
23 Command: irc.RPL_NOTOPIC,
[69]24 Params: []string{dc.nick, downstreamName, "No topic is set"},
[54]25 })
[32]26 }
27
28 // TODO: rpl_topicwhotime
29
30 // TODO: send multiple members in each message
31 for nick, membership := range ch.Members {
[139]32 s := membership.String() + dc.marshalNick(ch.conn, nick)
[32]33
[54]34 dc.SendMessage(&irc.Message{
[32]35 Prefix: dc.srv.prefix(),
36 Command: irc.RPL_NAMREPLY,
[69]37 Params: []string{dc.nick, string(ch.Status), downstreamName, s},
[54]38 })
[32]39 }
40
[54]41 dc.SendMessage(&irc.Message{
[32]42 Prefix: dc.srv.prefix(),
43 Command: irc.RPL_ENDOFNAMES,
[69]44 Params: []string{dc.nick, downstreamName, "End of /NAMES list"},
[54]45 })
[32]46}
Note: See TracBrowser for help on using the repository browser.