From 8ea54dd6f84f9f7f6ce062fa038a119440987c8b Mon Sep 17 00:00:00 2001 From: SoniEx2 Date: Mon, 17 Dec 2018 10:34:50 -0200 Subject: [PATCH] Update clog.md --- clog.md | 18 +++++++++--------- src/main.rs | 2 ++ 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/clog.md b/clog.md index f8792b2..f62fbe4 100644 --- a/clog.md +++ b/clog.md @@ -1,4 +1,4 @@ -CAP prefix/clog +CAP soniex2.github.io/clog =============== Copyright (c) 2018 Soni L. \ @@ -12,13 +12,13 @@ Cap syntax The capability shall be specified as - prefix/clog=hash_type,hash_type/tag,tag,tag + soniex2.github.io/clog=hash_type,hash_type/tag,tag,tag Example: - prefix/clog=sha1,sha256/server-time,prefix/hash + soniex2.github.io/clog=sha1,sha256/time,soniex2.github.io/clog -`server-time` and `prefix/hash` are always implicitly specified, and should be omitted. +`time` and `soniex2.github.io/clog` are always implicitly specified, and should be omitted. The `HASH` S2C command ---------------------- @@ -48,22 +48,22 @@ Optionally, the server may include a server name with the HASH command: <<< :server1.example.com HASH #channel :etc <<< :server2.example.com HASH #channel :other -The `hash` message tag +The `clog` message tag ---------------------- -The `hash` mesaage tag shall be sent with every `PRIVMSG`, `TOPIC` and `NOTICE`. +The `clog` message tag shall be sent with every `PRIVMSG`, `TOPIC` and `NOTICE`. Syntax: - prefix/hash=type=counter/short_hash,type=counter/short_hash,... + soniex2.github.io/clog=type=counter/short_hash,type=counter/short_hash,... The use of `short_hash` lowers bandwidth requirements. Consult your cryptography expert for best practices on using cryptography. These hashes specify the previous "head(s)" of the clog. "Merges" are just messages with hashes from different sources. -The hash encompasses the message tags specified by the capability (e.g. `server-time` and `hash`), sorted according to UTF-8 byte order, and the contents of the IRC message, as seen in the following format: +The hash encompasses the message tags specified by the capability (e.g. `time` and `clog`), sorted according to UTF-8 byte order, and the contents of the IRC message, as seen in the following format: - @prefix/hash=...;server-time=... :nick!user@host PRIVMSG #channel :message + @soniex2.github.io/clog=...;time=... :nick!user@host PRIVMSG #channel :message (This line is what gets hashed) diff --git a/src/main.rs b/src/main.rs index 59af07e..b437b06 100644 --- a/src/main.rs +++ b/src/main.rs @@ -53,6 +53,7 @@ impl fmt::Display for Hash { struct ServerData { hashes: BTreeSet, message_queue: HashMap, String)>>, // (source) server name -> messages + users: BTreeSet, } impl ServerData { @@ -74,6 +75,7 @@ impl ServerData { #[derive(Default)] struct Game { servers: BTreeMap, + users: BTreeSet, } impl Game {