Implement deletion of applications

This commit is contained in:
eikendev 2020-07-26 22:23:13 +02:00
parent 653e57fe03
commit 18d11677ac
No known key found for this signature in database
GPG key ID: A1BDB1B28C8EF694
7 changed files with 80 additions and 9 deletions

View file

@ -6,7 +6,7 @@ import (
"github.com/matrix-org/gomatrix"
)
// RegisterApplication creates a new channel for the application.
// RegisterApplication creates a new channel for an application.
func (d *Dispatcher) RegisterApplication(name, user string) (string, error) {
log.Printf("Registering application %s, notifications will be relayed to user %s.\n", name, user)
@ -27,3 +27,16 @@ func (d *Dispatcher) RegisterApplication(name, user string) (string, error) {
return response.RoomID, err
}
// DeregisterApplication deletes a channel for an application.
func (d *Dispatcher) DeregisterApplication(matrixID string) error {
log.Printf("Deregistering application with ID %s.\n", matrixID)
_, err := d.client.LeaveRoom(matrixID)
if err != nil {
log.Fatal(err)
}
return err
}