Merge pull request #15 from iownall555/master
Update the Example IRC-Go Client to Function with the New Tag Handling System
This commit is contained in:
commit
0f771dff99
@ -5,11 +5,10 @@ package gircclient
|
||||
|
||||
import (
|
||||
"github.com/goshuirc/irc-go/ircfmt"
|
||||
"github.com/goshuirc/irc-go/ircmsg"
|
||||
)
|
||||
|
||||
// Msg sends a message to the given target.
|
||||
func (sc *ServerConnection) Msg(tags *map[string]ircmsg.TagValue, target string, message string, escaped bool) {
|
||||
func (sc *ServerConnection) Msg(tags map[string]string, target string, message string, escaped bool) {
|
||||
if escaped {
|
||||
message = ircfmt.Unescape(message)
|
||||
}
|
||||
@ -17,7 +16,7 @@ func (sc *ServerConnection) Msg(tags *map[string]ircmsg.TagValue, target string,
|
||||
}
|
||||
|
||||
// Notice sends a notice to the given target.
|
||||
func (sc *ServerConnection) Notice(tags *map[string]ircmsg.TagValue, target string, message string, escaped bool) {
|
||||
func (sc *ServerConnection) Notice(tags map[string]string, target string, message string, escaped bool) {
|
||||
if escaped {
|
||||
message = ircfmt.Unescape(message)
|
||||
}
|
||||
|
@ -156,7 +156,7 @@ func (sc *ServerConnection) ProcessIncomingLine(line string) {
|
||||
info := eventmgr.NewInfoMap()
|
||||
info["server"] = sc
|
||||
info["direction"] = "in"
|
||||
info["tags"] = message.Tags
|
||||
info["tags"] = message.AllTags()
|
||||
info["prefix"] = message.Prefix
|
||||
info["command"] = cmd
|
||||
info["params"] = message.Params
|
||||
@ -236,7 +236,7 @@ func (sc *ServerConnection) Casefold(message string) (string, error) {
|
||||
|
||||
// Send sends an IRC message to the server. If the message cannot be converted
|
||||
// to a raw IRC line, an error is returned.
|
||||
func (sc *ServerConnection) Send(tags *map[string]ircmsg.TagValue, prefix string, command string, params ...string) error {
|
||||
func (sc *ServerConnection) Send(tags map[string]string, prefix string, command string, params ...string) error {
|
||||
msg := ircmsg.MakeMessage(tags, prefix, command, params...)
|
||||
line, err := msg.Line()
|
||||
if err != nil {
|
||||
@ -251,11 +251,11 @@ func (sc *ServerConnection) Send(tags *map[string]ircmsg.TagValue, prefix string
|
||||
info["data"] = line
|
||||
sc.dispatchRawOut(info)
|
||||
|
||||
var outTags map[string]ircmsg.TagValue
|
||||
var outTags map[string]string
|
||||
if tags == nil {
|
||||
outTags = *ircmsg.MakeTags()
|
||||
outTags = map[string]string{}
|
||||
} else {
|
||||
outTags = *tags
|
||||
outTags = tags
|
||||
}
|
||||
|
||||
// dispatch real event
|
||||
|
@ -122,7 +122,7 @@ func TestTLSConnection(t *testing.T) {
|
||||
testServerConnection(t, reactor, client, listener)
|
||||
}
|
||||
|
||||
func sendMessage(conn net.Conn, tags *map[string]ircmsg.TagValue, prefix string, command string, params ...string) {
|
||||
func sendMessage(conn net.Conn, tags map[string]string, prefix string, command string, params ...string) {
|
||||
ircmsg := ircmsg.MakeMessage(tags, prefix, command, params...)
|
||||
line, err := ircmsg.Line()
|
||||
if err != nil {
|
||||
|
Loading…
Reference in New Issue
Block a user