diff options
| author | Hubert Hirtz <hubert@hirtz.pm> | 2021-05-18 21:26:03 +0200 |
|---|---|---|
| committer | Hubert Hirtz <hubert@hirtz.pm> | 2021-05-20 22:45:48 +0200 |
| commit | 7835d39dda5f7a1dde3056de3dd8a84913b94c14 (patch) | |
| tree | cb989997170121baee7d227b7e909a624c2bdbf2 /irc/events.go | |
| parent | Add /mode command (diff) | |
Fix races conditions
Refactor:
- Split out reads/writes from irc.Session to irc.ChanInOut,
- Message handling is now manual, messages must be passed to
irc.Session.HandleMessage for its state to change,
- Remove data-race-prone App.addLineNow (called from both the main
eventLoop and irc loops) and add App.addStatusLine (to be called from
the main event loop) and App.queueStatusLine (to be called from other
goroutines). These two functions now write to both the current buffer
and the home buffer,
- add a irc.Typings.List function that locks the list of typings before
accessing it.
Changes as I went through the whole code...
- CAP handling is fixed (especially CAP DEL and CAP ACK),
- irc.Session now handles PREFIX,
- unhandled messages are now shown, except for some rare cases where
it's completely useless to show them.
Diffstat (limited to '')
| -rw-r--r-- | irc/events.go | 35 |
1 files changed, 6 insertions, 29 deletions
diff --git a/irc/events.go b/irc/events.go index a241232..bdd6914 100644 --- a/irc/events.go +++ b/irc/events.go @@ -1,17 +1,9 @@ package irc -import ( - "time" -) +import "time" type Event interface{} -type RawMessageEvent struct { - Message string - Outgoing bool - IsValid bool -} - type ErrorEvent struct { Severity Severity Code string @@ -22,13 +14,11 @@ type RegisteredEvent struct{} type SelfNickEvent struct { FormerNick string - Time time.Time } type UserNickEvent struct { - User *Prefix + User string FormerNick string - Time time.Time } type SelfJoinEvent struct { @@ -36,9 +26,8 @@ type SelfJoinEvent struct { } type UserJoinEvent struct { - User *Prefix + User string Channel string - Time time.Time } type SelfPartEvent struct { @@ -46,26 +35,22 @@ type SelfPartEvent struct { } type UserPartEvent struct { - User *Prefix + User string Channel string - Time time.Time } type UserQuitEvent struct { - User *Prefix + User string Channels []string - Time time.Time } type TopicChangeEvent struct { - User *Prefix Channel string Topic string - Time time.Time } type MessageEvent struct { - User *Prefix + User string Target string TargetIsChannel bool Command string @@ -73,14 +58,6 @@ type MessageEvent struct { Time time.Time } -type TagEvent struct { - User *Prefix - Target string - TargetIsChannel bool - Typing int - Time time.Time -} - type HistoryEvent struct { Target string Messages []Event |
