ncal2gcal 0.1.5 → 0.1.6

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/CHANGELOG.rdoc ADDED
@@ -0,0 +1,16 @@
1
+ === ncal2gcal 0.1.6
2
+ * New command line option --sync-names
3
+
4
+ === ncal2gcal 0.1.5
5
+ * New command line option --sync-alarm
6
+
7
+ === Version 0.1.4
8
+ * fixed issue with end date in all-day-events
9
+
10
+ === Version 0.1.3
11
+
12
+ === Version 0.1.1
13
+
14
+ === Version 0.1.1
15
+
16
+ === Version 0.1.0
data/README.rdoc CHANGED
@@ -20,8 +20,9 @@ Specific options:
20
20
  -P, --gmail-password PASSWORD Google user password
21
21
  -C, --gmail-calendar CALENDAR Google calendar (default: 'LotusNotes')
22
22
  -D, --days DAYS Do not sync events older then DAYS days
23
- --sync-desc Sync event description (default: no)
24
- --sync-alarm Sync event alarm notification (default: no)
23
+ --sync-desc Sync event description (default: no)
24
+ --sync-alarm Sync event alarm notification (default: no)
25
+ --sync-names Sync attendees (default: no)"
25
26
 
26
27
 
27
28
  Example:
@@ -0,0 +1,7 @@
1
+ rem build ncal2gcal portable using the ocra gem
2
+ rem installing ocra: gem install ocra
3
+ cp ncal2gcal "%appdata%\ncal2gcal_portable"
4
+ cd %appdata%
5
+ %SystemDrive%
6
+ ocra ncal2gcal_portable
7
+ pause
data/bin/ncal2gcal CHANGED
@@ -22,6 +22,7 @@ opts = OptionParser.new do |opts|
22
22
  opts.on("-D", "--days DAYS", "Do not sync events older then DAYS days (default: no limit)") { |days| conf[:days]=days.to_i }
23
23
  opts.on("--sync-desc", "Sync event description (default: no)") { |conf[:sync_desc]| }
24
24
  opts.on("--sync-alarm", "Sync alarm notification (default: no)") { |conf[:sync_alarm]| }
25
+ opts.on("--sync-names", "Sync attendees (default: no)") { |conf[:sync_names]| }
25
26
 
26
27
  opts.separator ""
27
28
  opts.separator "Example:"
@@ -36,7 +37,7 @@ opts = OptionParser.new do |opts|
36
37
  end
37
38
 
38
39
  opts.on_tail("-v", "--version", "Show version") do
39
- puts "ncal2gcal 0.1.5"
40
+ puts "ncal2gcal 0.1.6"
40
41
  exit
41
42
  end
42
43
 
@@ -75,7 +75,8 @@ module NCal2GCal
75
75
  :appointmenttype,
76
76
  :content,
77
77
  :repeats,
78
- :alarm, :alarm_offset
78
+ :alarm, :alarm_offset,
79
+ :required_names, :optional_names, :chair # todo ???
79
80
 
80
81
  def initialize(notes_event)
81
82
  fill_alarm(notes_event)
@@ -118,10 +119,15 @@ module NCal2GCal
118
119
  end
119
120
 
120
121
  fill_repeats(notes_event)
122
+ fill_names(notes_event) if meeting?
121
123
  end
122
124
  def all_day?
123
125
  @appointmenttype and (@appointmenttype == :all_day_event or @appointmenttype == :anniversary)
124
126
  end
127
+ def meeting?
128
+ @appointmenttype and (@appointmenttype == :meeting)
129
+ end
130
+
125
131
  def supported?
126
132
  # anniversaries are now (v.0.0.7) supported
127
133
  @appointmenttype #and (@appointmenttype != :anniversary)
@@ -172,5 +178,96 @@ module NCal2GCal
172
178
  @repeats << r
173
179
  end
174
180
  end
