Changeset 563 in code
- Timestamp:
- Jun 23, 2021, 5:23:09 PM (4 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/downstream.go
r562 r563 1914 1914 1915 1915 for _, name := range strings.Split(targetsStr, ",") { 1916 if name == "$"+dc.srv.Hostname || (name == "$*" && dc.network == nil) { 1917 // "$" means a server mask follows. If it's the bouncer's 1918 // hostname, broadcast the message to all bouncer users. 1919 if !dc.user.Admin { 1920 return ircError{&irc.Message{ 1921 Prefix: dc.srv.prefix(), 1922 Command: irc.ERR_BADMASK, 1923 Params: []string{dc.nick, name, "Permission denied to broadcast message to all bouncer users"}, 1924 }} 1925 } 1926 1927 dc.logger.Printf("broadcasting bouncer-wide %v: %v", msg.Command, text) 1928 1929 broadcastTags := tags.Copy() 1930 broadcastTags["time"] = irc.TagValue(time.Now().UTC().Format(serverTimeLayout)) 1931 broadcastMsg := &irc.Message{ 1932 Tags: broadcastTags, 1933 Prefix: servicePrefix, 1934 Command: msg.Command, 1935 Params: []string{name, text}, 1936 } 1937 dc.srv.forEachUser(func(u *user) { 1938 u.events <- eventBroadcast{broadcastMsg} 1939 }) 1940 continue 1941 } 1942 1916 1943 if dc.network == nil && casemapASCII(name) == dc.nickCM { 1917 1944 dc.SendMessage(msg) -
trunk/server.go
r531 r563 125 125 } 126 126 127 func (s *Server) forEachUser(f func(*user)) { 128 s.lock.Lock() 129 for _, u := range s.users { 130 f(u) 131 } 132 s.lock.Unlock() 133 } 134 127 135 func (s *Server) getUser(name string) *user { 128 136 s.lock.Lock() -
trunk/upstream.go
r561 r563 1769 1769 } 1770 1770 1771 // Don't store messages with a server mask target 1772 if strings.HasPrefix(entity, "$") { 1773 return "" 1774 } 1775 1771 1776 entityCM := uc.network.casemap(entity) 1772 1777 if entityCM == "nickserv" { -
trunk/user.go
r544 r563 52 52 uc *upstreamConn 53 53 name string 54 } 55 56 type eventBroadcast struct { 57 msg *irc.Message 54 58 } 55 59 … … 634 638 dc.Close() 635 639 } 640 case eventBroadcast: 641 msg := e.msg 642 u.forEachDownstream(func(dc *downstreamConn) { 643 dc.SendMessage(msg) 644 }) 636 645 case eventStop: 637 646 u.forEachDownstream(func(dc *downstreamConn) {
Note:
See TracChangeset
for help on using the changeset viewer.