// $Id: smbdefs.js,v 1.11 2019/08/26 08:57:14 rswindell Exp $
// Synchronet Message Base constant definitions (from smbdefs.h and smblib.h)
// @format.tab-size 4

/* Values for MsgBase.status (SMBLIB function return values) */
var SMB_SUCCESS			= 0;		// Successful result/return code
var SMB_DUPE_MSG			= 1;		// Duplicate message detected by smb_addcrc()
var SMB_FAILURE			= -1;		// Generic error (discouraged)
var SMB_ERR_NOT_OPEN		= -100;		// Message base not open
var SMB_ERR_HDR_LEN		= -101;		// Invalid message header length (>64k)
var SMB_ERR_HDR_OFFSET	= -102;		// Invalid message header offset
var SMB_ERR_HDR_ID		= -103;		// Invalid header ID
var SMB_ERR_HDR_VER		= -104;		// Unsupported version
var SMB_ERR_HDR_FIELD		= -105;		// Missing header field
var SMB_ERR_NOT_FOUND		= -110;		// Item not found
var SMB_ERR_DAT_OFFSET	= -120;		// Invalid data offset (>2GB)
var SMB_ERR_DAT_LEN		= -121;		// Invalid data length (>2GB)
var SMB_ERR_OPEN			= -200;		// File open error
var SMB_ERR_SEEK			= -201;		// File seek/setpos error
var SMB_ERR_LOCK			= -202;		// File lock error
var SMB_ERR_READ			= -203;		// File read error
var SMB_ERR_WRITE			= -204;		// File write error
var SMB_ERR_TIMEOUT		= -205;		// File operation timed-out
var SMB_ERR_FILE_LEN		= -206;		// File length invalid
var SMB_ERR_DELETE		= -207;		// File deletion error
var SMB_ERR_UNLOCK		= -208;		// File unlock error
var SMB_ERR_MEM			= -300;		// Memory allocation error

/* MsgBase.attributes bit flags */
var SMB_EMAIL				= 1;		// User numbers stored in Indexes
var SMB_HYPERALLOC		= 2;		// No allocation (also storage value for smb_addmsghdr)
var SMB_NOHASH			= 4;		// Do not calculate or store hashes

/* Message Types */
var MSG_TYPE_NORMAL		= 0;		// Classic message (for reading)
var MSG_TYPE_POLL			= 1;		// A poll question 
var MSG_TYPE_BALLOT		= 2;		// Voter response to poll or normal message
var MSG_TYPE_POLL_CLOSURE	= 3;		// Closure of an existing poll

/* Message attributes */
var MSG_PRIVATE 			= (1<<0);
var MSG_READ				= (1<<1);
var MSG_PERMANENT			= (1<<2);
var MSG_LOCKED			= (1<<3);
var MSG_DELETE			= (1<<4);
var MSG_ANONYMOUS			= (1<<5);
var MSG_KILLREAD			= (1<<6);
var MSG_MODERATED			= (1<<7);
var MSG_VALIDATED			= (1<<8);
var MSG_REPLIED			= (1<<9);	// User replied to this message
var MSG_NOREPLY			= (1<<10);	// No replies (or bounces) should be sent to the sender
var MSG_UPVOTE			= (1<<11);	// This message is an upvote
var MSG_DOWNVOTE			= (1<<12);	// This message is a downvote
var MSG_POLL				= (1<<13);	// This message is a poll
var MSG_SPAM				= (1<<14);	// This message has been flagged as SPAM

var MSG_VOTE				= (MSG_UPVOTE|MSG_DOWNVOTE);// This message is a poll-vote
var MSG_POLL_CLOSURE		= (MSG_POLL|MSG_VOTE);		// This message is a poll-closure
var MSG_POLL_VOTE_MASK	= MSG_POLL_CLOSURE;

var MSG_POLL_MAX_ANSWERS	= 16;


