summaryrefslogtreecommitdiff
path: root/irc
diff options
context:
space:
mode:
Diffstat (limited to 'irc')
-rw-r--r--irc/states.go14
1 files changed, 14 insertions, 0 deletions
diff --git a/irc/states.go b/irc/states.go
index 87c2a06..9737565 100644
--- a/irc/states.go
+++ b/irc/states.go
@@ -96,6 +96,9 @@ type (
Channel string
Topic string
}
+ actionQuit struct {
+ Reason string
+ }
actionPrivMsg struct {
Target string
@@ -390,6 +393,15 @@ func (s *Session) setTopic(act actionSetTopic) (err error) {
return
}
+func (s *Session) Quit(reason string) {
+ s.acts <- actionQuit{reason}
+}
+
+func (s *Session) quit(act actionQuit) (err error) {
+ err = s.send("QUIT :%s\r\n", act.Reason)
+ return
+}
+
func (s *Session) PrivMsg(target, content string) {
s.acts <- actionPrivMsg{target, content}
}
@@ -469,6 +481,8 @@ func (s *Session) run() {
err = s.part(act)
case actionSetTopic:
err = s.setTopic(act)
+ case actionQuit:
+ err = s.quit(act)
case actionPrivMsg:
err = s.privMsg(act)
case actionTyping: