queue

package
v0.0.0-...-0aeaaa6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 15, 2025 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MessageQueue

type MessageQueue struct {
	// contains filtered or unexported fields
}

func NewMessageQueue

func NewMessageQueue(dbSelector *repository.CouchDBSelector, env *types.Environment) *MessageQueue

func (*MessageQueue) DIDCommSendMessage

func (msq *MessageQueue) DIDCommSendMessage(userAddress string, input *types.DIDCommMessageInput) error

* Sends an encrypted DIDComm message to the specified recipient(s). The message is validated, logged, and optionally saved in a local database. It handles attachments, validates recipient addresses, and routes the message to the appropriate endpoints. *

func (*MessageQueue) DidCommReceiveMessage

func (msq *MessageQueue) DidCommReceiveMessage(message *types.DIDCommMessage) error

SendMessage sends encrypted DIDComm message to recipient

func (*MessageQueue) ProcessDIDCommTask

func (mqs *MessageQueue) ProcessDIDCommTask(ctx context.Context, t *asynq.Task) error

processing od DIDComm tasks

func (*MessageQueue) ProcessSMTPTask

func (mqs *MessageQueue) ProcessSMTPTask(ctx context.Context, t *asynq.Task) error

Processing of SMTP tasks

func (*MessageQueue) ReceiveSMTPMessage

func (msq *MessageQueue) ReceiveSMTPMessage(email *abi.Mail, taskId string) error

ReceiveSMTPMessage processes an incoming SMTP email message and handles it according to various rules and checks. The function performs the following steps:

  1. Determines the default folder for the email.
  2. Checks if the email is marked as spam and adjusts the folder accordingly.
  3. Prepares the recipients list.
  4. Iterates over each recipient to perform various checks and actions: a. Retrieves the SMTP handler for the recipient's domain. b. Checks if the user exists in the database. c. Retrieves the user's profile and checks if the user is enabled. d. Checks if the user is over the disk space limit on external disk storages. e. Processes any attachments in the email. f. If the email is not spam, performs additional checks using handshakes and statistics to determine the folder.
  5. Prepares the email for storage by marshalling it into JSON.
  6. Constructs a DIDCommMessage for compatibility with the client main JSON structure.
  7. Saves the email message to the database.

Detailed Description: - The default folder is initially set to `MailioFolderOther`. - If the email's SpamVerdict status is `VerdictStatusFail`, the email is marked as spam and the folder is set to `MailioFolderSpam`. - For each recipient in the email:

  • The SMTP handler for the recipient's domain is retrieved using `mailiosmtp.GetHandler`.
  • The recipient's email address is hashed and encoded to check for user existence in the database.
  • The user's profile is retrieved and checked if it is enabled.
  • The total disk usage for the user is calculated and compared against their disk space limit.
  • Attachments in the email are processed using `processAttachments`.
  • If the email is not marked as spam, additional checks are performed using handshakes and email statistics to determine the appropriate folder.

- The email is marshalled into JSON format and a DIDCommMessage is constructed. - The email message is saved to the database using `userService.SaveMessage`. - Errors are logged using `global.Logger.Log` and appropriate bounce messages are sent using `sendBounce`.

func (*MessageQueue) SendSMTPMessage

func (msq *MessageQueue) SendSMTPMessage(fromMailioAddress string, email *types.SmtpEmailInput, taskId string) error

Sending email message using SMTP 1. Checks if user canceled the email sending 2. deletes the draft message per message ID

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL