
It is a little pleasure to be working away with such a nice view in the background. I am not sure it makes the code any better but it certainly is nice to glance at from the keyboard to refocus the eyes every so often.
Dim s As notessession
Dim server As String
Dim placename As String
Sub Click(Source As Button)
Set s = New notessession
placename = "yourplacename"
server = "yourserver/projectlounge"
Print "Starting in main room"
Call restoredb(placename, "quickplace/"+placename+"/main.nsf")
End Sub
Sub restoredb(roomtitle, roompath)
Dim roomdb As NotesDatabase
Dim roomview As notesview
Set roomdb = s.GetDatabase(server, roompath)
If roomdb.IsOpen = False Then
Call roomdb.Open(server, roompath)
End If
roomdb.Title = roomtitle
Print "Set title: " + roomtitle
Set roomview = roomdb.GetView("System\Subrooms")
Dim doc As NotesDocument
Set doc = roomview.GetFirstDocument
While Not (doc Is Nothing)
Dim iroomtitle As String
Dim iroomfile As String
iroomtitle = doc.GetItemValue("h_Name")(0)
iroomfile = doc.GetItemValue("h_LocDbName")(0)
Print "Working on: " + iroomfile
Call restoredb(iroomtitle, "quickplace/"+placename+"/" + iroomfile)
Set doc = roomview.GetNextDocument(doc)
Wend
End Sub
require 'open-uri'
module DominoAuthenication
public
# accesses the current user from the session.
# overwrite this to set how the current user is retrieved from the session.
# To store just the whole user model in the session:
#
# def current_user
# session[:user]
# end
#
def current_user
if session[:user]
@current_user ||= session[:user]
else
begin
tokenstring = "LtpaToken="
tokenstring = tokenstring + cookies[:LtpaToken] if cookies[:LtpaToken]
OpenURI.open_uri('http://[your domino server here]/[your database]/[some page that returns the username]',
"Cookie" => tokenstring) do |http|
@current_user = http.read.strip
end
#rescue
end
end
end
end
require 'win32ole'
oSkype = WIN32OLE.new('SKYPEAPI.Access')
puts "Version: #{oSkype.Version}"
oSkype.Connect()
puts "Getting events"
ev = WIN32OLE_EVENT.new(oSkype, '_IAccessEvents')
ev.on_event('ChatMessageReceived') do |msg|
to = msg.MessageFrom.Handle
puts "#{to} said: #{msg.Body}"
if to != oSkype.CurrentUserHandle
response = "OMG, I can't believe you just said '#{msg.Body}'"
oSkype.SendMessage(to, response)
end
end
# infinite loop to keep the script alive
loop do
WIN32OLE_EVENT.message_loop
end