citadel: Index | Files | Directories

package citadel

import ""

Package is a Citadel Client library to access Citadel email and collaboration servers from Go using the Citadel Protocol.


Package Files

citadel.go floors.go messages.go rooms.go tools.go user.go


const (
    DS  = "|"
    DE  = "000"

    VIEW_BBS         = "0" // Bulletin board view
    VIEW_MAILBOX     = "1" // Mailbox summary
    VIEW_ADDRESSBOOK = "2" // Address book view
    VIEW_CALENDAR    = "3" // Calendar view
    VIEW_TASKS       = "4" // Tasks view
    VIEW_NOTES       = "5" // Notes view
    VIEW_WIKI        = "6" // Wiki view

    CODE_DONE            = 0
    CODE_LISTING_FOLLOWS = 1 // The requested operation is progressing and is now delivering text. The client *must* now read lines of text until it receives the termination sequence (“000” on a line by itself).
    CODE_OK              = 2 // The requested operation succeeded.
    CODE_MORE_DATA       = 3 // The requested operation succeeded so far, but another command is required to complete it.
    CODE_SEND_LISTING    = 4 // The requested operation is progressing and is now expecting text. The client *must* now transmit zero or more lines of text followed by the termination sequence (“000” on a line by itself).
    CODE_ERROR           = 5 // The requested operation failed. The second and third digits of the error code and/or the error message following it describes why.
    CODE_BINARY_FOLLOWS  = 6 // After this line please read n bytes. (n follows after a blank)
    CODE_SEND_BINARY     = 7 // you now may send us n bytes binary data. (n follows after a blank)
    CODE_START_CHAT_MODE = 8 // ok, we are in chat mode now. every line you send will be broadcasted.
    CODE_ASYNC_MSG       = 9 // there is a page waiting for you, please fetch it.

    MESG_OK                      = 0
    MESG_ASYNC_GEXP              = 02
    MESG_INTERNAL_ERROR          = 10
    MESG_TOO_BIG                 = 11
    MESG_ILLEGAL_VALUE           = 12
    MESG_NOT_LOGGED_IN           = 20
    MESG_RESOURCE_BUSY           = 52
    MESG_NOT_HERE                = 60
    MESG_NO_SUCH_USER            = 70
    MESG_FILE_NOT_FOUND          = 71
    MESG_ROOM_NOT_FOUND          = 72
    MESG_NO_SUCH_SYSTEM          = 73
    MESG_ALREADY_EXISTS          = 74
const (
    LIST_ALL    msglist = "all"
    LIST_OLD    msglist = "old"
    LIST_NEW    msglist = "new"
    LIST_FIRST  msglist = "first"
    LIST_LAST   msglist = "last"
    LIST_GT     msglist = "gt"
    LIST_LT     msglist = "lt"
    LIST_SEARCH msglist = "search"
const (
    Rx_USERNAME      = "^[A-Za-z0-9_-]{4,}$"
    Rx_USERNAME_TRIM = "_- "
    Rx_PASSWORD      = "^.{5,}$"
    Rx_SPACE_TRIM    = " "
const (
    USE_LEVEL_NEW      = "1"
    USE_LEVEL_LOCAL    = "3"
    USE_LEVEL_ADMIN    = "6"


var (
    DEVELOPER_ID   = 12    // Developer ID number	(same as the server developer ID numbers in the INFO command – please obtain one if you are a new developer)
    CLIENT_ID      = 1     // Client ID number	(which does not have to be globally unique - only unique within the domain of the developer number)
    CLIENT_VERSION = 3     // Client version number	the Version of your Client
    CLIENT_NAME    = "Lib" // Client IDString	afree-form text string describing the client
var (
    NetTimeout    = 30 * time.Second // Time to establish a TCP connection
    ServerTimeout = 60 * time.Second // Time to receive greeting and capabilities

Timeout values for the Dial functions.

var Floors []floor
var Rooms struct {
    List    []room
    Updated int

func StrToInt Uses

func StrToInt(s string) (i int, ok bool)

func StrToTime Uses

func StrToTime(s string) (t time.Time, ok bool)

func TrimPrefix Uses

func TrimPrefix(s, p string) string

func Validate Uses

func Validate(t, rx string) bool

type Citadel Uses

type Citadel struct {
    Conn  *textproto.Conn
    Room  room  // Current room data
    Floor floor // Current floor data
    Code  int   // Citadel reponce CODE_XXXX
    Mesg  int   // Citadel responce MESG_XXXX
    Resp  []string
    Raw   string // Raw responce from citadel
    Error error
    // contains filtered or unexported fields

func Dial Uses

func Dial(addr string) (cit *Citadel, err error)

Dial returns a new Client connected to a server at addr.

func New Uses

func New(addr string) (c *Citadel)

func (*Citadel) Check Uses

func (c *Citadel) Check() (ok bool)

func (*Citadel) Close Uses

func (c *Citadel) Close()

func (*Citadel) FloorsLoader Uses

func (c *Citadel) FloorsLoader() (ok bool)

func (*Citadel) GetDav Uses

func (c *Citadel) GetDav(MsgID string, contentType string) (msg *Message, dav *Dav, ok bool)

Get vcard from current room by MSG ID

func (*Citadel) GetMessage Uses

func (c *Citadel) GetMessage(MsgID, Mime string) (msg *Message, ok bool)

Get vcard from current room by MSG ID

func (*Citadel) Goto Uses

func (c *Citadel) Goto(ro string) (ok bool)

Enter a specific room by name

func (*Citadel) Iden Uses

func (c *Citadel) Iden()

func (*Citadel) Info Uses

func (c *Citadel) Info()

You can use this to see information about the last command executed

func (*Citadel) Login Uses

func (c *Citadel) Login(username, password string) (ok bool)

func (*Citadel) Logout Uses

func (c *Citadel) Logout()

func (*Citadel) MsgListAll Uses

func (c *Citadel) MsgListAll() (list []string, ok bool)

Get list of all messages in current room

func (*Citadel) MsgsDel Uses

func (c *Citadel) MsgsDel(list []string) (ok bool)

Del a list of messages from current room

func (*Citadel) Open Uses

func (c *Citadel) Open(addr string)

func (*Citadel) Request Uses

func (c *Citadel) Request(cmd string) (ok bool)

Makes a request and returns the 1st responce

func (*Citadel) Responce Uses

func (c *Citadel) Responce() (r [][]string)

This is for multi line responces. Used when receiving CODE_LISTING_FOLLOWS

func (*Citadel) RoomsAll Uses

func (c *Citadel) RoomsAll() bool

List all accessible Rooms

func (*Citadel) RoomsPublic Uses

func (c *Citadel) RoomsPublic() bool

List all Public Rooms

func (*Citadel) RoomsStat Uses

func (c *Citadel) RoomsStat() (ok bool)

Retrieve modification time of current room

func (*Citadel) UserCfg Uses

func (c *Citadel) UserCfg(username string) bool

func (*Citadel) UserCreate Uses

func (c *Citadel) UserCreate(username, password string) (ok bool)

func (*Citadel) UserSetPassword Uses

func (c *Citadel) UserSetPassword(password string) (ok bool)

This command sets a new password for the currently logged in user.

type Dav Uses

type Dav struct {
    UID    string
    REV    string
    FN     string
    Object string

func (*Dav) ParseDav Uses

func (dav *Dav) ParseDav(text string)

type Message Uses

type Message struct {
    EUID   string
    Mime   string // text/vcard
    UxTime int
    Text   string

type MsgList Uses

type MsgList struct {
    Cmd       msglist
    FirstLast int
    GtLt      int
    Find      string


citadelsyncSync local files such as vCard, vCalender, vNotes, and text files with a local or remote Citadel Mail Server

Package citadel imports 11 packages (graph) and is imported by 2 packages. Updated 2019-04-20. Refresh now. Tools for package owners.