...
This commit is contained in:
		
							
								
								
									
										284
									
								
								specs/models/mcc/README.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										284
									
								
								specs/models/mcc/README.md
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,284 @@
 | 
			
		||||
# MCC (Mail, Calendar, Contacts) Specification
 | 
			
		||||
 | 
			
		||||
This document outlines the data models for the MCC system, which is designed to be a self-hosted alternative to Google's Mail, Calendar, and Contacts services with full control over data.
 | 
			
		||||
 | 
			
		||||
## Overview
 | 
			
		||||
 | 
			
		||||
The MCC system consists of three main components:
 | 
			
		||||
 | 
			
		||||
1. **Mail**: A messaging system that can be used for email as well as chat
 | 
			
		||||
2. **Calendar**: A calendar system for managing events and appointments
 | 
			
		||||
3. **Contacts**: A contact management system
 | 
			
		||||
 | 
			
		||||
All components are integrated with the `circle.User` model, which serves as the primary user model for the system.
 | 
			
		||||
 | 
			
		||||
## Data Models
 | 
			
		||||
 | 
			
		||||
### User Model
 | 
			
		||||
 | 
			
		||||
The user model is defined in `circle/user.v` and has been enhanced with additional fields for MCC functionality:
 | 
			
		||||
 | 
			
		||||
```v
 | 
			
		||||
// User represents a member of a circle
 | 
			
		||||
pub struct User {
 | 
			
		||||
    base.Base
 | 
			
		||||
pub mut:
 | 
			
		||||
    name        string // name of the member as used in this circle
 | 
			
		||||
    description string // optional description which is relevant to this circle
 | 
			
		||||
    role        Role   // role of the member in the circle
 | 
			
		||||
    contact_ids []u32  // IDs of contacts linked to this member
 | 
			
		||||
    wallet_ids  []u32  // IDs of wallets owned by this member which are relevant to this circle
 | 
			
		||||
    pubkey      string // public key of the member as used in this circle
 | 
			
		||||
    
 | 
			
		||||
    // Additional fields needed for MCC functionality
 | 
			
		||||
    email       string // Primary email address
 | 
			
		||||
    timezone    string // User's preferred timezone
 | 
			
		||||
    preferences UserPreferences // User preferences for MCC
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// UserPreferences represents user preferences for MCC
 | 
			
		||||
pub struct UserPreferences {
 | 
			
		||||
pub mut:
 | 
			
		||||
    default_calendar_id u32    // Default calendar ID
 | 
			
		||||
    default_view        string // Default view (day, week, month)
 | 
			
		||||
    email_signature     string // Default email signature
 | 
			
		||||
    theme               string // UI theme preference
 | 
			
		||||
    notifications       bool   // Enable/disable notifications
 | 
			
		||||
}
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
### Mail Models
 | 
			
		||||
 | 
			
		||||
The mail models are defined in `mcc/message.v`:
 | 
			
		||||
 | 
			
		||||
```v
 | 
			
		||||
// Message represents an email message
 | 
			
		||||
pub struct Message {
 | 
			
		||||
    base.Base
 | 
			
		||||
pub mut:
 | 
			
		||||
    id             u32          // Database ID
 | 
			
		||||
    message_id     string       // Unique identifier for the email
 | 
			
		||||
    conversation_id string       // ID for grouping messages in the same thread
 | 
			
		||||
    folder         string       // The folder this email belongs to (inbox, sent, drafts, etc.)
 | 
			
		||||
    labels         []string     // Google-style labels for organization
 | 
			
		||||
    message        string       // The email body content
 | 
			
		||||
    attachments    []Attachment // Any file attachments
 | 
			
		||||
    send_time      ourtime.OurTime
 | 
			
		||||
    
 | 
			
		||||
    date     i64    // Unix timestamp when the email was sent/received
 | 
			
		||||
    size     u32    // Size of the message in bytes
 | 
			
		||||
    read     bool   // Whether the email has been read
 | 
			
		||||
    flagged  bool   // Whether the email has been flagged/starred
 | 
			
		||||
    priority string // Priority level (high, normal, low)
 | 
			
		||||
    
 | 
			
		||||
    // Header information
 | 
			
		||||
    subject     string
 | 
			
		||||
    from        []u32 // List of user IDs who sent the email
 | 
			
		||||
    sender      []u32
 | 
			
		||||
    reply_to    []u32
 | 
			
		||||
    to          []u32
 | 
			
		||||
    cc          []u32
 | 
			
		||||
    bcc         []u32
 | 
			
		||||
    in_reply_to u32
 | 
			
		||||
    
 | 
			
		||||
    // Additional fields
 | 
			
		||||
    draft          bool           // Whether this is a draft message
 | 
			
		||||
    scheduled_send ourtime.OurTime // Time to send if scheduled
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Attachment represents an email attachment
 | 
			
		||||
pub struct Attachment {
 | 
			
		||||
pub mut:
 | 
			
		||||
    filename     string
 | 
			
		||||
    content_type string
 | 
			
		||||
    hash         string // Hash of the attachment data
 | 
			
		||||
    size         u32    // Size in bytes
 | 
			
		||||
    content      []byte // Optional, for storing small attachments directly
 | 
			
		||||
}
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
### Calendar Models
 | 
			
		||||
 | 
			
		||||
The calendar models are defined in `mcc/calendar.v`:
 | 
			
		||||
 | 
			
		||||
```v
 | 
			
		||||
// Calendar represents a collection of events
 | 
			
		||||
pub struct Calendar {
 | 
			
		||||
    base.Base
 | 
			
		||||
pub mut:
 | 
			
		||||
    name        string // Name of the calendar
 | 
			
		||||
    description string // Description of the calendar
 | 
			
		||||
    color       string // Color for the calendar
 | 
			
		||||
    owner_id    u32    // User who owns this calendar
 | 
			
		||||
    timezone    string // Default timezone for this calendar
 | 
			
		||||
    visibility  string // Public, private, etc.
 | 
			
		||||
    shared_with []CalendarShare // Users this calendar is shared with
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// CalendarShare represents calendar sharing permissions
 | 
			
		||||
pub struct CalendarShare {
 | 
			
		||||
pub mut:
 | 
			
		||||
    user_id    u32    // User ID this calendar is shared with
 | 
			
		||||
    permission string // Read, write, owner, etc.
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// CalendarEvent represents a calendar event with all its properties
 | 
			
		||||
pub struct CalendarEvent {
 | 
			
		||||
    base.Base
 | 
			
		||||
pub mut:
 | 
			
		||||
    calendar_id u32    // ID of the calendar this event belongs to
 | 
			
		||||
    title       string // Event title
 | 
			
		||||
    description string // Event details
 | 
			
		||||
    location    string // Event location
 | 
			
		||||
    start_time  ourtime.OurTime
 | 
			
		||||
    end_time    ourtime.OurTime   // End time
 | 
			
		||||
    all_day     bool              // True if it's an all-day event
 | 
			
		||||
    recurrence  string            // RFC 5545 Recurrence Rule (e.g., "FREQ=DAILY;COUNT=10")
 | 
			
		||||
    attendees   []Attendee        // List of attendees
 | 
			
		||||
    organizer   u32               // The user who created the event
 | 
			
		||||
    status      string            // "CONFIRMED", "CANCELLED", "TENTATIVE"
 | 
			
		||||
    color       string            // User-friendly color categorization
 | 
			
		||||
    reminders   []Reminder        // Reminders for this event
 | 
			
		||||
    timezone    string            // Timezone for this specific event
 | 
			
		||||
    visibility  string            // Public, private, etc.
 | 
			
		||||
    attachments []Attachment      // Attachments for this event
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Reminder represents a reminder for an event
 | 
			
		||||
pub struct Reminder {
 | 
			
		||||
pub mut:
 | 
			
		||||
    event_id u32 // Event this reminder is for
 | 
			
		||||
    time     ourtime.OurTime // When to send the reminder
 | 
			
		||||
    method   string // How to deliver the reminder (email, notification, etc.)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Attendee represents an attendee of an event
 | 
			
		||||
pub struct Attendee {
 | 
			
		||||
pub mut:
 | 
			
		||||
    user_id   u32    // User ID of the attendee
 | 
			
		||||
    email     string // Email of the attendee (for external attendees)
 | 
			
		||||
    name      string // Name of the attendee
 | 
			
		||||
    response  string // "ACCEPTED", "DECLINED", "TENTATIVE", "NEEDS-ACTION"
 | 
			
		||||
    optional  bool   // Whether attendance is optional
 | 
			
		||||
    comment   string // Attendee's comment
 | 
			
		||||
}
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
### Contacts Models
 | 
			
		||||
 | 
			
		||||
The contacts models are defined in `mcc/contacts.v`:
 | 
			
		||||
 | 
			
		||||
```v
 | 
			
		||||
// Contact represents a contact with all their information
 | 
			
		||||
pub struct Contact {
 | 
			
		||||
    base.Base
 | 
			
		||||
pub mut:
 | 
			
		||||
    name           string // Display name of the contact
 | 
			
		||||
    first_name     string
 | 
			
		||||
    last_name      string
 | 
			
		||||
    nickname       string
 | 
			
		||||
    email          []ContactEmail // Multiple email addresses with labels
 | 
			
		||||
    phone          []ContactPhone // Multiple phone numbers with labels
 | 
			
		||||
    address        []ContactAddress // Multiple addresses with labels
 | 
			
		||||
    company        string
 | 
			
		||||
    job_title      string
 | 
			
		||||
    notes          string
 | 
			
		||||
    birthday       ourtime.OurTime
 | 
			
		||||
    website        []string
 | 
			
		||||
    social_profiles []SocialProfile
 | 
			
		||||
    photo          string // Path or URL to contact photo
 | 
			
		||||
    groups         []u32  // IDs of groups this contact belongs to
 | 
			
		||||
    custom_fields  []CustomField // User-defined fields
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// ContactEmail represents an email address with a label
 | 
			
		||||
pub struct ContactEmail {
 | 
			
		||||
pub mut:
 | 
			
		||||
    email   string
 | 
			
		||||
    label   string // Home, Work, Other, etc.
 | 
			
		||||
    primary bool
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// ContactPhone represents a phone number with a label
 | 
			
		||||
pub struct ContactPhone {
 | 
			
		||||
pub mut:
 | 
			
		||||
    number  string
 | 
			
		||||
    label   string // Mobile, Home, Work, etc.
 | 
			
		||||
    primary bool
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// ContactAddress represents a physical address with a label
 | 
			
		||||
pub struct ContactAddress {
 | 
			
		||||
pub mut:
 | 
			
		||||
    street      string
 | 
			
		||||
    city        string
 | 
			
		||||
    state       string
 | 
			
		||||
    postal_code string
 | 
			
		||||
    country     string
 | 
			
		||||
    label       string // Home, Work, Other, etc.
 | 
			
		||||
    primary     bool
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// SocialProfile represents a social media profile
 | 
			
		||||
pub struct SocialProfile {
 | 
			
		||||
pub mut:
 | 
			
		||||
    platform string // Facebook, Twitter, LinkedIn, etc.
 | 
			
		||||
    username string
 | 
			
		||||
    url      string
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// CustomField represents a user-defined field
 | 
			
		||||
pub struct CustomField {
 | 
			
		||||
pub mut:
 | 
			
		||||
    label string
 | 
			
		||||
    value string
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// ContactGroup represents a group of contacts
 | 
			
		||||
pub struct ContactGroup {
 | 
			
		||||
    base.Base
 | 
			
		||||
pub mut:
 | 
			
		||||
    name        string
 | 
			
		||||
    description string
 | 
			
		||||
    contacts    []u32 // IDs of contacts in this group
 | 
			
		||||
    owner_id    u32   // User who owns this group
 | 
			
		||||
    shared_with []u32 // Users this group is shared with
 | 
			
		||||
}
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
## Integration Points
 | 
			
		||||
 | 
			
		||||
The MCC system integrates with the existing system in the following ways:
 | 
			
		||||
 | 
			
		||||
1. **User Integration**:
 | 
			
		||||
   - Uses `circle.User` as the primary user model
 | 
			
		||||
   - The `biz.User` model has been deprecated and should not be used
 | 
			
		||||
 | 
			
		||||
2. **Cross-Component Integration**:
 | 
			
		||||
   - Calendar events can reference contacts as attendees
 | 
			
		||||
   - Emails can reference calendar events (for invitations)
 | 
			
		||||
   - Contacts can be used in email addressing
 | 
			
		||||
 | 
			
		||||
3. **Base Integration**:
 | 
			
		||||
   - All models extend the `base.Base` struct for common fields
 | 
			
		||||
   - Consistent ID and timestamp handling
 | 
			
		||||
 | 
			
		||||
## System Architecture
 | 
			
		||||
 | 
			