181
+ def formatted_names
182
+ names = "Chair: #{names_to_str(@chair)}\nRequired: "
183
+ names += names_to_str_name_email(@required_names)
184
+ names += "\nOptional: "+names_to_str_name_email(@optional_names)
185
+ names += "\n---\n"
186
+ #p names
187
+ names
188
+ end
189
+ def names_to_str_name_email(names)
190
+ (names.inject([]) do |x,y|
191
+ email, name = '', ''
192
+ email = "<#{y[:email]}>" if (y[:email] and y[:email] != '')
193
+ name = "\"#{y[:name]}\" " if (y[:name] and y[:name] != '')
194
+
195
+ x << name + email
196
+ x
197
+ end).join(', ')
198
+ end
199
+
200
+ def names_to_str(names)
201
+ (names.inject([]) do |x,y|
202
+ if y[:email] and y[:email] != ''
203
+ x << y[:email] if y[:email]
204
+ elsif y[:name]
205
+ x << y[:name] if y[:name]
206
+ end
207
+ x
208
+ end).join(', ')
209
+ end
210
+ def all_names
211
+ names = []
212
+ names += @chair || []
213
+ names += @required_names || []
214
+ names += @optional_names || []
215
+
216
+ names.uniq
217
+ end
218
+ def fill_names(notes_event)
219
+ @chair = fill_chair(notes_event)
220
+ @required_names = fill_notes_names(notes_event, 'AltRequiredNames', 'INetRequiredNames')
221
+ @optional_names = fill_notes_names(notes_event, 'AltOptionalNames', 'INetOptionalNames')
222
+ end
223
+ def fill_chair(notes_event)
224
+ chair = []
225
+ notes_chair = notes_event.GetFirstItem("CHAIR")
226
+ notes_chair = notes_event.GetFirstItem('AltChair') unless notes_chair
227
+ if notes_chair
228
+ then
229
+ notes_chair.Values.each do |name|
230
+ name =~ /^CN=(.*)\/O=(.*)\/C=(.*)/
231
+ chair << {:name => ($1 || name)}
232
+ end
233
+ end
234
+ chair
235
+ end
236
+ def find_email(names, idx)
237
+ email = names[idx]
238
+ if email
239
+ email = nil if email == '.'
240
+ email = nil if email == ''
241
+ # email =~ /^CN=(.*)\/O=(.*)\/C=(.*)/
242
+ # email = $1 if $1
243
+ end
244
+ return email
245
+ end
246
+
247
+ def fill_notes_names(notes_event, notes_attr_name, notes_attr_email = nil)
248
+ names = []
249
+ notes_names = []
250
+ notes_names1 = notes_event.GetFirstItem(notes_attr_name)
251
+ if notes_attr_email
252
+ notes_names2 = notes_event.GetFirstItem(notes_attr_email)
253
+ notes_names2 = nil unless (notes_names2 and notes_names2.Values.size == notes_names1.Values.size)
254
+ end
255
+ if notes_names1
256
+ notes_names1.Values.each_with_index do |name, idx|
257
+ email = find_email(notes_names2.Values, idx) if notes_names2
258
+ #name =~ /^CN=(.*)\/O=(.*)\/C=(.*)/
259
+ #email ? short_name = name.split('/')[0] : short_name # use name+domain if email missing
260
+ short_name = name.split('/')[0]
261
+ # check if name is an email adress
262
+ if !email and short_name =~ /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\Z/i
263
+ email = short_name
264
+ short_name = ''
265
+ end
266
+ names << {:name => (short_name || ''), :email => (email || '')}
267
+ end
268
+ end
269
+ names
270
+ end
271
+
175
272
  end
176
273
  end
@@ -12,6 +12,8 @@ class String
12
12
  str = str.gsub(/\304/,"Ä") # �
13
13
  str = str.gsub(/\344/,"ä") # �
14
14
  str = str.gsub(/\337/,"ß") # �
