Skip to content

mesopelagique/PIM

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PIM

language language-top code-size license discord sponsors

personal information manager stuff, ie. VCard and VCalendar

VCard

VCard builder class

rfc6350

Create

$vCard = PIM.VCard.new()

// set properties
$vCard.firstName := "Eric"
$vCard.middleName := ""
$vCard.lastName := "Marchand"
$vCard.organization := "4D"
$vCard.photo.attachFromUrl("https://avatars.githubusercontent.com/u/59135882?v=4"; "JPEG")
$vCard.workPhone := "312-555-1212"
$vCard.title := "Software Developer"
$vCard.url := "https://github.com/mesopelagique"
$vCard.note := "Notes on Eric"

save to file

$vCard.saveToFile(Folder(...).file("eric-marchand.vcf"))

get as formatted text

$text:=$vCard.getText()

send it when responding to http request

$vCard.webSend("eric-marchand.vcf")

Embedding Images

Instead of using url you could embedded images

With files

$vCard.photo.embedFromFile(File("/path/to/file.png"))
$vCard.logo.embedFromFile(File("/path/to/file.png"))

With base 64 data

$vCard.photo.embedFromString("iVBORw0KGgoAAAANSUhEUgAAA2..."; "image/png"')
$vCard.logo.embedFromString("iVBORw0KGgoAAAANSUhEUgAAA2..."; "image/png")

Multiple Email, Fax, & Phone Examples

// multiple email entry
$vCard.email := New collection(\
    "[email protected]";\
    "[email protected]";\
    "[email protected]"\
)

// multiple cellphone
$vCard.cellPhone := New collection(\
    "312-555-1414";\
    "312-555-1415";\
    "312-555-1416"\
)

VCalendar(🚧)

VCalendar builder class

Create

$calendar = PIM.VCalendar.new()

Add events

TODO

get as formatted text

$text:=$calendar.getText()

send it when responding to http request

$calendar.webSend("eric-marchand.ics")

Testing

To do unit test, this component use expect BDD/TDD component as git submodule in Components

When opening this database, the test component expect will be compiled by onStartUp method with the new v19 Compile project command.

💡 If you have issue with previous version of 4D, just remove "expect" component, and test files like test_pim

🌏 To test web, you could also launch the web server and do any request on it, a vcard will be downloaded, vcard produced by test_web

TODO

  • Fix format VCard bugs, seems to not import well with macOS calendar app
  • Implement calendar event formatting
  • Parse VCard (partially implemented in _parse or _parseFile but not enough file tested)
  • Parse VCalendar

To help

If you run a business and you’re using one of my projects in a revenue-generating product, it makes business sense to sponsor this open source development

sponsors

Thank you for your support!

Other components

mesopelagique

Acknowledgements