Added Whois, Who and Mode (also go fmt)
This commit is contained in:
parent
95288a16c5
commit
9100ba0734
19
irc.go
19
irc.go
@ -7,13 +7,13 @@ package irc
|
|||||||
import (
|
import (
|
||||||
"bufio"
|
"bufio"
|
||||||
"crypto/tls"
|
"crypto/tls"
|
||||||
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
"net"
|
"net"
|
||||||
"os"
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
"errors"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@ -215,6 +215,23 @@ func (irc *Connection) GetNick() string {
|
|||||||
return irc.nickcurrent
|
return irc.nickcurrent
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (irc *Connection) Whois(nick string) {
|
||||||
|
irc.SendRawf("WHOIS %s", nick)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (irc *Connection) Who(nick string) {
|
||||||
|
irc.SendRawf("WHO %s", nick)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (irc *Connection) Mode(target string, modestring ...string) {
|
||||||
|
if len(modestring) > 0 {
|
||||||
|
mode := strings.Join(modestring, " ")
|
||||||
|
irc.SendRawf("MODE %s %s", target, mode)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
irc.SendRawf("MODE %s", target)
|
||||||
|
}
|
||||||
|
|
||||||
// Sends all buffered messages (if possible),
|
// Sends all buffered messages (if possible),
|
||||||
// stops all goroutines and then closes the socket.
|
// stops all goroutines and then closes the socket.
|
||||||
func (irc *Connection) Disconnect() {
|
func (irc *Connection) Disconnect() {
|
||||||
|
Loading…
Reference in New Issue
Block a user