		||||
```
 | 
			
		||||
+----------------+       +----------------+       +----------------+
 | 
			
		||||
|                |       |                |       |                |
 | 
			
		||||
|  Mail System   |<----->|  User System   |<----->| Contact System |
 | 
			
		||||
|                |       |                |       |                |
 | 
			
		||||
+----------------+       +----------------+       +----------------+
 | 
			
		||||
        ^                        ^                        ^
 | 
			
		||||
        |                        |                        |
 | 
			
		||||
        v                        v                        v
 | 
			
		||||
+----------------+       +----------------+       +----------------+
 | 
			
		||||
|                |       |                |       |                |
 | 
			
		||||
| Calendar System|<----->|  Base System   |<----->|  Group System  |
 | 
			
		||||
|                |       |                |       |                |
 | 
			
		||||
+----------------+       +----------------+       +----------------+
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
This specification provides a comprehensive data model for creating a self-hosted alternative to Google's Mail, Calendar, and Contacts services, with a focus on data ownership and control.
 | 
			
		||||
@@ -3,10 +3,67 @@ import base
 | 
			
		||||
 | 
			
		||||
import freeflowuniverse.herolib.data.ourtime
 | 
			
		||||
 | 
			
		||||
// EventStatus represents the status of a calendar event
 | 
			
		||||
pub enum EventStatus {
 | 
			
		||||
	confirmed
 | 
			
		||||
	cancelled
 | 
			
		||||
	tentative
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// EventColor represents the color categorization of a calendar event
 | 
			
		||||
pub enum EventColor {
 | 
			
		||||
	red
 | 
			
		||||
	blue
 | 
			
		||||
	green
 | 
			
		||||
	yellow
 | 
			
		||||
	purple
 | 
			
		||||
	orange
 | 
			
		||||
	cyan
 | 
			
		||||
	magenta
 | 
			
		||||
	gray
 | 
			
		||||
	custom // For custom color values
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// EventVisibility represents the visibility setting of a calendar event
 | 
			
		||||
pub enum EventVisibility {
 | 
			
		||||
	public
 | 
			
		||||
	private
 | 
			
		||||
	confidential
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// AttendeeResponse represents an attendee's response to an event invitation
 | 
			
		||||
pub enum AttendeeResponse {
 | 
			
		||||
	accepted
 | 
			
		||||
	declined
 | 
			
		||||
	tentative
 | 
			
		||||
	needs_action
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Calendar represents a collection of events
 | 
			
		||||
pub struct Calendar {
 | 
			
		||||
	base.Base
 | 
			
		||||
pub mut:
 | 
			
		||||
	name        string // Name of the calendar
 | 
			
		||||
	description string // Description of the calendar
 | 
			
		||||
	color       string // Color for the calendar
 | 
			
		||||
	owner_id    u32    // User who owns this calendar
 | 
			
		||||
	timezone    string // Default timezone for this calendar
 | 
			
		||||
	visibility  string // Public, private, etc.
 | 
			
		||||
	shared_with []CalendarShare // Users this calendar is shared with
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// CalendarShare represents calendar sharing permissions
 | 
			
		||||
pub struct CalendarShare {
 | 
			
		||||
pub mut:
 | 
			
		||||
	user_id    u32    // User ID this calendar is shared with
 | 
			
		||||
	permission string // Read, write, owner, etc.
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// CalendarEvent represents a calendar event with all its properties
 | 
			
		||||
pub struct CalendarEvent {
 | 
			
		||||
	base.Base
 | 
			
		||||
pub mut:
 | 
			
		||||
	calendar_id u32    // ID of the calendar this event belongs to
 | 
			
		||||
	title       string // Event title
 | 
			
		||||
	description string // Event details
 | 
			
		||||
	location    string // Event location
 | 
			
		||||
@@ -14,9 +71,38 @@ pub mut:
 | 
			
		||||
	end_time    ourtime.OurTime   // End time
 | 
			
		||||
	all_day     bool              // True if it's an all-day event
 | 
			
		||||
	recurrence  string            // RFC 5545 Recurrence Rule (e.g., "FREQ=DAILY;COUNT=10")
 | 
			
		||||
	attendees   []u32             // List of contact id's
 | 
			
		||||
	attendees   []Attendee        // List of attendees
 | 
			
		||||
	organizer   u32               // The user (see circle) who created the event
 | 
			
		||||
	status      string            // "CONFIRMED", "CANCELLED", "TENTATIVE" //TODO: make enum
 | 
			
		||||
	color       string            // User-friendly color categorization, e.g., "red", "blue" //TODO: make enum
 | 
			
		||||
	reminder    []ourtime.OurTime // Reminder time before the event
 | 
			
		||||
	status      EventStatus       // Status of the event
 | 
			
		||||
	color       EventColor        // User-friendly color categorization
 | 
			
		||||
	reminders   []Reminder        // Reminders for this event
 | 
			
		||||
	timezone    string            // Timezone for this specific event
 | 
			
		||||
	visibility  EventVisibility   // Visibility setting for the event
 | 
			
		||||
	attachments []Attachment      // Attachments for this event
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Reminder represents a reminder for an event
 | 
			
		||||
pub struct Reminder {
 | 
			
		||||
pub mut:
 | 
			
		||||
	event_id u32 // Event this reminder is for
 | 
			
		||||
	time     ourtime.OurTime // When to send the reminder
 | 
			
		||||
	method   string // How to deliver the reminder (email, notification, etc.)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Attendee represents an attendee of an event
 | 
			
		||||
pub struct Attendee {
 | 
			
		||||
pub mut:
 | 
			
		||||
	contact_id   u32    // User ID of the attendee
 | 
			
		||||
	response  AttendeeResponse // Attendee's response to the event invitation
 | 
			
		||||
	optional  bool   // Whether attendance is optional
 | 
			
		||||
	comment   string // Attendee's comment
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Attachment represents an attachment for a calendar event
 | 
			
		||||
pub struct Attachment {
 | 
			
		||||
pub mut:
 | 
			
		||||
	filename     string
 | 
			
		||||
	content_type string
 | 
			
		||||
	hash         string // Hash of the attachment data
 | 
			
		||||
	size         u32    // Size in bytes
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,16 +1,111 @@
 | 
			
		||||
module biz
 | 
			
		||||
import base
 | 
			
		||||
 | 
			
		||||
// import freeflowuniverse.herolib.data.ourtime
 | 
			
		||||
import freeflowuniverse.herolib.data.ourtime
 | 
			
		||||
 | 
			
		||||
// ContactLabelType represents the type of label for contact information
 | 
			
		||||
pub enum ContactLabelType {
 | 
			
		||||
	home
 | 
			
		||||
	work
 | 
			
		||||
	mobile
 | 
			
		||||
	other
 | 
			
		||||
	main
 | 
			
		||||
	personal
 | 
			
		||||
	business
 | 
			
		||||
	school
 | 
			
		||||
	custom // For user-defined labels
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// SocialPlatformType represents the type of social media platform
 | 
			
		||||
pub enum SocialPlatformType {
 | 
			
		||||
	facebook
 | 
			
		||||
	twitter
 | 
			
		||||
	linkedin
 | 
			
		||||
	instagram
 | 
			
		||||
	github
 | 
			
		||||
	youtube
 | 
			
		||||
	tiktok
 | 
			
		||||
	reddit
 | 
			
		||||
	pinterest
 | 
			
		||||
	snapchat
 | 
			
		||||
	whatsapp
 | 
			
		||||
	telegram
 | 
			
		||||
	discord
 | 
			
		||||
	mastodon
 | 
			
		||||
	other
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Contact represents a contact with all their information
 | 
			
		||||
pub struct Contact {
 | 
			
		||||
	base.Base
 | 
			
		||||
pub mut:
 | 
			
		||||
	name       string // name of the contact as we use in this circle
 | 
			
		||||
	first_name string
 | 
			
		||||
	last_name  string
 | 
			
		||||
	email      []string
 | 
			
		||||
	tel        []string
 | 
			
		||||
	name           string // Display name of the contact
 | 
			
		||||
	first_name     string
 | 
			
		||||
	last_name      string
 | 
			
		||||
	nickname       string
 | 
			
		||||
	email          []ContactEmail // Multiple email addresses with labels
 | 
			
		||||
	phone          []ContactPhone // Multiple phone numbers with labels
 | 
			
		||||
	address        []ContactAddress // Multiple addresses with labels
 | 
			
		||||
	company        string
 | 
			
		||||
	job_title      string
 | 
			
		||||
	notes          string
 | 
			
		||||
	birthday       ourtime.OurTime
 | 
			
		||||
	website        []string
 | 
			
		||||
	social_profiles []SocialProfile
 | 
			
		||||
	photo          u32 // link to the attachment in the circle
 | 
			
		||||
	custom_fields  []CustomField // User-defined fields
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// ContactEmail represents an email address with a label
 | 
			
		||||
pub struct ContactEmail {
 | 
			
		||||
pub mut:
 | 
			
		||||
	email   string
 | 
			
		||||
	label   ContactLabelType // Type of email address
 | 
			
		||||
	primary bool
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// ContactPhone represents a phone number with a label
 | 
			
		||||
pub struct ContactPhone {
 | 
			
		||||
pub mut:
 | 
			
		||||
	number  string
 | 
			
		||||
	label   ContactLabelType // Type of phone number
 | 
			
		||||
	primary bool
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// ContactAddress represents a physical address with a label
 | 
			
		||||
pub struct ContactAddress {
 | 
			
		||||
pub mut:
 | 
			
		||||
	street      string
 | 
			
		||||
	city        string
 | 
			
		||||
	state       string
 | 
			
		||||
	postal_code string
 | 
			
		||||
	country     string
 | 
			
		||||
	label       ContactLabelType // Type of address
 | 
			
		||||
	primary     bool
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// SocialProfile represents a social media profile
 | 
			
		||||
pub struct SocialProfile {
 | 
			
		||||
pub mut:
 | 
			
		||||
	platform SocialPlatformType // Type of social media platform
 | 
			
		||||
	username string
 | 
			
		||||
	url      string
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// CustomField represents a user-defined field
 | 
			
		||||
pub struct CustomField {
 | 
			
		||||
pub mut:
 | 
			
		||||
	label string
 | 
			
		||||
	value string
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// ContactGroup represents a group of contacts
 | 
			
		||||
pub struct ContactGroup {
 | 
			
		||||
	base.Base
 | 
			
		||||
pub mut:
 | 
			
		||||
	name        string
 | 
			
		||||
	description string
 | 
			
		||||
	contacts    []u32 // IDs of contacts in this group
 | 
			
		||||
	owner_id    u32   // User who owns this group
 | 
			
		||||
	shared_with []u32 // Users this group is shared with
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -3,22 +3,29 @@ import base
 | 
			
		||||
 | 
			
		||||
import freeflowuniverse.herolib.data.ourtime
 | 
			
		||||
 | 
			
		||||
// our attempt to make a message object which can be used for email as well as chat
 | 
			
		||||
// MessagePriority represents the priority level of a message
 | 
			
		||||
pub enum MessagePriority {
 | 
			
		||||
	low
 | 
			
		||||
	normal
 | 
			
		||||
	high
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Message represents an email message that can be used for email as well as chat
 | 
			
		||||
pub struct Message {
 | 
			
		||||
	base.Base // Base struct for common fields
 | 
			
		||||
pub mut:
 | 
			
		||||
	// Database ID
 | 
			
		||||
	id          u32          // Database ID (assigned by DBHandler)
 | 
			
		||||
	message_id  string       // Unique identifier for the email
 | 
			
		||||
	folder      string       // The folder this email belongs to (inbox, sent, drafts, etc.)
 | 
			
		||||
	message     string       // The email body content
 | 
			
		||||
	attachments []Attachment // Any file attachments
 | 
			
		||||
	send_time   ourtime.OurTime
 | 
			
		||||
 | 
			
		||||
	date    i64  // Unix timestamp when the email was sent/received
 | 
			
		||||
	size    u32  // Size of the message in bytes
 | 
			
		||||
	read    bool // Whether the email has been read
 | 
			
		||||
	flagged bool // Whether the email has been flagged/starred
 | 
			
		||||
	conversation_id string       // ID for grouping messages in the same thread
 | 
			
		||||
	folder         string       // The folder this email belongs to (inbox, sent, drafts, etc.)
 | 
			
		||||
	labels         []u16   //from circle config called message (config with name message)
 | 
			
		||||
	message        string       // The email body content
 | 
			
		||||
	attachments    []u32// Any file attachment, is in circle
 | 
			
		||||
	send_time      ourtime.OurTime 
 | 
			
		||||
	scheduled_send ourtime.OurTime // Time to send if scheduled
 | 
			
		||||
	size     u32    // Size of the message in bytes
 | 
			
		||||
	read     bool   // Whether the email has been read
 | 
			
		||||
	flagged  bool   // Whether the email has been flagged/starred
 | 
			
		||||
	priority MessagePriority // Priority level
 | 
			
		||||
 | 
			
		||||
	// Header information
 | 
			
		||||
	subject     string
 | 
			
		||||
@@ -28,13 +35,6 @@ pub mut:
 | 
			
		||||
	to          []u32
 | 
			
		||||
	cc          []u32
 | 
			
		||||
	bcc         []u32
 | 
			
		||||
	in_reply_to u32
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Attachment represents an email attachment
 | 
			
		||||
pub struct Attachment {
 | 
			
		||||
pub mut:
 | 
			
		||||
	filename     string
 | 
			
		||||
	content_type string
 | 
			
		||||
	hash         string // Hash of the attachment data
 | 
			
		||||
	in_reply_to u32	
 | 
			
		||||
	draft          bool           // Whether this is a draft message	
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user