aboutsummaryrefslogtreecommitdiff
path: root/wsm.go
diff options
context:
space:
mode:
Diffstat (limited to 'wsm.go')
-rw-r--r--wsm.go30
1 files changed, 30 insertions, 0 deletions
diff --git a/wsm.go b/wsm.go
index 4a63c9a..01cf36a 100644
--- a/wsm.go
+++ b/wsm.go
@@ -67,6 +67,12 @@ func messageHello(
return reportError("error collecting choices")
}
+ if atomic.LoadUint32(&state) == 2 {
+ err = writeText(ctx, c, "START")
+ if err != nil {
+ return fmt.Errorf("%w: %w", errCannotSend, err)
+ }
+ }
err = writeText(ctx, c, "HI :"+strings.Join(courseIDs, ","))
if err != nil {
return fmt.Errorf("%w: %w", errCannotSend, err)
@@ -86,6 +92,18 @@ func messageChooseCourse(
) error {
_ = session
+ if atomic.LoadUint32(&state) != 2 {
+ err := writeText(ctx, c, "E :Course selections are not open")
+ if err != nil {
+ return fmt.Errorf(
+ "%w: %w",
+ errCannotSend,
+ err,
+ )
+ }
+ return nil
+ }
+
select {
case <-ctx.Done():
return fmt.Errorf(
@@ -263,6 +281,18 @@ func messageUnchooseCourse(
) error {
_ = session
+ if atomic.LoadUint32(&state) != 2 {
+ err := writeText(ctx, c, "E :Course selections are not open")
+ if err != nil {
+ return fmt.Errorf(
+ "%w: %w",
+ errCannotSend,
+ err,
+ )
+ }
+ return nil
+ }
+
select {
case <-ctx.Done():
return fmt.Errorf(