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
Line 
1package soju
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
12 downstreamName := dc.marshalChannel(ch.conn, ch.Name)
13
14 if ch.Topic != "" {
15 dc.SendMessage(&irc.Message{
16 Prefix: dc.srv.prefix(),
17 Command: irc.RPL_TOPIC,
18 Params: []string{dc.nick, downstreamName, ch.Topic},
19 })
20 } else {
21 dc.SendMessage(&irc.Message{
22 Prefix: dc.srv.prefix(),
23 Command: irc.RPL_NOTOPIC,
24 Params: []string{dc.nick, downstreamName, "No topic is set"},
25 })
26 }
27
28 // TODO: rpl_topicwhotime
29
30 // TODO: send multiple members in each message
31 for nick, membership := range ch.Members {
32 s := membership.String() + dc.marshalNick(ch.conn, nick)
33
34 dc.SendMessage(&irc.Message{
35 Prefix: dc.srv.prefix(),
36 Command: irc.RPL_NAMREPLY,
37 Params: []string{dc.nick, string(ch.Status), downstreamName, s},
38 })
39 }
40
41 dc.SendMessage(&irc.Message{
42 Prefix: dc.srv.prefix(),
43 Command: irc.RPL_ENDOFNAMES,
44 Params: []string{dc.nick, downstreamName, "End of /NAMES list"},
45 })
46}
Note: See TracBrowser for help on using the repository browser.