15
+ str = str.gsub(/>/,"&gt;")
16
+ str = str.gsub(/</,"&lt;")
15
17
  # bez_neu = Iconv.conv('UTF-8','CP850', bez_neu)
16
18
  #str = str.gsub(/([^\d\w\s\.\[\]-])/, '')
17
19
  return str
@@ -31,6 +31,7 @@ module NCal2GCal
31
31
  # do not sync the description unless the users wants to
32
32
  @sync_desc = params[:sync_desc] # || true
33
33
  @sync_alarm = params[:sync_alarm]
34
+ @sync_names = params[:sync_names]
34
35
 
35
36
  init_logger
36
37
  end
@@ -141,7 +142,15 @@ module NCal2GCal
141
142
  end
142
143
  google_event.where = notes_event.where.asciify if notes_event.where
143
144
  google_event.all_day = notes_event.all_day?
144
- google_event.content = notes_event.content.asciify if @sync_desc
145
+
146
+ if (@sync_desc || @sync_names)
147
+ content = ''
148
+ content += notes_event.formatted_names.asciify if (@sync_names and notes_event.all_names.size > 0)
149
+ content += notes_event.content.asciify if @sync_desc
150
+ google_event.content = content
151
+ #puts content
152
+ end
153
+
145
154
  if @sync_alarm and notes_event.alarm
146
155
  google_event.reminder = {:method =>'alert', :minutes => notes_event.alarm_offset.to_i.to_s }
147
156
  end
data/ncal2gcal.gemspec CHANGED
@@ -2,13 +2,13 @@ require "rubygems"
2
2
 
3
3
  spec = Gem::Specification.new do |s|
4
4
  s.name = %q{ncal2gcal}
5
- s.version = "0.1.5"
5
+ s.version = "0.1.6"
6
6
  s.authors = ["Elias Kugler"]
7
7
  s.email = %q{groesser3@gmail.com}
8
8
  s.files = Dir["lib/**/*"] + Dir["bin/**/*"] + Dir["*.rb"] + ["MIT-LICENSE","ncal2gcal.gemspec"]
9
9
  s.platform = Gem::Platform::RUBY
10
10
  s.has_rdoc = true
11
- s.extra_rdoc_files = ["README.rdoc"]
11
+ s.extra_rdoc_files = ["README.rdoc", "CHANGELOG.rdoc"]
12
12
  s.require_paths = ["lib"]
13
13
  s.summary = %q{Sync your Lotus Notes calendar with your Google calendar}
14
14
  s.description = %q{This lib/tool syncs your IBM Lotus Notes calendar with your (private) Google calendar. The synchronisation is only one-way: Lotus Notes events are pushed to your Google Calendar. All types of events (including recurring events like anniversaries) are supported.}
metadata CHANGED
@@ -1,7 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ncal2gcal
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 1
8
+ - 6
9
+ version: 0.1.6
5
10
  platform: ruby
6
11
  authors:
7
12
  - Elias Kugler
@@ -9,49 +14,65 @@ autorequire:
9
14
  bindir: bin
10
15
  cert_chain: []
11
16
 
12
- date: 2010-03-08 00:00:00 +01:00
17
+ date: 2010-06-23 00:00:00 +02:00
13
18
  default_executable: ncal2gcal
14
19
  dependencies:
15
20
  - !ruby/object:Gem::Dependency
16
21
  name: dm-core
17
- type: :runtime
18
- version_requirement:
19
- version_requirements: !ruby/object:Gem::Requirement
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
20
24
  requirements:
21
25
  - - ">="
22
26
  - !ruby/object:Gem::Version
27
+ segments:
28
+ - 0
29
+ - 10
30
+ - 0
23
31
  version: 0.10.0
24
- version:
32
+ type: :runtime
33
+ version_requirements: *id001
25
34
  - !ruby/object:Gem::Dependency
26
35
  name: do_sqlite3
