mobius

package
v0.17.0 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2024 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ConfigSearchOrder = []string{
	"config",
	"/usr/local/var/mobius/config",
	"/opt/homebrew/var/mobius/config",
}

Functions

func HandleChatSend

func HandleChatSend(cc *hotline.ClientConn, t *hotline.Transaction) (res []hotline.Transaction)

func HandleDelNewsArt

func HandleDelNewsArt(cc *hotline.ClientConn, t *hotline.Transaction) (res []hotline.Transaction)

HandleDelNewsArt deletes a threaded news article. Request Fields 325 News path 326 News article Type 337 News article recursive delete - Delete child articles (1) or not (0)

func HandleDelNewsItem

func HandleDelNewsItem(cc *hotline.ClientConn, t *hotline.Transaction) (res []hotline.Transaction)

HandleDelNewsItem deletes a threaded news folder or category. Fields used in the request: 325 News path Fields used in the reply: None

func HandleDeleteFile

func HandleDeleteFile(cc *hotline.ClientConn, t *hotline.Transaction) (res []hotline.Transaction)

HandleDeleteFile deletes a file or folder Fields used in the request: * 201 File Name * 202 File path Fields used in the reply: none

func HandleDeleteUser

func HandleDeleteUser(cc *hotline.ClientConn, t *hotline.Transaction) (res []hotline.Transaction)

func HandleDisconnectUser

func HandleDisconnectUser(cc *hotline.ClientConn, t *hotline.Transaction) (res []hotline.Transaction)

func HandleDownloadBanner

func HandleDownloadBanner(cc *hotline.ClientConn, t *hotline.Transaction) (res []hotline.Transaction)

HandleDownloadBanner handles requests for a new banner from the server Fields used in the request: None Fields used in the reply: 107 FieldRefNum Used later for transfer 108 FieldTransferSize Size of data to be downloaded

func HandleDownloadFile

func HandleDownloadFile(cc *hotline.ClientConn, t *hotline.Transaction) (res []hotline.Transaction)

func HandleDownloadFolder

func HandleDownloadFolder(cc *hotline.ClientConn, t *hotline.Transaction) (res []hotline.Transaction)

Download all files from the specified folder and sub-folders

func HandleGetClientInfoText

func HandleGetClientInfoText(cc *hotline.ClientConn, t *hotline.Transaction) (res []hotline.Transaction)

HandleGetClientInfoText returns user information for the specific user.

Fields used in the request: 103 User Type

Fields used in the reply: 102 User Name 101 Data User info text string

func HandleGetFileInfo

func HandleGetFileInfo(cc *hotline.ClientConn, t *hotline.Transaction) (res []hotline.Transaction)

func HandleGetFileNameList

func HandleGetFileNameList(cc *hotline.ClientConn, t *hotline.Transaction) (res []hotline.Transaction)

func HandleGetMsgs

func HandleGetMsgs(cc *hotline.ClientConn, t *hotline.Transaction) (res []hotline.Transaction)

HandleGetMsgs returns the flat news data

func HandleGetNewsArtData

func HandleGetNewsArtData(cc *hotline.ClientConn, t *hotline.Transaction) (res []hotline.Transaction)

HandleGetNewsArtData requests information about the specific news article. Fields used in the request:

Request fields 325 News path 326 News article Type 327 News article data flavor

Fields used in the reply: 328 News article title 329 News article poster 330 News article date 331 Previous article Type 332 Next article Type 335 Parent article Type 336 First child article Type 327 News article data flavor "Should be “text/plain” 333 News article data Optional (if data flavor is “text/plain”)

func HandleGetNewsArtNameList

func HandleGetNewsArtNameList(cc *hotline.ClientConn, t *hotline.Transaction) (res []hotline.Transaction)

Fields used in the reply: 321 News article list data Optional

func HandleGetNewsCatNameList

func HandleGetNewsCatNameList(cc *hotline.ClientConn, t *hotline.Transaction) (res []hotline.Transaction)

HandleGetNewsCatNameList returns a list of news categories for a path Fields used in the request: 325 News path (Optional)

func HandleGetUser

func HandleGetUser(cc *hotline.ClientConn, t *hotline.Transaction) (res []hotline.Transaction)

