From 174496bdf9bdff82a1120d14fe9b1ca81e870896 Mon Sep 17 00:00:00 2001 From: diamondburned Date: Fri, 19 Mar 2021 16:52:41 -0700 Subject: [PATCH] Enforce Identifier on all Services This commit breaks the Service interface to force all services to have a global unique identifier. The commit does not enforce any particular format, but the Reverse Domain Name Notation is recommended. For reference: https://en.wikipedia.org/wiki/Reverse_domain_name_notation --- cchat.go | 13 ++++++++++--- repository/gob/repository.gob | Bin 37803 -> 38138 bytes repository/main.go | 13 ++++++++++++- 3 files changed, 22 insertions(+), 4 deletions(-) diff --git a/cchat.go b/cchat.go index 0d3816a..2afec08 100644 --- a/cchat.go +++ b/cchat.go @@ -731,9 +731,9 @@ type ServersContainer interface { SetServers([]Server) } -// A service is a complete service that's capable of multiple sessions. It has -// to implement the Authenticate() method, which returns multiple -// implementations of Authenticator. +// Service is a complete service that's capable of multiple sessions. It has to +// implement the Authenticate() method, which returns multiple implementations +// of Authenticator. // // A service can implement SessionRestorer, which would indicate the frontend // that it can restore past sessions. Sessions are saved using the SessionSaver @@ -745,6 +745,13 @@ type ServersContainer interface { // configurations must be optional, as frontends may not implement a // configurator UI. type Service interface { + // Identifier returns the unique identifier for the service. There is no + // enforced representation, but services are recommended to follow the Reverse + // Domain Name Notation for consistency. An example of that would be: + // + // com.github.diamondburned.cchat-discord + // com.github.username.service + Identifier // Namer returns the name of the service. Namer diff --git a/repository/gob/repository.gob b/repository/gob/repository.gob index 514f2e35ca5e3a8f37cbff4a7f82790b81bbf086..35935ee77563cf3494f355456a4acdfc554bf193 100644 GIT binary patch delta 361 zcmZXQu}Z{15QZ;7kfg8@>}0UkeE>PdgKKO~P+wrPJ24B%%(1(<)9M~V-@rn|Mo4et z3)qP-;R9HRW1?8N)v){h|G)n{+@&A)>Er7--MH=E#_wzEPkAQitb3U}r#oqqd?tte zO?GUNqAMMG@EBW90b+&MM+ciL_TM7}^b2QD!Fh!q2bBvz3`iw=gI1Jtk3o!dbWFQY zwDDIKKzkIxaMK`Jfg=wdCD%1C`-oFqpbrRBZnPtq=>}o8;=v9i1PoJfAtIS81rr(^ z@KQJP8i7l3(Giy1))orf&xiL+Le+(fRa+?Qbi-r|X^2)CBmACq!LYag;Z{1+w){f< Sl<$#IlK*XM)ZI+CPQC!>GIsC) delta 43 ycmeyhl4