mirror of https://github.com/fluffle/goirc
Run gofmt over everything, for great justice.
This commit is contained in:
parent
6bb5558c46
commit
c419ef1ead
|
@ -124,7 +124,7 @@ func (conn *Conn) Mode(t string, modestring ...string) {
|
||||||
func (conn *Conn) Away(message ...string) {
|
func (conn *Conn) Away(message ...string) {
|
||||||
msg := strings.Join(message, " ")
|
msg := strings.Join(message, " ")
|
||||||
if msg != "" {
|
if msg != "" {
|
||||||
msg = " :"+msg
|
msg = " :" + msg
|
||||||
}
|
}
|
||||||
conn.out <- "AWAY"+msg
|
conn.out <- "AWAY"+msg
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,8 +14,8 @@ import (
|
||||||
// encountered are piped down *Conn.Err; this channel is closed on disconnect.
|
// encountered are piped down *Conn.Err; this channel is closed on disconnect.
|
||||||
type Conn struct {
|
type Conn struct {
|
||||||
// Connection Hostname and Nickname
|
// Connection Hostname and Nickname
|
||||||
Host string
|
Host string
|
||||||
Me *Nick
|
Me *Nick
|
||||||
Network string
|
Network string
|
||||||
|
|
||||||
// I/O stuff to server
|
// I/O stuff to server
|
||||||
|
@ -26,7 +26,7 @@ type Conn struct {
|
||||||
connected bool
|
connected bool
|
||||||
|
|
||||||
// Are we connecting via SSL? Do we care about certificate validity?
|
// Are we connecting via SSL? Do we care about certificate validity?
|
||||||
SSL bool
|
SSL bool
|
||||||
SSLConfig *tls.Config
|
SSLConfig *tls.Config
|
||||||
|
|
||||||
// Error channel to transmit any fail back to the user
|
// Error channel to transmit any fail back to the user
|
||||||
|
@ -95,8 +95,8 @@ func (conn *Conn) initialise() {
|
||||||
func (conn *Conn) Connect(host string, pass ...string) os.Error {
|
func (conn *Conn) Connect(host string, pass ...string) os.Error {
|
||||||
if conn.connected {
|
if conn.connected {
|
||||||
return os.NewError(fmt.Sprintf(
|
return os.NewError(fmt.Sprintf(
|
||||||
"irc.Connect(): already connected to %s, cannot connect to %s",
|
"irc.Connect(): already connected to %s, cannot connect to %s",
|
||||||
conn.Host, host))
|
conn.Host, host))
|
||||||
}
|
}
|
||||||
|
|
||||||
if conn.SSL {
|
if conn.SSL {
|
||||||
|
@ -160,7 +160,7 @@ func hasPort(s string) bool {
|
||||||
// flood controlled using hybrid's algorithm if conn.Flood is true
|
// flood controlled using hybrid's algorithm if conn.Flood is true
|
||||||
func (conn *Conn) send() {
|
func (conn *Conn) send() {
|
||||||
lastsent := time.Nanoseconds()
|
lastsent := time.Nanoseconds()
|
||||||
var badness, linetime, second int64 = 0, 0, 1000000000;
|
var badness, linetime, second int64 = 0, 0, 1000000000
|
||||||
for line := range conn.out {
|
for line := range conn.out {
|
||||||
// Hybrid's algorithm allows for 2 seconds per line and an additional
|
// Hybrid's algorithm allows for 2 seconds per line and an additional
|
||||||
// 1/120 of a second per character on that line.
|
// 1/120 of a second per character on that line.
|
||||||
|
@ -245,7 +245,7 @@ func (conn *Conn) recv() {
|
||||||
|
|
||||||
func (conn *Conn) runLoop() {
|
func (conn *Conn) runLoop() {
|
||||||
for line := range conn.in {
|
for line := range conn.in {
|
||||||
conn.dispatchEvent(line)
|
conn.dispatchEvent(line)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -108,9 +108,9 @@ func (conn *Conn) setupEvents() {
|
||||||
// XXX: do we need 005 protocol support message parsing here?
|
// XXX: do we need 005 protocol support message parsing here?
|
||||||
// probably in the future, but I can't quite be arsed yet.
|
// probably in the future, but I can't quite be arsed yet.
|
||||||
/*
|
/*
|
||||||
:irc.pl0rt.org 005 GoTest CMDS=KNOCK,MAP,DCCALLOW,USERIP UHNAMES NAMESX SAFELIST HCN MAXCHANNELS=20 CHANLIMIT=#:20 MAXLIST=b:60,e:60,I:60 NICKLEN=30 CHANNELLEN=32 TOPICLEN=307 KICKLEN=307 AWAYLEN=307 :are supported by this server
|
:irc.pl0rt.org 005 GoTest CMDS=KNOCK,MAP,DCCALLOW,USERIP UHNAMES NAMESX SAFELIST HCN MAXCHANNELS=20 CHANLIMIT=#:20 MAXLIST=b:60,e:60,I:60 NICKLEN=30 CHANNELLEN=32 TOPICLEN=307 KICKLEN=307 AWAYLEN=307 :are supported by this server
|
||||||
:irc.pl0rt.org 005 GoTest MAXTARGETS=20 WALLCHOPS WATCH=128 WATCHOPTS=A SILENCE=15 MODES=12 CHANTYPES=# PREFIX=(qaohv)~&@%+ CHANMODES=beI,kfL,lj,psmntirRcOAQKVCuzNSMT NETWORK=bb101.net CASEMAPPING=ascii EXTBAN=~,cqnr ELIST=MNUCT :are supported by this server
|
:irc.pl0rt.org 005 GoTest MAXTARGETS=20 WALLCHOPS WATCH=128 WATCHOPTS=A SILENCE=15 MODES=12 CHANTYPES=# PREFIX=(qaohv)~&@%+ CHANMODES=beI,kfL,lj,psmntirRcOAQKVCuzNSMT NETWORK=bb101.net CASEMAPPING=ascii EXTBAN=~,cqnr ELIST=MNUCT :are supported by this server
|
||||||
:irc.pl0rt.org 005 GoTest STATUSMSG=~&@%+ EXCEPTS INVEX :are supported by this server
|
:irc.pl0rt.org 005 GoTest STATUSMSG=~&@%+ EXCEPTS INVEX :are supported by this server
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Handler to deal with "433 :Nickname already in use"
|
// Handler to deal with "433 :Nickname already in use"
|
||||||
|
|
|
@ -12,4 +12,3 @@ func TestIRC(t *testing.T) {
|
||||||
t.FailNow()
|
t.FailNow()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -203,44 +203,44 @@ func (n *Nick) Delete() {
|
||||||
|
|
||||||
// Map *irc.ChanMode fields to IRC mode characters
|
// Map *irc.ChanMode fields to IRC mode characters
|
||||||
var ChanModeToString = map[string]string{
|
var ChanModeToString = map[string]string{
|
||||||
"Private": "p",
|
"Private": "p",
|
||||||
"Secret": "s",
|
"Secret": "s",
|
||||||
"ProtectedTopic": "t",
|
"ProtectedTopic": "t",
|
||||||
"NoExternalMsg": "n",
|
"NoExternalMsg": "n",
|
||||||
"Moderated": "m",
|
"Moderated": "m",
|
||||||
"InviteOnly": "i",
|
"InviteOnly": "i",
|
||||||
"OperOnly": "O",
|
"OperOnly": "O",
|
||||||
"SSLOnly": "z",
|
"SSLOnly": "z",
|
||||||
"Key": "k",
|
"Key": "k",
|
||||||
"Limit": "l",
|
"Limit": "l",
|
||||||
}
|
}
|
||||||
|
|
||||||
// Map *irc.NickMode fields to IRC mode characters
|
// Map *irc.NickMode fields to IRC mode characters
|
||||||
var NickModeToString = map[string]string{
|
var NickModeToString = map[string]string{
|
||||||
"Invisible": "i",
|
"Invisible": "i",
|
||||||
"Oper": "o",
|
"Oper": "o",
|
||||||
"WallOps": "w",
|
"WallOps": "w",
|
||||||
"HiddenHost": "x",
|
"HiddenHost": "x",
|
||||||
"SSL": "z",
|
"SSL": "z",
|
||||||
}
|
}
|
||||||
|
|
||||||
// Map *irc.ChanPrivs fields to IRC mode characters
|
// Map *irc.ChanPrivs fields to IRC mode characters
|
||||||
var ChanPrivToString = map[string]string{
|
var ChanPrivToString = map[string]string{
|
||||||
"Owner": "q",
|
"Owner": "q",
|
||||||
"Admin": "a",
|
"Admin": "a",
|
||||||
"Op": "o",
|
"Op": "o",
|
||||||
"HalfOp": "h",
|
"HalfOp": "h",
|
||||||
"Voice": "v",
|
"Voice": "v",
|
||||||
}
|
}
|
||||||
|
|
||||||
// Map *irc.ChanPrivs fields to the symbols used to represent these modes
|
// Map *irc.ChanPrivs fields to the symbols used to represent these modes
|
||||||
// in NAMES and WHOIS responses
|
// in NAMES and WHOIS responses
|
||||||
var ChanPrivToModeChar = map[string]byte{
|
var ChanPrivToModeChar = map[string]byte{
|
||||||
"Owner": '~',
|
"Owner": '~',
|
||||||
"Admin": '&',
|
"Admin": '&',
|
||||||
"Op": '@',
|
"Op": '@',
|
||||||
"HalfOp": '%',
|
"HalfOp": '%',
|
||||||
"Voice": '+',
|
"Voice": '+',
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reverse mappings of the above datastructures
|
// Reverse mappings of the above datastructures
|
||||||
|
|
Loading…
Reference in New Issue