27
- type: :runtime
28
- version_requirement:
29
- version_requirements: !ruby/object:Gem::Requirement
36
+ prerelease: false
37
+ requirement: &id002 !ruby/object:Gem::Requirement
30
38
  requirements:
31
39
  - - ">="
32
40
  - !ruby/object:Gem::Version
41
+ segments:
42
+ - 0
43
+ - 10
44
+ - 0
33
45
  version: 0.10.0
34
- version:
46
+ type: :runtime
47
+ version_requirements: *id002
35
48
  - !ruby/object:Gem::Dependency
36
49
  name: gcal4ruby
37
- type: :runtime
38
- version_requirement:
39
- version_requirements: !ruby/object:Gem::Requirement
50
+ prerelease: false
51
+ requirement: &id003 !ruby/object:Gem::Requirement
40
52
  requirements:
41
53
  - - ">="
42
54
  - !ruby/object:Gem::Version
55
+ segments:
56
+ - 0
57
+ - 3
58
+ - 1
43
59
  version: 0.3.1
44
- version:
60
+ type: :runtime
61
+ version_requirements: *id003
45
62
  - !ruby/object:Gem::Dependency
46
63
  name: log4r
47
- type: :runtime
48
- version_requirement:
49
- version_requirements: !ruby/object:Gem::Requirement
64
+ prerelease: false
65
+ requirement: &id004 !ruby/object:Gem::Requirement
50
66
  requirements:
51
67
  - - ">="
52
68
  - !ruby/object:Gem::Version
69
+ segments:
70
+ - 1
71
+ - 0
72
+ - 5
53
73
  version: 1.0.5
54
- version:
74
+ type: :runtime
75
+ version_requirements: *id004
55
76
  description: "This lib/tool syncs your IBM Lotus Notes calendar with your (private) Google calendar. The synchronisation is only one-way: Lotus Notes events are pushed to your Google Calendar. All types of events (including recurring events like anniversaries) are supported."
56
77
  email: groesser3@gmail.com
57
78
  executables:
@@ -60,6 +81,7 @@ extensions: []
60
81
 
61
82
  extra_rdoc_files:
62
83
  - README.rdoc
84
+ - CHANGELOG.rdoc
63
85
  files:
64
86
  - lib/ncal2gcal/counter.rb
65
87
  - lib/ncal2gcal/gcal4ruby_gateway.rb
@@ -68,10 +90,12 @@ files:
68
90
  - lib/ncal2gcal/string.rb
69
91
  - lib/ncal2gcal/sync.rb
70
92
  - lib/ncal2gcal/sync_entry.rb
93
+ - bin/build_ncal2gcal_portable.cmd
71
94
  - bin/ncal2gcal
72
95
  - MIT-LICENSE
73
96
  - ncal2gcal.gemspec
74
97
  - README.rdoc
98
+ - CHANGELOG.rdoc
75
99
  has_rdoc: true
76
100
  homepage: http://rubyforge.org/projects/ncal2gcal/
77
101
  licenses: []
@@ -85,18 +109,20 @@ required_ruby_version: !ruby/object:Gem::Requirement
85
109
  requirements:
86
110
  - - ">="
87
111
  - !ruby/object:Gem::Version
112
+ segments:
113
+ - 0
88
114
  version: "0"
89
- version:
90
115
  required_rubygems_version: !ruby/object:Gem::Requirement
91
116
  requirements:
92
117
  - - ">="
93
118
  - !ruby/object:Gem::Version
119
+ segments:
120
+ - 0
94
121
  version: "0"
95
- version:
96
122
  requirements: []
97
123
 
98
124
  rubyforge_project: ncal2gcal
99
- rubygems_version: 1.3.5
125
+ rubygems_version: 1.3.6
100
126
  signing_key:
101
127
  specification_version: 3
102
128
  summary: Sync your Lotus Notes calendar with your Google calendar