...
This commit is contained in:
@@ -2,6 +2,7 @@ module actionprocessor
|
||||
|
||||
|
||||
import freeflowuniverse.herolib.circles.dbs.core
|
||||
import freeflowuniverse.herolib.circles.dbs.mcc
|
||||
import freeflowuniverse.herolib.circles.models
|
||||
import freeflowuniverse.herolib.core.texttools
|
||||
|
||||
@@ -19,7 +20,8 @@ pub mut:
|
||||
agents &core.AgentDB
|
||||
circles &core.CircleDB
|
||||
names &core.NameDB
|
||||
mails &core.MailDB
|
||||
mails &mcc.MailDB
|
||||
calendar &mcc.CalendarDB
|
||||
session_state models.SessionState
|
||||
}
|
||||
|
||||
@@ -57,13 +59,15 @@ pub fn new(args_ CircleCoordinatorArgs) !&CircleCoordinator {
|
||||
mut agent_db := core.new_agentdb(session_state)!
|
||||
mut circle_db := core.new_circledb(session_state)!
|
||||
mut name_db := core.new_namedb(session_state)!
|
||||
mut mail_db := core.new_maildb(session_state)!
|
||||
mut mail_db := mcc.new_maildb(session_state)!
|
||||
mut calendar_db := mcc.new_calendardb(session_state)!
|
||||
|
||||
mut cm := &CircleCoordinator{
|
||||
agents: &agent_db
|
||||
circles: &circle_db
|
||||
names: &name_db
|
||||
mails: &mail_db
|
||||
calendar: &calendar_db
|
||||
session_state: session_state
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
module core
|
||||
module mcc
|
||||
|
||||
import freeflowuniverse.herolib.circles.models { DBHandler, SessionState }
|
||||
import freeflowuniverse.herolib.circles.models.calendar { CalendarEvent, calendar_event_loads }
|
||||
import freeflowuniverse.herolib.circles.models.mcc { CalendarEvent, calendar_event_loads }
|
||||
|
||||
@[heap]
|
||||
pub struct CalendarDB {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
module core
|
||||
module mcc
|
||||
|
||||
import freeflowuniverse.herolib.circles.models { SessionState, new_session }
|
||||
import freeflowuniverse.herolib.circles.models.calendar { CalendarEvent }
|
||||
import freeflowuniverse.herolib.circles.models.mcc { CalendarEvent }
|
||||
import freeflowuniverse.herolib.data.ourtime
|
||||
import os
|
||||
import rand
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
module core
|
||||
module mcc
|
||||
|
||||
import freeflowuniverse.herolib.circles.models { DBHandler, SessionState }
|
||||
import freeflowuniverse.herolib.circles.models.mail { Email, email_loads }
|
||||
import freeflowuniverse.herolib.circles.models.mcc { Email, email_loads }
|
||||
|
||||
@[heap]
|
||||
pub struct MailDB {
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
module core
|
||||
module mcc
|
||||
|
||||
import os
|
||||
import rand
|
||||
import freeflowuniverse.herolib.circles.actionprocessor
|
||||
import freeflowuniverse.herolib.circles.models.mail
|
||||
import freeflowuniverse.herolib.circles.models.mcc
|
||||
|
||||
fn test_mail_db() {
|
||||
// Create a temporary directory for testing
|
||||
@@ -22,7 +22,7 @@ fn test_mail_db() {
|
||||
email1.flags = ['\\Seen']
|
||||
email1.internal_date = 1647123456
|
||||
email1.size = 1024
|
||||
email1.envelope = mail.Envelope{
|
||||
email1.envelope = mcc.Envelope{
|
||||
subject: 'Test Email 1'
|
||||
from: ['sender1@example.com']
|
||||
to: ['recipient1@example.com']
|
||||
@@ -36,7 +36,7 @@ fn test_mail_db() {
|
||||
email2.flags = ['\\Seen', '\\Flagged']
|
||||
email2.internal_date = 1647123457
|
||||
email2.size = 2048
|
||||
email2.envelope = mail.Envelope{
|
||||
email2.envelope = mcc.Envelope{
|
||||
subject: 'Test Email 2'
|
||||
from: ['sender2@example.com']
|
||||
to: ['recipient2@example.com']
|
||||
@@ -50,7 +50,7 @@ fn test_mail_db() {
|
||||
email3.flags = ['\\Seen']
|
||||
email3.internal_date = 1647123458
|
||||
email3.size = 3072
|
||||
email3.envelope = mail.Envelope{
|
||||
email3.envelope = mcc.Envelope{
|
||||
subject: 'Test Email 3'
|
||||
from: ['user@example.com']
|
||||
to: ['recipient3@example.com']
|
||||
@@ -215,7 +215,7 @@ fn test_mail_db() {
|
||||
emails_after_all_deleted := runner.mails.getall() or {
|
||||
// This is expected to fail with 'No emails found' error
|
||||
assert err.msg().contains('No')
|
||||
[]mail.Email{cap: 0}
|
||||
[]mcc.Email{cap: 0}
|
||||
}
|
||||
assert emails_after_all_deleted.len == 0, 'Expected 0 emails after all deletions, got ${emails_after_all_deleted.len}'
|
||||
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
module models
|
||||
|
||||
import freeflowuniverse.herolib.circles.models.core { agent_loads, Agent, circle_loads, Circle, name_loads, Name }
|
||||
import freeflowuniverse.herolib.circles.models.mcc.mail { Email, email_loads }
|
||||
import freeflowuniverse.herolib.circles.models.mcc.caledar { CalendarEvent, calendar_event_loads }
|
||||
import freeflowuniverse.herolib.circles.models.mcc { Email, email_loads, CalendarEvent, calendar_event_loads }
|
||||
|
||||
pub struct DBHandler[T] {
|
||||
pub mut:
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
module calendar
|
||||
module mcc
|
||||
|
||||
import freeflowuniverse.herolib.data.ourtime
|
||||
import freeflowuniverse.herolib.data.encoder
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
module calendar
|
||||
module mcc
|
||||
|
||||
import freeflowuniverse.herolib.data.ourtime
|
||||
import time
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
module mail
|
||||
module mcc
|
||||
|
||||
import freeflowuniverse.herolib.data.ourtime
|
||||
// import freeflowuniverse.herolib.data.ourtime
|
||||
import freeflowuniverse.herolib.data.encoder
|
||||
import strings
|
||||
import strconv
|
||||
// import strings
|
||||
// import strconv
|
||||
|
||||
// Email represents an email message with all its metadata and content
|
||||
pub struct Email {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
module mail
|
||||
module mcc
|
||||
|
||||
// A simplified test file to verify basic functionality
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
module mail
|
||||
module mcc
|
||||
|
||||
import freeflowuniverse.herolib.data.ourtime
|
||||
|
||||
|
||||
@@ -94,7 +94,7 @@ pub fn path_fix(path string) string {
|
||||
if path == '' {
|
||||
return ''
|
||||
}
|
||||
return path.to_lower()
|
||||
return path.to_lower().trim('/')
|
||||
}
|
||||
|
||||
// normalize a file path while preserving path structure
|
||||
@@ -102,12 +102,6 @@ pub fn path_fix_absolute(path string) string {
|
||||
return "/${path_fix(path)}"
|
||||
}
|
||||
|
||||
// normalize a file path while preserving path structure
|
||||
pub fn path_fix(path string) string {
|
||||
return path.trim('/')
|
||||
}
|
||||
|
||||
|
||||
// remove underscores and extension
|
||||
pub fn name_fix_no_ext(name_ string) string {
|
||||
return name_fix_keepext(name_).all_before_last('.').trim_right('_')
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
module vfs_mail
|
||||
|
||||
import freeflowuniverse.herolib.vfs
|
||||
import freeflowuniverse.herolib.circles.models.mail
|
||||
import freeflowuniverse.herolib.circles.models.mcc.mail
|
||||
|
||||
// MailFSEntry implements FSEntry for mail objects
|
||||
pub struct MailFSEntry {
|
||||
|
||||
@@ -4,7 +4,7 @@ import json
|
||||
import os
|
||||
import time
|
||||
import freeflowuniverse.herolib.vfs
|
||||
import freeflowuniverse.herolib.circles.models.mail
|
||||
import freeflowuniverse.herolib.circles.models.mcc.mail
|
||||
import freeflowuniverse.herolib.circles.dbs.core
|
||||
import freeflowuniverse.herolib.core.texttools
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ module vfs_mail
|
||||
|
||||
import freeflowuniverse.herolib.vfs
|
||||
import freeflowuniverse.herolib.circles.models
|
||||
import freeflowuniverse.herolib.circles.models.mail
|
||||
import freeflowuniverse.herolib.circles.models.mcc.mail
|
||||
import freeflowuniverse.herolib.circles.dbs.core
|
||||
import json
|
||||
import time
|
||||
|
||||
Reference in New Issue
Block a user