pidgin2adium 2.0.0 → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/History.txt CHANGED
@@ -1,6 +1,10 @@
1
- === 1.0.0 / 2009-09-27
2
-
3
- * 1 major enhancement
1
+ === 2.0.1 / 2009-12-06
2
+ * Fix timestamps so they show up in Adium chat log viewer
4
3
 
5
- * Birthday!
4
+ === 2.0.0 / 2009-11-24
5
+ * Added documentation, available at http://pidgin2adium.rubyforge.org/rdoc/
6
+ * Added public interface for scripting purposes
7
+ * Removed -o and -l options. Now gem automatically outputs to Adium log dir with no intermediate folder.
6
8
 
9
+ === 1.0.0 / 2009-09-27
10
+ * Birthday!
data/README.rdoc CHANGED
@@ -25,12 +25,16 @@ the person to whom you are chatting.
25
25
  Note that aliases are lower-cased and space is removed, so providing "Gabe B-W,
26
26
  GBW" is the same as providing "gabeb-w,gbw".
27
27
 
28
+ You do not need to provide your screenname in the alias list.
29
+
28
30
  ===Example (using script)
29
31
  Assuming that:
30
32
  * your Pidgin log files are in the "pidgin-logs" folder
31
33
  * your various aliases in your chats are "Gabe", "Gabe B-W", and "gbw"
32
- Then run:
33
- pidgin2adium -i pidgin-logs -a "Gabe, Gabe B-W, gbw"
34
+ Then run (at the command line):
35
+ $ pidgin2adium -i pidgin-logs -a "Gabe, Gabe B-W, gbw"
36
+ Or:
37
+ $ pidgin2adium -i pidgin-logs -a gabe,gabeb-w,gbw
34
38
 
35
39
  ===Example (using library)
36
40
  The library style allows you to parse a log file and get back a
data/Rakefile.rb CHANGED
@@ -3,20 +3,24 @@ gem 'hoe', '>= 2.1.0'
3
3
  require 'hoe'
4
4
  require 'fileutils'
5
5
  require './lib/pidgin2adium.rb'
6
+ require 'hanna/rdoctask'
6
7
 
8
+ Hoe.plugin :gemcutter
7
9
  Hoe.plugin :newgem
8
- # Hoe.plugin :website
10
+ Hoe.plugin :website
9
11
  # Hoe.plugin :cucumberfeatures
10
12
 
11
13
  # Generate all the Rake tasks
12
14
  # Run 'rake -T' to see list of generated tasks (from gem root directory)
13
15
  $hoe = Hoe.spec 'pidgin2adium' do
14
- self.developer('Gabe B-W', 'gbw@brandeis.edu')
16
+ self.developer('Gabe B-W', 'pidgin2adium@brandeis.edu')
15
17
  self.extra_rdoc_files = %w{README.rdoc}
16
18
  #self.post_install_message = 'PostInstall.txt' # TODO remove if post-install message not required
17
19
  self.rubyforge_name = self.name # this is default value
18
20
  # self.extra_deps = [['activesupport','>= 2.0.2']]
19
21
  end
22
+ # Use hanna RDoc template
23
+ $hoe.spec.rdoc_options = %w{--main README.rdoc -T hanna}
20
24
 
21
25
  require 'newgem/tasks'
22
26
  Dir['tasks/**/*.rake'].each { |t| load t }
data/lib/pidgin2adium.rb CHANGED
@@ -14,7 +14,7 @@ module Pidgin2Adium
14
14
  ADIUM_LOG_DIR = File.expand_path('~/Library/Application Support/Adium 2.0/Users/Default/Logs/') << '/'
15
15
  # These files/directories show up in Dir.entries()
16
16
  BAD_DIRS = %w{. .. .DS_Store Thumbs.db .system}
17
- VERSION = "2.0.0"
17
+ VERSION = "2.0.1"
18
18
 
19
19
  def log_msg(str) #:nodoc
20
20
  puts str.to_s
@@ -29,7 +29,8 @@ module Pidgin2Adium
29
29
  end
30
30
 
31
31
  #######################
32
- private :log_msg, :oops, :error
32
+ #So that we can use log_msg when calling delete_search_indexes() by itself
33
+ module_function :log_msg, :oops, :error
33
34
  #######################
34
35
 
35
36
  # Returns a LogFile instance or false if an error occurred.
@@ -162,14 +162,28 @@ module Pidgin2Adium
162
162
  #################
163
163
 
164
164
  def get_time_zone_offset()
165
+ # We must have a tz_offset or else the Adium Chat Log viewer
166
+ # doesn't read the date correctly and then:
167
+ # 1) the log has an empty start date column in the viewer
168
+ # 2) The timestamps are all the same for the whole log
165
169
  tz_match = /([-\+]\d+)[A-Z]{3}\.(?:txt|htm|html)/.match(@src_path)
166
- tz_offset = tz_match[1] rescue ''
170
+ if tz_match[1]
171
+ tz_offset = tz_match[1]
172
+ else
173
+ zone = Time.local(Time.new.year).zone
174
+ # "-0500" (3d rather than 2d to allow for "+")
175
+ tz_offset = sprintf('+%03d00', Time.zone_offset(zone) / 3600)
176
+ end
167
177
  return tz_offset
168
178
  end
169
179
 
170
180
  #--
171
- # Adium time format: YYYY-MM-DD\THH.MM.SS[+-]TZ_HRS like:
181
+ # Adium time format: YYYY-MM-DD\THH:MM:SS[+-]TZ_HRS like:
182
+ # 2008-10-05T22:26:20-0800
183
+ # HOWEVER:
184
+ # If it's the first line, then return it like this (note periods):
172
185
  # 2008-10-05T22.26.20-0800
186
+ # because it will be used in the filename.
173
187
  #++
174
188
  # Converts a pidgin datestamp to an Adium one.
175
189
  def create_adium_time(time, is_first_line = false)
@@ -207,7 +221,12 @@ module Pidgin2Adium
207
221
  log_msg("Continuing...")
208
222
  year,month,day,hour,min,sec = ParseDate.parsedate(time)
209
223
  end
210
- return Time.local(year,month,day,hour,min,sec).strftime("%Y-%m-%dT%H.%M.%S#{@tz_offset}")
224
+ if is_first_line
225
+ adium_time = Time.local(year,month,day,hour,min,sec).strftime("%Y-%m-%dT%H.%M.%S#{@tz_offset}")
226
+ else
227
+ adium_time = Time.local(year,month,day,hour,min,sec).strftime("%Y-%m-%dT%H:%M:%S#{@tz_offset}")
228
+ end
229
+ return adium_time
211
230
  end
212
231
 
213
232
  # Extract required data from the file. Run by parse.
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pidgin2adium
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gabe B-W
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-11-24 00:00:00 -05:00
12
+ date: 2009-12-06 00:00:00 -05:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -27,7 +27,7 @@ description: |-
27
27
  Adium format.
28
28
  Note that it assumes a Mac OS X environment with Adium installed.
29
29
  email:
30
- - gbw@brandeis.edu
30
+ - pidgin2adium@brandeis.edu
31
31
  executables:
32
32
  - pidgin2adium
33
33
  extensions: []
@@ -55,6 +55,8 @@ post_install_message:
55
55
  rdoc_options:
56
56
  - --main
57
57
  - README.rdoc
58
+ - -T
59
+ - hanna
58
60
  require_paths:
59
61
  - lib
60
62
  required_ruby_version: !ruby/object:Gem::Requirement