/* Auxiliary header attributes */
var MSG_FILEREQUEST 		= (1<<0);	// File request
var MSG_FILEATTACH		= (1<<1);	// File(s) attached to Msg
var MSG_MIMEATTACH		= (1<<2);	// Truncate file(s) when sent
var MSG_KILLFILE			= (1<<3);	// Delete file(s) when sent
var MSG_RECEIPTREQ		= (1<<4);	// Return receipt requested
var MSG_CONFIRMREQ		= (1<<5);	// Confirmation receipt requested
var MSG_NODISP			= (1<<6);	// Msg may not be displayed to user
var MSG_FIXED_FORMAT		= (1<<7);   // Pre-formatted message body text
var MSG_HFIELDS_UTF8		= (1<<13);	// Message header fields are UTF-8 encoded
var POLL_CLOSED			= (1<<24);	// Closed to voting
var POLL_RESULTS_MASK		= (3<<30);	// 4 possible values:
var POLL_RESULTS_SECRET	= (3<<30);	// No one but pollster can see results
var POLL_RESULTS_CLOSED	= (2<<30);	// No one but pollster can see results until poll is closed
var POLL_RESULTS_OPEN		= (1<<30);	// Results are visible to everyone always
var POLL_RESULTS_VOTERS	= (0<<30);	// Voters can see results right away, everyone else when closed
var POLL_RESULTS_SHIFT	= 30;


/* Message network attributes */
var NETMSG_LOCAL				= (1<<0);	// Msg created locally
var NETMSG_INTRANSIT			= (1<<1);	// Msg is in-transit
var NETMSG_SENT				= (1<<2);	// Sent to remote
var NETMSG_KILLSENT			= (1<<3);	// Kill when sent
var NETMSG_ARCHIVESENT 		= (1<<4);	// Archive when sent
var NETMSG_HOLD				= (1<<5);	// Hold for pick-up
var NETMSG_CRASH				= (1<<6);	// Crash
var NETMSG_IMMEDIATE			= (1<<7);	// Send Msg now, ignore restrictions
var NETMSG_DIRECT				= (1<<8);	// Send directly to destination

/* Net types */
var NET_NONE				= 0;		// Local message
var NET_UNKNOWN			= 1;		// Networked, but unknown type
var NET_FIDO				= 2;		// FidoNet
var NET_POSTLINK			= 3;		// PostLink
var NET_QWK				= 4;		// QWK
var NET_INTERNET			= 5;		// NNTP
var NET_WWIV				= 6;		// WWIV
var NET_MHS				= 7;		// MHS

/* Agent types */
var AGENT_PERSON			= 0;		// Human
var AGENT_PROCESS			= 1;		// Unknown process type
var AGENT_SMBUTIL			= 2;		// Imported via Synchronet SMBUTIL
var AGENT_SMTPSYSMSG		= 3;		// Synchronet SMTP server system message

/* Message Priority */
var SMB_PRIORITY_UNSPECIFIED 	= 0;
var SMB_PRIORITY_HIGHEST		= 1;
var SMB_PRIORITY_HIGH			= 2;
var SMB_PRIORITY_NORMAL		= 3;
var SMB_PRIORITY_LOW			= 4;
var SMB_PRIORITY_LOWEST		= 5;

/* Message hfield types */
var SMB_SUMMARY			= 0x61; 	// Not currently used for messages
var SMB_COMMENT 			= 0x62; 	// Appear in message text, before body
var SMB_GROUP 			= 0x64;
var SMB_TAGS				= 0x69; 	// Tags (ala hashtags) for a message
var SMB_TAGS_MAXLEN		= 60;		// Tags strings are limited to this total length
var SMB_TAG_DELIMITER		= ' ';		// Tags are space-separated
var SMB_POLL_ANSWER		= 0xe0;		// One poll answer (the subject is the question)

var FIDOCTRL     			= 0xa0;
var FIDOSEENBY   			= 0xa2;
var FIDOPATH     			= 0xa3;
var RFC822HEADER 			= 0xb0;
var RFC822MSGID 			= 0xb1;
var RFC822REPLYID			= 0xb2;
var RFC822TO				= 0xb3;
var RFC822FROM			= 0xb4;
var RFC822REPLYTO			= 0xb5;
var RFC822CC				= 0xb6;
var RFC822ORG				= 0xb7;
var RFC822SUBJECT			= 0xb8;
var SMTPRECEIVED 			= 0xd3;
