atheme

package
v0.0.0-...-dd27f12 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 29, 2015 License: Zlib Imports: 5 Imported by: 1

Documentation

Overview

Package atheme implements an Atheme XMLRPC client and does all the horrifyingly ugly scraping of the raw output to machine-usable structures.

Index

Constants

View Source
const (
	FaultNEEDMOREPARAMS = iota // Not enough parameters
	FaultBADPARAMS             // Parameters invalid somehow
	FaultNOSUCHSOURCE          // Source account does not exist
	FaultNOSUCHTARGET          // Target does not exist
	FaultAUTHFAIL              // Bad password or authcookie
	FaultNOPRIVS               // Permission denied (not auth)
	FaultNOSUCHKEY             // Requested element on target does not exist
	FaultALREADYEXISTS         // Something conflicting already exists
	FaultTOOMANY               // Too many of something
	FaultEMAILFAIL             // Sending email failed
	FaultNOTVERIFIED           // Account not verified
	FaultNOCHANGE              // Object is already in requested state
	FaultALREADYAUTHED         // Already logged in
	FaultUNIMPLEMENTED         // Function not implemented
)

Fault constants from atheme/doc/XMLRPC

Variables

This section is empty.

Functions

This section is empty.

Types

type Akill

type Akill struct {
	Num    int    `json:"num"`
	Mask   string `json:"mask"`
	Setter string `json:"setter"`
	Expiry string `json:"expiry"`
	Reason string `json:"reason"`
}

Akill models an AKILL, also known as a K:Line. This represents a network-wide ban by user@host.

type Atheme

type Atheme struct {
	Privset []string // Privilege set of the user
	Account string   // Account Atheme is logged in as

	Authcookie string

	NickServ *NickServ
	ChanServ *ChanServ
	OperServ *OperServ
	HostServ *HostServ
	MemoServ *MemoServ
	LastUsed time.Time // When the last RPC call was made
	// contains filtered or unexported fields
}

Atheme is an Atheme context. This contains everything a client needs to access Atheme data remotely.

func NewAtheme

func NewAtheme(url string) (atheme *Atheme, err error)

NewAtheme returns a new Atheme instance or raises an error.

func (*Atheme) Command

func (a *Atheme) Command(args ...string) (string, error)

Command runs an Atheme command and gives the output or an error.

func (*Atheme) GetPrivset

func (a *Atheme) GetPrivset() (privs []string)

GetPrivset returns the privset of a user.

func (*Atheme) Login

func (a *Atheme) Login(username, password string) (err error)

Login attempts to log a user into Atheme. It returns true or false

func (*Atheme) Logout

func (a *Atheme) Logout()

Logout logs a user out of Atheme. There is no return.

type ChanServ

type ChanServ struct {
	// contains filtered or unexported fields
}

ChanServ implements a Golang client to Atheme's ChanServ. This is mostly a port of Cod's string parsing code.

func (*ChanServ) GetAccessList

func (cs *ChanServ) GetAccessList(channel string) (res []Flagset, err error)

GetAccessList returns a slice of Flagsets representing the access list of the channel you are requesting. This will fail if the Atheme call fails.

func (*ChanServ) GetChannelFlags

func (cs *ChanServ) GetChannelFlags(channel string) (flags []string, err error)

GetChannelFlags returns the SET flags of a channel as a string slice.

func (*ChanServ) Info

func (cs *ChanServ) Info(channel string) (ci *ChannelInfo, err error)

Info gets information on a channel, returning a ChannelInfo struct or an error describing the fault.

func (*ChanServ) Kick

func (cs *ChanServ) Kick(channel, victim, reason string) (res string, err error)

Kick sends a ChanServ KICK command to channel on victim with the denoted reason. You must have a reason for calls made with this function.

func (*ChanServ) List

func (cs *ChanServ) List() (res []*ChannelInfo, err error)

List lists all channels returning a slice of ChannelInfo structs or an error describing the fault.

func (*ChanServ) SetAccessList

func (cs *ChanServ) SetAccessList(channel, target, flags string) (err error)

SetAccessList commits a flag change on a channel with a given flagset.

func (*ChanServ) SetChannelFlag

func (cs *ChanServ) SetChannelFlag(channel, flag, value string) (err error)

SetChannelFlag sets a channel SET flag or returns an error.

type ChannelInfo

type ChannelInfo struct {
	Name        string   `json:"name"`        // Channel name
	Mlock       string   `json:"mlock"`       // Channel mode lock
	Flags       []string `json:"flags"`       // Channel SET flags
	Founder     string   `json:"founder"`     // Channel founder
	Registered  string   `json:"registered"`  // Channel age
	Description string   `json:"description"` // Channel description
}

ChannelInfo is the information Atheme has on a channel.

type Flagset

type Flagset struct {
	Id    int    `json:"id"`
	Nick  string `json:"nick"`
	Flags string `json:"flags"`
}

