Add AWAY support and update README, fixes #22

This commit is contained in:
Trevor Slocum 2017-06-07 18:53:08 -07:00
parent d1d1d43e2b
commit bba2aff2cd
4 changed files with 17 additions and 9 deletions

2
Godeps/Godeps.json generated
View File

@ -1,6 +1,6 @@
{
"ImportPath": "github.com/tslocum/AnonIRCd",
"GoVersion": "go1.7",
"GoVersion": "go1.8",
"GodepVersion": "v79",
"Deps": [
{

View File

@ -1,7 +1,8 @@
AnonIRCd
--------
# AnonIRCd
#### Try it out!
AnonIRCd is an anonymous IRC daemon. All messages appear to be written by **Anonymous**.
#### Try AnonIRCd by joining AnonIRC
Connect to [**z.1chan.us:6667**](irc://z.1chan.us:6667) or [**:6697 (SSL)**](ircs://z.1chan.us:6697).

View File

@ -1,5 +1,5 @@
// AnonIRCd
// https://github.com/tslocum/anonircd
// AnonIRCd - Anonymous IRC daemon
// https://github.com/tslocum/AnonIRCd
// Written by Trevor 'tee' Slocum <tslocum@gmail.com>
//
// This program is free software: you can redistribute it and/or modify

View File

@ -10,13 +10,14 @@ import (
"time"
"crypto/tls"
"github.com/BurntSushi/toml"
cmap "github.com/orcaman/concurrent-map"
irc "gopkg.in/sorcix/irc.v2"
"math/rand"
"net/http"
"os"
"reflect"
"github.com/BurntSushi/toml"
cmap "github.com/orcaman/concurrent-map"
irc "gopkg.in/sorcix/irc.v2"
)
type Config struct {
@ -474,6 +475,12 @@ func (s *Server) handleRead(c *Client) {
}
s.joinChannel("#", c.identifier)
} else if msg.Command == irc.AWAY {
if len(msg.Params) > 0 {
c.write(&irc.Message{&anonirc, irc.RPL_NOWAWAY, []string{"You have been marked as being away"}})
} else {
c.write(&irc.Message{&anonirc, irc.RPL_UNAWAY, []string{"You are no longer marked as being away"}})
}
} else if msg.Command == irc.LIST {
chans := make(map[string]int)
for chs := range s.channels.IterBuffered() {