mirror of
https://github.com/ergochat/ergo.git
synced 2024-11-25 21:39:25 +01:00
don't send prefix on server-originated string coded replies
This commit is contained in:
parent
0ad05abf5f
commit
e1c4c8e8cc
@ -175,7 +175,7 @@ func (client *Client) Touch() {
|
||||
}
|
||||
|
||||
func (client *Client) Idle() {
|
||||
client.replies <- RplPing(client.server, client)
|
||||
client.replies <- RplPing(client)
|
||||
|
||||
if client.quitTimer == nil {
|
||||
client.quitTimer = time.AfterFunc(QUIT_TIMEOUT, client.connectionTimeout)
|
||||
@ -304,7 +304,7 @@ func (client *Client) Quit(message string) {
|
||||
return
|
||||
}
|
||||
|
||||
client.replies <- RplError(client.server, "connection closed")
|
||||
client.replies <- RplError("connection closed")
|
||||
client.replies <- EOF
|
||||
|
||||
client.hasQuit = true
|
||||
|
18
irc/reply.go
18
irc/reply.go
@ -9,11 +9,9 @@ import (
|
||||
func NewStringReply(source Identifier, code StringCode,
|
||||
format string, args ...interface{}) string {
|
||||
var header string
|
||||
switch source.(type) {
|
||||
case *Server:
|
||||
// TODO only omit prefix for local server
|
||||
if source == nil {
|
||||
header = fmt.Sprintf("%s ", code)
|
||||
default:
|
||||
} else {
|
||||
header = fmt.Sprintf(":%s %s ", source, code)
|
||||
}
|
||||
message := fmt.Sprintf(format, args...)
|
||||
@ -104,20 +102,20 @@ func RplTopicMsg(source Identifier, channel *Channel) string {
|
||||
return NewStringReply(source, TOPIC, "%s :%s", channel, channel.topic)
|
||||
}
|
||||
|
||||
func RplPing(server *Server, target Identifier) string {
|
||||
return NewStringReply(server, PING, ":%s", target.Nick())
|
||||
func RplPing(target Identifier) string {
|
||||
return NewStringReply(nil, PING, ":%s", target.Nick())
|
||||
}
|
||||
|
||||
func RplPong(server *Server, client *Client) string {
|
||||
return NewStringReply(server, PONG, client.Nick())
|
||||
func RplPong(client *Client) string {
|
||||
return NewStringReply(nil, PONG, client.Nick())
|
||||
}
|
||||
|
||||
func RplQuit(client *Client, message string) string {
|
||||
return NewStringReply(client, QUIT, ":%s", message)
|
||||
}
|
||||
|
||||
func RplError(server *Server, message string) string {
|
||||
return NewStringReply(server, ERROR, ":%s", message)
|
||||
func RplError(message string) string {
|
||||
return NewStringReply(nil, ERROR, ":%s", message)
|
||||
}
|
||||
|
||||
func RplInviteMsg(channel *Channel, inviter *Client) string {
|
||||
|
@ -351,7 +351,7 @@ func (m *PassCommand) HandleServer(s *Server) {
|
||||
}
|
||||
|
||||
func (m *PingCommand) HandleServer(s *Server) {
|
||||
m.Client().replies <- RplPong(s, m.Client())
|
||||
m.Client().replies <- RplPong(m.Client())
|
||||
}
|
||||
|
||||
func (m *PongCommand) HandleServer(s *Server) {
|
||||
|
Loading…
Reference in New Issue
Block a user