// ExportActions exports the Action channel from the IRC robot so as to enable modules to send new actions through it func ExportActions(exp *netchan.Exporter) chan Action { chac := make(chan Action) err := exp.Export("actions", chac, netchan.Recv) if err != nil { log.Fatalf("Can't export Actions channel: %v", err) } return chac }
func handleSession(exporter *netchan.Exporter, sCount string, lock chan string) { echoIn := make(chan string) exporter.Export("echoIn"+sCount, echoIn, netchan.Send) echoOut := make(chan string) exporter.Export("echoOut"+sCount, echoOut, netchan.Recv) fmt.Println("made " + "echoOut" + sCount) lock <- "done" for { s := <-echoOut echoIn <- s } // should unexport net channels }
// ExportActions exports the Event channel from the IRC robot so as to enable modules to read events through it func ExportEvents(exp *netchan.Exporter, moduleUUID string) chan Event { chev := make(chan Event) err := exp.Export("events-"+moduleUUID, chev, netchan.Send) if err != nil { exp.Hangup("events-" + moduleUUID) err := exp.Export("events-"+moduleUUID, chev, netchan.Send) if err != nil { log.Fatalf("Can't export Events channel for %s: %v", moduleUUID, err) } } return chev }