...

Package controller

import "vminko.org/dscuss/cmd/dscuss-web/controller"
Overview
Index

Overview ▾

controller responds to the user input and performs interactions on the Dscuss data model objects (Users, Messages, Operations, Threads, Subscriptions etc.) via Dscuss API.

Index ▾

Package files

common_data.go controller.go handle_ban_user.go handle_board.go handle_create_thread.go handle_list_operations.go handle_list_peers.go handle_login.go handle_peer_history.go handle_profile.go handle_remove_message.go handle_reply_thread.go handle_thread.go handle_user.go init_handlers.go session.go session_pool.go sessions.go

Constants

const (
    MaxPasswordLen = 64
)

Variables

var LoginHandler, ProfileHandler, BoardHandler, ThreadHandler, CreateThread, ReplyThreadHandler,
    AddModeratorHandler, DelModeratorHandler, SubscribeHandler, UnsubscribeHandler, UserHandler,
    RemoveMessageHandler, BanUserHandler, ListOperationsHandler, ListPeersHandler,
    PeerHistoryHandler func(w http.ResponseWriter, r *http.Request)

func BadRequestHandler

func BadRequestHandler(w http.ResponseWriter, r *http.Request, msg string)

func CSSHandler

func CSSHandler(w http.ResponseWriter, r *http.Request)

func CloseSession

func CloseSession(w http.ResponseWriter, r *http.Request)

func ForbiddenHandler

func ForbiddenHandler(w http.ResponseWriter, r *http.Request)

func InitHandlers

func InitHandlers(l *dscuss.LoginHandle)

func InternalServerErrorHandler

func InternalServerErrorHandler(w http.ResponseWriter, r *http.Request)

func JavaScriptHandler

func JavaScriptHandler(w http.ResponseWriter, r *http.Request)

func LogoutHandler

func LogoutHandler(w http.ResponseWriter, r *http.Request)

func NotFoundHandler

func NotFoundHandler(w http.ResponseWriter, r *http.Request)

func RootHandler

func RootHandler(w http.ResponseWriter, r *http.Request)

func SetPassword

func SetPassword(p string)

type CommonData

type CommonData struct {
    CSRF               string
    Owner              User
    NodeName           string
    PageTitle          string
    Topic              string
    CurrentURL         template.URL
    ShowLogin          bool
    IsWritingPermitted bool
}

type ComposedReply

type ComposedReply struct {
    Subject string
    Text    string
}

type ComposedRootMessage

type ComposedRootMessage struct {
    Topic   string
    Subject string
    Text    string
}

type Message

type Message struct {
    ID            string
    ShortID       string
    Subject       string
    Text          string
    DateWritten   string
    AuthorName    string
    AuthorID      string
    AuthorShortID string
}

func (*Message) Assign

func (m *Message) Assign(em *entity.Message, l *dscuss.LoginHandle)

type Operation

type Operation struct {
    ID            string
    ShortID       string
    Type          string
    Reason        string
    Comment       string
    DatePerformed string
    AuthorName    string
    AuthorID      string
    AuthorShortID string
}

func (*Operation) Assign

func (o *Operation) Assign(eo *entity.Operation, l *dscuss.LoginHandle)

type Peer

type Peer struct {
    Nickname        string
    ID              string
    LocalAddr       string
    RemoteAddr      string
    AssociatedAddrs string
    Subscriptions   string
    State           string
}

func (*Peer) Assign

func (p *Peer) Assign(pi *peer.Info)

type PeerHistory

type PeerHistory struct {
    ID            string
    Disconnected  string
    Subscriptions string
}

func (*PeerHistory) Assign

func (ph *PeerHistory) Assign(uh *entity.UserHistory)

type RootMessage

type RootMessage struct {
    Message
    Topic string
}

func (*RootMessage) Assign

func (rm *RootMessage) Assign(em *entity.Message, l *dscuss.LoginHandle)

type Session

type Session struct {
    ID              string
    IsAuthenticated bool
    CSRFToken       string
    CreatedDate     time.Time
    UpdatedDate     time.Time
}

func OpenSession

func OpenSession(w http.ResponseWriter, r *http.Request) *Session

func (*Session) Authenticate

func (s *Session) Authenticate(loginHandle *dscuss.LoginHandle, user string, pass string) error

type SessionPool

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

type Thread

type Thread struct {
    RootMessage
    Replies []Message
}

type ThreadComposer

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

func (*ThreadComposer) Handle

func (tc *ThreadComposer) Handle(n *thread.Node) bool

type User

type User struct {
    ID       string
    ShortID  string
    Nickname string
    Info     string
    RegDate  string
}

func (*User) Assign

func (u *User) Assign(eu *entity.User)