Skip to content

Commit

Permalink
new: added session.stopped event (and fixed session.started event pro…
Browse files Browse the repository at this point in the history
…pagation)
  • Loading branch information
evilsocket committed Jun 10, 2022
1 parent fd160bf commit 22de9d3
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion modules/events_stream/events_view.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ func (mod *EventsStream) Render(output io.Writer, e session.Event) {
mod.viewUpdateEvent(output, e)
} else if e.Tag == "gateway.change" {
mod.viewGatewayEvent(output, e)
} else if e.Tag != "tick" {
} else if e.Tag != "tick" && e.Tag != "session.started" && e.Tag != "session.stopped" {
fmt.Fprintf(output, "[%s] [%s] %v\n", e.Time.Format(mod.timeFormat), tui.Green(e.Tag), e)
}
}
Expand Down
4 changes: 1 addition & 3 deletions session/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -306,9 +306,7 @@ func (s *Session) Start() error {

s.startNetMon()

if *s.Options.Debug {
s.Events.Add("session.started", nil)
}
s.Events.Add("session.started", nil)

// register js functions here to avoid cyclic dependency between
// js and session
Expand Down
3 changes: 3 additions & 0 deletions session/session_core_handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,9 @@ func (s *Session) activeHandler(args []string, sess *Session) error {
}

func (s *Session) exitHandler(args []string, sess *Session) error {
// notify any listener that the session is about to end
s.Events.Add("session.stopped", nil)

for _, mod := range s.Modules {
if mod.Running() {
mod.Stop()
Expand Down

0 comments on commit 22de9d3

Please sign in to comment.