common

package
v0.0.0-...-0f44469 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2020 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var TranslateEncoding = func() func(string) string {
	// https://tools.ietf.org/html/rfc1342
	var r = regexp.MustCompile(`(?i)=\?UTF-8\?B\?(\S+)\?=`)
	var rq = regexp.MustCompile(`(?i)=\?UTF-8\?Q\?(\S+)\?=`)
	var rq2 = regexp.MustCompile(`(?i)(=[0-9a-f]{2})`)

	return func(in string) string {
		outs := r.FindAllStringSubmatch(in, -1)
		if len(outs) == 1 && len(outs[0]) == 2 {
			buf, err := base64.StdEncoding.DecodeString(outs[0][1])
			if err == nil {
				return string(buf)
			}
		}
		outs = rq.FindAllStringSubmatch(in, -1)
		if len(outs) == 1 && len(outs[0]) == 2 {
			return string(rq2.ReplaceAllFunc([]byte(outs[0][1]), func(in []byte) []byte {
				hex.Decode(in, in[1:])
				return in[:1]
			}))
		}
		return in
	}
}()
View Source
var Verbose = 1

Functions

func D

func D(f string, a ...interface{})

func E

func E(f string, a ...interface{})

func ExtractEmail

func ExtractEmail(from string) string

func ExtractMsgID

func ExtractMsgID(msgID string) string

func F

func F(f string, a ...interface{})

func FormatSize

func FormatSize(v int64) string

func IntIf

func IntIf(a, b int64) int64

func L

func L(f string, a ...interface{})

func MsgIDToRawMsgID

func MsgIDToRawMsgID(msgid string, msgidbuf []byte) [16]byte

func PanicIf

func PanicIf(err interface{}, f string, a ...interface{})

Types

type Article

type Article struct {
	Headers textproto.MIMEHeader
	Body    []byte
	Refer   []string
}

func (*Article) Marshal

func (a *Article) Marshal() []byte

func (*Article) Unmarshal

func (a *Article) Unmarshal(rd io.Reader, headerOnly bool) error

type ArticleRef

type ArticleRef struct {
	Index    int
	RawMsgID [16]byte
	Offset   int64
	Length   int64
}

func (*ArticleRef) MsgID

func (ar *ArticleRef) MsgID() string

func (*ArticleRef) String

func (ar *ArticleRef) String() string

type AuthObject

type AuthObject struct {
	User, Pass string
}

type BaseGroupInfo

type BaseGroupInfo struct {
	Name        string `json:",omitempty"`
	Desc        string `json:",omitempty"`
	Posting     int64  `json:",omitempty"`
	MaxPostSize int64  `json:",omitempty"`
	MaxLives    int64  `json:",omitempty"`
	CreateTime  int64  `json:",omitempty"`
}

func (BaseGroupInfo) Diff

func (g BaseGroupInfo) Diff(g2 *BaseGroupInfo) string

type Config

type Config struct {
	MaxPostSize     int64
	ThrotCmdWin     int64
	PostIntervalSec int64
}

type HighLowSlice

type HighLowSlice struct {
	MaxSize int
	// contains filtered or unexported fields
}

func (*HighLowSlice) Append

func (s *HighLowSlice) Append(v *ArticleRef) ([]*ArticleRef, int)

func (*HighLowSlice) Get

func (s *HighLowSlice) Get(i int) (*ArticleRef, bool)

func (*HighLowSlice) High

func (s *HighLowSlice) High() int

func (*HighLowSlice) Len

func (s *HighLowSlice) Len() int

func (*HighLowSlice) Low

func (s *HighLowSlice) Low() int

func (*HighLowSlice) Set

func (s *HighLowSlice) Set(i int, v *ArticleRef)

func (*HighLowSlice) Slice

func (s *HighLowSlice) Slice(i, j int, copy bool) (results []*ArticleRef, actualStart, actualEnd int)

func (*HighLowSlice) String

func (s *HighLowSlice) String() string

type ModInfo

type ModInfo struct {
	Email    string
	Password string
	Deleted  bool
}

func (*ModInfo) String

func (m *ModInfo) String() string

Directories

Path Synopsis
Package dateparse parses date-strings without knowing the format in advance, using a fast lex based approach to eliminate shotgun attempts.
Package dateparse parses date-strings without knowing the format in advance, using a fast lex based approach to eliminate shotgun attempts.

Jump to

Keyboard shortcuts

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