func HandleGetUserNameList

func HandleGetUserNameList(cc *hotline.ClientConn, t *hotline.Transaction) (res []hotline.Transaction)

func HandleInviteNewChat

func HandleInviteNewChat(cc *hotline.ClientConn, t *hotline.Transaction) (res []hotline.Transaction)

HandleInviteNewChat invites users to new private chat

func HandleInviteToChat

func HandleInviteToChat(cc *hotline.ClientConn, t *hotline.Transaction) (res []hotline.Transaction)

func HandleJoinChat

func HandleJoinChat(cc *hotline.ClientConn, t *hotline.Transaction) (res []hotline.Transaction)

HandleJoinChat is sent from a v1.8+ Hotline client when the joins a private chat Fields used in the reply: * 115 Chat subject * 300 User Name with info (Optional) * 300 (more user names with info)

func HandleKeepAlive

func HandleKeepAlive(cc *hotline.ClientConn, t *hotline.Transaction) (res []hotline.Transaction)

HandleKeepAlive responds to keepalive transactions with an empty reply * HL 1.9.2 Client sends keepalive msg every 3 minutes * HL 1.2.3 Client doesn't send keepalives

func HandleLeaveChat

func HandleLeaveChat(cc *hotline.ClientConn, t *hotline.Transaction) (res []hotline.Transaction)

HandleLeaveChat is sent from a v1.8+ Hotline client when the user exits a private chat Fields used in the request:

  • 114 FieldChatID

Reply is not expected.

func HandleListUsers

func HandleListUsers(cc *hotline.ClientConn, t *hotline.Transaction) (res []hotline.Transaction)

func HandleMakeAlias

func HandleMakeAlias(cc *hotline.ClientConn, t *hotline.Transaction) (res []hotline.Transaction)

HandleMakeAlias makes a file alias using the specified path. Fields used in the request: 201 File Name 202 File path 212 File new path Destination path

Fields used in the reply: None

func HandleMoveFile

func HandleMoveFile(cc *hotline.ClientConn, t *hotline.Transaction) (res []hotline.Transaction)

HandleMoveFile moves files or folders. Note: seemingly not documented

func HandleNewFolder

func HandleNewFolder(cc *hotline.ClientConn, t *hotline.Transaction) (res []hotline.Transaction)

func HandleNewNewsCat

func HandleNewNewsCat(cc *hotline.ClientConn, t *hotline.Transaction) (res []hotline.Transaction)

func HandleNewNewsFldr

func HandleNewNewsFldr(cc *hotline.ClientConn, t *hotline.Transaction) (res []hotline.Transaction)

Fields used in the request: 322 News category Name 325 News path

func HandleNewUser

func HandleNewUser(cc *hotline.ClientConn, t *hotline.Transaction) (res []hotline.Transaction)

HandleNewUser creates a new user account

func HandlePostNewsArt

func HandlePostNewsArt(cc *hotline.ClientConn, t *hotline.Transaction) (res []hotline.Transaction)

Request fields 325 News path 326 News article Type Type of the parent article? 328 News article title 334 News article flags 327 News article data flavor Currently “text/plain” 333 News article data

func HandleRejectChatInvite

func HandleRejectChatInvite(cc *hotline.ClientConn, t *hotline.Transaction) (res []hotline.Transaction)

func HandleSendInstantMsg

func HandleSendInstantMsg(cc *hotline.ClientConn, t *hotline.Transaction) (res []hotline.Transaction)

HandleSendInstantMsg sends instant message to the user on the current server. Fields used in the request:

103	User Type
113	Options
	One of the following values:
	- User message (myOpt_UserMessage = 1)
	- Refuse message (myOpt_RefuseMessage = 2)
	- Refuse chat (myOpt_RefuseChat  = 3)
	- Automatic response (myOpt_AutomaticResponse = 4)"
101	Data	Optional
214	Quoting message	Optional

Fields used in the reply: None

func HandleSetChatSubject

func HandleSetChatSubject(cc *hotline.ClientConn, t *hotline.Transaction) (res []hotline.Transaction)

