darkirc Specification

PrivMsgEvent

This is the main message type inside darkirc. The PrivMsgEvent is an event action.

DescriptionData TypeComments
nicknameStringThe nickname for the sender (must be less than 32 chars)
targetStringThe target for the message (recipient)
messageStringThe actual content of the message

ChannelInfo

Preconfigured channel in the configuration file.

In the TOML configuration file, the channel is set as such:

[channel."#dev"]
secret = "GvH4kno3kUu6dqPrZ8zjMhqxTUDZ2ev16EdprZiZJgj1"
topic = "DarkFi Development Channel"
DescriptionData TypeComments
topicStringOptional topic for the channel
secretStringOptional NaCl box for the channel, used for {en,de}cryption.
joinedboolIndicate whether the user has joined the channel
namesVecAll nicknames which are visible on the channel

ContactInfo

Preconfigured contact in the configuration file.

In the TOML configuration file, the contact is set as such:

[contact."nick"]
contact_pubkey = "7CkVuFgwTUpJn5Sv67Q3fyEDpa28yrSeL5Hg2GqQ4jfM"
DescriptionData TypeComments
pubkeyStringA Public key for the contact to encrypt the message

IrcConfig

The base Irc configuration for each new IrcClient.

DescriptionData TypeComments
is_nick_initboolConfirmation of receiving /nick command
is_user_initboolConfirmation of receiving /user command
is_cap_endboolIndicate whether the irc client finished the Client Capability Negotiation
is_pass_initboolConfirmation of checking the password in the configuration file
is_registeredboolIndicate the IrcClient is initialized and ready to sending/receiving messages
nicknameStringThe irc client nickname
passwordStringThe password for the irc client. (it could be empty)
private_keyOptionA private key to decrypt direct messages from contacts
capabilitiesHashMap<String, bool>A list of capabilities for the irc clients and the server to negotiate
auto_channelsVecAuto join channels for the irc clients
channelsHashMap<String, ChannelInfo>A list of preconfigured channels in the configuration file
contactsHashMap<String, ContactInfo>A list of preconfigured contacts in the configuration file for direct message

IrcServer

The server start listening to an address specifed in the configuration file.

For each irc client get connected, an IrcClient instance created.

DescriptionData TypeComments
settingsSettingsThe base settings parsed from the configuration file
clients_subscriptionsSubscriberPtr<ClientSubMsg>Channels to notify the IrcClients about new data

IrcClient

The IrcClient handle all irc opeartions and commands from the irc client.

DescriptionData TypeComments
write_streamWriteHalfA writer for sending data to the connection stream
read_streamReadHalfRead data from the connection stream
addressSocketAddrThe actual address for the irc client connection
irc_configIrcConfigBase configuration for irc
server_notifierChannel<(NotifierMsg, u64)>A Channel to notify the server about a new data from the irc client
subscriptionSubscription<ClientSubMsg>A channel to receive notification from the server

Communications between the server and the clients

Two Communication channels get initialized by the server for every new IrcClient.

The channel Channel<(NotifierMsg, u64)> used by the IrcClient to notify the server about new messages/queries received from the irc client.

The channel Subscription<ClientSubMsg> used by the server to notify IrcClients about new messages/queries fetched from the View.

ClientSubMsg

	enum ClientSubMsg {
		Privmsg(`PrivMsgEvent`),
		Config(`IrcConfig`),	
	}

NotifierMsg

	enum NotifierMsg {
		Privmsg(`PrivMsgEvent`),
		UpdateConfig,
	}