summaryrefslogtreecommitdiff
path: root/irc
diff options
context:
space:
mode:
authorHubert Hirtz <hubert@hirtz.pm>2020-11-20 19:27:59 +0100
committerHubert Hirtz <hubert@hirtz.pm>2020-11-20 19:27:59 +0100
commit8828195c86f54adc03791c13233bf8e19354b31e (patch)
tree3586f879e897c1044cc5043b9b568d5fb18ffa10 /irc
parentConsider the CASEMAPPING isupport token (diff)
Only send the SelfJoinEvent when channel info is complete
Diffstat (limited to 'irc')
-rw-r--r--irc/states.go10
1 files changed, 9 insertions, 1 deletions
diff --git a/irc/states.go b/irc/states.go
index da5d582..626f3b7 100644
--- a/irc/states.go
+++ b/irc/states.go
@@ -117,6 +117,8 @@ type Channel struct {
TopicWho *Prefix
TopicTime time.Time
Secret bool
+
+ complete bool
}
type SessionParams struct {
@@ -701,7 +703,6 @@ func (s *Session) handle(msg Message) (err error) {
Name: msg.Params[0],
Members: map[*User]string{},
}
- s.evts <- SelfJoinEvent{Channel: msg.Params[0]}
} else if c, ok := s.channels[channelCf]; ok {
if _, ok := s.users[nickCf]; !ok {
s.users[nickCf] = &User{Name: msg.Prefix.Copy()}
@@ -803,6 +804,13 @@ func (s *Session) handle(msg Message) (err error) {
s.channels[channelCf] = c
}
+ case rplEndofnames:
+ channelCf := s.Casemap(msg.Params[1])
+ if c, ok := s.channels[channelCf]; ok && !c.complete {
+ c.complete = true
+ s.channels[channelCf] = c
+ s.evts <- SelfJoinEvent{Channel: c.Name}
+ }
case rplTopic:
channelCf := s.Casemap(msg.Params[1])
if c, ok := s.channels[channelCf]; ok {