HandleSetChatSubject is sent from a v1.8+ Hotline client when the user sets a private chat subject Fields used in the request: * 114 Chat Type * 115 Chat subject Reply is not expected.

func HandleSetClientUserInfo

func HandleSetClientUserInfo(cc *hotline.ClientConn, t *hotline.Transaction) (res []hotline.Transaction)

func HandleSetFileInfo

func HandleSetFileInfo(cc *hotline.ClientConn, t *hotline.Transaction) (res []hotline.Transaction)

HandleSetFileInfo updates a file or folder Name and/or comment from the Get Info window Fields used in the request: * 201 File Name * 202 File path Optional * 211 File new Name Optional * 210 File comment Optional Fields used in the reply: None

func HandleSetUser

func HandleSetUser(cc *hotline.ClientConn, t *hotline.Transaction) (res []hotline.Transaction)

func HandleTranAgreed

func HandleTranAgreed(cc *hotline.ClientConn, t *hotline.Transaction) (res []hotline.Transaction)

func HandleTranOldPostNews

func HandleTranOldPostNews(cc *hotline.ClientConn, t *hotline.Transaction) (res []hotline.Transaction)

HandleTranOldPostNews updates the flat news Fields used in this request: 101 Data

func HandleUpdateUser

func HandleUpdateUser(cc *hotline.ClientConn, t *hotline.Transaction) (res []hotline.Transaction)

HandleUpdateUser is used by the v1.5+ multi-user editor to perform account editing for multiple users at a time. An update can be a mix of these actions: * Create user * Delete user * Modify user (including renaming the account login)

The Transaction sent by the client includes one data field per user that was modified. This data field in turn contains another data field encoded in its payload with a varying number of sub fields depending on which action is performed. This seems to be the only place in the Hotline protocol where a data field contains another data field.

func HandleUploadFile

func HandleUploadFile(cc *hotline.ClientConn, t *hotline.Transaction) (res []hotline.Transaction)

HandleUploadFile Fields used in the request: 201 File Name 202 File path 204 File transfer options "Optional Used only to resume download, currently has value 2" 108 File transfer size "Optional used if download is not resumed"

func HandleUploadFolder

func HandleUploadFolder(cc *hotline.ClientConn, t *hotline.Transaction) (res []hotline.Transaction)

Upload all files from the local folder and its subfolders to the specified path on the server Fields used in the request 201 File Name 202 File path 108 hotline.Transfer size Total size of all items in the folder 220 Folder item count 204 File transfer options "Optional Currently set to 1" (TODO: ??)

func HandleUserBroadcast

func HandleUserBroadcast(cc *hotline.ClientConn, t *hotline.Transaction) (res []hotline.Transaction)

HandleUserBroadcast sends an Administrator Message to all connected clients of the server

func LoadConfig

func LoadConfig(path string) (*hotline.Config, error)

func NewLogResponseWriter added in v0.14.0

func NewLogResponseWriter(w http.ResponseWriter) *logResponseWriter

func NewLogger added in v0.14.0

func NewLogger(logLevel, logFile *string) *slog.Logger

func RegisterHandlers

func RegisterHandlers(srv *hotline.Server)

Assign functions to handle specific Hotline transaction types

Types

type APIServer added in v0.14.0

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

func NewAPIServer added in v0.14.0

func NewAPIServer(hlServer *hotline.Server, reloadFunc func(), logger *slog.Logger) *APIServer

func (*APIServer) ReloadHandler added in v0.14.0

func (srv *APIServer) ReloadHandler(reloadFunc func()) func(w http.ResponseWriter, _ *http.Request)

func (*APIServer) RenderStats added in v0.14.0

func (srv *APIServer) RenderStats(w http.ResponseWriter, _ *http.Request)

func (*APIServer) Serve added in v0.14.0

func (srv *APIServer) Serve(port string)

func (*APIServer) ShutdownHandler added in v0.14.0

func (srv *APIServer) ShutdownHandler(w http.ResponseWriter, r *http.Request)

type Agreement

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

func NewAgreement

func NewAgreement(path, lineEndings string) (*Agreement, error)

func (*Agreement) Read

func (a *Agreement) Read(p []byte) (int, error)

It returns the number of bytes read and any error encountered.

