Skip to content

Add the notion of messenger hooks. Hooks can e.g. compress outgoing messages, encrypt, verify signatures and so on. #13

Description

@mtahmed

I had the idea for this a long time ago but I was more focused on getting the system more architecturally sound before moving to other use-case "features".

This is (roughly) how it work work:

In Master:

messenger = Messenger()
messenger.add_hooks(Compress, Encrypt)

The hooks will be applied in that order ... first Compress and then Encrypt.

In Messenger:

def add_hooks(hooks):
    for hook in hooks:
        self.hooks.append(hook())

def send(msg):
    ...
    for hook in self.hooks:
        msg = hook.apply(msg)
    ...

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions