id
int32
0
167k
repo
stringlengths
5
54
path
stringlengths
4
155
func_name
stringlengths
1
118
original_string
stringlengths
52
85.5k
language
stringclasses
1 value
code
stringlengths
52
85.5k
code_tokens
listlengths
21
1.41k
docstring
stringlengths
6
2.61k
docstring_tokens
listlengths
3
215
sha
stringlengths
40
40
url
stringlengths
85
252
148,100
alecthomas/kingpin
values_generated.go
DurationList
func (p *parserMixin) DurationList() (target *[]time.Duration) { target = new([]time.Duration) p.DurationListVar(target) return }
go
func (p *parserMixin) DurationList() (target *[]time.Duration) { target = new([]time.Duration) p.DurationListVar(target) return }
[ "func", "(", "p", "*", "parserMixin", ")", "DurationList", "(", ")", "(", "target", "*", "[", "]", "time", ".", "Duration", ")", "{", "target", "=", "new", "(", "[", "]", "time", ".", "Duration", ")", "\n", "p", ".", "DurationListVar", "(", "target...
// DurationList accumulates time.Duration values into a slice.
[ "DurationList", "accumulates", "time", ".", "Duration", "values", "into", "a", "slice", "." ]
ef6e7c151c4fdbd3fe78aad001729fee08fa0932
https://github.com/alecthomas/kingpin/blob/ef6e7c151c4fdbd3fe78aad001729fee08fa0932/values_generated.go#L617-L621
148,101
alecthomas/kingpin
values_generated.go
IPList
func (p *parserMixin) IPList() (target *[]net.IP) { target = new([]net.IP) p.IPListVar(target) return }
go
func (p *parserMixin) IPList() (target *[]net.IP) { target = new([]net.IP) p.IPListVar(target) return }
[ "func", "(", "p", "*", "parserMixin", ")", "IPList", "(", ")", "(", "target", "*", "[", "]", "net", ".", "IP", ")", "{", "target", "=", "new", "(", "[", "]", "net", ".", "IP", ")", "\n", "p", ".", "IPListVar", "(", "target", ")", "\n", "retur...
// IPList accumulates net.IP values into a slice.
[ "IPList", "accumulates", "net", ".", "IP", "values", "into", "a", "slice", "." ]
ef6e7c151c4fdbd3fe78aad001729fee08fa0932
https://github.com/alecthomas/kingpin/blob/ef6e7c151c4fdbd3fe78aad001729fee08fa0932/values_generated.go#L630-L634
148,102
alecthomas/kingpin
values_generated.go
ExistingFiles
func (p *parserMixin) ExistingFiles() (target *[]string) { target = new([]string) p.ExistingFilesVar(target) return }
go
func (p *parserMixin) ExistingFiles() (target *[]string) { target = new([]string) p.ExistingFilesVar(target) return }
[ "func", "(", "p", "*", "parserMixin", ")", "ExistingFiles", "(", ")", "(", "target", "*", "[", "]", "string", ")", "{", "target", "=", "new", "(", "[", "]", "string", ")", "\n", "p", ".", "ExistingFilesVar", "(", "target", ")", "\n", "return", "\n"...
// ExistingFiles accumulates string values into a slice.
[ "ExistingFiles", "accumulates", "string", "values", "into", "a", "slice", "." ]
ef6e7c151c4fdbd3fe78aad001729fee08fa0932
https://github.com/alecthomas/kingpin/blob/ef6e7c151c4fdbd3fe78aad001729fee08fa0932/values_generated.go#L656-L660
148,103
alecthomas/kingpin
values_generated.go
ExistingDirs
func (p *parserMixin) ExistingDirs() (target *[]string) { target = new([]string) p.ExistingDirsVar(target) return }
go
func (p *parserMixin) ExistingDirs() (target *[]string) { target = new([]string) p.ExistingDirsVar(target) return }
[ "func", "(", "p", "*", "parserMixin", ")", "ExistingDirs", "(", ")", "(", "target", "*", "[", "]", "string", ")", "{", "target", "=", "new", "(", "[", "]", "string", ")", "\n", "p", ".", "ExistingDirsVar", "(", "target", ")", "\n", "return", "\n", ...
// ExistingDirs accumulates string values into a slice.
[ "ExistingDirs", "accumulates", "string", "values", "into", "a", "slice", "." ]
ef6e7c151c4fdbd3fe78aad001729fee08fa0932
https://github.com/alecthomas/kingpin/blob/ef6e7c151c4fdbd3fe78aad001729fee08fa0932/values_generated.go#L669-L673
148,104
alecthomas/kingpin
values_generated.go
ExistingFilesOrDirs
func (p *parserMixin) ExistingFilesOrDirs() (target *[]string) { target = new([]string) p.ExistingFilesOrDirsVar(target) return }
go
func (p *parserMixin) ExistingFilesOrDirs() (target *[]string) { target = new([]string) p.ExistingFilesOrDirsVar(target) return }
[ "func", "(", "p", "*", "parserMixin", ")", "ExistingFilesOrDirs", "(", ")", "(", "target", "*", "[", "]", "string", ")", "{", "target", "=", "new", "(", "[", "]", "string", ")", "\n", "p", ".", "ExistingFilesOrDirsVar", "(", "target", ")", "\n", "ret...
// ExistingFilesOrDirs accumulates string values into a slice.
[ "ExistingFilesOrDirs", "accumulates", "string", "values", "into", "a", "slice", "." ]
ef6e7c151c4fdbd3fe78aad001729fee08fa0932
https://github.com/alecthomas/kingpin/blob/ef6e7c151c4fdbd3fe78aad001729fee08fa0932/values_generated.go#L682-L686
148,105
alecthomas/kingpin
values_generated.go
ResolvedIP
func (p *parserMixin) ResolvedIP() (target *net.IP) { target = new(net.IP) p.ResolvedIPVar(target) return }
go
func (p *parserMixin) ResolvedIP() (target *net.IP) { target = new(net.IP) p.ResolvedIPVar(target) return }
[ "func", "(", "p", "*", "parserMixin", ")", "ResolvedIP", "(", ")", "(", "target", "*", "net", ".", "IP", ")", "{", "target", "=", "new", "(", "net", ".", "IP", ")", "\n", "p", ".", "ResolvedIPVar", "(", "target", ")", "\n", "return", "\n", "}" ]
// Resolve a hostname or IP to an IP.
[ "Resolve", "a", "hostname", "or", "IP", "to", "an", "IP", "." ]
ef6e7c151c4fdbd3fe78aad001729fee08fa0932
https://github.com/alecthomas/kingpin/blob/ef6e7c151c4fdbd3fe78aad001729fee08fa0932/values_generated.go#L757-L761
148,106
alecthomas/kingpin
values_generated.go
ResolvedIPList
func (p *parserMixin) ResolvedIPList() (target *[]net.IP) { target = new([]net.IP) p.ResolvedIPListVar(target) return }
go
func (p *parserMixin) ResolvedIPList() (target *[]net.IP) { target = new([]net.IP) p.ResolvedIPListVar(target) return }
[ "func", "(", "p", "*", "parserMixin", ")", "ResolvedIPList", "(", ")", "(", "target", "*", "[", "]", "net", ".", "IP", ")", "{", "target", "=", "new", "(", "[", "]", "net", ".", "IP", ")", "\n", "p", ".", "ResolvedIPListVar", "(", "target", ")", ...
// ResolvedIPList accumulates net.IP values into a slice.
[ "ResolvedIPList", "accumulates", "net", ".", "IP", "values", "into", "a", "slice", "." ]
ef6e7c151c4fdbd3fe78aad001729fee08fa0932
https://github.com/alecthomas/kingpin/blob/ef6e7c151c4fdbd3fe78aad001729fee08fa0932/values_generated.go#L768-L772
148,107
alecthomas/kingpin
values_generated.go
HexBytes
func (p *parserMixin) HexBytes() (target *[]byte) { target = new([]byte) p.HexBytesVar(target) return }
go
func (p *parserMixin) HexBytes() (target *[]byte) { target = new([]byte) p.HexBytesVar(target) return }
[ "func", "(", "p", "*", "parserMixin", ")", "HexBytes", "(", ")", "(", "target", "*", "[", "]", "byte", ")", "{", "target", "=", "new", "(", "[", "]", "byte", ")", "\n", "p", ".", "HexBytesVar", "(", "target", ")", "\n", "return", "\n", "}" ]
// Bytes as a hex string.
[ "Bytes", "as", "a", "hex", "string", "." ]
ef6e7c151c4fdbd3fe78aad001729fee08fa0932
https://github.com/alecthomas/kingpin/blob/ef6e7c151c4fdbd3fe78aad001729fee08fa0932/values_generated.go#L800-L804
148,108
alecthomas/kingpin
global.go
Parse
func Parse() string { selected := MustParse(CommandLine.Parse(os.Args[1:])) if selected == "" && CommandLine.cmdGroup.have() { Usage() CommandLine.terminate(0) } return selected }
go
func Parse() string { selected := MustParse(CommandLine.Parse(os.Args[1:])) if selected == "" && CommandLine.cmdGroup.have() { Usage() CommandLine.terminate(0) } return selected }
[ "func", "Parse", "(", ")", "string", "{", "selected", ":=", "MustParse", "(", "CommandLine", ".", "Parse", "(", "os", ".", "Args", "[", "1", ":", "]", ")", ")", "\n", "if", "selected", "==", "\"", "\"", "&&", "CommandLine", ".", "cmdGroup", ".", "h...
// Parse and return the selected command. Will call the termination handler if // an error is encountered.
[ "Parse", "and", "return", "the", "selected", "command", ".", "Will", "call", "the", "termination", "handler", "if", "an", "error", "is", "encountered", "." ]
ef6e7c151c4fdbd3fe78aad001729fee08fa0932
https://github.com/alecthomas/kingpin/blob/ef6e7c151c4fdbd3fe78aad001729fee08fa0932/global.go#L38-L45
148,109
alecthomas/kingpin
global.go
FatalIfError
func FatalIfError(err error, format string, args ...interface{}) { CommandLine.FatalIfError(err, format, args...) }
go
func FatalIfError(err error, format string, args ...interface{}) { CommandLine.FatalIfError(err, format, args...) }
[ "func", "FatalIfError", "(", "err", "error", ",", "format", "string", ",", "args", "...", "interface", "{", "}", ")", "{", "CommandLine", ".", "FatalIfError", "(", "err", ",", "format", ",", "args", "...", ")", "\n", "}" ]
// FatalIfError prints an error and exits if err is not nil. The error is printed // with the given prefix.
[ "FatalIfError", "prints", "an", "error", "and", "exits", "if", "err", "is", "not", "nil", ".", "The", "error", "is", "printed", "with", "the", "given", "prefix", "." ]
ef6e7c151c4fdbd3fe78aad001729fee08fa0932
https://github.com/alecthomas/kingpin/blob/ef6e7c151c4fdbd3fe78aad001729fee08fa0932/global.go#L59-L61
148,110
alecthomas/kingpin
global.go
FatalUsageContext
func FatalUsageContext(context *ParseContext, format string, args ...interface{}) { CommandLine.FatalUsageContext(context, format, args...) }
go
func FatalUsageContext(context *ParseContext, format string, args ...interface{}) { CommandLine.FatalUsageContext(context, format, args...) }
[ "func", "FatalUsageContext", "(", "context", "*", "ParseContext", ",", "format", "string", ",", "args", "...", "interface", "{", "}", ")", "{", "CommandLine", ".", "FatalUsageContext", "(", "context", ",", "format", ",", "args", "...", ")", "\n", "}" ]
// FatalUsageContext writes a printf formatted error message to stderr, then // usage information for the given ParseContext, before exiting.
[ "FatalUsageContext", "writes", "a", "printf", "formatted", "error", "message", "to", "stderr", "then", "usage", "information", "for", "the", "given", "ParseContext", "before", "exiting", "." ]
ef6e7c151c4fdbd3fe78aad001729fee08fa0932
https://github.com/alecthomas/kingpin/blob/ef6e7c151c4fdbd3fe78aad001729fee08fa0932/global.go#L71-L73
148,111
alecthomas/kingpin
args.go
GetArg
func (a *argGroup) GetArg(name string) *ArgClause { for _, arg := range a.args { if arg.name == name { return arg } } return nil }
go
func (a *argGroup) GetArg(name string) *ArgClause { for _, arg := range a.args { if arg.name == name { return arg } } return nil }
[ "func", "(", "a", "*", "argGroup", ")", "GetArg", "(", "name", "string", ")", "*", "ArgClause", "{", "for", "_", ",", "arg", ":=", "range", "a", ".", "args", "{", "if", "arg", ".", "name", "==", "name", "{", "return", "arg", "\n", "}", "\n", "}...
// GetArg gets an argument definition. // // This allows existing arguments to be modified after definition but before parsing. Useful for // modular applications.
[ "GetArg", "gets", "an", "argument", "definition", ".", "This", "allows", "existing", "arguments", "to", "be", "modified", "after", "definition", "but", "before", "parsing", ".", "Useful", "for", "modular", "applications", "." ]
ef6e7c151c4fdbd3fe78aad001729fee08fa0932
https://github.com/alecthomas/kingpin/blob/ef6e7c151c4fdbd3fe78aad001729fee08fa0932/args.go#L23-L30
148,112
alecthomas/kingpin
completions.go
addHintActionBuiltin
func (a *completionsMixin) addHintActionBuiltin(action HintAction) { a.builtinHintActions = append(a.builtinHintActions, action) }
go
func (a *completionsMixin) addHintActionBuiltin(action HintAction) { a.builtinHintActions = append(a.builtinHintActions, action) }
[ "func", "(", "a", "*", "completionsMixin", ")", "addHintActionBuiltin", "(", "action", "HintAction", ")", "{", "a", ".", "builtinHintActions", "=", "append", "(", "a", ".", "builtinHintActions", ",", "action", ")", "\n", "}" ]
// Allow adding of HintActions which are added internally, ie, EnumVar
[ "Allow", "adding", "of", "HintActions", "which", "are", "added", "internally", "ie", "EnumVar" ]
ef6e7c151c4fdbd3fe78aad001729fee08fa0932
https://github.com/alecthomas/kingpin/blob/ef6e7c151c4fdbd3fe78aad001729fee08fa0932/completions.go#L16-L18
148,113
alecthomas/kingpin
cmd.go
CmdCompletion
func (c *cmdMixin) CmdCompletion(context *ParseContext) []string { var options []string // Count args already satisfied - we won't complete those, and add any // default commands' alternatives, since they weren't listed explicitly // and the user may want to explicitly list something else. argsSatisfied := 0 all...
go
func (c *cmdMixin) CmdCompletion(context *ParseContext) []string { var options []string // Count args already satisfied - we won't complete those, and add any // default commands' alternatives, since they weren't listed explicitly // and the user may want to explicitly list something else. argsSatisfied := 0 all...
[ "func", "(", "c", "*", "cmdMixin", ")", "CmdCompletion", "(", "context", "*", "ParseContext", ")", "[", "]", "string", "{", "var", "options", "[", "]", "string", "\n\n", "// Count args already satisfied - we won't complete those, and add any", "// default commands' alte...
// CmdCompletion returns completion options for arguments, if that's where // parsing left off, or commands if there aren't any unsatisfied args.
[ "CmdCompletion", "returns", "completion", "options", "for", "arguments", "if", "that", "s", "where", "parsing", "left", "off", "or", "commands", "if", "there", "aren", "t", "any", "unsatisfied", "args", "." ]
ef6e7c151c4fdbd3fe78aad001729fee08fa0932
https://github.com/alecthomas/kingpin/blob/ef6e7c151c4fdbd3fe78aad001729fee08fa0932/cmd.go#L17-L79
148,114
alecthomas/kingpin
cmd.go
Alias
func (c *CmdClause) Alias(name string) *CmdClause { c.aliases = append(c.aliases, name) return c }
go
func (c *CmdClause) Alias(name string) *CmdClause { c.aliases = append(c.aliases, name) return c }
[ "func", "(", "c", "*", "CmdClause", ")", "Alias", "(", "name", "string", ")", "*", "CmdClause", "{", "c", ".", "aliases", "=", "append", "(", "c", ".", "aliases", ",", "name", ")", "\n", "return", "c", "\n", "}" ]
// Add an Alias for this command.
[ "Add", "an", "Alias", "for", "this", "command", "." ]
ef6e7c151c4fdbd3fe78aad001729fee08fa0932
https://github.com/alecthomas/kingpin/blob/ef6e7c151c4fdbd3fe78aad001729fee08fa0932/cmd.go#L243-L246
148,115
alecthomas/kingpin
cmd.go
Command
func (c *CmdClause) Command(name, help string) *CmdClause { cmd := c.addCommand(name, help) cmd.parent = c return cmd }
go
func (c *CmdClause) Command(name, help string) *CmdClause { cmd := c.addCommand(name, help) cmd.parent = c return cmd }
[ "func", "(", "c", "*", "CmdClause", ")", "Command", "(", "name", ",", "help", "string", ")", "*", "CmdClause", "{", "cmd", ":=", "c", ".", "addCommand", "(", "name", ",", "help", ")", "\n", "cmd", ".", "parent", "=", "c", "\n", "return", "cmd", "...
// Command adds a new sub-command.
[ "Command", "adds", "a", "new", "sub", "-", "command", "." ]
ef6e7c151c4fdbd3fe78aad001729fee08fa0932
https://github.com/alecthomas/kingpin/blob/ef6e7c151c4fdbd3fe78aad001729fee08fa0932/cmd.go#L263-L267
148,116
alecthomas/kingpin
parser.go
Next
func (p *ParseContext) Next() *Token { if len(p.peek) > 0 { return p.pop() } // End of tokens. if len(p.args) == 0 { return &Token{Index: p.argi, Type: TokenEOL} } arg := p.args[0] p.next() if p.argsOnly { return &Token{p.argi, TokenArg, arg} } // All remaining args are passed directly. if arg == "...
go
func (p *ParseContext) Next() *Token { if len(p.peek) > 0 { return p.pop() } // End of tokens. if len(p.args) == 0 { return &Token{Index: p.argi, Type: TokenEOL} } arg := p.args[0] p.next() if p.argsOnly { return &Token{p.argi, TokenArg, arg} } // All remaining args are passed directly. if arg == "...
[ "func", "(", "p", "*", "ParseContext", ")", "Next", "(", ")", "*", "Token", "{", "if", "len", "(", "p", ".", "peek", ")", ">", "0", "{", "return", "p", ".", "pop", "(", ")", "\n", "}", "\n\n", "// End of tokens.", "if", "len", "(", "p", ".", ...
// Next token in the parse context.
[ "Next", "token", "in", "the", "parse", "context", "." ]
ef6e7c151c4fdbd3fe78aad001729fee08fa0932
https://github.com/alecthomas/kingpin/blob/ef6e7c151c4fdbd3fe78aad001729fee08fa0932/parser.go#L161-L231
148,117
alecthomas/kingpin
usage.go
Usage
func (a *Application) Usage(args []string) { context, err := a.parseContext(true, args) a.FatalIfError(err, "") if err := a.UsageForContextWithTemplate(context, 2, a.usageTemplate); err != nil { panic(err) } }
go
func (a *Application) Usage(args []string) { context, err := a.parseContext(true, args) a.FatalIfError(err, "") if err := a.UsageForContextWithTemplate(context, 2, a.usageTemplate); err != nil { panic(err) } }
[ "func", "(", "a", "*", "Application", ")", "Usage", "(", "args", "[", "]", "string", ")", "{", "context", ",", "err", ":=", "a", ".", "parseContext", "(", "true", ",", "args", ")", "\n", "a", ".", "FatalIfError", "(", "err", ",", "\"", "\"", ")",...
// Usage writes application usage to w. It parses args to determine // appropriate help context, such as which command to show help for.
[ "Usage", "writes", "application", "usage", "to", "w", ".", "It", "parses", "args", "to", "determine", "appropriate", "help", "context", "such", "as", "which", "command", "to", "show", "help", "for", "." ]
ef6e7c151c4fdbd3fe78aad001729fee08fa0932
https://github.com/alecthomas/kingpin/blob/ef6e7c151c4fdbd3fe78aad001729fee08fa0932/usage.go#L46-L52
148,118
emersion/go-imap
search.go
ParseWithCharset
func (c *SearchCriteria) ParseWithCharset(fields []interface{}, charsetReader func(io.Reader) io.Reader) error { for len(fields) > 0 { var err error if fields, err = c.parseField(fields, charsetReader); err != nil { return err } } return nil }
go
func (c *SearchCriteria) ParseWithCharset(fields []interface{}, charsetReader func(io.Reader) io.Reader) error { for len(fields) > 0 { var err error if fields, err = c.parseField(fields, charsetReader); err != nil { return err } } return nil }
[ "func", "(", "c", "*", "SearchCriteria", ")", "ParseWithCharset", "(", "fields", "[", "]", "interface", "{", "}", ",", "charsetReader", "func", "(", "io", ".", "Reader", ")", "io", ".", "Reader", ")", "error", "{", "for", "len", "(", "fields", ")", "...
// ParseWithCharset parses a search criteria from the provided fields. // charsetReader is an optional function that converts from the fields charset // to UTF-8.
[ "ParseWithCharset", "parses", "a", "search", "criteria", "from", "the", "provided", "fields", ".", "charsetReader", "is", "an", "optional", "function", "that", "converts", "from", "the", "fields", "charset", "to", "UTF", "-", "8", "." ]
b7db4a2bc5cc04fb568fb036a438da43ee9a9f78
https://github.com/emersion/go-imap/blob/b7db4a2bc5cc04fb568fb036a438da43ee9a9f78/search.go#L264-L272
148,119
emersion/go-imap
backend/backendutil/envelope.go
FetchEnvelope
func FetchEnvelope(h message.Header) (*imap.Envelope, error) { mh := mail.Header{Header: h} env := new(imap.Envelope) env.Date, _ = mh.Date() env.Subject, _ = mh.Subject() env.From, _ = headerAddressList(mh, "From") env.Sender, _ = headerAddressList(mh, "Sender") env.ReplyTo, _ = headerAddressList(mh, "Reply-To...
go
func FetchEnvelope(h message.Header) (*imap.Envelope, error) { mh := mail.Header{Header: h} env := new(imap.Envelope) env.Date, _ = mh.Date() env.Subject, _ = mh.Subject() env.From, _ = headerAddressList(mh, "From") env.Sender, _ = headerAddressList(mh, "Sender") env.ReplyTo, _ = headerAddressList(mh, "Reply-To...
[ "func", "FetchEnvelope", "(", "h", "message", ".", "Header", ")", "(", "*", "imap", ".", "Envelope", ",", "error", ")", "{", "mh", ":=", "mail", ".", "Header", "{", "Header", ":", "h", "}", "\n\n", "env", ":=", "new", "(", "imap", ".", "Envelope", ...
// FetchEnvelope returns a message's envelope from its header.
[ "FetchEnvelope", "returns", "a", "message", "s", "envelope", "from", "its", "header", "." ]
b7db4a2bc5cc04fb568fb036a438da43ee9a9f78
https://github.com/emersion/go-imap/blob/b7db4a2bc5cc04fb568fb036a438da43ee9a9f78/backend/backendutil/envelope.go#L34-L50
148,120
emersion/go-imap
backend/backendutil/flags.go
UpdateFlags
func UpdateFlags(current []string, op imap.FlagsOp, flags []string) []string { switch op { case imap.SetFlags: // TODO: keep \Recent if it is present return flags case imap.AddFlags: // Check for duplicates for _, flag := range current { for i, addFlag := range flags { if addFlag == flag { flags ...
go
func UpdateFlags(current []string, op imap.FlagsOp, flags []string) []string { switch op { case imap.SetFlags: // TODO: keep \Recent if it is present return flags case imap.AddFlags: // Check for duplicates for _, flag := range current { for i, addFlag := range flags { if addFlag == flag { flags ...
[ "func", "UpdateFlags", "(", "current", "[", "]", "string", ",", "op", "imap", ".", "FlagsOp", ",", "flags", "[", "]", "string", ")", "[", "]", "string", "{", "switch", "op", "{", "case", "imap", ".", "SetFlags", ":", "// TODO: keep \\Recent if it is presen...
// UpdateFlags executes a flag operation on the flag set current.
[ "UpdateFlags", "executes", "a", "flag", "operation", "on", "the", "flag", "set", "current", "." ]
b7db4a2bc5cc04fb568fb036a438da43ee9a9f78
https://github.com/emersion/go-imap/blob/b7db4a2bc5cc04fb568fb036a438da43ee9a9f78/backend/backendutil/flags.go#L8-L40
148,121
emersion/go-imap
mailbox.go
CanonicalMailboxName
func CanonicalMailboxName(name string) string { if strings.ToUpper(name) == InboxName { return InboxName } return name }
go
func CanonicalMailboxName(name string) string { if strings.ToUpper(name) == InboxName { return InboxName } return name }
[ "func", "CanonicalMailboxName", "(", "name", "string", ")", "string", "{", "if", "strings", ".", "ToUpper", "(", "name", ")", "==", "InboxName", "{", "return", "InboxName", "\n", "}", "\n", "return", "name", "\n", "}" ]
// CanonicalMailboxName returns the canonical form of a mailbox name. Mailbox names can be // case-sensitive or case-insensitive depending on the backend implementation. // The special INBOX mailbox is case-insensitive.
[ "CanonicalMailboxName", "returns", "the", "canonical", "form", "of", "a", "mailbox", "name", ".", "Mailbox", "names", "can", "be", "case", "-", "sensitive", "or", "case", "-", "insensitive", "depending", "on", "the", "backend", "implementation", ".", "The", "s...
b7db4a2bc5cc04fb568fb036a438da43ee9a9f78
https://github.com/emersion/go-imap/blob/b7db4a2bc5cc04fb568fb036a438da43ee9a9f78/mailbox.go#L18-L23
148,122
emersion/go-imap
mailbox.go
Parse
func (info *MailboxInfo) Parse(fields []interface{}) error { if len(fields) < 3 { return errors.New("Mailbox info needs at least 3 fields") } var err error if info.Attributes, err = ParseStringList(fields[0]); err != nil { return err } var ok bool if info.Delimiter, ok = fields[1].(string); !ok { return ...
go
func (info *MailboxInfo) Parse(fields []interface{}) error { if len(fields) < 3 { return errors.New("Mailbox info needs at least 3 fields") } var err error if info.Attributes, err = ParseStringList(fields[0]); err != nil { return err } var ok bool if info.Delimiter, ok = fields[1].(string); !ok { return ...
[ "func", "(", "info", "*", "MailboxInfo", ")", "Parse", "(", "fields", "[", "]", "interface", "{", "}", ")", "error", "{", "if", "len", "(", "fields", ")", "<", "3", "{", "return", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n\n", "...
// Parse mailbox info from fields.
[ "Parse", "mailbox", "info", "from", "fields", "." ]
b7db4a2bc5cc04fb568fb036a438da43ee9a9f78
https://github.com/emersion/go-imap/blob/b7db4a2bc5cc04fb568fb036a438da43ee9a9f78/mailbox.go#L52-L76
148,123
emersion/go-imap
mailbox.go
Format
func (info *MailboxInfo) Format() []interface{} { name, _ := utf7.Encoding.NewEncoder().String(info.Name) attrs := make([]interface{}, len(info.Attributes)) for i, attr := range info.Attributes { attrs[i] = Atom(attr) } // Thunderbird doesn't understand delimiters if not quoted return []interface{}{attrs, Quote...
go
func (info *MailboxInfo) Format() []interface{} { name, _ := utf7.Encoding.NewEncoder().String(info.Name) attrs := make([]interface{}, len(info.Attributes)) for i, attr := range info.Attributes { attrs[i] = Atom(attr) } // Thunderbird doesn't understand delimiters if not quoted return []interface{}{attrs, Quote...
[ "func", "(", "info", "*", "MailboxInfo", ")", "Format", "(", ")", "[", "]", "interface", "{", "}", "{", "name", ",", "_", ":=", "utf7", ".", "Encoding", ".", "NewEncoder", "(", ")", ".", "String", "(", "info", ".", "Name", ")", "\n", "attrs", ":=...
// Format mailbox info to fields.
[ "Format", "mailbox", "info", "to", "fields", "." ]
b7db4a2bc5cc04fb568fb036a438da43ee9a9f78
https://github.com/emersion/go-imap/blob/b7db4a2bc5cc04fb568fb036a438da43ee9a9f78/mailbox.go#L79-L87
148,124
emersion/go-imap
mailbox.go
Match
func (info *MailboxInfo) Match(reference, pattern string) bool { name := info.Name if strings.HasPrefix(pattern, info.Delimiter) { reference = "" pattern = strings.TrimPrefix(pattern, info.Delimiter) } if reference != "" { if !strings.HasSuffix(reference, info.Delimiter) { reference += info.Delimiter } ...
go
func (info *MailboxInfo) Match(reference, pattern string) bool { name := info.Name if strings.HasPrefix(pattern, info.Delimiter) { reference = "" pattern = strings.TrimPrefix(pattern, info.Delimiter) } if reference != "" { if !strings.HasSuffix(reference, info.Delimiter) { reference += info.Delimiter } ...
[ "func", "(", "info", "*", "MailboxInfo", ")", "Match", "(", "reference", ",", "pattern", "string", ")", "bool", "{", "name", ":=", "info", ".", "Name", "\n\n", "if", "strings", ".", "HasPrefix", "(", "pattern", ",", "info", ".", "Delimiter", ")", "{", ...
// Match checks if a reference and a pattern matches this mailbox name, as // defined in RFC 3501 section 6.3.8.
[ "Match", "checks", "if", "a", "reference", "and", "a", "pattern", "matches", "this", "mailbox", "name", "as", "defined", "in", "RFC", "3501", "section", "6", ".", "3", ".", "8", "." ]
b7db4a2bc5cc04fb568fb036a438da43ee9a9f78
https://github.com/emersion/go-imap/blob/b7db4a2bc5cc04fb568fb036a438da43ee9a9f78/mailbox.go#L123-L141
148,125
emersion/go-imap
mailbox.go
NewMailboxStatus
func NewMailboxStatus(name string, items []StatusItem) *MailboxStatus { status := &MailboxStatus{ Name: name, Items: make(map[StatusItem]interface{}), } for _, k := range items { status.Items[k] = nil } return status }
go
func NewMailboxStatus(name string, items []StatusItem) *MailboxStatus { status := &MailboxStatus{ Name: name, Items: make(map[StatusItem]interface{}), } for _, k := range items { status.Items[k] = nil } return status }
[ "func", "NewMailboxStatus", "(", "name", "string", ",", "items", "[", "]", "StatusItem", ")", "*", "MailboxStatus", "{", "status", ":=", "&", "MailboxStatus", "{", "Name", ":", "name", ",", "Items", ":", "make", "(", "map", "[", "StatusItem", "]", "inter...
// Create a new mailbox status that will contain the specified items.
[ "Create", "a", "new", "mailbox", "status", "that", "will", "contain", "the", "specified", "items", "." ]
b7db4a2bc5cc04fb568fb036a438da43ee9a9f78
https://github.com/emersion/go-imap/blob/b7db4a2bc5cc04fb568fb036a438da43ee9a9f78/mailbox.go#L179-L190
148,126
emersion/go-imap
backend/updates.go
NewUpdate
func NewUpdate(username, mailbox string) Update { return &update{ username: username, mailbox: mailbox, } }
go
func NewUpdate(username, mailbox string) Update { return &update{ username: username, mailbox: mailbox, } }
[ "func", "NewUpdate", "(", "username", ",", "mailbox", "string", ")", "Update", "{", "return", "&", "update", "{", "username", ":", "username", ",", "mailbox", ":", "mailbox", ",", "}", "\n", "}" ]
// NewUpdate creates a new update.
[ "NewUpdate", "creates", "a", "new", "update", "." ]
b7db4a2bc5cc04fb568fb036a438da43ee9a9f78
https://github.com/emersion/go-imap/blob/b7db4a2bc5cc04fb568fb036a438da43ee9a9f78/backend/updates.go#L22-L27
148,127
emersion/go-imap
client/client.go
State
func (c *Client) State() imap.ConnState { c.locker.Lock() state := c.state c.locker.Unlock() return state }
go
func (c *Client) State() imap.ConnState { c.locker.Lock() state := c.state c.locker.Unlock() return state }
[ "func", "(", "c", "*", "Client", ")", "State", "(", ")", "imap", ".", "ConnState", "{", "c", ".", "locker", ".", "Lock", "(", ")", "\n", "state", ":=", "c", ".", "state", "\n", "c", ".", "locker", ".", "Unlock", "(", ")", "\n", "return", "state...
// State returns the current connection state.
[ "State", "returns", "the", "current", "connection", "state", "." ]
b7db4a2bc5cc04fb568fb036a438da43ee9a9f78
https://github.com/emersion/go-imap/blob/b7db4a2bc5cc04fb568fb036a438da43ee9a9f78/client/client.go#L278-L283
148,128
emersion/go-imap
client/client.go
Mailbox
func (c *Client) Mailbox() *imap.MailboxStatus { // c.Mailbox fields are not supposed to change, so we can return the pointer. c.locker.Lock() mbox := c.mailbox c.locker.Unlock() return mbox }
go
func (c *Client) Mailbox() *imap.MailboxStatus { // c.Mailbox fields are not supposed to change, so we can return the pointer. c.locker.Lock() mbox := c.mailbox c.locker.Unlock() return mbox }
[ "func", "(", "c", "*", "Client", ")", "Mailbox", "(", ")", "*", "imap", ".", "MailboxStatus", "{", "// c.Mailbox fields are not supposed to change, so we can return the pointer.", "c", ".", "locker", ".", "Lock", "(", ")", "\n", "mbox", ":=", "c", ".", "mailbox"...
// Mailbox returns the selected mailbox. It returns nil if there isn't one.
[ "Mailbox", "returns", "the", "selected", "mailbox", ".", "It", "returns", "nil", "if", "there", "isn", "t", "one", "." ]
b7db4a2bc5cc04fb568fb036a438da43ee9a9f78
https://github.com/emersion/go-imap/blob/b7db4a2bc5cc04fb568fb036a438da43ee9a9f78/client/client.go#L286-L292
148,129
emersion/go-imap
client/client.go
SetState
func (c *Client) SetState(state imap.ConnState, mailbox *imap.MailboxStatus) { c.locker.Lock() c.state = state c.mailbox = mailbox c.locker.Unlock() }
go
func (c *Client) SetState(state imap.ConnState, mailbox *imap.MailboxStatus) { c.locker.Lock() c.state = state c.mailbox = mailbox c.locker.Unlock() }
[ "func", "(", "c", "*", "Client", ")", "SetState", "(", "state", "imap", ".", "ConnState", ",", "mailbox", "*", "imap", ".", "MailboxStatus", ")", "{", "c", ".", "locker", ".", "Lock", "(", ")", "\n", "c", ".", "state", "=", "state", "\n", "c", "....
// SetState sets this connection's internal state. // // This function should not be called directly, it must only be used by // libraries implementing extensions of the IMAP protocol.
[ "SetState", "sets", "this", "connection", "s", "internal", "state", ".", "This", "function", "should", "not", "be", "called", "directly", "it", "must", "only", "be", "used", "by", "libraries", "implementing", "extensions", "of", "the", "IMAP", "protocol", "." ...
b7db4a2bc5cc04fb568fb036a438da43ee9a9f78
https://github.com/emersion/go-imap/blob/b7db4a2bc5cc04fb568fb036a438da43ee9a9f78/client/client.go#L298-L303
148,130
emersion/go-imap
client/client.go
Execute
func (c *Client) Execute(cmdr imap.Commander, h responses.Handler) (*imap.StatusResp, error) { return c.execute(cmdr, h) }
go
func (c *Client) Execute(cmdr imap.Commander, h responses.Handler) (*imap.StatusResp, error) { return c.execute(cmdr, h) }
[ "func", "(", "c", "*", "Client", ")", "Execute", "(", "cmdr", "imap", ".", "Commander", ",", "h", "responses", ".", "Handler", ")", "(", "*", "imap", ".", "StatusResp", ",", "error", ")", "{", "return", "c", ".", "execute", "(", "cmdr", ",", "h", ...
// Execute executes a generic command. cmdr is a value that can be converted to // a raw command and h is a response handler. The function returns when the // command has completed or failed, in this case err is nil. A non-nil err value // indicates a network error. // // This function should not be called directly, it...
[ "Execute", "executes", "a", "generic", "command", ".", "cmdr", "is", "a", "value", "that", "can", "be", "converted", "to", "a", "raw", "command", "and", "h", "is", "a", "response", "handler", ".", "The", "function", "returns", "when", "the", "command", "...
b7db4a2bc5cc04fb568fb036a438da43ee9a9f78
https://github.com/emersion/go-imap/blob/b7db4a2bc5cc04fb568fb036a438da43ee9a9f78/client/client.go#L312-L314
148,131
emersion/go-imap
client/client.go
New
func New(conn net.Conn) (*Client, error) { continues := make(chan bool) w := imap.NewClientWriter(nil, continues) r := imap.NewReader(nil) c := &Client{ conn: imap.NewConn(conn, r, w), replies: make(chan []byte), loggedOut: make(chan struct{}), state: imap.ConnectingState, ErrorLog: log.New(o...
go
func New(conn net.Conn) (*Client, error) { continues := make(chan bool) w := imap.NewClientWriter(nil, continues) r := imap.NewReader(nil) c := &Client{ conn: imap.NewConn(conn, r, w), replies: make(chan []byte), loggedOut: make(chan struct{}), state: imap.ConnectingState, ErrorLog: log.New(o...
[ "func", "New", "(", "conn", "net", ".", "Conn", ")", "(", "*", "Client", ",", "error", ")", "{", "continues", ":=", "make", "(", "chan", "bool", ")", "\n", "w", ":=", "imap", ".", "NewClientWriter", "(", "nil", ",", "continues", ")", "\n", "r", "...
// New creates a new client from an existing connection.
[ "New", "creates", "a", "new", "client", "from", "an", "existing", "connection", "." ]
b7db4a2bc5cc04fb568fb036a438da43ee9a9f78
https://github.com/emersion/go-imap/blob/b7db4a2bc5cc04fb568fb036a438da43ee9a9f78/client/client.go#L558-L575
148,132
emersion/go-imap
client/client.go
Dial
func Dial(addr string) (c *Client, err error) { conn, err := net.Dial("tcp", addr) if err != nil { return } c, err = New(conn) return }
go
func Dial(addr string) (c *Client, err error) { conn, err := net.Dial("tcp", addr) if err != nil { return } c, err = New(conn) return }
[ "func", "Dial", "(", "addr", "string", ")", "(", "c", "*", "Client", ",", "err", "error", ")", "{", "conn", ",", "err", ":=", "net", ".", "Dial", "(", "\"", "\"", ",", "addr", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\n", "}", "\n...
// Dial connects to an IMAP server using an unencrypted connection.
[ "Dial", "connects", "to", "an", "IMAP", "server", "using", "an", "unencrypted", "connection", "." ]
b7db4a2bc5cc04fb568fb036a438da43ee9a9f78
https://github.com/emersion/go-imap/blob/b7db4a2bc5cc04fb568fb036a438da43ee9a9f78/client/client.go#L578-L586
148,133
emersion/go-imap
client/client.go
DialWithDialer
func DialWithDialer(dialer *net.Dialer, address string) (c *Client, err error) { conn, err := dialer.Dial("tcp", address) if err != nil { return nil, err } // We don't return to the caller until we try to receive a greeting. As such, // there is no way to set the client's Timeout for that action. As a // worka...
go
func DialWithDialer(dialer *net.Dialer, address string) (c *Client, err error) { conn, err := dialer.Dial("tcp", address) if err != nil { return nil, err } // We don't return to the caller until we try to receive a greeting. As such, // there is no way to set the client's Timeout for that action. As a // worka...
[ "func", "DialWithDialer", "(", "dialer", "*", "net", ".", "Dialer", ",", "address", "string", ")", "(", "c", "*", "Client", ",", "err", "error", ")", "{", "conn", ",", "err", ":=", "dialer", ".", "Dial", "(", "\"", "\"", ",", "address", ")", "\n", ...
// DialWithDialer connects to an IMAP server using an unencrypted connection // using dialer.Dial. // // Among other uses, this allows to apply a dial timeout.
[ "DialWithDialer", "connects", "to", "an", "IMAP", "server", "using", "an", "unencrypted", "connection", "using", "dialer", ".", "Dial", ".", "Among", "other", "uses", "this", "allows", "to", "apply", "a", "dial", "timeout", "." ]
b7db4a2bc5cc04fb568fb036a438da43ee9a9f78
https://github.com/emersion/go-imap/blob/b7db4a2bc5cc04fb568fb036a438da43ee9a9f78/client/client.go#L592-L611
148,134
emersion/go-imap
client/client.go
DialTLS
func DialTLS(addr string, tlsConfig *tls.Config) (c *Client, err error) { conn, err := tls.Dial("tcp", addr, tlsConfig) if err != nil { return } c, err = New(conn) c.isTLS = true return }
go
func DialTLS(addr string, tlsConfig *tls.Config) (c *Client, err error) { conn, err := tls.Dial("tcp", addr, tlsConfig) if err != nil { return } c, err = New(conn) c.isTLS = true return }
[ "func", "DialTLS", "(", "addr", "string", ",", "tlsConfig", "*", "tls", ".", "Config", ")", "(", "c", "*", "Client", ",", "err", "error", ")", "{", "conn", ",", "err", ":=", "tls", ".", "Dial", "(", "\"", "\"", ",", "addr", ",", "tlsConfig", ")",...
// DialTLS connects to an IMAP server using an encrypted connection.
[ "DialTLS", "connects", "to", "an", "IMAP", "server", "using", "an", "encrypted", "connection", "." ]
b7db4a2bc5cc04fb568fb036a438da43ee9a9f78
https://github.com/emersion/go-imap/blob/b7db4a2bc5cc04fb568fb036a438da43ee9a9f78/client/client.go#L614-L623
148,135
emersion/go-imap
client/client.go
DialWithDialerTLS
func DialWithDialerTLS(dialer *net.Dialer, addr string, tlsConfig *tls.Config) (c *Client, err error) { conn, err := tls.DialWithDialer(dialer, "tcp", addr, tlsConfig) if err != nil { return } // We don't return to the caller until we try to receive a greeting. As such, // there is no way to set the client's T...
go
func DialWithDialerTLS(dialer *net.Dialer, addr string, tlsConfig *tls.Config) (c *Client, err error) { conn, err := tls.DialWithDialer(dialer, "tcp", addr, tlsConfig) if err != nil { return } // We don't return to the caller until we try to receive a greeting. As such, // there is no way to set the client's T...
[ "func", "DialWithDialerTLS", "(", "dialer", "*", "net", ".", "Dialer", ",", "addr", "string", ",", "tlsConfig", "*", "tls", ".", "Config", ")", "(", "c", "*", "Client", ",", "err", "error", ")", "{", "conn", ",", "err", ":=", "tls", ".", "DialWithDia...
// DialWithDialerTLS connects to an IMAP server using an encrypted connection // using dialer.Dial. // // Among other uses, this allows to apply a dial timeout.
[ "DialWithDialerTLS", "connects", "to", "an", "IMAP", "server", "using", "an", "encrypted", "connection", "using", "dialer", ".", "Dial", ".", "Among", "other", "uses", "this", "allows", "to", "apply", "a", "dial", "timeout", "." ]
b7db4a2bc5cc04fb568fb036a438da43ee9a9f78
https://github.com/emersion/go-imap/blob/b7db4a2bc5cc04fb568fb036a438da43ee9a9f78/client/client.go#L629-L650
148,136
emersion/go-imap
write.go
FormatStringList
func FormatStringList(list []string) (fields []interface{}) { fields = make([]interface{}, len(list)) for i, v := range list { fields[i] = v } return }
go
func FormatStringList(list []string) (fields []interface{}) { fields = make([]interface{}, len(list)) for i, v := range list { fields[i] = v } return }
[ "func", "FormatStringList", "(", "list", "[", "]", "string", ")", "(", "fields", "[", "]", "interface", "{", "}", ")", "{", "fields", "=", "make", "(", "[", "]", "interface", "{", "}", ",", "len", "(", "list", ")", ")", "\n", "for", "i", ",", "...
// Convert a string list to a field list.
[ "Convert", "a", "string", "list", "to", "a", "field", "list", "." ]
b7db4a2bc5cc04fb568fb036a438da43ee9a9f78
https://github.com/emersion/go-imap/blob/b7db4a2bc5cc04fb568fb036a438da43ee9a9f78/write.go#L33-L39
148,137
emersion/go-imap
write.go
isAscii
func isAscii(s string) bool { for _, c := range s { if c > unicode.MaxASCII || unicode.IsControl(c) { return false } } return true }
go
func isAscii(s string) bool { for _, c := range s { if c > unicode.MaxASCII || unicode.IsControl(c) { return false } } return true }
[ "func", "isAscii", "(", "s", "string", ")", "bool", "{", "for", "_", ",", "c", ":=", "range", "s", "{", "if", "c", ">", "unicode", ".", "MaxASCII", "||", "unicode", ".", "IsControl", "(", "c", ")", "{", "return", "false", "\n", "}", "\n", "}", ...
// Check if a string is 8-bit clean.
[ "Check", "if", "a", "string", "is", "8", "-", "bit", "clean", "." ]
b7db4a2bc5cc04fb568fb036a438da43ee9a9f78
https://github.com/emersion/go-imap/blob/b7db4a2bc5cc04fb568fb036a438da43ee9a9f78/write.go#L42-L49
148,138
emersion/go-imap
write.go
writeString
func (w *Writer) writeString(s string) error { _, err := io.WriteString(w.Writer, s) return err }
go
func (w *Writer) writeString(s string) error { _, err := io.WriteString(w.Writer, s) return err }
[ "func", "(", "w", "*", "Writer", ")", "writeString", "(", "s", "string", ")", "error", "{", "_", ",", "err", ":=", "io", ".", "WriteString", "(", "w", ".", "Writer", ",", "s", ")", "\n", "return", "err", "\n", "}" ]
// Helper function to write a string to w.
[ "Helper", "function", "to", "write", "a", "string", "to", "w", "." ]
b7db4a2bc5cc04fb568fb036a438da43ee9a9f78
https://github.com/emersion/go-imap/blob/b7db4a2bc5cc04fb568fb036a438da43ee9a9f78/write.go#L59-L62
148,139
emersion/go-imap
utf7/decoder.go
decode
func decode(b64 []byte) []byte { var b []byte // Allocate a single block of memory large enough to store the Base64 data // (if padding is required), UTF-16-BE bytes, and decoded UTF-8 bytes. // Since a 2-byte UTF-16 sequence may expand into a 3-byte UTF-8 sequence, // double the space allocation for UTF-8. if n...
go
func decode(b64 []byte) []byte { var b []byte // Allocate a single block of memory large enough to store the Base64 data // (if padding is required), UTF-16-BE bytes, and decoded UTF-8 bytes. // Since a 2-byte UTF-16 sequence may expand into a 3-byte UTF-8 sequence, // double the space allocation for UTF-8. if n...
[ "func", "decode", "(", "b64", "[", "]", "byte", ")", "[", "]", "byte", "{", "var", "b", "[", "]", "byte", "\n\n", "// Allocate a single block of memory large enough to store the Base64 data", "// (if padding is required), UTF-16-BE bytes, and decoded UTF-8 bytes.", "// Since ...
// Extracts UTF-16-BE bytes from base64 data and converts them to UTF-8. // A nil slice is returned if the encoding is invalid.
[ "Extracts", "UTF", "-", "16", "-", "BE", "bytes", "from", "base64", "data", "and", "converts", "them", "to", "UTF", "-", "8", ".", "A", "nil", "slice", "is", "returned", "if", "the", "encoding", "is", "invalid", "." ]
b7db4a2bc5cc04fb568fb036a438da43ee9a9f78
https://github.com/emersion/go-imap/blob/b7db4a2bc5cc04fb568fb036a438da43ee9a9f78/utf7/decoder.go#L105-L148
148,140
emersion/go-imap
imap.go
Expand
func (item FetchItem) Expand() []FetchItem { switch item { case FetchAll: return []FetchItem{FetchFlags, FetchInternalDate, FetchRFC822Size, FetchEnvelope} case FetchFast: return []FetchItem{FetchFlags, FetchInternalDate, FetchRFC822Size} case FetchFull: return []FetchItem{FetchFlags, FetchInternalDate, Fetch...
go
func (item FetchItem) Expand() []FetchItem { switch item { case FetchAll: return []FetchItem{FetchFlags, FetchInternalDate, FetchRFC822Size, FetchEnvelope} case FetchFast: return []FetchItem{FetchFlags, FetchInternalDate, FetchRFC822Size} case FetchFull: return []FetchItem{FetchFlags, FetchInternalDate, Fetch...
[ "func", "(", "item", "FetchItem", ")", "Expand", "(", ")", "[", "]", "FetchItem", "{", "switch", "item", "{", "case", "FetchAll", ":", "return", "[", "]", "FetchItem", "{", "FetchFlags", ",", "FetchInternalDate", ",", "FetchRFC822Size", ",", "FetchEnvelope",...
// Expand expands the item if it's a macro.
[ "Expand", "expands", "the", "item", "if", "it", "s", "a", "macro", "." ]
b7db4a2bc5cc04fb568fb036a438da43ee9a9f78
https://github.com/emersion/go-imap/blob/b7db4a2bc5cc04fb568fb036a438da43ee9a9f78/imap.go#L46-L57
148,141
emersion/go-imap
imap.go
FormatFlagsOp
func FormatFlagsOp(op FlagsOp, silent bool) StoreItem { s := string(op) if silent { s += silentOp } return StoreItem(s) }
go
func FormatFlagsOp(op FlagsOp, silent bool) StoreItem { s := string(op) if silent { s += silentOp } return StoreItem(s) }
[ "func", "FormatFlagsOp", "(", "op", "FlagsOp", ",", "silent", "bool", ")", "StoreItem", "{", "s", ":=", "string", "(", "op", ")", "\n", "if", "silent", "{", "s", "+=", "silentOp", "\n", "}", "\n", "return", "StoreItem", "(", "s", ")", "\n", "}" ]
// FormatFlagsOp returns the StoreItem that executes the flags operation op.
[ "FormatFlagsOp", "returns", "the", "StoreItem", "that", "executes", "the", "flags", "operation", "op", "." ]
b7db4a2bc5cc04fb568fb036a438da43ee9a9f78
https://github.com/emersion/go-imap/blob/b7db4a2bc5cc04fb568fb036a438da43ee9a9f78/imap.go#L79-L85
148,142
emersion/go-imap
imap.go
ParseFlagsOp
func ParseFlagsOp(item StoreItem) (op FlagsOp, silent bool, err error) { itemStr := string(item) silent = strings.HasSuffix(itemStr, silentOp) if silent { itemStr = strings.TrimSuffix(itemStr, silentOp) } op = FlagsOp(itemStr) if op != SetFlags && op != AddFlags && op != RemoveFlags { err = errors.New("Unsup...
go
func ParseFlagsOp(item StoreItem) (op FlagsOp, silent bool, err error) { itemStr := string(item) silent = strings.HasSuffix(itemStr, silentOp) if silent { itemStr = strings.TrimSuffix(itemStr, silentOp) } op = FlagsOp(itemStr) if op != SetFlags && op != AddFlags && op != RemoveFlags { err = errors.New("Unsup...
[ "func", "ParseFlagsOp", "(", "item", "StoreItem", ")", "(", "op", "FlagsOp", ",", "silent", "bool", ",", "err", "error", ")", "{", "itemStr", ":=", "string", "(", "item", ")", "\n", "silent", "=", "strings", ".", "HasSuffix", "(", "itemStr", ",", "sile...
// ParseFlagsOp parses a flags operation from StoreItem.
[ "ParseFlagsOp", "parses", "a", "flags", "operation", "from", "StoreItem", "." ]
b7db4a2bc5cc04fb568fb036a438da43ee9a9f78
https://github.com/emersion/go-imap/blob/b7db4a2bc5cc04fb568fb036a438da43ee9a9f78/imap.go#L88-L100
148,143
emersion/go-imap
client/cmd_any.go
Capability
func (c *Client) Capability() (map[string]bool, error) { cmd := &commands.Capability{} if status, err := c.execute(cmd, nil); err != nil { return nil, err } else if err := status.Err(); err != nil { return nil, err } c.locker.Lock() caps := c.caps c.locker.Unlock() return caps, nil }
go
func (c *Client) Capability() (map[string]bool, error) { cmd := &commands.Capability{} if status, err := c.execute(cmd, nil); err != nil { return nil, err } else if err := status.Err(); err != nil { return nil, err } c.locker.Lock() caps := c.caps c.locker.Unlock() return caps, nil }
[ "func", "(", "c", "*", "Client", ")", "Capability", "(", ")", "(", "map", "[", "string", "]", "bool", ",", "error", ")", "{", "cmd", ":=", "&", "commands", ".", "Capability", "{", "}", "\n\n", "if", "status", ",", "err", ":=", "c", ".", "execute"...
// Capability requests a listing of capabilities that the server supports. // Capabilities are often returned by the server with the greeting or with the // STARTTLS and LOGIN responses, so usually explicitly requesting capabilities // isn't needed. // // Most of the time, Support should be used instead.
[ "Capability", "requests", "a", "listing", "of", "capabilities", "that", "the", "server", "supports", ".", "Capabilities", "are", "often", "returned", "by", "the", "server", "with", "the", "greeting", "or", "with", "the", "STARTTLS", "and", "LOGIN", "responses", ...
b7db4a2bc5cc04fb568fb036a438da43ee9a9f78
https://github.com/emersion/go-imap/blob/b7db4a2bc5cc04fb568fb036a438da43ee9a9f78/client/cmd_any.go#L20-L33
148,144
emersion/go-imap
client/cmd_any.go
Support
func (c *Client) Support(cap string) (bool, error) { c.locker.Lock() ok := c.caps != nil c.locker.Unlock() // If capabilities are not cached, request them if !ok { if _, err := c.Capability(); err != nil { return false, err } } c.locker.Lock() supported := c.caps[cap] c.locker.Unlock() return support...
go
func (c *Client) Support(cap string) (bool, error) { c.locker.Lock() ok := c.caps != nil c.locker.Unlock() // If capabilities are not cached, request them if !ok { if _, err := c.Capability(); err != nil { return false, err } } c.locker.Lock() supported := c.caps[cap] c.locker.Unlock() return support...
[ "func", "(", "c", "*", "Client", ")", "Support", "(", "cap", "string", ")", "(", "bool", ",", "error", ")", "{", "c", ".", "locker", ".", "Lock", "(", ")", "\n", "ok", ":=", "c", ".", "caps", "!=", "nil", "\n", "c", ".", "locker", ".", "Unloc...
// Support checks if cap is a capability supported by the server. If the server // hasn't sent its capabilities yet, Support requests them.
[ "Support", "checks", "if", "cap", "is", "a", "capability", "supported", "by", "the", "server", ".", "If", "the", "server", "hasn", "t", "sent", "its", "capabilities", "yet", "Support", "requests", "them", "." ]
b7db4a2bc5cc04fb568fb036a438da43ee9a9f78
https://github.com/emersion/go-imap/blob/b7db4a2bc5cc04fb568fb036a438da43ee9a9f78/client/cmd_any.go#L37-L53
148,145
emersion/go-imap
client/cmd_any.go
Noop
func (c *Client) Noop() error { cmd := new(commands.Noop) status, err := c.execute(cmd, nil) if err != nil { return err } return status.Err() }
go
func (c *Client) Noop() error { cmd := new(commands.Noop) status, err := c.execute(cmd, nil) if err != nil { return err } return status.Err() }
[ "func", "(", "c", "*", "Client", ")", "Noop", "(", ")", "error", "{", "cmd", ":=", "new", "(", "commands", ".", "Noop", ")", "\n\n", "status", ",", "err", ":=", "c", ".", "execute", "(", "cmd", ",", "nil", ")", "\n", "if", "err", "!=", "nil", ...
// Noop always succeeds and does nothing. // // It can be used as a periodic poll for new messages or message status updates // during a period of inactivity. It can also be used to reset any inactivity // autologout timer on the server.
[ "Noop", "always", "succeeds", "and", "does", "nothing", ".", "It", "can", "be", "used", "as", "a", "periodic", "poll", "for", "new", "messages", "or", "message", "status", "updates", "during", "a", "period", "of", "inactivity", ".", "It", "can", "also", ...
b7db4a2bc5cc04fb568fb036a438da43ee9a9f78
https://github.com/emersion/go-imap/blob/b7db4a2bc5cc04fb568fb036a438da43ee9a9f78/client/cmd_any.go#L60-L68
148,146
emersion/go-imap
client/cmd_any.go
Logout
func (c *Client) Logout() error { if c.State() == imap.LogoutState { return ErrAlreadyLoggedOut } cmd := new(commands.Logout) if status, err := c.execute(cmd, nil); err == errClosed { // Server closed connection, that's what we want anyway return nil } else if err != nil { return err } else if status !=...
go
func (c *Client) Logout() error { if c.State() == imap.LogoutState { return ErrAlreadyLoggedOut } cmd := new(commands.Logout) if status, err := c.execute(cmd, nil); err == errClosed { // Server closed connection, that's what we want anyway return nil } else if err != nil { return err } else if status !=...
[ "func", "(", "c", "*", "Client", ")", "Logout", "(", ")", "error", "{", "if", "c", ".", "State", "(", ")", "==", "imap", ".", "LogoutState", "{", "return", "ErrAlreadyLoggedOut", "\n", "}", "\n\n", "cmd", ":=", "new", "(", "commands", ".", "Logout", ...
// Logout gracefully closes the connection.
[ "Logout", "gracefully", "closes", "the", "connection", "." ]
b7db4a2bc5cc04fb568fb036a438da43ee9a9f78
https://github.com/emersion/go-imap/blob/b7db4a2bc5cc04fb568fb036a438da43ee9a9f78/client/cmd_any.go#L71-L87
148,147
emersion/go-imap
client/cmd_selected.go
Check
func (c *Client) Check() error { if c.State() != imap.SelectedState { return ErrNoMailboxSelected } cmd := new(commands.Check) status, err := c.execute(cmd, nil) if err != nil { return err } return status.Err() }
go
func (c *Client) Check() error { if c.State() != imap.SelectedState { return ErrNoMailboxSelected } cmd := new(commands.Check) status, err := c.execute(cmd, nil) if err != nil { return err } return status.Err() }
[ "func", "(", "c", "*", "Client", ")", "Check", "(", ")", "error", "{", "if", "c", ".", "State", "(", ")", "!=", "imap", ".", "SelectedState", "{", "return", "ErrNoMailboxSelected", "\n", "}", "\n\n", "cmd", ":=", "new", "(", "commands", ".", "Check",...
// Check requests a checkpoint of the currently selected mailbox. A checkpoint // refers to any implementation-dependent housekeeping associated with the // mailbox that is not normally executed as part of each command.
[ "Check", "requests", "a", "checkpoint", "of", "the", "currently", "selected", "mailbox", ".", "A", "checkpoint", "refers", "to", "any", "implementation", "-", "dependent", "housekeeping", "associated", "with", "the", "mailbox", "that", "is", "not", "normally", "...
b7db4a2bc5cc04fb568fb036a438da43ee9a9f78
https://github.com/emersion/go-imap/blob/b7db4a2bc5cc04fb568fb036a438da43ee9a9f78/client/cmd_selected.go#L18-L31
148,148
emersion/go-imap
client/cmd_selected.go
Close
func (c *Client) Close() error { if c.State() != imap.SelectedState { return ErrNoMailboxSelected } cmd := new(commands.Close) status, err := c.execute(cmd, nil) if err != nil { return err } else if err := status.Err(); err != nil { return err } c.locker.Lock() c.state = imap.AuthenticatedState c.mai...
go
func (c *Client) Close() error { if c.State() != imap.SelectedState { return ErrNoMailboxSelected } cmd := new(commands.Close) status, err := c.execute(cmd, nil) if err != nil { return err } else if err := status.Err(); err != nil { return err } c.locker.Lock() c.state = imap.AuthenticatedState c.mai...
[ "func", "(", "c", "*", "Client", ")", "Close", "(", ")", "error", "{", "if", "c", ".", "State", "(", ")", "!=", "imap", ".", "SelectedState", "{", "return", "ErrNoMailboxSelected", "\n", "}", "\n\n", "cmd", ":=", "new", "(", "commands", ".", "Close",...
// Close permanently removes all messages that have the \Deleted flag set from // the currently selected mailbox, and returns to the authenticated state from // the selected state.
[ "Close", "permanently", "removes", "all", "messages", "that", "have", "the", "\\", "Deleted", "flag", "set", "from", "the", "currently", "selected", "mailbox", "and", "returns", "to", "the", "authenticated", "state", "from", "the", "selected", "state", "." ]
b7db4a2bc5cc04fb568fb036a438da43ee9a9f78
https://github.com/emersion/go-imap/blob/b7db4a2bc5cc04fb568fb036a438da43ee9a9f78/client/cmd_selected.go#L36-L55
148,149
emersion/go-imap
client/cmd_selected.go
Expunge
func (c *Client) Expunge(ch chan uint32) error { if c.State() != imap.SelectedState { return ErrNoMailboxSelected } cmd := new(commands.Expunge) var h responses.Handler if ch != nil { h = &responses.Expunge{SeqNums: ch} defer close(ch) } status, err := c.execute(cmd, h) if err != nil { return err } ...
go
func (c *Client) Expunge(ch chan uint32) error { if c.State() != imap.SelectedState { return ErrNoMailboxSelected } cmd := new(commands.Expunge) var h responses.Handler if ch != nil { h = &responses.Expunge{SeqNums: ch} defer close(ch) } status, err := c.execute(cmd, h) if err != nil { return err } ...
[ "func", "(", "c", "*", "Client", ")", "Expunge", "(", "ch", "chan", "uint32", ")", "error", "{", "if", "c", ".", "State", "(", ")", "!=", "imap", ".", "SelectedState", "{", "return", "ErrNoMailboxSelected", "\n", "}", "\n\n", "cmd", ":=", "new", "(",...
// Expunge permanently removes all messages that have the \Deleted flag set from // the currently selected mailbox. If ch is not nil, sends sequence IDs of each // deleted message to this channel.
[ "Expunge", "permanently", "removes", "all", "messages", "that", "have", "the", "\\", "Deleted", "flag", "set", "from", "the", "currently", "selected", "mailbox", ".", "If", "ch", "is", "not", "nil", "sends", "sequence", "IDs", "of", "each", "deleted", "messa...
b7db4a2bc5cc04fb568fb036a438da43ee9a9f78
https://github.com/emersion/go-imap/blob/b7db4a2bc5cc04fb568fb036a438da43ee9a9f78/client/cmd_selected.go#L65-L83
148,150
emersion/go-imap
client/cmd_selected.go
UidSearch
func (c *Client) UidSearch(criteria *imap.SearchCriteria) (uids []uint32, err error) { return c.search(true, criteria) }
go
func (c *Client) UidSearch(criteria *imap.SearchCriteria) (uids []uint32, err error) { return c.search(true, criteria) }
[ "func", "(", "c", "*", "Client", ")", "UidSearch", "(", "criteria", "*", "imap", ".", "SearchCriteria", ")", "(", "uids", "[", "]", "uint32", ",", "err", "error", ")", "{", "return", "c", ".", "search", "(", "true", ",", "criteria", ")", "\n", "}" ...
// UidSearch is identical to Search, but UIDs are returned instead of message // sequence numbers.
[ "UidSearch", "is", "identical", "to", "Search", "but", "UIDs", "are", "returned", "instead", "of", "message", "sequence", "numbers", "." ]
b7db4a2bc5cc04fb568fb036a438da43ee9a9f78
https://github.com/emersion/go-imap/blob/b7db4a2bc5cc04fb568fb036a438da43ee9a9f78/client/cmd_selected.go#L132-L134
148,151
emersion/go-imap
client/cmd_selected.go
Fetch
func (c *Client) Fetch(seqset *imap.SeqSet, items []imap.FetchItem, ch chan *imap.Message) error { return c.fetch(false, seqset, items, ch) }
go
func (c *Client) Fetch(seqset *imap.SeqSet, items []imap.FetchItem, ch chan *imap.Message) error { return c.fetch(false, seqset, items, ch) }
[ "func", "(", "c", "*", "Client", ")", "Fetch", "(", "seqset", "*", "imap", ".", "SeqSet", ",", "items", "[", "]", "imap", ".", "FetchItem", ",", "ch", "chan", "*", "imap", ".", "Message", ")", "error", "{", "return", "c", ".", "fetch", "(", "fals...
// Fetch retrieves data associated with a message in the mailbox. See RFC 3501 // section 6.4.5 for a list of items that can be requested.
[ "Fetch", "retrieves", "data", "associated", "with", "a", "message", "in", "the", "mailbox", ".", "See", "RFC", "3501", "section", "6", ".", "4", ".", "5", "for", "a", "list", "of", "items", "that", "can", "be", "requested", "." ]
b7db4a2bc5cc04fb568fb036a438da43ee9a9f78
https://github.com/emersion/go-imap/blob/b7db4a2bc5cc04fb568fb036a438da43ee9a9f78/client/cmd_selected.go#L162-L164
148,152
emersion/go-imap
client/cmd_selected.go
UidFetch
func (c *Client) UidFetch(seqset *imap.SeqSet, items []imap.FetchItem, ch chan *imap.Message) error { return c.fetch(true, seqset, items, ch) }
go
func (c *Client) UidFetch(seqset *imap.SeqSet, items []imap.FetchItem, ch chan *imap.Message) error { return c.fetch(true, seqset, items, ch) }
[ "func", "(", "c", "*", "Client", ")", "UidFetch", "(", "seqset", "*", "imap", ".", "SeqSet", ",", "items", "[", "]", "imap", ".", "FetchItem", ",", "ch", "chan", "*", "imap", ".", "Message", ")", "error", "{", "return", "c", ".", "fetch", "(", "t...
// UidFetch is identical to Fetch, but seqset is interpreted as containing // unique identifiers instead of message sequence numbers.
[ "UidFetch", "is", "identical", "to", "Fetch", "but", "seqset", "is", "interpreted", "as", "containing", "unique", "identifiers", "instead", "of", "message", "sequence", "numbers", "." ]
b7db4a2bc5cc04fb568fb036a438da43ee9a9f78
https://github.com/emersion/go-imap/blob/b7db4a2bc5cc04fb568fb036a438da43ee9a9f78/client/cmd_selected.go#L168-L170
148,153
emersion/go-imap
client/cmd_selected.go
Store
func (c *Client) Store(seqset *imap.SeqSet, item imap.StoreItem, value interface{}, ch chan *imap.Message) error { return c.store(false, seqset, item, value, ch) }
go
func (c *Client) Store(seqset *imap.SeqSet, item imap.StoreItem, value interface{}, ch chan *imap.Message) error { return c.store(false, seqset, item, value, ch) }
[ "func", "(", "c", "*", "Client", ")", "Store", "(", "seqset", "*", "imap", ".", "SeqSet", ",", "item", "imap", ".", "StoreItem", ",", "value", "interface", "{", "}", ",", "ch", "chan", "*", "imap", ".", "Message", ")", "error", "{", "return", "c", ...
// Store alters data associated with a message in the mailbox. If ch is not nil, // the updated value of the data will be sent to this channel. See RFC 3501 // section 6.4.6 for a list of items that can be updated.
[ "Store", "alters", "data", "associated", "with", "a", "message", "in", "the", "mailbox", ".", "If", "ch", "is", "not", "nil", "the", "updated", "value", "of", "the", "data", "will", "be", "sent", "to", "this", "channel", ".", "See", "RFC", "3501", "sec...
b7db4a2bc5cc04fb568fb036a438da43ee9a9f78
https://github.com/emersion/go-imap/blob/b7db4a2bc5cc04fb568fb036a438da43ee9a9f78/client/cmd_selected.go#L220-L222
148,154
emersion/go-imap
client/cmd_selected.go
UidStore
func (c *Client) UidStore(seqset *imap.SeqSet, item imap.StoreItem, value interface{}, ch chan *imap.Message) error { return c.store(true, seqset, item, value, ch) }
go
func (c *Client) UidStore(seqset *imap.SeqSet, item imap.StoreItem, value interface{}, ch chan *imap.Message) error { return c.store(true, seqset, item, value, ch) }
[ "func", "(", "c", "*", "Client", ")", "UidStore", "(", "seqset", "*", "imap", ".", "SeqSet", ",", "item", "imap", ".", "StoreItem", ",", "value", "interface", "{", "}", ",", "ch", "chan", "*", "imap", ".", "Message", ")", "error", "{", "return", "c...
// UidStore is identical to Store, but seqset is interpreted as containing // unique identifiers instead of message sequence numbers.
[ "UidStore", "is", "identical", "to", "Store", "but", "seqset", "is", "interpreted", "as", "containing", "unique", "identifiers", "instead", "of", "message", "sequence", "numbers", "." ]
b7db4a2bc5cc04fb568fb036a438da43ee9a9f78
https://github.com/emersion/go-imap/blob/b7db4a2bc5cc04fb568fb036a438da43ee9a9f78/client/cmd_selected.go#L226-L228
148,155
emersion/go-imap
client/cmd_selected.go
UidCopy
func (c *Client) UidCopy(seqset *imap.SeqSet, dest string) error { return c.copy(true, seqset, dest) }
go
func (c *Client) UidCopy(seqset *imap.SeqSet, dest string) error { return c.copy(true, seqset, dest) }
[ "func", "(", "c", "*", "Client", ")", "UidCopy", "(", "seqset", "*", "imap", ".", "SeqSet", ",", "dest", "string", ")", "error", "{", "return", "c", ".", "copy", "(", "true", ",", "seqset", ",", "dest", ")", "\n", "}" ]
// UidCopy is identical to Copy, but seqset is interpreted as containing unique // identifiers instead of message sequence numbers.
[ "UidCopy", "is", "identical", "to", "Copy", "but", "seqset", "is", "interpreted", "as", "containing", "unique", "identifiers", "instead", "of", "message", "sequence", "numbers", "." ]
b7db4a2bc5cc04fb568fb036a438da43ee9a9f78
https://github.com/emersion/go-imap/blob/b7db4a2bc5cc04fb568fb036a438da43ee9a9f78/client/cmd_selected.go#L258-L260
148,156
emersion/go-imap
conn.go
NewDebugWriter
func NewDebugWriter(local, remote io.Writer) io.Writer { return &debugWriter{Writer: local, local: local, remote: remote} }
go
func NewDebugWriter(local, remote io.Writer) io.Writer { return &debugWriter{Writer: local, local: local, remote: remote} }
[ "func", "NewDebugWriter", "(", "local", ",", "remote", "io", ".", "Writer", ")", "io", ".", "Writer", "{", "return", "&", "debugWriter", "{", "Writer", ":", "local", ",", "local", ":", "local", ",", "remote", ":", "remote", "}", "\n", "}" ]
// NewDebugWriter creates a new io.Writer that will write local network activity // to local and remote network activity to remote.
[ "NewDebugWriter", "creates", "a", "new", "io", ".", "Writer", "that", "will", "write", "local", "network", "activity", "to", "local", "and", "remote", "network", "activity", "to", "remote", "." ]
b7db4a2bc5cc04fb568fb036a438da43ee9a9f78
https://github.com/emersion/go-imap/blob/b7db4a2bc5cc04fb568fb036a438da43ee9a9f78/conn.go#L117-L119
148,157
emersion/go-imap
conn.go
NewConn
func NewConn(conn net.Conn, r *Reader, w *Writer) *Conn { c := &Conn{Conn: conn, Reader: r, Writer: w} c.init() return c }
go
func NewConn(conn net.Conn, r *Reader, w *Writer) *Conn { c := &Conn{Conn: conn, Reader: r, Writer: w} c.init() return c }
[ "func", "NewConn", "(", "conn", "net", ".", "Conn", ",", "r", "*", "Reader", ",", "w", "*", "Writer", ")", "*", "Conn", "{", "c", ":=", "&", "Conn", "{", "Conn", ":", "conn", ",", "Reader", ":", "r", ",", "Writer", ":", "w", "}", "\n\n", "c",...
// NewConn creates a new IMAP connection.
[ "NewConn", "creates", "a", "new", "IMAP", "connection", "." ]
b7db4a2bc5cc04fb568fb036a438da43ee9a9f78
https://github.com/emersion/go-imap/blob/b7db4a2bc5cc04fb568fb036a438da43ee9a9f78/conn.go#L154-L159
148,158
emersion/go-imap
seqset.go
Less
func (s Seq) Less(q uint32) bool { return (s.Stop < q || q == 0) && s.Stop != 0 }
go
func (s Seq) Less(q uint32) bool { return (s.Stop < q || q == 0) && s.Stop != 0 }
[ "func", "(", "s", "Seq", ")", "Less", "(", "q", "uint32", ")", "bool", "{", "return", "(", "s", ".", "Stop", "<", "q", "||", "q", "==", "0", ")", "&&", "s", ".", "Stop", "!=", "0", "\n", "}" ]
// Less returns true if s precedes and does not contain seq-number q.
[ "Less", "returns", "true", "if", "s", "precedes", "and", "does", "not", "contain", "seq", "-", "number", "q", "." ]
b7db4a2bc5cc04fb568fb036a438da43ee9a9f78
https://github.com/emersion/go-imap/blob/b7db4a2bc5cc04fb568fb036a438da43ee9a9f78/seqset.go#L65-L67
148,159
emersion/go-imap
seqset.go
Merge
func (s Seq) Merge(t Seq) (union Seq, ok bool) { if union = s; s == t { ok = true return } if s.Start != 0 && t.Start != 0 { // s and t are any combination of "n", "n:m", or "n:*" if s.Start > t.Start { s, t = t, s } // s starts at or before t, check where it ends if (s.Stop >= t.Stop && t.Stop != 0...
go
func (s Seq) Merge(t Seq) (union Seq, ok bool) { if union = s; s == t { ok = true return } if s.Start != 0 && t.Start != 0 { // s and t are any combination of "n", "n:m", or "n:*" if s.Start > t.Start { s, t = t, s } // s starts at or before t, check where it ends if (s.Stop >= t.Stop && t.Stop != 0...
[ "func", "(", "s", "Seq", ")", "Merge", "(", "t", "Seq", ")", "(", "union", "Seq", ",", "ok", "bool", ")", "{", "if", "union", "=", "s", ";", "s", "==", "t", "{", "ok", "=", "true", "\n", "return", "\n", "}", "\n", "if", "s", ".", "Start", ...
// Merge combines sequence values s and t into a single union if the two // intersect or one is a superset of the other. The order of s and t does not // matter. If the values cannot be merged, s is returned unmodified and ok is // set to false.
[ "Merge", "combines", "sequence", "values", "s", "and", "t", "into", "a", "single", "union", "if", "the", "two", "intersect", "or", "one", "is", "a", "superset", "of", "the", "other", ".", "The", "order", "of", "s", "and", "t", "does", "not", "matter", ...
b7db4a2bc5cc04fb568fb036a438da43ee9a9f78
https://github.com/emersion/go-imap/blob/b7db4a2bc5cc04fb568fb036a438da43ee9a9f78/seqset.go#L73-L102
148,160
emersion/go-imap
seqset.go
String
func (s Seq) String() string { if s.Start == s.Stop { if s.Start == 0 { return "*" } return strconv.FormatUint(uint64(s.Start), 10) } b := strconv.AppendUint(make([]byte, 0, 24), uint64(s.Start), 10) if s.Stop == 0 { return string(append(b, ':', '*')) } return string(strconv.AppendUint(append(b, ':'), ...
go
func (s Seq) String() string { if s.Start == s.Stop { if s.Start == 0 { return "*" } return strconv.FormatUint(uint64(s.Start), 10) } b := strconv.AppendUint(make([]byte, 0, 24), uint64(s.Start), 10) if s.Stop == 0 { return string(append(b, ':', '*')) } return string(strconv.AppendUint(append(b, ':'), ...
[ "func", "(", "s", "Seq", ")", "String", "(", ")", "string", "{", "if", "s", ".", "Start", "==", "s", ".", "Stop", "{", "if", "s", ".", "Start", "==", "0", "{", "return", "\"", "\"", "\n", "}", "\n", "return", "strconv", ".", "FormatUint", "(", ...
// String returns sequence value s as a seq-number or seq-range string.
[ "String", "returns", "sequence", "value", "s", "as", "a", "seq", "-", "number", "or", "seq", "-", "range", "string", "." ]
b7db4a2bc5cc04fb568fb036a438da43ee9a9f78
https://github.com/emersion/go-imap/blob/b7db4a2bc5cc04fb568fb036a438da43ee9a9f78/seqset.go#L105-L117
148,161
emersion/go-imap
seqset.go
ParseSeqSet
func ParseSeqSet(set string) (s *SeqSet, err error) { s = new(SeqSet) return s, s.Add(set) }
go
func ParseSeqSet(set string) (s *SeqSet, err error) { s = new(SeqSet) return s, s.Add(set) }
[ "func", "ParseSeqSet", "(", "set", "string", ")", "(", "s", "*", "SeqSet", ",", "err", "error", ")", "{", "s", "=", "new", "(", "SeqSet", ")", "\n", "return", "s", ",", "s", ".", "Add", "(", "set", ")", "\n", "}" ]
// ParseSeqSet returns a new SeqSet instance after parsing the set string.
[ "ParseSeqSet", "returns", "a", "new", "SeqSet", "instance", "after", "parsing", "the", "set", "string", "." ]
b7db4a2bc5cc04fb568fb036a438da43ee9a9f78
https://github.com/emersion/go-imap/blob/b7db4a2bc5cc04fb568fb036a438da43ee9a9f78/seqset.go#L126-L129
148,162
emersion/go-imap
seqset.go
Add
func (s *SeqSet) Add(set string) error { for _, sv := range strings.Split(set, ",") { v, err := parseSeq(sv) if err != nil { return err } s.insert(v) } return nil }
go
func (s *SeqSet) Add(set string) error { for _, sv := range strings.Split(set, ",") { v, err := parseSeq(sv) if err != nil { return err } s.insert(v) } return nil }
[ "func", "(", "s", "*", "SeqSet", ")", "Add", "(", "set", "string", ")", "error", "{", "for", "_", ",", "sv", ":=", "range", "strings", ".", "Split", "(", "set", ",", "\"", "\"", ")", "{", "v", ",", "err", ":=", "parseSeq", "(", "sv", ")", "\n...
// Add inserts new sequence values into the set. The string format is described // by RFC 3501 sequence-set ABNF rule. If an error is encountered, all values // inserted successfully prior to the error remain in the set.
[ "Add", "inserts", "new", "sequence", "values", "into", "the", "set", ".", "The", "string", "format", "is", "described", "by", "RFC", "3501", "sequence", "-", "set", "ABNF", "rule", ".", "If", "an", "error", "is", "encountered", "all", "values", "inserted",...
b7db4a2bc5cc04fb568fb036a438da43ee9a9f78
https://github.com/emersion/go-imap/blob/b7db4a2bc5cc04fb568fb036a438da43ee9a9f78/seqset.go#L134-L143
148,163
emersion/go-imap
seqset.go
AddRange
func (s *SeqSet) AddRange(Start, Stop uint32) { if (Stop < Start && Stop != 0) || Start == 0 { s.insert(Seq{Stop, Start}) } else { s.insert(Seq{Start, Stop}) } }
go
func (s *SeqSet) AddRange(Start, Stop uint32) { if (Stop < Start && Stop != 0) || Start == 0 { s.insert(Seq{Stop, Start}) } else { s.insert(Seq{Start, Stop}) } }
[ "func", "(", "s", "*", "SeqSet", ")", "AddRange", "(", "Start", ",", "Stop", "uint32", ")", "{", "if", "(", "Stop", "<", "Start", "&&", "Stop", "!=", "0", ")", "||", "Start", "==", "0", "{", "s", ".", "insert", "(", "Seq", "{", "Stop", ",", "...
// AddRange inserts a new sequence range into the set.
[ "AddRange", "inserts", "a", "new", "sequence", "range", "into", "the", "set", "." ]
b7db4a2bc5cc04fb568fb036a438da43ee9a9f78
https://github.com/emersion/go-imap/blob/b7db4a2bc5cc04fb568fb036a438da43ee9a9f78/seqset.go#L153-L159
148,164
emersion/go-imap
seqset.go
AddSet
func (s *SeqSet) AddSet(t *SeqSet) { for _, v := range t.Set { s.insert(v) } }
go
func (s *SeqSet) AddSet(t *SeqSet) { for _, v := range t.Set { s.insert(v) } }
[ "func", "(", "s", "*", "SeqSet", ")", "AddSet", "(", "t", "*", "SeqSet", ")", "{", "for", "_", ",", "v", ":=", "range", "t", ".", "Set", "{", "s", ".", "insert", "(", "v", ")", "\n", "}", "\n", "}" ]
// AddSet inserts all values from t into s.
[ "AddSet", "inserts", "all", "values", "from", "t", "into", "s", "." ]
b7db4a2bc5cc04fb568fb036a438da43ee9a9f78
https://github.com/emersion/go-imap/blob/b7db4a2bc5cc04fb568fb036a438da43ee9a9f78/seqset.go#L162-L166
148,165
emersion/go-imap
seqset.go
String
func (s SeqSet) String() string { if len(s.Set) == 0 { return "" } b := make([]byte, 0, 64) for _, v := range s.Set { b = append(b, ',') if v.Start == 0 { b = append(b, '*') continue } b = strconv.AppendUint(b, uint64(v.Start), 10) if v.Start != v.Stop { if v.Stop == 0 { b = append(b, ':', ...
go
func (s SeqSet) String() string { if len(s.Set) == 0 { return "" } b := make([]byte, 0, 64) for _, v := range s.Set { b = append(b, ',') if v.Start == 0 { b = append(b, '*') continue } b = strconv.AppendUint(b, uint64(v.Start), 10) if v.Start != v.Stop { if v.Stop == 0 { b = append(b, ':', ...
[ "func", "(", "s", "SeqSet", ")", "String", "(", ")", "string", "{", "if", "len", "(", "s", ".", "Set", ")", "==", "0", "{", "return", "\"", "\"", "\n", "}", "\n", "b", ":=", "make", "(", "[", "]", "byte", ",", "0", ",", "64", ")", "\n", "...
// String returns a sorted representation of all contained sequence values.
[ "String", "returns", "a", "sorted", "representation", "of", "all", "contained", "sequence", "values", "." ]
b7db4a2bc5cc04fb568fb036a438da43ee9a9f78
https://github.com/emersion/go-imap/blob/b7db4a2bc5cc04fb568fb036a438da43ee9a9f78/seqset.go#L196-L217
148,166
emersion/go-imap
seqset.go
insert
func (s *SeqSet) insert(v Seq) { i, _ := s.search(v.Start) merged := false if i > 0 { // try merging with the preceding entry (e.g. "1,4".insert(2), i == 1) s.Set[i-1], merged = s.Set[i-1].Merge(v) } if i == len(s.Set) { // v was either merged with the last entry or needs to be appended if !merged { s.i...
go
func (s *SeqSet) insert(v Seq) { i, _ := s.search(v.Start) merged := false if i > 0 { // try merging with the preceding entry (e.g. "1,4".insert(2), i == 1) s.Set[i-1], merged = s.Set[i-1].Merge(v) } if i == len(s.Set) { // v was either merged with the last entry or needs to be appended if !merged { s.i...
[ "func", "(", "s", "*", "SeqSet", ")", "insert", "(", "v", "Seq", ")", "{", "i", ",", "_", ":=", "s", ".", "search", "(", "v", ".", "Start", ")", "\n", "merged", ":=", "false", "\n", "if", "i", ">", "0", "{", "// try merging with the preceding entry...
// insert adds sequence value v to the set.
[ "insert", "adds", "sequence", "value", "v", "to", "the", "set", "." ]
b7db4a2bc5cc04fb568fb036a438da43ee9a9f78
https://github.com/emersion/go-imap/blob/b7db4a2bc5cc04fb568fb036a438da43ee9a9f78/seqset.go#L220-L251
148,167
emersion/go-imap
seqset.go
insertAt
func (s *SeqSet) insertAt(i int, v Seq) { if n := len(s.Set); i == n { // insert at the end s.Set = append(s.Set, v) return } else if n < cap(s.Set) { // enough space, shift everything at and after i to the right s.Set = s.Set[:n+1] copy(s.Set[i+1:], s.Set[i:]) } else { // allocate new slice and copy e...
go
func (s *SeqSet) insertAt(i int, v Seq) { if n := len(s.Set); i == n { // insert at the end s.Set = append(s.Set, v) return } else if n < cap(s.Set) { // enough space, shift everything at and after i to the right s.Set = s.Set[:n+1] copy(s.Set[i+1:], s.Set[i:]) } else { // allocate new slice and copy e...
[ "func", "(", "s", "*", "SeqSet", ")", "insertAt", "(", "i", "int", ",", "v", "Seq", ")", "{", "if", "n", ":=", "len", "(", "s", ".", "Set", ")", ";", "i", "==", "n", "{", "// insert at the end", "s", ".", "Set", "=", "append", "(", "s", ".", ...
// insertAt inserts a new sequence value v at index i, resizing s.Set as needed.
[ "insertAt", "inserts", "a", "new", "sequence", "value", "v", "at", "index", "i", "resizing", "s", ".", "Set", "as", "needed", "." ]
b7db4a2bc5cc04fb568fb036a438da43ee9a9f78
https://github.com/emersion/go-imap/blob/b7db4a2bc5cc04fb568fb036a438da43ee9a9f78/seqset.go#L254-L271
148,168
emersion/go-imap
seqset.go
search
func (s SeqSet) search(q uint32) (i int, ok bool) { min, max := 0, len(s.Set)-1 for min < max { if mid := (min + max) >> 1; s.Set[mid].Less(q) { min = mid + 1 } else { max = mid } } if max < 0 || s.Set[min].Less(q) { return len(s.Set), false // q is the new largest value } return min, s.Set[min].Con...
go
func (s SeqSet) search(q uint32) (i int, ok bool) { min, max := 0, len(s.Set)-1 for min < max { if mid := (min + max) >> 1; s.Set[mid].Less(q) { min = mid + 1 } else { max = mid } } if max < 0 || s.Set[min].Less(q) { return len(s.Set), false // q is the new largest value } return min, s.Set[min].Con...
[ "func", "(", "s", "SeqSet", ")", "search", "(", "q", "uint32", ")", "(", "i", "int", ",", "ok", "bool", ")", "{", "min", ",", "max", ":=", "0", ",", "len", "(", "s", ".", "Set", ")", "-", "1", "\n", "for", "min", "<", "max", "{", "if", "m...
// search attempts to find the index of the sequence set value that contains q. // If no values contain q, the returned index is the position where q should be // inserted and ok is set to false.
[ "search", "attempts", "to", "find", "the", "index", "of", "the", "sequence", "set", "value", "that", "contains", "q", ".", "If", "no", "values", "contain", "q", "the", "returned", "index", "is", "the", "position", "where", "q", "should", "be", "inserted", ...
b7db4a2bc5cc04fb568fb036a438da43ee9a9f78
https://github.com/emersion/go-imap/blob/b7db4a2bc5cc04fb568fb036a438da43ee9a9f78/seqset.go#L276-L289
148,169
emersion/go-imap
status.go
Err
func (r *StatusResp) Err() error { if r == nil { // No status response, connection closed before we get one return errors.New("imap: connection closed during command execution") } if r.Type == StatusRespNo || r.Type == StatusRespBad { return errors.New(r.Info) } return nil }
go
func (r *StatusResp) Err() error { if r == nil { // No status response, connection closed before we get one return errors.New("imap: connection closed during command execution") } if r.Type == StatusRespNo || r.Type == StatusRespBad { return errors.New(r.Info) } return nil }
[ "func", "(", "r", "*", "StatusResp", ")", "Err", "(", ")", "error", "{", "if", "r", "==", "nil", "{", "// No status response, connection closed before we get one", "return", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n\n", "if", "r", ".", "...
// If this status is NO or BAD, returns an error with the status info. // Otherwise, returns nil.
[ "If", "this", "status", "is", "NO", "or", "BAD", "returns", "an", "error", "with", "the", "status", "info", ".", "Otherwise", "returns", "nil", "." ]
b7db4a2bc5cc04fb568fb036a438da43ee9a9f78
https://github.com/emersion/go-imap/blob/b7db4a2bc5cc04fb568fb036a438da43ee9a9f78/status.go#L79-L89
148,170
emersion/go-imap
utf7/encoder.go
encode
func encode(s []byte) []byte { // len(s) is sufficient for UTF-8 to UTF-16 conversion if there are no // control code points (see table below). b := make([]byte, 0, len(s)+4) for len(s) > 0 { r, size := utf8.DecodeRune(s) if r > utf8.MaxRune { r, size = utf8.RuneError, 1 // Bug fix (issue 3785) } s = s[s...
go
func encode(s []byte) []byte { // len(s) is sufficient for UTF-8 to UTF-16 conversion if there are no // control code points (see table below). b := make([]byte, 0, len(s)+4) for len(s) > 0 { r, size := utf8.DecodeRune(s) if r > utf8.MaxRune { r, size = utf8.RuneError, 1 // Bug fix (issue 3785) } s = s[s...
[ "func", "encode", "(", "s", "[", "]", "byte", ")", "[", "]", "byte", "{", "// len(s) is sufficient for UTF-8 to UTF-16 conversion if there are no", "// control code points (see table below).", "b", ":=", "make", "(", "[", "]", "byte", ",", "0", ",", "len", "(", "s...
// Converts string s from UTF-8 to UTF-16-BE, encodes the result as base64, // removes the padding, and adds UTF-7 shifts.
[ "Converts", "string", "s", "from", "UTF", "-", "8", "to", "UTF", "-", "16", "-", "BE", "encodes", "the", "result", "as", "base64", "removes", "the", "padding", "and", "adds", "UTF", "-", "7", "shifts", "." ]
b7db4a2bc5cc04fb568fb036a438da43ee9a9f78
https://github.com/emersion/go-imap/blob/b7db4a2bc5cc04fb568fb036a438da43ee9a9f78/utf7/encoder.go#L61-L91
148,171
emersion/go-imap
response.go
ReadResp
func ReadResp(r *Reader) (Resp, error) { atom, err := r.ReadAtom() if err != nil { return nil, err } tag, ok := atom.(string) if !ok { return nil, newParseError("response tag is not an atom") } if tag == "+" { if err := r.ReadSp(); err != nil { r.UnreadRune() } resp := &ContinuationReq{} resp.In...
go
func ReadResp(r *Reader) (Resp, error) { atom, err := r.ReadAtom() if err != nil { return nil, err } tag, ok := atom.(string) if !ok { return nil, newParseError("response tag is not an atom") } if tag == "+" { if err := r.ReadSp(); err != nil { r.UnreadRune() } resp := &ContinuationReq{} resp.In...
[ "func", "ReadResp", "(", "r", "*", "Reader", ")", "(", "Resp", ",", "error", ")", "{", "atom", ",", "err", ":=", "r", ".", "ReadAtom", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "tag", ",", "o...
// ReadResp reads a single response from a Reader.
[ "ReadResp", "reads", "a", "single", "response", "from", "a", "Reader", "." ]
b7db4a2bc5cc04fb568fb036a438da43ee9a9f78
https://github.com/emersion/go-imap/blob/b7db4a2bc5cc04fb568fb036a438da43ee9a9f78/response.go#L14-L98
148,172
emersion/go-imap
response.go
ParseNamedResp
func ParseNamedResp(resp Resp) (name string, fields []interface{}, ok bool) { data, ok := resp.(*DataResp) if !ok || len(data.Fields) == 0 { return } // Some responses (namely EXISTS and RECENT) are formatted like so: // [num] [name] [...] // Which is fucking stupid. But we handle that here by checking if th...
go
func ParseNamedResp(resp Resp) (name string, fields []interface{}, ok bool) { data, ok := resp.(*DataResp) if !ok || len(data.Fields) == 0 { return } // Some responses (namely EXISTS and RECENT) are formatted like so: // [num] [name] [...] // Which is fucking stupid. But we handle that here by checking if th...
[ "func", "ParseNamedResp", "(", "resp", "Resp", ")", "(", "name", "string", ",", "fields", "[", "]", "interface", "{", "}", ",", "ok", "bool", ")", "{", "data", ",", "ok", ":=", "resp", ".", "(", "*", "DataResp", ")", "\n", "if", "!", "ok", "||", ...
// ParseNamedResp attempts to parse a named data response.
[ "ParseNamedResp", "attempts", "to", "parse", "a", "named", "data", "response", "." ]
b7db4a2bc5cc04fb568fb036a438da43ee9a9f78
https://github.com/emersion/go-imap/blob/b7db4a2bc5cc04fb568fb036a438da43ee9a9f78/response.go#L153-L181
148,173
emersion/go-imap
command.go
Parse
func (cmd *Command) Parse(fields []interface{}) error { if len(fields) < 2 { return errors.New("imap: cannot parse command: no enough fields") } var ok bool if cmd.Tag, ok = fields[0].(string); !ok { return errors.New("imap: cannot parse command: invalid tag") } if cmd.Name, ok = fields[1].(string); !ok { ...
go
func (cmd *Command) Parse(fields []interface{}) error { if len(fields) < 2 { return errors.New("imap: cannot parse command: no enough fields") } var ok bool if cmd.Tag, ok = fields[0].(string); !ok { return errors.New("imap: cannot parse command: invalid tag") } if cmd.Name, ok = fields[1].(string); !ok { ...
[ "func", "(", "cmd", "*", "Command", ")", "Parse", "(", "fields", "[", "]", "interface", "{", "}", ")", "error", "{", "if", "len", "(", "fields", ")", "<", "2", "{", "return", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n\n", "var",...
// Parse a command from fields.
[ "Parse", "a", "command", "from", "fields", "." ]
b7db4a2bc5cc04fb568fb036a438da43ee9a9f78
https://github.com/emersion/go-imap/blob/b7db4a2bc5cc04fb568fb036a438da43ee9a9f78/command.go#L41-L57
148,174
emersion/go-imap
client/cmd_auth.go
Select
func (c *Client) Select(name string, readOnly bool) (*imap.MailboxStatus, error) { if err := c.ensureAuthenticated(); err != nil { return nil, err } cmd := &commands.Select{ Mailbox: name, ReadOnly: readOnly, } mbox := &imap.MailboxStatus{Name: name, Items: make(map[imap.StatusItem]interface{})} res := &...
go
func (c *Client) Select(name string, readOnly bool) (*imap.MailboxStatus, error) { if err := c.ensureAuthenticated(); err != nil { return nil, err } cmd := &commands.Select{ Mailbox: name, ReadOnly: readOnly, } mbox := &imap.MailboxStatus{Name: name, Items: make(map[imap.StatusItem]interface{})} res := &...
[ "func", "(", "c", "*", "Client", ")", "Select", "(", "name", "string", ",", "readOnly", "bool", ")", "(", "*", "imap", ".", "MailboxStatus", ",", "error", ")", "{", "if", "err", ":=", "c", ".", "ensureAuthenticated", "(", ")", ";", "err", "!=", "ni...
// Select selects a mailbox so that messages in the mailbox can be accessed. Any // currently selected mailbox is deselected before attempting the new selection. // Even if the readOnly parameter is set to false, the server can decide to open // the mailbox in read-only mode.
[ "Select", "selects", "a", "mailbox", "so", "that", "messages", "in", "the", "mailbox", "can", "be", "accessed", ".", "Any", "currently", "selected", "mailbox", "is", "deselected", "before", "attempting", "the", "new", "selection", ".", "Even", "if", "the", "...
b7db4a2bc5cc04fb568fb036a438da43ee9a9f78
https://github.com/emersion/go-imap/blob/b7db4a2bc5cc04fb568fb036a438da43ee9a9f78/client/cmd_auth.go#L28-L65
148,175
emersion/go-imap
client/cmd_auth.go
Rename
func (c *Client) Rename(existingName, newName string) error { if err := c.ensureAuthenticated(); err != nil { return err } cmd := &commands.Rename{ Existing: existingName, New: newName, } status, err := c.execute(cmd, nil) if err != nil { return err } return status.Err() }
go
func (c *Client) Rename(existingName, newName string) error { if err := c.ensureAuthenticated(); err != nil { return err } cmd := &commands.Rename{ Existing: existingName, New: newName, } status, err := c.execute(cmd, nil) if err != nil { return err } return status.Err() }
[ "func", "(", "c", "*", "Client", ")", "Rename", "(", "existingName", ",", "newName", "string", ")", "error", "{", "if", "err", ":=", "c", ".", "ensureAuthenticated", "(", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "cmd", ...
// Rename changes the name of a mailbox.
[ "Rename", "changes", "the", "name", "of", "a", "mailbox", "." ]
b7db4a2bc5cc04fb568fb036a438da43ee9a9f78
https://github.com/emersion/go-imap/blob/b7db4a2bc5cc04fb568fb036a438da43ee9a9f78/client/cmd_auth.go#L102-L117
148,176
emersion/go-imap
client/cmd_auth.go
Subscribe
func (c *Client) Subscribe(name string) error { if err := c.ensureAuthenticated(); err != nil { return err } cmd := &commands.Subscribe{ Mailbox: name, } status, err := c.execute(cmd, nil) if err != nil { return err } return status.Err() }
go
func (c *Client) Subscribe(name string) error { if err := c.ensureAuthenticated(); err != nil { return err } cmd := &commands.Subscribe{ Mailbox: name, } status, err := c.execute(cmd, nil) if err != nil { return err } return status.Err() }
[ "func", "(", "c", "*", "Client", ")", "Subscribe", "(", "name", "string", ")", "error", "{", "if", "err", ":=", "c", ".", "ensureAuthenticated", "(", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "cmd", ":=", "&", "commands...
// Subscribe adds the specified mailbox name to the server's set of "active" or // "subscribed" mailboxes.
[ "Subscribe", "adds", "the", "specified", "mailbox", "name", "to", "the", "server", "s", "set", "of", "active", "or", "subscribed", "mailboxes", "." ]
b7db4a2bc5cc04fb568fb036a438da43ee9a9f78
https://github.com/emersion/go-imap/blob/b7db4a2bc5cc04fb568fb036a438da43ee9a9f78/client/cmd_auth.go#L121-L135
148,177
emersion/go-imap
client/cmd_auth.go
Status
func (c *Client) Status(name string, items []imap.StatusItem) (*imap.MailboxStatus, error) { if err := c.ensureAuthenticated(); err != nil { return nil, err } cmd := &commands.Status{ Mailbox: name, Items: items, } res := &responses.Status{ Mailbox: new(imap.MailboxStatus), } status, err := c.execute...
go
func (c *Client) Status(name string, items []imap.StatusItem) (*imap.MailboxStatus, error) { if err := c.ensureAuthenticated(); err != nil { return nil, err } cmd := &commands.Status{ Mailbox: name, Items: items, } res := &responses.Status{ Mailbox: new(imap.MailboxStatus), } status, err := c.execute...
[ "func", "(", "c", "*", "Client", ")", "Status", "(", "name", "string", ",", "items", "[", "]", "imap", ".", "StatusItem", ")", "(", "*", "imap", ".", "MailboxStatus", ",", "error", ")", "{", "if", "err", ":=", "c", ".", "ensureAuthenticated", "(", ...
// Status requests the status of the indicated mailbox. It does not change the // currently selected mailbox, nor does it affect the state of any messages in // the queried mailbox. // // See RFC 3501 section 6.3.10 for a list of items that can be requested.
[ "Status", "requests", "the", "status", "of", "the", "indicated", "mailbox", ".", "It", "does", "not", "change", "the", "currently", "selected", "mailbox", "nor", "does", "it", "affect", "the", "state", "of", "any", "messages", "in", "the", "queried", "mailbo...
b7db4a2bc5cc04fb568fb036a438da43ee9a9f78
https://github.com/emersion/go-imap/blob/b7db4a2bc5cc04fb568fb036a438da43ee9a9f78/client/cmd_auth.go#L213-L231
148,178
emersion/go-imap
client/cmd_auth.go
Append
func (c *Client) Append(mbox string, flags []string, date time.Time, msg imap.Literal) error { if err := c.ensureAuthenticated(); err != nil { return err } cmd := &commands.Append{ Mailbox: mbox, Flags: flags, Date: date, Message: msg, } status, err := c.execute(cmd, nil) if err != nil { return...
go
func (c *Client) Append(mbox string, flags []string, date time.Time, msg imap.Literal) error { if err := c.ensureAuthenticated(); err != nil { return err } cmd := &commands.Append{ Mailbox: mbox, Flags: flags, Date: date, Message: msg, } status, err := c.execute(cmd, nil) if err != nil { return...
[ "func", "(", "c", "*", "Client", ")", "Append", "(", "mbox", "string", ",", "flags", "[", "]", "string", ",", "date", "time", ".", "Time", ",", "msg", "imap", ".", "Literal", ")", "error", "{", "if", "err", ":=", "c", ".", "ensureAuthenticated", "(...
// Append appends the literal argument as a new message to the end of the // specified destination mailbox. This argument SHOULD be in the format of an // RFC 2822 message. flags and date are optional arguments and can be set to // nil.
[ "Append", "appends", "the", "literal", "argument", "as", "a", "new", "message", "to", "the", "end", "of", "the", "specified", "destination", "mailbox", ".", "This", "argument", "SHOULD", "be", "in", "the", "format", "of", "an", "RFC", "2822", "message", "....
b7db4a2bc5cc04fb568fb036a438da43ee9a9f78
https://github.com/emersion/go-imap/blob/b7db4a2bc5cc04fb568fb036a438da43ee9a9f78/client/cmd_auth.go#L237-L254
148,179
emersion/go-imap
backend/backendutil/search.go
MatchFlags
func MatchFlags(flags []string, c *imap.SearchCriteria) bool { flagsMap := make(map[string]bool) for _, f := range flags { flagsMap[f] = true } return matchFlags(flagsMap, c) }
go
func MatchFlags(flags []string, c *imap.SearchCriteria) bool { flagsMap := make(map[string]bool) for _, f := range flags { flagsMap[f] = true } return matchFlags(flagsMap, c) }
[ "func", "MatchFlags", "(", "flags", "[", "]", "string", ",", "c", "*", "imap", ".", "SearchCriteria", ")", "bool", "{", "flagsMap", ":=", "make", "(", "map", "[", "string", "]", "bool", ")", "\n", "for", "_", ",", "f", ":=", "range", "flags", "{", ...
// MatchFlags returns true if a flag list matches the provided criteria.
[ "MatchFlags", "returns", "true", "if", "a", "flag", "list", "matches", "the", "provided", "criteria", "." ]
b7db4a2bc5cc04fb568fb036a438da43ee9a9f78
https://github.com/emersion/go-imap/blob/b7db4a2bc5cc04fb568fb036a438da43ee9a9f78/backend/backendutil/search.go#L172-L179
148,180
emersion/go-imap
backend/backendutil/search.go
MatchSeqNumAndUid
func MatchSeqNumAndUid(seqNum uint32, uid uint32, c *imap.SearchCriteria) bool { if c.SeqNum != nil && !c.SeqNum.Contains(seqNum) { return false } if c.Uid != nil && !c.Uid.Contains(uid) { return false } for _, not := range c.Not { if MatchSeqNumAndUid(seqNum, uid, not) { return false } } for _, or :...
go
func MatchSeqNumAndUid(seqNum uint32, uid uint32, c *imap.SearchCriteria) bool { if c.SeqNum != nil && !c.SeqNum.Contains(seqNum) { return false } if c.Uid != nil && !c.Uid.Contains(uid) { return false } for _, not := range c.Not { if MatchSeqNumAndUid(seqNum, uid, not) { return false } } for _, or :...
[ "func", "MatchSeqNumAndUid", "(", "seqNum", "uint32", ",", "uid", "uint32", ",", "c", "*", "imap", ".", "SearchCriteria", ")", "bool", "{", "if", "c", ".", "SeqNum", "!=", "nil", "&&", "!", "c", ".", "SeqNum", ".", "Contains", "(", "seqNum", ")", "{"...
// MatchSeqNumAndUid returns true if a sequence number and a UID matches the // provided criteria.
[ "MatchSeqNumAndUid", "returns", "true", "if", "a", "sequence", "number", "and", "a", "UID", "matches", "the", "provided", "criteria", "." ]
b7db4a2bc5cc04fb568fb036a438da43ee9a9f78
https://github.com/emersion/go-imap/blob/b7db4a2bc5cc04fb568fb036a438da43ee9a9f78/backend/backendutil/search.go#L183-L202
148,181
emersion/go-imap
backend/backendutil/search.go
MatchDate
func MatchDate(date time.Time, c *imap.SearchCriteria) bool { date = date.Round(24 * time.Hour) if !c.Since.IsZero() && !date.After(c.Since) { return false } if !c.Before.IsZero() && !date.Before(c.Before) { return false } for _, not := range c.Not { if MatchDate(date, not) { return false } } for _,...
go
func MatchDate(date time.Time, c *imap.SearchCriteria) bool { date = date.Round(24 * time.Hour) if !c.Since.IsZero() && !date.After(c.Since) { return false } if !c.Before.IsZero() && !date.Before(c.Before) { return false } for _, not := range c.Not { if MatchDate(date, not) { return false } } for _,...
[ "func", "MatchDate", "(", "date", "time", ".", "Time", ",", "c", "*", "imap", ".", "SearchCriteria", ")", "bool", "{", "date", "=", "date", ".", "Round", "(", "24", "*", "time", ".", "Hour", ")", "\n", "if", "!", "c", ".", "Since", ".", "IsZero",...
// MatchDate returns true if a date matches the provided criteria.
[ "MatchDate", "returns", "true", "if", "a", "date", "matches", "the", "provided", "criteria", "." ]
b7db4a2bc5cc04fb568fb036a438da43ee9a9f78
https://github.com/emersion/go-imap/blob/b7db4a2bc5cc04fb568fb036a438da43ee9a9f78/backend/backendutil/search.go#L205-L225
148,182
emersion/go-imap
client/cmd_noauth.go
StartTLS
func (c *Client) StartTLS(tlsConfig *tls.Config) error { if c.isTLS { return ErrTLSAlreadyEnabled } cmd := new(commands.StartTLS) err := c.Upgrade(func(conn net.Conn) (net.Conn, error) { // Flag connection as in upgrading c.upgrading = true if status, err := c.execute(cmd, nil); err != nil { return nil...
go
func (c *Client) StartTLS(tlsConfig *tls.Config) error { if c.isTLS { return ErrTLSAlreadyEnabled } cmd := new(commands.StartTLS) err := c.Upgrade(func(conn net.Conn) (net.Conn, error) { // Flag connection as in upgrading c.upgrading = true if status, err := c.execute(cmd, nil); err != nil { return nil...
[ "func", "(", "c", "*", "Client", ")", "StartTLS", "(", "tlsConfig", "*", "tls", ".", "Config", ")", "error", "{", "if", "c", ".", "isTLS", "{", "return", "ErrTLSAlreadyEnabled", "\n", "}", "\n\n", "cmd", ":=", "new", "(", "commands", ".", "StartTLS", ...
// StartTLS starts TLS negotiation.
[ "StartTLS", "starts", "TLS", "negotiation", "." ]
b7db4a2bc5cc04fb568fb036a438da43ee9a9f78
https://github.com/emersion/go-imap/blob/b7db4a2bc5cc04fb568fb036a438da43ee9a9f78/client/cmd_noauth.go#L33-L69
148,183
emersion/go-imap
client/cmd_noauth.go
SupportAuth
func (c *Client) SupportAuth(mech string) (bool, error) { return c.Support("AUTH=" + mech) }
go
func (c *Client) SupportAuth(mech string) (bool, error) { return c.Support("AUTH=" + mech) }
[ "func", "(", "c", "*", "Client", ")", "SupportAuth", "(", "mech", "string", ")", "(", "bool", ",", "error", ")", "{", "return", "c", ".", "Support", "(", "\"", "\"", "+", "mech", ")", "\n", "}" ]
// SupportAuth checks if the server supports a given authentication mechanism.
[ "SupportAuth", "checks", "if", "the", "server", "supports", "a", "given", "authentication", "mechanism", "." ]
b7db4a2bc5cc04fb568fb036a438da43ee9a9f78
https://github.com/emersion/go-imap/blob/b7db4a2bc5cc04fb568fb036a438da43ee9a9f78/client/cmd_noauth.go#L72-L74
148,184
emersion/go-imap
client/cmd_noauth.go
Authenticate
func (c *Client) Authenticate(auth sasl.Client) error { if c.State() != imap.NotAuthenticatedState { return ErrAlreadyLoggedIn } mech, ir, err := auth.Start() if err != nil { return err } cmd := &commands.Authenticate{ Mechanism: mech, } res := &responses.Authenticate{ Mechanism: auth, Initia...
go
func (c *Client) Authenticate(auth sasl.Client) error { if c.State() != imap.NotAuthenticatedState { return ErrAlreadyLoggedIn } mech, ir, err := auth.Start() if err != nil { return err } cmd := &commands.Authenticate{ Mechanism: mech, } res := &responses.Authenticate{ Mechanism: auth, Initia...
[ "func", "(", "c", "*", "Client", ")", "Authenticate", "(", "auth", "sasl", ".", "Client", ")", "error", "{", "if", "c", ".", "State", "(", ")", "!=", "imap", ".", "NotAuthenticatedState", "{", "return", "ErrAlreadyLoggedIn", "\n", "}", "\n\n", "mech", ...
// Authenticate indicates a SASL authentication mechanism to the server. If the // server supports the requested authentication mechanism, it performs an // authentication protocol exchange to authenticate and identify the client.
[ "Authenticate", "indicates", "a", "SASL", "authentication", "mechanism", "to", "the", "server", ".", "If", "the", "server", "supports", "the", "requested", "authentication", "mechanism", "it", "performs", "an", "authentication", "protocol", "exchange", "to", "authen...
b7db4a2bc5cc04fb568fb036a438da43ee9a9f78
https://github.com/emersion/go-imap/blob/b7db4a2bc5cc04fb568fb036a438da43ee9a9f78/client/cmd_noauth.go#L79-L120
148,185
emersion/go-imap
client/cmd_noauth.go
Login
func (c *Client) Login(username, password string) error { if state := c.State(); state == imap.AuthenticatedState || state == imap.SelectedState { return ErrAlreadyLoggedIn } c.locker.Lock() loginDisabled := c.caps != nil && c.caps["LOGINDISABLED"] c.locker.Unlock() if loginDisabled { return ErrLoginDisabled...
go
func (c *Client) Login(username, password string) error { if state := c.State(); state == imap.AuthenticatedState || state == imap.SelectedState { return ErrAlreadyLoggedIn } c.locker.Lock() loginDisabled := c.caps != nil && c.caps["LOGINDISABLED"] c.locker.Unlock() if loginDisabled { return ErrLoginDisabled...
[ "func", "(", "c", "*", "Client", ")", "Login", "(", "username", ",", "password", "string", ")", "error", "{", "if", "state", ":=", "c", ".", "State", "(", ")", ";", "state", "==", "imap", ".", "AuthenticatedState", "||", "state", "==", "imap", ".", ...
// Login identifies the client to the server and carries the plaintext password // authenticating this user.
[ "Login", "identifies", "the", "client", "to", "the", "server", "and", "carries", "the", "plaintext", "password", "authenticating", "this", "user", "." ]
b7db4a2bc5cc04fb568fb036a438da43ee9a9f78
https://github.com/emersion/go-imap/blob/b7db4a2bc5cc04fb568fb036a438da43ee9a9f78/client/cmd_noauth.go#L124-L158
148,186
emersion/go-imap
message.go
CanonicalFlag
func CanonicalFlag(flag string) string { flag = strings.ToLower(flag) for _, f := range flags { if strings.ToLower(f) == flag { return f } } return flag }
go
func CanonicalFlag(flag string) string { flag = strings.ToLower(flag) for _, f := range flags { if strings.ToLower(f) == flag { return f } } return flag }
[ "func", "CanonicalFlag", "(", "flag", "string", ")", "string", "{", "flag", "=", "strings", ".", "ToLower", "(", "flag", ")", "\n", "for", "_", ",", "f", ":=", "range", "flags", "{", "if", "strings", ".", "ToLower", "(", "f", ")", "==", "flag", "{"...
// CanonicalFlag returns the canonical form of a flag. Flags are case-insensitive. // // If the flag is defined in RFC 3501, it returns the flag with the case of the // RFC. Otherwise, it returns the lowercase version of the flag.
[ "CanonicalFlag", "returns", "the", "canonical", "form", "of", "a", "flag", ".", "Flags", "are", "case", "-", "insensitive", ".", "If", "the", "flag", "is", "defined", "in", "RFC", "3501", "it", "returns", "the", "flag", "with", "the", "case", "of", "the"...
b7db4a2bc5cc04fb568fb036a438da43ee9a9f78
https://github.com/emersion/go-imap/blob/b7db4a2bc5cc04fb568fb036a438da43ee9a9f78/message.go#L54-L62
148,187
emersion/go-imap
message.go
NewMessage
func NewMessage(seqNum uint32, items []FetchItem) *Message { msg := &Message{ SeqNum: seqNum, Items: make(map[FetchItem]interface{}), Body: make(map[*BodySectionName]Literal), itemsOrder: items, } for _, k := range items { msg.Items[k] = nil } return msg }
go
func NewMessage(seqNum uint32, items []FetchItem) *Message { msg := &Message{ SeqNum: seqNum, Items: make(map[FetchItem]interface{}), Body: make(map[*BodySectionName]Literal), itemsOrder: items, } for _, k := range items { msg.Items[k] = nil } return msg }
[ "func", "NewMessage", "(", "seqNum", "uint32", ",", "items", "[", "]", "FetchItem", ")", "*", "Message", "{", "msg", ":=", "&", "Message", "{", "SeqNum", ":", "seqNum", ",", "Items", ":", "make", "(", "map", "[", "FetchItem", "]", "interface", "{", "...
// Create a new empty message that will contain the specified items.
[ "Create", "a", "new", "empty", "message", "that", "will", "contain", "the", "specified", "items", "." ]
b7db4a2bc5cc04fb568fb036a438da43ee9a9f78
https://github.com/emersion/go-imap/blob/b7db4a2bc5cc04fb568fb036a438da43ee9a9f78/message.go#L168-L181
148,188
emersion/go-imap
message.go
Parse
func (m *Message) Parse(fields []interface{}) error { m.Items = make(map[FetchItem]interface{}) m.Body = map[*BodySectionName]Literal{} m.itemsOrder = nil var k FetchItem for i, f := range fields { if i%2 == 0 { // It's a key if kstr, ok := f.(string); !ok { return fmt.Errorf("cannot parse message: key i...
go
func (m *Message) Parse(fields []interface{}) error { m.Items = make(map[FetchItem]interface{}) m.Body = map[*BodySectionName]Literal{} m.itemsOrder = nil var k FetchItem for i, f := range fields { if i%2 == 0 { // It's a key if kstr, ok := f.(string); !ok { return fmt.Errorf("cannot parse message: key i...
[ "func", "(", "m", "*", "Message", ")", "Parse", "(", "fields", "[", "]", "interface", "{", "}", ")", "error", "{", "m", ".", "Items", "=", "make", "(", "map", "[", "FetchItem", "]", "interface", "{", "}", ")", "\n", "m", ".", "Body", "=", "map"...
// Parse a message from fields.
[ "Parse", "a", "message", "from", "fields", "." ]
b7db4a2bc5cc04fb568fb036a438da43ee9a9f78
https://github.com/emersion/go-imap/blob/b7db4a2bc5cc04fb568fb036a438da43ee9a9f78/message.go#L184-L254
148,189
emersion/go-imap
message.go
GetBody
func (m *Message) GetBody(section *BodySectionName) Literal { section = section.resp() for s, body := range m.Body { if section.Equal(s) { return body } } return nil }
go
func (m *Message) GetBody(section *BodySectionName) Literal { section = section.resp() for s, body := range m.Body { if section.Equal(s) { return body } } return nil }
[ "func", "(", "m", "*", "Message", ")", "GetBody", "(", "section", "*", "BodySectionName", ")", "Literal", "{", "section", "=", "section", ".", "resp", "(", ")", "\n\n", "for", "s", ",", "body", ":=", "range", "m", ".", "Body", "{", "if", "section", ...
// GetBody gets the body section with the specified name. Returns nil if it's not found.
[ "GetBody", "gets", "the", "body", "section", "with", "the", "specified", "name", ".", "Returns", "nil", "if", "it", "s", "not", "found", "." ]
b7db4a2bc5cc04fb568fb036a438da43ee9a9f78
https://github.com/emersion/go-imap/blob/b7db4a2bc5cc04fb568fb036a438da43ee9a9f78/message.go#L316-L325
148,190
emersion/go-imap
message.go
Equal
func (section *BodySectionName) Equal(other *BodySectionName) bool { if section.Peek != other.Peek { return false } if len(section.Partial) != len(other.Partial) { return false } if len(section.Partial) > 0 && section.Partial[0] != other.Partial[0] { return false } if len(section.Partial) > 1 && section.Pa...
go
func (section *BodySectionName) Equal(other *BodySectionName) bool { if section.Peek != other.Peek { return false } if len(section.Partial) != len(other.Partial) { return false } if len(section.Partial) > 0 && section.Partial[0] != other.Partial[0] { return false } if len(section.Partial) > 1 && section.Pa...
[ "func", "(", "section", "*", "BodySectionName", ")", "Equal", "(", "other", "*", "BodySectionName", ")", "bool", "{", "if", "section", ".", "Peek", "!=", "other", ".", "Peek", "{", "return", "false", "\n", "}", "\n", "if", "len", "(", "section", ".", ...
// Equal checks whether two sections are equal.
[ "Equal", "checks", "whether", "two", "sections", "are", "equal", "." ]
b7db4a2bc5cc04fb568fb036a438da43ee9a9f78
https://github.com/emersion/go-imap/blob/b7db4a2bc5cc04fb568fb036a438da43ee9a9f78/message.go#L439-L453
148,191
emersion/go-imap
message.go
ExtractPartial
func (section *BodySectionName) ExtractPartial(b []byte) []byte { if len(section.Partial) != 2 { return b } from := section.Partial[0] length := section.Partial[1] to := from + length if from > len(b) { return nil } if to > len(b) { to = len(b) } return b[from:to] }
go
func (section *BodySectionName) ExtractPartial(b []byte) []byte { if len(section.Partial) != 2 { return b } from := section.Partial[0] length := section.Partial[1] to := from + length if from > len(b) { return nil } if to > len(b) { to = len(b) } return b[from:to] }
[ "func", "(", "section", "*", "BodySectionName", ")", "ExtractPartial", "(", "b", "[", "]", "byte", ")", "[", "]", "byte", "{", "if", "len", "(", "section", ".", "Partial", ")", "!=", "2", "{", "return", "b", "\n", "}", "\n\n", "from", ":=", "sectio...
// ExtractPartial returns a subset of the specified bytes matching the partial requested in the // section name.
[ "ExtractPartial", "returns", "a", "subset", "of", "the", "specified", "bytes", "matching", "the", "partial", "requested", "in", "the", "section", "name", "." ]
b7db4a2bc5cc04fb568fb036a438da43ee9a9f78
https://github.com/emersion/go-imap/blob/b7db4a2bc5cc04fb568fb036a438da43ee9a9f78/message.go#L469-L484
148,192
emersion/go-imap
message.go
ParseBodySectionName
func ParseBodySectionName(s FetchItem) (*BodySectionName, error) { section := new(BodySectionName) err := section.parse(string(s)) return section, err }
go
func ParseBodySectionName(s FetchItem) (*BodySectionName, error) { section := new(BodySectionName) err := section.parse(string(s)) return section, err }
[ "func", "ParseBodySectionName", "(", "s", "FetchItem", ")", "(", "*", "BodySectionName", ",", "error", ")", "{", "section", ":=", "new", "(", "BodySectionName", ")", "\n", "err", ":=", "section", ".", "parse", "(", "string", "(", "s", ")", ")", "\n", "...
// ParseBodySectionName parses a body section name.
[ "ParseBodySectionName", "parses", "a", "body", "section", "name", "." ]
b7db4a2bc5cc04fb568fb036a438da43ee9a9f78
https://github.com/emersion/go-imap/blob/b7db4a2bc5cc04fb568fb036a438da43ee9a9f78/message.go#L487-L491
148,193
emersion/go-imap
message.go
Equal
func (part *BodyPartName) Equal(other *BodyPartName) bool { if part.Specifier != other.Specifier { return false } if part.NotFields != other.NotFields { return false } if len(part.Path) != len(other.Path) { return false } for i, node := range part.Path { if node != other.Path[i] { return false } } ...
go
func (part *BodyPartName) Equal(other *BodyPartName) bool { if part.Specifier != other.Specifier { return false } if part.NotFields != other.NotFields { return false } if len(part.Path) != len(other.Path) { return false } for i, node := range part.Path { if node != other.Path[i] { return false } } ...
[ "func", "(", "part", "*", "BodyPartName", ")", "Equal", "(", "other", "*", "BodyPartName", ")", "bool", "{", "if", "part", ".", "Specifier", "!=", "other", ".", "Specifier", "{", "return", "false", "\n", "}", "\n", "if", "part", ".", "NotFields", "!=",...
// Equal checks whether two body part names are equal.
[ "Equal", "checks", "whether", "two", "body", "part", "names", "are", "equal", "." ]
b7db4a2bc5cc04fb568fb036a438da43ee9a9f78
https://github.com/emersion/go-imap/blob/b7db4a2bc5cc04fb568fb036a438da43ee9a9f78/message.go#L590-L621
148,194
emersion/go-imap
message.go
Parse
func (addr *Address) Parse(fields []interface{}) error { if len(fields) < 4 { return errors.New("Address doesn't contain 4 fields") } if s, err := ParseString(fields[0]); err == nil { addr.PersonalName, _ = decodeHeader(s) } if s, err := ParseString(fields[1]); err == nil { addr.AtDomainList, _ = decodeHead...
go
func (addr *Address) Parse(fields []interface{}) error { if len(fields) < 4 { return errors.New("Address doesn't contain 4 fields") } if s, err := ParseString(fields[0]); err == nil { addr.PersonalName, _ = decodeHeader(s) } if s, err := ParseString(fields[1]); err == nil { addr.AtDomainList, _ = decodeHead...
[ "func", "(", "addr", "*", "Address", ")", "Parse", "(", "fields", "[", "]", "interface", "{", "}", ")", "error", "{", "if", "len", "(", "fields", ")", "<", "4", "{", "return", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n\n", "if",...
// Parse an address from fields.
[ "Parse", "an", "address", "from", "fields", "." ]
b7db4a2bc5cc04fb568fb036a438da43ee9a9f78
https://github.com/emersion/go-imap/blob/b7db4a2bc5cc04fb568fb036a438da43ee9a9f78/message.go#L636-L655
148,195
emersion/go-imap
message.go
Format
func (addr *Address) Format() []interface{} { fields := make([]interface{}, 4) if addr.PersonalName != "" { fields[0] = encodeHeader(addr.PersonalName) } if addr.AtDomainList != "" { fields[1] = addr.AtDomainList } if addr.MailboxName != "" { fields[2] = addr.MailboxName } if addr.HostName != "" { fiel...
go
func (addr *Address) Format() []interface{} { fields := make([]interface{}, 4) if addr.PersonalName != "" { fields[0] = encodeHeader(addr.PersonalName) } if addr.AtDomainList != "" { fields[1] = addr.AtDomainList } if addr.MailboxName != "" { fields[2] = addr.MailboxName } if addr.HostName != "" { fiel...
[ "func", "(", "addr", "*", "Address", ")", "Format", "(", ")", "[", "]", "interface", "{", "}", "{", "fields", ":=", "make", "(", "[", "]", "interface", "{", "}", ",", "4", ")", "\n\n", "if", "addr", ".", "PersonalName", "!=", "\"", "\"", "{", "...
// Format an address to fields.
[ "Format", "an", "address", "to", "fields", "." ]
b7db4a2bc5cc04fb568fb036a438da43ee9a9f78
https://github.com/emersion/go-imap/blob/b7db4a2bc5cc04fb568fb036a438da43ee9a9f78/message.go#L658-L675
148,196
emersion/go-imap
message.go
ParseAddressList
func ParseAddressList(fields []interface{}) (addrs []*Address) { addrs = make([]*Address, len(fields)) for i, f := range fields { if addrFields, ok := f.([]interface{}); ok { addr := &Address{} if err := addr.Parse(addrFields); err == nil { addrs[i] = addr } } } return }
go
func ParseAddressList(fields []interface{}) (addrs []*Address) { addrs = make([]*Address, len(fields)) for i, f := range fields { if addrFields, ok := f.([]interface{}); ok { addr := &Address{} if err := addr.Parse(addrFields); err == nil { addrs[i] = addr } } } return }
[ "func", "ParseAddressList", "(", "fields", "[", "]", "interface", "{", "}", ")", "(", "addrs", "[", "]", "*", "Address", ")", "{", "addrs", "=", "make", "(", "[", "]", "*", "Address", ",", "len", "(", "fields", ")", ")", "\n\n", "for", "i", ",", ...
// Parse an address list from fields.
[ "Parse", "an", "address", "list", "from", "fields", "." ]
b7db4a2bc5cc04fb568fb036a438da43ee9a9f78
https://github.com/emersion/go-imap/blob/b7db4a2bc5cc04fb568fb036a438da43ee9a9f78/message.go#L678-L691
148,197
emersion/go-imap
message.go
FormatAddressList
func FormatAddressList(addrs []*Address) (fields []interface{}) { fields = make([]interface{}, len(addrs)) for i, addr := range addrs { fields[i] = addr.Format() } return }
go
func FormatAddressList(addrs []*Address) (fields []interface{}) { fields = make([]interface{}, len(addrs)) for i, addr := range addrs { fields[i] = addr.Format() } return }
[ "func", "FormatAddressList", "(", "addrs", "[", "]", "*", "Address", ")", "(", "fields", "[", "]", "interface", "{", "}", ")", "{", "fields", "=", "make", "(", "[", "]", "interface", "{", "}", ",", "len", "(", "addrs", ")", ")", "\n\n", "for", "i...
// Format an address list to fields.
[ "Format", "an", "address", "list", "to", "fields", "." ]
b7db4a2bc5cc04fb568fb036a438da43ee9a9f78
https://github.com/emersion/go-imap/blob/b7db4a2bc5cc04fb568fb036a438da43ee9a9f78/message.go#L694-L702
148,198
emersion/go-imap
message.go
Parse
func (e *Envelope) Parse(fields []interface{}) error { if len(fields) < 10 { return errors.New("ENVELOPE doesn't contain 10 fields") } if date, ok := fields[0].(string); ok { e.Date, _ = parseMessageDateTime(date) } if subject, err := ParseString(fields[1]); err == nil { e.Subject, _ = decodeHeader(subject)...
go
func (e *Envelope) Parse(fields []interface{}) error { if len(fields) < 10 { return errors.New("ENVELOPE doesn't contain 10 fields") } if date, ok := fields[0].(string); ok { e.Date, _ = parseMessageDateTime(date) } if subject, err := ParseString(fields[1]); err == nil { e.Subject, _ = decodeHeader(subject)...
[ "func", "(", "e", "*", "Envelope", ")", "Parse", "(", "fields", "[", "]", "interface", "{", "}", ")", "error", "{", "if", "len", "(", "fields", ")", "<", "10", "{", "return", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n\n", "if", ...
// Parse an envelope from fields.
[ "Parse", "an", "envelope", "from", "fields", "." ]
b7db4a2bc5cc04fb568fb036a438da43ee9a9f78
https://github.com/emersion/go-imap/blob/b7db4a2bc5cc04fb568fb036a438da43ee9a9f78/message.go#L730-L767
148,199
emersion/go-imap
message.go
Format
func (e *Envelope) Format() (fields []interface{}) { return []interface{}{ envelopeDateTime(e.Date), encodeHeader(e.Subject), FormatAddressList(e.From), FormatAddressList(e.Sender), FormatAddressList(e.ReplyTo), FormatAddressList(e.To), FormatAddressList(e.Cc), FormatAddressList(e.Bcc), e.InReplyTo, ...
go
func (e *Envelope) Format() (fields []interface{}) { return []interface{}{ envelopeDateTime(e.Date), encodeHeader(e.Subject), FormatAddressList(e.From), FormatAddressList(e.Sender), FormatAddressList(e.ReplyTo), FormatAddressList(e.To), FormatAddressList(e.Cc), FormatAddressList(e.Bcc), e.InReplyTo, ...
[ "func", "(", "e", "*", "Envelope", ")", "Format", "(", ")", "(", "fields", "[", "]", "interface", "{", "}", ")", "{", "return", "[", "]", "interface", "{", "}", "{", "envelopeDateTime", "(", "e", ".", "Date", ")", ",", "encodeHeader", "(", "e", "...
// Format an envelope to fields.
[ "Format", "an", "envelope", "to", "fields", "." ]
b7db4a2bc5cc04fb568fb036a438da43ee9a9f78
https://github.com/emersion/go-imap/blob/b7db4a2bc5cc04fb568fb036a438da43ee9a9f78/message.go#L770-L783