This commit breaks the previous Columnate API to return booleans instead
of constant integers. This makes handling Columnate API much simpler
with less false values (since all possible boolean values are valid).
This commit breaks ContainerMethod to enforce explicit destructors. This
gives the frontend explicit control over when the container is
unsubscribed, but it also eases unsubscription implementations in the
backend.
With this new change, the backend can now add the container into a
global repository and unsubscribe from it explicitly from the callback.
This commit breaks more of the API to force all implementations of Namer
to use a LabelContainer instead of just returning a text. This is done
to allow updating of all labels instead of having to update the whole
parent context. This allows the backend to do book-keeping of labels and
images and trivially update them simultaneously without updating the
parent context.
The Author interface is also renamed to User. This allows the user
interface to be used everywhere else outside of Message.
This commit introduced a big breaking change of changing Author and
Namer to no longer have any reference to Icon or Image containers and
interfaces.
Instead, in the case of Author and Namer, it relies on the label being
updated by either an update setter or LabelContainer. The frontend
should get the first image/avatar to display that instead.
This commit also added ReadIndicator and related interfaces to support
the read receipts feature seen in Matrix, Telegram, Messenger and co.
The UnreadIndicator interface was broken to add the MarkRead method,
which hands explicit control of setting read messages for the current
user to the frontend instead.
This commit added the Columnator interface. This interface accommodates
the fact that some services (such as Discord) stylizes certain nested
servers in the same column.
This commit also fixed a minor test case.
This commit changes IOMethods and clarifies stop functions that they
will act as destructors or disposers for whatever interface that
implements the methods, and that both the backend and frontend should
free that interface when they're called.
This commit is added as part of the IPC protocol.
This commit renamed Attachments to Attacher, as the new name is more
idiomatic.
This commit also added the Replier interface, which is used to indicate
that a message being sent is a reply towards something.
This commit clarifies that JoinServer must only be opened by one
container. In other words, before it is called again, the stop callback
of the last call must be called beforehand. This applies per messenger.
This commit reverts commit 9fd965d45a.
The reason for this reversion is that Send does not return an ID, and
therefore cannot know if any of its incoming messages are what it sent
or not.
Although a message return can be added into Send, that would be
extraneous, as the same message may now arrive by Send returning and/or
through the messenger container. Working around this would require
having an Upsert behavior instead of Insert or Update.
This commit deprecates all Nonce methods as well as the concept of
Nonces in general. This is because in certain cases where coordination
between message sends and echoes would require far too much effort with
nonces as a method to detect message arrivals.
Starting from this commit, frontend implementations must assume that a
nil error returned from Sender's Send method means that the message has
successfully arrived.
Backend implementations must provide this guarantee if necessary by
blocking Send until it's sure that the message has arrived. For services
that send messages asynchronously, a handler and a blocking channel
(or pubsub) could be used to signal to the Send goroutine from the event
loop that the message has arrived. Backends may choose to transmit its
own nonces for this purpose.
This commit broke both the cchat API and its repository generation API
to accomodate for custom error types, as the new Authenticator API now
uses AuthenticateError over error to add in multi-stage authentication
instead of the old method with the for loop.
This commit also removed the multistage example documented in
Authenticator, as the API is now clearer.
This commit also added the WrapAuthenticateError helper function that
wraps a normal error into an AuthenticateError that does not have a
NextStage return. Backends should use this for
This commit embeds the Namer interface into Authenticator as well as
adding the new Description method, both of which returns a text.Rich.
These methods are added to provide contextual clues to the user about
each Authenticator method.
Frontends can use the Name as the title, so the name should be short,
concise, and not include the name of the service.
This commit clarifies the rules regarding ID uniqueness and guarantees
when it comes to the backend and frontend. This piece of documentation
was added into the top package section.
This commit breaks the API to allow backends to return a slice of
Authenticators instead of a single Authenticator in the Service
interface. This is because some services might allow for more than one
method of authentication.
Note that the representation of multiple authenticators depends on the
frontend. One may choose to use tabs, notebooks, stacks, or anything
that is reasonable.
This commit clarified the word split rules when it comes to the
Commander interface. Specifically, this interface now has an edge case
of having split rules similarly to shell words (or shell syntax).
The implementation of these split rules is added into package split,
similarly to SplitIndexed. It is called ArgsIndexed. For the most parts,
it will behave similarly to shell syntax.
This commit breaks the Commander interface. Prior to this, the Run
method would take in an io.Writer and do its tasks in the background.
Although this has lots of potential for usages, it is also very
overkill. Moreover, it makes IPC harder, since it now has to send over
fragments of data in synchronized order.
This commit gets rid of the io.Writer and only take a []byte for return
along with the error. This makes it easier for both the frontend and
backend to implement most commands, as well as making it easier for data
to be transferred over the wire.
Prior to this commit, the PreviousID method ambiguously confused two
different behaviors for the same result, that is when the returned ID is
empty.
This commit adds a return boolean to the method to differentiate those
two behaviors.
Prior to this commit, the PreviousID method of ServerUpdate seemed to be
a big unknown. This commit clarified that unknown by declaring two
conditions: when PreviousID returns an empty and non-empty ID.
The above change allows ServerUpdate events to both modify existing
servers as well as inserting new ones.
This commit regenerates all files to adhere to the arguably-official
convention of having a standardized comment format to allow
distinguishing between written and generated files.
Refer to https://golang.org/s/generatedcode for more information.
This commit restores the old API prior to the repository commits to make
the Actions method of the Actioner interface take in a message ID and
return a slice of strings.
Prior to this commit, the Mentioned method in MessageCreate didn't
return anything. This is a regression. It now returns a boolean that
indicates mentioned.
This commit adds the Avatar method into the Author interface. It returns
the URL if one, or it can return an empty string if either the service
does not support avatars or the user doesn't have avatars.
Prior to this commit, interface Author embedded interface Namer. This
doesn't work, as it is discouraged to keep a working state inside the
implementation of Author, but Namer's embedded Iconer requires a state.
The commit changed Author to use a Name method instead, which is only a
getter. It will no longer satisfy interface Name.
This commit fixes IconContainer's SetIcon, which was SetImage prior to
this commit. Before the code generation commits, this container
originally had SetIcon.
This commit also adds back ImageContainer, which was a regression during
the code generation changes. It has the SetImage method.
This commit fixes some trivial errors in the repository package. The
changes are breaking.
This commit also replaced the old cchat and text Go source code files
with ones generated straight from the repository. To regenerate, run
go generate ./...
The code is generated using the Jennifer library. In the future, all
generated code (including package empty and the RPC library) will use
Jennifer.
This commit refactors entirely the ways cchat interfaces extend others.
Prior to this commit, interfaces extend itself simply by implementing
methods. This change is crucial to allow structs to decide whether or
not an interface is extended during runtime.
The current change adds the "As" methods into interfaces. When said, for
example, "Messenger extends Server," we now have the Server interface
implementing the AsMessenger method instead of before where the struct
implementing Server also implemented Messenger's methods.
For future references, these method will be called asserter methods.
The biggest motivation for this change is that these asserter methods
can allow backends to decide whether or not certain features are
implemented during runtime. For example, not all servers may support
sending messages. The asserting method is also simpler than the actual
type assertions done before.
Another motivation is to prepare cchat for an API that can reasonably be
translated to something that can be transferred over the wire. Although
the API itself will likely not be transferred over actual networking,
there are lots of plans for IPC-ing the API. This could mean that
developers would be able to develop the backends and frontends in any
programming language.
A downside to this is that the API is more restricted in terms of
extending beyond interfaces defined in the package. The initial goal of
this was to allow certain frontends to check for additional interfaces
outside of cchat that certain services could implement. However, this
goal is mostly moot, as interfaces like these require prior extensive
knowledge from both the developers of the backend and frontend
libraries.
This commit introduces many breaking changes that will break all current
code, both in the frontend and backend.
This commit changes the previous interface names to shorter versions.
This is done because, with the addition of the parent interface being
embedded in every extension interfaces, it is pointless to have the
name indicate this relationship. Furthermore, shorter and concise names
are more idiomatic.
This commit also introduces the "Is" method that is in every extension
interfaces. The purpose of this method is to provide an alternative
mechanism to check if an interface is extended.
Prior to the "Is" method, the only way for a backend to indicate
channels that can either be sent a message or not is to use two
separate types. Now, backends could implement a single type and return a
true or false on the Is method.
This method has a major disadvantage: it makes type assertions longer
and more complex. Refer to the "assert extension interfaces" example for
an example.
Despite the above disadvantage, this change is needed by the RPC
implementation in the future. Thus, it is worth the trouble of checks
being more verbose.
This commit adds the ID type, which is a type alias to a string. This
change does not break any APIs and is done purely for documentation
purposes.
This commit also adds backlog interfaces to add support for services
capable of storing and showing chat history.
A subtle behavior change with the above change would be that
MessageContainer implementations are now required to add a mechanism to
invalidate old containers when needed. For example, the MessagePrepender
passed into MessagesBefore must be invalidated by the frontend when the
channel in view is changed. This prevents stray messages from old
channels coming in.
There are many ways to invalidate a container, but the easiest way would
be to attach an optionally atomic boolean into the store and completely
separate the store from the view (aka widget).
This commit adds 2 extra string fields into the authentication entry
struct. The objective is to allow backends to hint additional
information that the user might want to know while authenticating.
Frontends that cannot do placeholders can opt for another way to display
the information, such as adding it into the name, surrounded by
parentheses.
This commit adds member list support for servers capable of showing
messages. This includes both backend and frontend interfaces.
A UserStatus type was added with the appropriate constants for this purpose,
but it could be used in the future for other purposes.
All cchat documentation has been moved off of the README and into
GoDoc's documentation sections. This is done to free up the README for
other useful information about the project that doesn't have to do with
the code itself.
This commit is a breaking change. It changes the UnreadIndicate method
to require returning an additional stop callback similar to that in
Nickname.
The motivation for this change was that frontends need a way to announce
cancellation before it destroys its server containers. This may happen
when the backend wants to replace in the container a completely new
list. As such, old lists will be destroyed, and the frontend will call
UnreadIndicate again. Because of that, the old callbacks must be cleaned
up.
This commit adds message attachments. More specifically, the
MessageAttachment struct was added to represent a single attachment.
Interfaces are added as well, that is ServerMessageAttachmentSender and
SendableMessageAttachments.
For the most parts, the frontend will use SendableMessageAttachments,
which extends the usual SendableMessage.
This commit undos these latest changes and replaced them with the new
ImageContainer API as well as Image boolean in CompletionEntry.
These changes, unlike the earlier commits, are not breaking changes.
They are only additions.
ImageContainer is added for future usages, which translates to the
previous commits' IconContainer. The current IconContainer translates to
the previous commits' RoundIconContainer.
This change was done without breaking the existing API. Initially, the
idea was to use a URL fragment to indicate if an icon should be round.
That, however, was a bad idea, as URL fragments are part of the URL
string and would require additional effort to parse them. As such,
RoundIconContainer was added.
Frontends don't need to round icons from RoundIconContainer, and as
such, may call IconContainer in the implementation. The choice of using
round icons is up to the backend implementations.