func (*Agreement) Reload

func (a *Agreement) Reload() error

func (*Agreement) Seek

func (a *Agreement) Seek(offset int64, _ int) (int64, error)

type BanFile

type BanFile struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func NewBanFile

func NewBanFile(path string) (*BanFile, error)

func (*BanFile) Add

func (bf *BanFile) Add(ip string, until *time.Time) error

func (*BanFile) IsBanned

func (bf *BanFile) IsBanned(ip string) (bool, *time.Time)

func (*BanFile) Load

func (bf *BanFile) Load() error

type FlatNews

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

func NewFlatNews

func NewFlatNews(path string) (*FlatNews, error)

func (*FlatNews) Read

func (f *FlatNews) Read(p []byte) (int, error)

It returns the number of bytes read and any error encountered.

func (*FlatNews) Reload

func (f *FlatNews) Reload() error

func (*FlatNews) Seek

func (f *FlatNews) Seek(offset int64, _ int) (int64, error)

func (*FlatNews) Write

func (f *FlatNews) Write(p []byte) (int, error)

Write implements io.Writer for flat news. p is guaranteed to contain the full data of a news post.

type MockAccountManager

type MockAccountManager struct {
	mock.Mock
}

func (*MockAccountManager) Create

func (m *MockAccountManager) Create(account hotline.Account) error

func (*MockAccountManager) Delete

func (m *MockAccountManager) Delete(login string) error

func (*MockAccountManager) Get

func (m *MockAccountManager) Get(login string) *hotline.Account

func (*MockAccountManager) List

func (m *MockAccountManager) List() []hotline.Account

func (*MockAccountManager) Update

func (m *MockAccountManager) Update(account hotline.Account, newLogin string) error

type ThreadedNewsYAML

type ThreadedNewsYAML struct {
	ThreadedNews hotline.ThreadedNews
	// contains filtered or unexported fields
}

func NewThreadedNewsYAML

func NewThreadedNewsYAML(filePath string) (*ThreadedNewsYAML, error)

func (*ThreadedNewsYAML) CreateGrouping

func (n *ThreadedNewsYAML) CreateGrouping(newsPath []string, name string, t [2]byte) error

func (*ThreadedNewsYAML) DeleteArticle

func (n *ThreadedNewsYAML) DeleteArticle(newsPath []string, articleID uint32, _ bool) error

func (*ThreadedNewsYAML) DeleteNewsItem

func (n *ThreadedNewsYAML) DeleteNewsItem(newsPath []string) error

func (*ThreadedNewsYAML) GetArticle

func (n *ThreadedNewsYAML) GetArticle(newsPath []string, articleID uint32) *hotline.NewsArtData

func (*ThreadedNewsYAML) GetCategories

func (n *ThreadedNewsYAML) GetCategories(paths []string) []hotline.NewsCategoryListData15

func (*ThreadedNewsYAML) ListArticles

func (n *ThreadedNewsYAML) ListArticles(newsPath []string) hotline.NewsArtListData

func (*ThreadedNewsYAML) Load

func (n *ThreadedNewsYAML) Load() error

func (*ThreadedNewsYAML) NewsItem

func (n *ThreadedNewsYAML) NewsItem(newsPath []string) hotline.NewsCategoryListData15

func (*ThreadedNewsYAML) PostArticle

func (n *ThreadedNewsYAML) PostArticle(newsPath []string, parentArticleID uint32, article hotline.NewsArtData) error

type YAMLAccountManager

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

func NewYAMLAccountManager

func NewYAMLAccountManager(accountDir string) (*YAMLAccountManager, error)

func (*YAMLAccountManager) Create

func (am *YAMLAccountManager) Create(account hotline.Account) error

func (*YAMLAccountManager) Delete

func (am *YAMLAccountManager) Delete(login string) error

func (*YAMLAccountManager) Get

func (am *YAMLAccountManager) Get(login string) *hotline.Account

func (*YAMLAccountManager) List

func (am *YAMLAccountManager) List() []hotline.Account

func (*YAMLAccountManager) Update

func (am *YAMLAccountManager) Update(account hotline.Account, newLogin string) error

Jump to

Keyboard shortcuts

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