Skip to content

Commit

Permalink
Fixed bugs in the posting thingy (and made the date stuff slightly more
Browse files Browse the repository at this point in the history
duck-shaped).
  • Loading branch information
dagbrown authored and Dave Brown committed Sep 28, 2007
1 parent 59dbfb2 commit 1ecf3a3
Showing 1 changed file with 15 additions and 9 deletions.
24 changes: 15 additions & 9 deletions lib/livejournal.rb
@@ -1,11 +1,12 @@
#!/usr/bin/ruby #!/usr/bin/ruby


require "rubygems"
gem "hpricot"


require "xmlrpc/client" require "xmlrpc/client"
require "md5" require "md5"
gem "hpricot"
require "hpricot"
require "yaml" require "yaml"
require "hpricot"


class LiveJournal class LiveJournal
private private
Expand Down Expand Up @@ -124,10 +125,15 @@ def export_comments start_id=0
# Optional fields date, mood, music, # Optional fields date, mood, music,
def post subject, text, options = {} def post subject, text, options = {}
date = if options[:date] then date = if options[:date] then
DateTime.parse(options[:date]) if String === options[:date] then
else DateTime.parse(options[:date])
DateTime.now else
end options[:date]
end
else
DateTime.now
end



callhash = { callhash = {
:event => text, :event => text,
Expand All @@ -136,7 +142,7 @@ def post subject, text, options = {}
:mon => date.month, :mon => date.month,
:day => date.day, :day => date.day,
:hour => date.hour, :hour => date.hour,
:min => date.minute, :min => date.min,
:lineendings => "unix", :lineendings => "unix",
:props => {} :props => {}
} }
Expand All @@ -153,8 +159,8 @@ def post subject, text, options = {}
:picture => :picture_keyword, :picture => :picture_keyword,
:noemail => :opt_noemail :noemail => :opt_noemail
}.each do |option_name, lj_option_name| }.each do |option_name, lj_option_name|
if options[:option_name] then if options[option_name] then
callhash[:props][lj_option_name] = options[:option_name] callhash[:props][lj_option_name] = options[option_name]
end end
end end


Expand Down

0 comments on commit 1ecf3a3

Please sign in to comment.