VERSION 1.0 CLASS
BEGIN
  MultiUse = -1  'True
END
Attribute VB_Name = "ThisOutlookSession"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = True
Dim outApp As Outlook.Application
Dim WithEvents edsApp As RoosterLib.EDS
Attribute edsApp.VB_VarHelpID = -1

Private Sub Application_Startup()
On Error Resume Next

'start Rooster. if it's already running, we'll use the same instance
Set edsApp = CreateObject("Rooster.EDS.1")

'close all Rooster windows (optionally)
edsApp.Windows (-1)

'apply for Delivery Royal
edsApp.ApplyForDeliveryRoyal edsApp

Set outApp = CreateObject("Outlook.Application")
End Sub

Private Sub Application_Quit()
On Error Resume Next

'call off Delivery Royal
edsApp.CallOffDeliveryRoyal edsApp

'disconnect
Set edsApp = Nothing
Set outApp = Nothing
End Sub

Private Sub edsApp_GettingArticles(ByVal bsAuthor As String, ByVal bsHeadline As String, ByVal bsFeedName As String, ByVal bsDate As String, ByVal bsArticleBody As String)

On Error Resume Next

'lets post this article
Dim opiArticle As Outlook.PostItem
Set opiArticle = outApp.CreateItem(olPostItem)

opiArticle.Subject = bsHeadline
opiArticle.BodyFormat = olFormatHTML
opiArticle.HTMLBody = "Author: " + bsAuthor + "<br>" + _
                   "Headline: " + bsHeadline + "<br>" + _
                   "Feed: " + bsFeedName + "<br>" + _
                   "Date Published: " + bsDate + "<br><br>" + _
                   bsArticleBody

opiArticle.Post

Set opiArticle = Nothing
End Sub
