package ircparse

import "github.com/hlandau/ircproto/ircparse"

Package ircparse provides an IRC message parser and serializer supporting RFC1459 and IRCv3 message tags.

Index

Functions

func IsValidChannelName

func IsValidChannelName(chanName string) bool

Returns true iff the given string is a valid channel name.

func NickMatch

func NickMatch(x, y string) bool

Returns true iff nicknames x and y are the same.

func NormalizeChannelName

func NormalizeChannelName(chanName string) string

Normalizes a channel name by converting it to lowercase.

func NormalizeNickName

func NormalizeNickName(nickName string) string

Normalizes a nickname by converting it to lowercase.

Types

type Msg

type Msg struct {
	// Where :server.name is present, this is "server.name".
	ServerName string

	// Where :nick!user@host is present, this is nick, user and host.
	NickName, UserName, HostName string

	// Command name (uppercase) or three-digit numeric.
	Command string

	// All arguments including trailing argument. Note that the trailing argument
	// is not in any way semantically distinct from the other arguments, but it
	// may contain spaces.
	Args []string

	// IRCv3 tags. nil if no tags were specified. Tags without values have empty string values.
	// @tag1=tagvalue;tag2=tagvalue
	Tags map[string]string

	// The raw message which was parsed.
	Raw string
}

An RFC1459 IRC protocol message. Supports IRCv3 tags.

func Parse

func Parse(s string) (*Msg, error)

Parse an IRC protocol line. This should end with "\n".

func (*Msg) String

func (m *Msg) String() (string, error)

Marshal a message as an RFC1459 protocol line, including any IRCv3 message tags if specified.

Source Files

parse.go util.go

Version
v0.0.0-20240529044229-f1af42e426cd (latest)
Published
May 29, 2024
Platform
linux/amd64
Imports
4 packages
Last checked
1 month ago

Tools for package owners.