Flagset is a simple flagset wrapper.

type HostServ

type HostServ struct {
	// contains filtered or unexported fields
}

HostServ wraps Atheme's HostServ for use in Go programs.

func (*HostServ) Activate

func (hs *HostServ) Activate(account string) (err error)

Activate activates a VHost request for account.

func (*HostServ) Assign

func (hs *HostServ) Assign(account, vhost string) (err error)

Assign assigns a vhost to an account or returns an error.

func (*HostServ) List

func (hs *HostServ) List() ([]VHost, error)

List returns a list of all the vhosts Atheme is keeping track of.

func (*HostServ) ListPattern

func (hs *HostServ) ListPattern(pattern string) (res []VHost, err error)

ListPattern returns a list of all the vhosts Atheme is keeping track of that match a given pattern

func (*HostServ) Reject

func (hs *HostServ) Reject(account, message string) (err error)

Reject rejects a vhost request for an account.

func (*HostServ) Request

func (hs *HostServ) Request(vhost string) (err error)

Request requests a vhost for the logged in account.

func (*HostServ) Revoke

func (hs *HostServ) Revoke(account string) (err error)

Revoke revokes a vhost from an account or returns an error.

func (*HostServ) Waiting

func (hs *HostServ) Waiting() (res []VHost, err error)

Waiting returns a list of all the vhosts that are waiting for activation.

type Memo

type Memo struct {
	From    string `json:"from"`
	Date    string `json:"date"`
	Message string `json:"message"`
	ID      int    `json:"id"`
}

Memo represents a MemoServ memo.

type MemoServ

type MemoServ struct {
	// contains filtered or unexported fields
}

MemoServ binds MemoServ RPC calls.

func (*MemoServ) Forward

func (ms *MemoServ) Forward(memo Memo, target string) (err error)

Forward forwards a Memo to another account.

func (*MemoServ) List

func (ms *MemoServ) List() (memos []Memo, err error)

List lists all the Memos in a user's inbox.

func (*MemoServ) Send

func (ms *MemoServ) Send(target, message string) (err error)

Send figures out what send command to use and sends a memo to that target. It returns an error if the command failed.

type NickServ

type NickServ struct {
	// contains filtered or unexported fields
}

NickServ implements a Golang client to Atheme's NickServ. This is mostly a port of Cod's Atheme parsing code

func (*NickServ) Info

func (ns *NickServ) Info(target string) (res map[string]string, err error)

Info gets NickServ info on an arbitrary user or returns an error.

func (*NickServ) ListAccess

func (ns *NickServ) ListAccess(target string) (res NickServFlagset, err error)

ListAccess lists the channels a user has flags in.

func (*NickServ) ListOwnAccess

func (ns *NickServ) ListOwnAccess() (res NickServFlagset, err error)

ListOwnAccess lists the channels this user has flags in.

func (*NickServ) OwnInfo

func (ns *NickServ) OwnInfo() (map[string]string, error)

OwnInfo gets NickServ info for the "local" user in the Atheme instance.

func (*NickServ) SetEmail

func (ns *NickServ) SetEmail(email string) (res string, err error)

SetEmail sets the email address for an account.

func (*NickServ) SetPassword

func (ns *NickServ) SetPassword(password string) (res string, err error)

SetPassword sets the password for an account.

func (*NickServ) UID

func (ns *NickServ) UID(account string) (res string, err error)

UID returns the Atheme UID of an account.

type NickServFlagset

type NickServFlagset []map[string]string

NickServFlagset is a convenience wrapper around a slice of string->string maps.

type OperServ

type OperServ struct {
	// contains filtered or unexported fields
}

OperServ models Atheme's OperServ to Golang programs.

func (*OperServ) AkillAdd

func (os *OperServ) AkillAdd(mask, reason, time string) (ak *Akill, err error)

AkillAdd adds an Akill to Atheme and returns the struct created by the call.

func (*OperServ) AkillDel

func (os *OperServ) AkillDel(num int) (err error)

AkillDel attempts to delete an Akill from Atheme and returns an error representing the status of the command.

func (*OperServ) AkillList

func (os *OperServ) AkillList() (akills []Akill, err error)

AkillList returns the Akills Atheme is tracking and an error representing the command's status.

func (*OperServ) Kill

func (os *OperServ) Kill(target, reason string) (err error)

Kill asks OperServ to KILL a client off of the network for a given reason. You must give a reason.

type VHost

type VHost struct {
	Nick  string `json:"nick"`
	VHost string `json:"vhost"`
	Date  string `json:"date"`
}

VHost is a vhost listing or request.

func (*VHost) String

func (v *VHost) String() string

String satisfies fmt.Stringer

Directories

Path Synopsis
Package xmlrpc implements a simple xmlrpc client.
Package xmlrpc implements a simple xmlrpc client.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL