mirror of https://github.com/gissleh/irc.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
44 lines
854 B
44 lines
854 B
package irc
|
|
|
|
import (
|
|
"git.aiterp.net/gisle/irc/list"
|
|
)
|
|
|
|
// A Query is a target for direct messages to and from a specific nick.
|
|
type Query struct {
|
|
user list.User
|
|
}
|
|
|
|
// Kind returns "channel"
|
|
func (query *Query) Kind() string {
|
|
return "query"
|
|
}
|
|
|
|
// Name gets the query name
|
|
func (query *Query) Name() string {
|
|
return query.user.Nick
|
|
}
|
|
|
|
// Handle handles messages routed to this channel by the client's event loop
|
|
func (query *Query) Handle(event *Event, client *Client) {
|
|
switch event.Name() {
|
|
case "packet.nick":
|
|
{
|
|
query.user.Nick = event.Arg(0)
|
|
}
|
|
case "packet.account":
|
|
{
|
|
account := ""
|
|
if accountArg := event.Arg(0); accountArg != "" && accountArg != "*" {
|
|
account = accountArg
|
|
}
|
|
|
|
query.user.Account = account
|
|
}
|
|
case "packet.chghost":
|
|
{
|
|
query.user.User = event.Arg(0)
|
|
query.user.Host = event.Arg(1)
|
|
}
|
|
}
|
|
}
|