Start X11 and web frontends for xC
For this, we needed a wire protocol. After surveying available options,
it was decided to implement an XDR-like protocol code generator
in portable AWK. It now has two backends, per each of:
- xF, the X11 frontend, is in C, and is meant to be the primary
user interface in the future.
- xP, the web frontend, relies on a protocol proxy written in Go,
and is meant for use on-the-go (no pun intended).
They are very much work-in-progress proofs of concept right now,
and the relay protocol is certain to change.
2022-08-08 04:39:20 +02:00
|
|
|
// Backwards-compatible protocol version.
|
|
|
|
const VERSION = 1;
|
|
|
|
|
|
|
|
// From the frontend to the relay.
|
|
|
|
struct CommandMessage {
|
2022-09-07 19:42:18 +02:00
|
|
|
// The command sequence number will be repeated in responses
|
|
|
|
// in the respective fields.
|
Start X11 and web frontends for xC
For this, we needed a wire protocol. After surveying available options,
it was decided to implement an XDR-like protocol code generator
in portable AWK. It now has two backends, per each of:
- xF, the X11 frontend, is in C, and is meant to be the primary
user interface in the future.
- xP, the web frontend, relies on a protocol proxy written in Go,
and is meant for use on-the-go (no pun intended).
They are very much work-in-progress proofs of concept right now,
and the relay protocol is certain to change.
2022-08-08 04:39:20 +02:00
|
|
|
u32 command_seq;
|
|
|
|
union CommandData switch (enum Command {
|
|
|
|
HELLO,
|
|
|
|
ACTIVE,
|
|
|
|
BUFFER_ACTIVATE,
|
2022-09-16 02:46:03 +02:00
|
|
|
BUFFER_INPUT,
|
|
|
|
BUFFER_TOGGLE_UNIMPORTANT,
|
2022-09-08 02:33:44 +02:00
|
|
|
PING_RESPONSE,
|
|
|
|
PING,
|
|
|
|
BUFFER_COMPLETE,
|
Start X11 and web frontends for xC
For this, we needed a wire protocol. After surveying available options,
it was decided to implement an XDR-like protocol code generator
in portable AWK. It now has two backends, per each of:
- xF, the X11 frontend, is in C, and is meant to be the primary
user interface in the future.
- xP, the web frontend, relies on a protocol proxy written in Go,
and is meant for use on-the-go (no pun intended).
They are very much work-in-progress proofs of concept right now,
and the relay protocol is certain to change.
2022-08-08 04:39:20 +02:00
|
|
|
BUFFER_LOG,
|
|
|
|
} command) {
|
2022-09-16 02:46:03 +02:00
|
|
|
// If the version check succeeds, the client will receive
|
|
|
|
// an initial stream of SERVER_UPDATE, BUFFER_UPDATE, BUFFER_STATS,
|
|
|
|
// BUFFER_LINE, and finally a BUFFER_ACTIVATE message.
|
Start X11 and web frontends for xC
For this, we needed a wire protocol. After surveying available options,
it was decided to implement an XDR-like protocol code generator
in portable AWK. It now has two backends, per each of:
- xF, the X11 frontend, is in C, and is meant to be the primary
user interface in the future.
- xP, the web frontend, relies on a protocol proxy written in Go,
and is meant for use on-the-go (no pun intended).
They are very much work-in-progress proofs of concept right now,
and the relay protocol is certain to change.
2022-08-08 04:39:20 +02:00
|
|
|
case HELLO:
|
|
|
|
u32 version;
|
|
|
|
case ACTIVE:
|
|
|
|
void;
|
2022-09-16 02:46:03 +02:00
|
|
|
case BUFFER_ACTIVATE:
|
|
|
|
string buffer_name;
|
Start X11 and web frontends for xC
For this, we needed a wire protocol. After surveying available options,
it was decided to implement an XDR-like protocol code generator
in portable AWK. It now has two backends, per each of:
- xF, the X11 frontend, is in C, and is meant to be the primary
user interface in the future.
- xP, the web frontend, relies on a protocol proxy written in Go,
and is meant for use on-the-go (no pun intended).
They are very much work-in-progress proofs of concept right now,
and the relay protocol is certain to change.
2022-08-08 04:39:20 +02:00
|
|
|
case BUFFER_INPUT:
|
|
|
|
string buffer_name;
|
|
|
|
string text;
|
2022-09-16 02:46:03 +02:00
|
|
|
// XXX: Perhaps this should rather be handled through a /buffer command.
|
|
|
|
case BUFFER_TOGGLE_UNIMPORTANT:
|
Start X11 and web frontends for xC
For this, we needed a wire protocol. After surveying available options,
it was decided to implement an XDR-like protocol code generator
in portable AWK. It now has two backends, per each of:
- xF, the X11 frontend, is in C, and is meant to be the primary
user interface in the future.
- xP, the web frontend, relies on a protocol proxy written in Go,
and is meant for use on-the-go (no pun intended).
They are very much work-in-progress proofs of concept right now,
and the relay protocol is certain to change.
2022-08-08 04:39:20 +02:00
|
|
|
string buffer_name;
|
2022-09-08 02:33:44 +02:00
|
|
|
case PING_RESPONSE:
|
|
|
|
u32 event_seq;
|
|
|
|
|
|
|
|
// Only these commands may produce Event.RESPONSE, as below,
|
|
|
|
// but any command may produce an error.
|
|
|
|
case PING:
|
|
|
|
void;
|
|
|
|
case BUFFER_COMPLETE:
|
|
|
|
string buffer_name;
|
|
|
|
string text;
|
|
|
|
u32 position;
|
Start X11 and web frontends for xC
For this, we needed a wire protocol. After surveying available options,
it was decided to implement an XDR-like protocol code generator
in portable AWK. It now has two backends, per each of:
- xF, the X11 frontend, is in C, and is meant to be the primary
user interface in the future.
- xP, the web frontend, relies on a protocol proxy written in Go,
and is meant for use on-the-go (no pun intended).
They are very much work-in-progress proofs of concept right now,
and the relay protocol is certain to change.
2022-08-08 04:39:20 +02:00
|
|
|
case BUFFER_LOG:
|
|
|
|
string buffer_name;
|
|
|
|
} data;
|
|
|
|
};
|
|
|
|
|
|
|
|
// From the relay to the frontend.
|
|
|
|
struct EventMessage {
|
|
|
|
u32 event_seq;
|
|
|
|
union EventData switch (enum Event {
|
|
|
|
PING,
|
|
|
|
BUFFER_UPDATE,
|
2022-09-10 17:37:19 +02:00
|
|
|
BUFFER_STATS,
|
Start X11 and web frontends for xC
For this, we needed a wire protocol. After surveying available options,
it was decided to implement an XDR-like protocol code generator
in portable AWK. It now has two backends, per each of:
- xF, the X11 frontend, is in C, and is meant to be the primary
user interface in the future.
- xP, the web frontend, relies on a protocol proxy written in Go,
and is meant for use on-the-go (no pun intended).
They are very much work-in-progress proofs of concept right now,
and the relay protocol is certain to change.
2022-08-08 04:39:20 +02:00
|
|
|
BUFFER_RENAME,
|
|
|
|
BUFFER_REMOVE,
|
|
|
|
BUFFER_ACTIVATE,
|
|
|
|
BUFFER_LINE,
|
|
|
|
BUFFER_CLEAR,
|
2022-09-11 20:46:35 +02:00
|
|
|
SERVER_UPDATE,
|
|
|
|
SERVER_RENAME,
|
|
|
|
SERVER_REMOVE,
|
Start X11 and web frontends for xC
For this, we needed a wire protocol. After surveying available options,
it was decided to implement an XDR-like protocol code generator
in portable AWK. It now has two backends, per each of:
- xF, the X11 frontend, is in C, and is meant to be the primary
user interface in the future.
- xP, the web frontend, relies on a protocol proxy written in Go,
and is meant for use on-the-go (no pun intended).
They are very much work-in-progress proofs of concept right now,
and the relay protocol is certain to change.
2022-08-08 04:39:20 +02:00
|
|
|
ERROR,
|
|
|
|
RESPONSE,
|
|
|
|
} event) {
|
|
|
|
case PING:
|
|
|
|
void;
|
2022-09-11 20:46:35 +02:00
|
|
|
|
Start X11 and web frontends for xC
For this, we needed a wire protocol. After surveying available options,
it was decided to implement an XDR-like protocol code generator
in portable AWK. It now has two backends, per each of:
- xF, the X11 frontend, is in C, and is meant to be the primary
user interface in the future.
- xP, the web frontend, relies on a protocol proxy written in Go,
and is meant for use on-the-go (no pun intended).
They are very much work-in-progress proofs of concept right now,
and the relay protocol is certain to change.
2022-08-08 04:39:20 +02:00
|
|
|
case BUFFER_UPDATE:
|
|
|
|
string buffer_name;
|
2022-09-10 18:58:55 +02:00
|
|
|
bool hide_unimportant;
|
2022-09-11 20:46:35 +02:00
|
|
|
union BufferContext switch (enum BufferKind {
|
|
|
|
GLOBAL,
|
|
|
|
SERVER,
|
|
|
|
CHANNEL,
|
|
|
|
PRIVATE_MESSAGE,
|
|
|
|
} kind) {
|
|
|
|
case GLOBAL:
|
|
|
|
void;
|
|
|
|
case SERVER:
|
|
|
|
string server_name;
|
|
|
|
case CHANNEL:
|
|
|
|
string server_name;
|
|
|
|
case PRIVATE_MESSAGE:
|
|
|
|
string server_name;
|
|
|
|
} context;
|
2022-09-10 17:37:19 +02:00
|
|
|
case BUFFER_STATS:
|
|
|
|
string buffer_name;
|
2022-09-07 19:42:18 +02:00
|
|
|
// These are cumulative, even for lines flushed out from buffers.
|
|
|
|
// Updates to these values aren't broadcasted, thus handle:
|
|
|
|
// - BUFFER_LINE by bumping/setting them as appropriate,
|
|
|
|
// - BUFFER_ACTIVATE by clearing them for the previous buffer
|
|
|
|
// (this way, they can be used to mark unread messages).
|
|
|
|
u32 new_messages;
|
|
|
|
u32 new_unimportant_messages;
|
|
|
|
bool highlighted;
|
Start X11 and web frontends for xC
For this, we needed a wire protocol. After surveying available options,
it was decided to implement an XDR-like protocol code generator
in portable AWK. It now has two backends, per each of:
- xF, the X11 frontend, is in C, and is meant to be the primary
user interface in the future.
- xP, the web frontend, relies on a protocol proxy written in Go,
and is meant for use on-the-go (no pun intended).
They are very much work-in-progress proofs of concept right now,
and the relay protocol is certain to change.
2022-08-08 04:39:20 +02:00
|
|
|
case BUFFER_RENAME:
|
|
|
|
string buffer_name;
|
|
|
|
string new;
|
|
|
|
case BUFFER_REMOVE:
|
|
|
|
string buffer_name;
|
|
|
|
case BUFFER_ACTIVATE:
|
|
|
|
string buffer_name;
|
|
|
|
case BUFFER_LINE:
|
|
|
|
string buffer_name;
|
2022-09-07 19:42:18 +02:00
|
|
|
// Whether the line should also be displayed in the active buffer.
|
2022-09-07 15:33:38 +02:00
|
|
|
bool leak_to_active;
|
Start X11 and web frontends for xC
For this, we needed a wire protocol. After surveying available options,
it was decided to implement an XDR-like protocol code generator
in portable AWK. It now has two backends, per each of:
- xF, the X11 frontend, is in C, and is meant to be the primary
user interface in the future.
- xP, the web frontend, relies on a protocol proxy written in Go,
and is meant for use on-the-go (no pun intended).
They are very much work-in-progress proofs of concept right now,
and the relay protocol is certain to change.
2022-08-08 04:39:20 +02:00
|
|
|
bool is_unimportant;
|
|
|
|
bool is_highlight;
|
|
|
|
enum Rendition {
|
|
|
|
BARE,
|
|
|
|
INDENT,
|
|
|
|
STATUS,
|
|
|
|
ERROR,
|
|
|
|
JOIN,
|
|
|
|
PART,
|
2022-09-05 22:53:34 +02:00
|
|
|
ACTION,
|
Start X11 and web frontends for xC
For this, we needed a wire protocol. After surveying available options,
it was decided to implement an XDR-like protocol code generator
in portable AWK. It now has two backends, per each of:
- xF, the X11 frontend, is in C, and is meant to be the primary
user interface in the future.
- xP, the web frontend, relies on a protocol proxy written in Go,
and is meant for use on-the-go (no pun intended).
They are very much work-in-progress proofs of concept right now,
and the relay protocol is certain to change.
2022-08-08 04:39:20 +02:00
|
|
|
} rendition;
|
2022-09-06 14:38:09 +02:00
|
|
|
// Unix timestamp in milliseconds.
|
Start X11 and web frontends for xC
For this, we needed a wire protocol. After surveying available options,
it was decided to implement an XDR-like protocol code generator
in portable AWK. It now has two backends, per each of:
- xF, the X11 frontend, is in C, and is meant to be the primary
user interface in the future.
- xP, the web frontend, relies on a protocol proxy written in Go,
and is meant for use on-the-go (no pun intended).
They are very much work-in-progress proofs of concept right now,
and the relay protocol is certain to change.
2022-08-08 04:39:20 +02:00
|
|
|
u64 when;
|
|
|
|
// Broken-up text, with in-band formatting.
|
|
|
|
union ItemData switch (enum Item {
|
|
|
|
TEXT,
|
|
|
|
RESET,
|
|
|
|
FG_COLOR,
|
|
|
|
BG_COLOR,
|
|
|
|
FLIP_BOLD,
|
|
|
|
FLIP_ITALIC,
|
|
|
|
FLIP_UNDERLINE,
|
|
|
|
FLIP_INVERSE,
|
|
|
|
FLIP_CROSSED_OUT,
|
|
|
|
FLIP_MONOSPACE,
|
|
|
|
} kind) {
|
|
|
|
case TEXT:
|
|
|
|
string text;
|
|
|
|
case RESET:
|
|
|
|
void;
|
|
|
|
case FG_COLOR:
|
|
|
|
i16 color;
|
|
|
|
case BG_COLOR:
|
|
|
|
i16 color;
|
|
|
|
case FLIP_BOLD:
|
|
|
|
case FLIP_ITALIC:
|
|
|
|
case FLIP_UNDERLINE:
|
|
|
|
case FLIP_INVERSE:
|
|
|
|
case FLIP_CROSSED_OUT:
|
|
|
|
case FLIP_MONOSPACE:
|
|
|
|
void;
|
|
|
|
} items<>;
|
|
|
|
case BUFFER_CLEAR:
|
|
|
|
string buffer_name;
|
2022-09-06 17:17:32 +02:00
|
|
|
|
2022-09-11 20:46:35 +02:00
|
|
|
case SERVER_UPDATE:
|
|
|
|
string server_name;
|
|
|
|
enum ServerState {
|
|
|
|
DISCONNECTED,
|
|
|
|
CONNECTING,
|
|
|
|
CONNECTED,
|
|
|
|
REGISTERED,
|
|
|
|
DISCONNECTING,
|
|
|
|
} state;
|
|
|
|
case SERVER_RENAME:
|
|
|
|
// Buffers aren't sent updates for in this circumstance,
|
|
|
|
// as that wouldn't be sufficiently atomic anyway.
|
|
|
|
string server_name;
|
|
|
|
string new;
|
|
|
|
case SERVER_REMOVE:
|
|
|
|
string server_name;
|
|
|
|
|
2022-09-07 19:42:18 +02:00
|
|
|
// Restriction: command_seq strictly follows the sequence received
|
|
|
|
// by the relay, across both of these replies.
|
Start X11 and web frontends for xC
For this, we needed a wire protocol. After surveying available options,
it was decided to implement an XDR-like protocol code generator
in portable AWK. It now has two backends, per each of:
- xF, the X11 frontend, is in C, and is meant to be the primary
user interface in the future.
- xP, the web frontend, relies on a protocol proxy written in Go,
and is meant for use on-the-go (no pun intended).
They are very much work-in-progress proofs of concept right now,
and the relay protocol is certain to change.
2022-08-08 04:39:20 +02:00
|
|
|
case ERROR:
|
|
|
|
u32 command_seq;
|
|
|
|
string error;
|
|
|
|
case RESPONSE:
|
|
|
|
u32 command_seq;
|
|
|
|
union ResponseData switch (Command command) {
|
2022-09-08 01:48:15 +02:00
|
|
|
case PING:
|
|
|
|
void;
|
Start X11 and web frontends for xC
For this, we needed a wire protocol. After surveying available options,
it was decided to implement an XDR-like protocol code generator
in portable AWK. It now has two backends, per each of:
- xF, the X11 frontend, is in C, and is meant to be the primary
user interface in the future.
- xP, the web frontend, relies on a protocol proxy written in Go,
and is meant for use on-the-go (no pun intended).
They are very much work-in-progress proofs of concept right now,
and the relay protocol is certain to change.
2022-08-08 04:39:20 +02:00
|
|
|
case BUFFER_COMPLETE:
|
|
|
|
u32 start;
|
|
|
|
string completions<>;
|
|
|
|
case BUFFER_LOG:
|
|
|
|
// UTF-8, but not guaranteed.
|
|
|
|
u8 log<>;
|
|
|
|
} data;
|
|
|
|
} data;
|
|
|
|
};
|