// DefaultFrontpage returns the submissions on the default reddit frontpage.
358466
func (s Session) DefaultFrontpage(sort PopularitySort, params ListingOptions) ([]*Submission, error) {
	return s.SubredditSubmissions("", sort, params)
}
949858
func (t Type) defaultFlags() byte {
	switch t {
	case CONNECT:
		return 0
	case CONNACK:
		return 0
	case PUBACK:
		return 0
	case PUBREC:
		return 0
	case PUBREL:
		return 2 // 00000010
	case PUBCOMP:
		return 0
	case SUBSCRIBE:
		return 2 // 00000010
	case SUBACK:
		return 0
	case UNSUBSCRIBE:
		return 2 // 00000010
	case UNSUBACK:
		return 0
	case PINGREQ:
		return 0
	case PINGRESP:
		return 0
	case DISCONNECT:
		return 0
	}

	return 0
}
1102600
func DefaultErrorFunc(w http.ResponseWriter, r *http.Request, status int) {
	WriteTextResponse(w, status, fmt.Sprintf("%d %s\n", status, http.StatusText(status)))
}
800075
func Default(users map[string]string) context.Handler {
	c := DefaultConfig()
	c.Users = users
	return New(c)
}
901391
func (c *IPMemberList) LastPage() (*IPMemberList, error) {
	return c.getPage(c.Meta.LastPageUri)
}
348127
func (l *waiterList) PushFront(e *Entry) {
	waiterElementMapper{}.linkerFor(e).SetNext(l.head)
	waiterElementMapper{}.linkerFor(e).SetPrev(nil)

	if l.head != nil {
		waiterElementMapper{}.linkerFor(l.head).SetPrev(e)
	} else {
		l.tail = e
	}

	l.head = e
}
774667
func (c *Client) DefaultSource(ctx context.Context) (*platform.Source, error) {
	var s *platform.Source

	err := c.db.View(func(tx *bolt.Tx) error {
		// TODO(desa): make this faster by putting the default source in an index.
		srcs, err := c.findSources(ctx, tx, platform.FindOptions{})
		if err != nil {
			return err
		}
		for _, src := range srcs {
			if src.Default {
				s = src
				return nil
			}
		}
		return &platform.Error{
			Code: platform.ENotFound,
			Msg:  "no default source found",
		}
	})

	if err != nil {
		return nil, &platform.Error{
			Op:  getOp(platform.OpDefaultSource),
			Err: err,
		}
	}

	return s, nil
}
1366180
func (s Session) SubredditSubmissions(subreddit string, sort PopularitySort, params ListingOptions) ([]*Submission, error) {
	v, err := query.Values(params)
	if err != nil {
		return nil, err
	}

	baseUrl := "https://www.reddit.com"

	// If subbreddit given, add to URL
	if subreddit != "" {
		baseUrl += "/r/" + subreddit
	}

	redditUrl := fmt.Sprintf(baseUrl+"/%s.json?%s", sort, v.Encode())

	req := request{
		url:       redditUrl,
		useragent: s.useragent,
	}
	body, err := req.getResponse()
	if err != nil {
		return nil, err
	}

	type Response struct {
		Data struct {
			Children []struct {
				Data *Submission
			}
		}
	}

	r := new(Response)
	err = json.NewDecoder(body).Decode(r)
	if err != nil {
		return nil, err
	}

	submissions := make([]*Submission, len(r.Data.Children))
	for i, child := range r.Data.Children {
		submissions[i] = child.Data
	}

	return submissions, nil
}
61181
func (n *NFS) DefaultRoute() string {
	if n.Remark.Network == nil {
		return ""
	}
	return n.Remark.Network.DefaultRoute
}
107689
func (m *mux) TopFrontends(beKey *engine.BackendKey) ([]engine.Frontend, error) {
	m.mtx.RLock()
	defer m.mtx.RUnlock()

	feCfgs := []engine.Frontend{}
	for _, fe := range m.filteredFrontends(beKey) {
		feCfg, ok, err := fe.CfgWithStats()
		if err != nil {
			return nil, errors.Wrapf(err, "cannot get stats from %v", fe.Key())
		}
		if !ok {
			continue
		}
		feCfgs = append(feCfgs, feCfg)
	}
	sort.Stable(&frontendSorter{frontends: feCfgs})
	return feCfgs, nil
}
677354
func (c *IPMessageList) FirstPage() (*IPMessageList, error) {
	return c.getPage(c.Meta.FirstPageUri)
}
967780
func (d *domainClient) PushNodeByPathToFrontend(ctx context.Context, args *PushNodeByPathToFrontendArgs) (reply *PushNodeByPathToFrontendReply, err error) {
	reply = new(PushNodeByPathToFrontendReply)
	if args != nil {
		err = rpcc.Invoke(ctx, "DOM.pushNodeByPathToFrontend", args, reply, d.conn)
	} else {
		err = rpcc.Invoke(ctx, "DOM.pushNodeByPathToFrontend", nil, reply, d.conn)
	}
	if err != nil {
		err = &internal.OpError{Domain: "DOM", Op: "PushNodeByPathToFrontend", Err: err}
	}
	return
}
1367560
func (o *OAuthSession) SubredditSubmissions(subreddit string, sort PopularitySort, params ListingOptions) ([]*Submission, error) {
	v, err := query.Values(params)
	if err != nil {
		return nil, err
	}

	baseUrl := "https://oauth.reddit.com"

	// If subbreddit given, add to URL
	if subreddit != "" {
		baseUrl += "/r/" + subreddit
	}

	redditURL := fmt.Sprintf(baseUrl+"/%s.json?%s", sort, v.Encode())

	type Response struct {
		Data struct {
			Children []struct {
				Data *Submission
			}
		}
	}

	r := new(Response)
	err = o.getBody(redditURL, r)
	if err != nil {
		return nil, err
	}

	submissions := make([]*Submission, len(r.Data.Children))
	for i, child := range r.Data.Children {
		submissions[i] = child.Data
	}

	return submissions, nil
}
900067
func (l *PacketIntervalList) Front() *PacketIntervalElement {
	if l.len == 0 {
		return nil
	}
	return l.root.next
}
956418
func (l *pageLexer) lexFrontMatterSection(tp ItemType, delimr rune, name string, delim []byte) stateFunc {

	for i := 0; i < 2; i++ {
		if r := l.next(); r != delimr {
			return l.errorf("invalid %s delimiter", name)
		}
	}

	// Let front matter start at line 1
	wasEndOfLine := l.consumeCRLF()
	// We don't care about the delimiters.
	l.ignore()

	var r rune

	for {
		if !wasEndOfLine {
			r = l.next()
			if r == eof {
				return l.errorf("EOF looking for end %s front matter delimiter", name)
			}
		}

		if wasEndOfLine || isEndOfLine(r) {
			if l.hasPrefix(delim) {
				l.emit(tp)
				l.pos += 3
				l.consumeCRLF()
				l.ignore()
				break
			}
		}

		wasEndOfLine = false
	}

	return lexMainSection
}
1150013
func defaultFilter(w http.ResponseWriter, r *http.Request) bool {
	hdr := w.Header()
	for _, tp := range defaultFilterTypes {
		ok := HeaderMatch(hdr, "Content-Type", HmContains, tp)
		if ok {
			return true
		}
	}
	return false
}
1112758
func defaultHandler(w http.ResponseWriter, r *http.Request) {
	if err := defaultEntryTemplate.Execute(w, nil); err != nil {
		reportError(w, r, err)
	}
}