From 9f6e59195c1186e079946d7596c5e20cbb11d320 Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Tue, 7 Apr 2020 22:30:54 +0200 Subject: [PATCH] Document downstreamConn.{,un}marshalEntity --- downstream.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/downstream.go b/downstream.go index c493520..b925796 100644 --- a/downstream.go +++ b/downstream.go @@ -121,6 +121,11 @@ func (dc *downstreamConn) upstream() *upstreamConn { return dc.network.upstream() } +// marshalEntity converts an upstream entity name (ie. channel or nick) into a +// downstream entity name. +// +// This involves adding a "/" suffix if the entity isn't the current +// user. func (dc *downstreamConn) marshalEntity(uc *upstreamConn, entity string) string { if uc.isChannel(entity) { return dc.marshalChannel(uc, entity) @@ -135,6 +140,10 @@ func (dc *downstreamConn) marshalChannel(uc *upstreamConn, name string) string { return name + "/" + uc.network.GetName() } +// unmarshalEntity converts a downstream entity name (ie. channel or nick) into +// an upstream entity name. +// +// This involves removing the "/" suffix. func (dc *downstreamConn) unmarshalEntity(name string) (*upstreamConn, string, error) { if uc := dc.upstream(); uc != nil { return uc, name, nil