Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 14 additions & 9 deletions lib/inwx/domrobot.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ module INWX
class Domrobot
attr_accessor :client, :cookie

def initialize(address)
def initialize(address, options = {})
@options = options
@cookie = ""
# Create a new client instance
@client = XMLRPC::Client.new(address,"/xmlrpc/","443", nil, nil, nil, nil, true, 100)
Expand All @@ -26,20 +27,24 @@ def logout()

def setCookie(cookie)
self.cookie = cookie
fp = File.new("domrobot.tmp", "w")
fp.write(cookie)
fp.close
unless @options[:skip_cookie_file]
fp = File.new("domrobot.tmp", "w")
fp.write(cookie)
fp.close
end
end

def getCookie()
if self.cookie.length > 2
return self.cookie
end
if File.exist?("domrobot.tmp")
fp = File.new("domrobot.tmp", "r")
cookie = fp.read()
fp.close
return cookie
unless @options[:skip_cookie_file]
if File.exist?("domrobot.tmp")
fp = File.new("domrobot.tmp", "r")
cookie = fp.read()
fp.close
return cookie
end
end
end

Expand Down