rwdaddresses 1.04 → 1.05

Sign up to get free protection for your applications and to get access to all the features.
Files changed (223) hide show
  1. data/Readme.txt +380 -179
  2. data/code/01rwdcore/01rwdcore.rb +7 -0
  3. data/code/01rwdcore/02helptexthashbegin.rb +0 -0
  4. data/code/01rwdcore/03helptexthash.rb +13 -21
  5. data/code/01rwdcore/04helptextend.rb +0 -0
  6. data/code/01rwdcore/jumplinkcommand.rb +1 -1
  7. data/code/01rwdcore/openhelpwindow.rb +1 -1
  8. data/code/01rwdcore/returntomain.rb +0 -0
  9. data/code/01rwdcore/rundocuments.rb +0 -0
  10. data/code/01rwdcore/runeditconfiguration.rb +0 -0
  11. data/code/01rwdcore/runhelpabout.rb +0 -0
  12. data/code/01rwdcore/runopentinkerdocument.rb +7 -0
  13. data/code/01rwdcore/rwdtinkerversion.rb +11 -3
  14. data/code/01rwdcore/rwdwindowreturn.rb +0 -0
  15. data/code/01rwdcore/selectiontab.rb +0 -0
  16. data/code/01rwdcore/setuphelpaboutoptions.rb +13 -0
  17. data/code/01rwdcore/setuptinkerdocuments.rb +6 -0
  18. data/code/01rwdcore/test_cases.rb +0 -0
  19. data/code/01rwdcore/test_harness.rb +0 -0
  20. data/code/01rwdcore/uploadreturns.rb +0 -0
  21. data/code/dd0viewphoto/dd0viewphoto.rb +3 -0
  22. data/code/superant.com.bigtinker/rwdtinkerversion.rb +10 -0
  23. data/code/superant.com.rwdaddresses/0uninstallapplet.rb +14 -0
  24. data/code/superant.com.rwdaddresses/attachtmpcontactphoto.rb +0 -0
  25. data/code/superant.com.rwdaddresses/clearscreendisplay.rb +0 -0
  26. data/code/superant.com.rwdaddresses/createnewnamerecord.rb +0 -0
  27. data/code/superant.com.rwdaddresses/deletecontactrecord.rb +0 -0
  28. data/code/superant.com.rwdaddresses/deleterwdaddressesupdatefiles.rb +0 -0
  29. data/code/superant.com.rwdaddresses/downloadrwdaddressfiles.rb +0 -0
  30. data/code/superant.com.rwdaddresses/helptexthashrwdaddresses.rb +0 -0
  31. data/code/superant.com.rwdaddresses/listnamerecord.rb +0 -0
  32. data/code/superant.com.rwdaddresses/listvcardrecord.rb +0 -0
  33. data/code/superant.com.rwdaddresses/loadconfigurationrecord.rb +22 -45
  34. data/code/superant.com.rwdaddresses/loadconfigurationvariables.rb +2 -1
  35. data/code/superant.com.rwdaddresses/loadnamerecord.rb +0 -0
  36. data/code/superant.com.rwdaddresses/openhelpwindowrwdaddresses.rb +0 -0
  37. data/code/superant.com.rwdaddresses/renamecontact.rb +0 -0
  38. data/code/superant.com.rwdaddresses/runaddresseswindow.rb +1 -1
  39. data/code/superant.com.rwdaddresses/runrwdaddressesmenu1.rb +4 -4
  40. data/code/superant.com.rwdaddresses/runrwdaddresssyncbackwindow.rb +0 -0
  41. data/code/superant.com.rwdaddresses/rwdaddressesbackwindow.rb +2 -2
  42. data/code/superant.com.rwdaddresses/rwdaddresseshelpabout.rb +2 -5
  43. data/code/superant.com.rwdaddresses/saveconfigurationrecord.rb +1 -1
  44. data/code/superant.com.rwdaddresses/savevcardrecord.rb +0 -0
  45. data/code/superant.com.rwdaddresses/syncrwdaddress.rb +0 -0
  46. data/code/superant.com.rwdaddresses/test_cases.rb +1 -2
  47. data/code/superant.com.rwdaddresses/uploadrwdaddressfiles.rb +0 -0
  48. data/code/superant.com.rwdaddresses/viewaddressconfiguration.rb +0 -0
  49. data/code/superant.com.rwdaddresses/viewnamedata.rb +0 -0
  50. data/code/superant.com.rwdaddresses/viewphoto.rb +0 -0
  51. data/code/superant.com.rwdaddresses/viewrwdaddressesconfiguration.rb +0 -0
  52. data/code/superant.com.rwdaddresses/viewtmpcontactphoto.rb +0 -0
  53. data/code/superant.com.rwdaddresses/viewvcarddata.rb +0 -0
  54. data/code/superant.com.rwdtinkerbackwindow/diagnostictab.rb +0 -0
  55. data/code/superant.com.rwdtinkerbackwindow/helptexthashtinkerwin2.rb +0 -0
  56. data/code/superant.com.rwdtinkerbackwindow/initiateapplets.rb +240 -0
  57. data/code/superant.com.rwdtinkerbackwindow/installgemapplet.rb +18 -5
  58. data/code/superant.com.rwdtinkerbackwindow/installremotegem.rb +0 -0
  59. data/code/superant.com.rwdtinkerbackwindow/listgemdirs.rb +0 -0
  60. data/code/superant.com.rwdtinkerbackwindow/listgemzips.rb +1 -1
  61. data/code/superant.com.rwdtinkerbackwindow/listinstalledfiles.rb +0 -0
  62. data/code/superant.com.rwdtinkerbackwindow/listzips.rb +1 -1
  63. data/code/superant.com.rwdtinkerbackwindow/loadconfigurationrecord.rb +1 -12
  64. data/code/superant.com.rwdtinkerbackwindow/loadconfigurationvariables.rb +0 -0
  65. data/code/superant.com.rwdtinkerbackwindow/network.rb +0 -0
  66. data/code/superant.com.rwdtinkerbackwindow/openappletname.rb +0 -0
  67. data/code/superant.com.rwdtinkerbackwindow/openhelpwindowtinkerwin2.rb +1 -5
  68. data/code/superant.com.rwdtinkerbackwindow/remotegemlist.rb +0 -0
  69. data/code/superant.com.rwdtinkerbackwindow/removeapplet.rb +19 -6
  70. data/code/superant.com.rwdtinkerbackwindow/removeappletvariables.rb +52 -0
  71. data/code/superant.com.rwdtinkerbackwindow/runremoteinstall.rb +0 -0
  72. data/code/superant.com.rwdtinkerbackwindow/runrwdtinkerbackwindow.rb +4 -0
  73. data/code/superant.com.rwdtinkerbackwindow/rwdtinkerwin2version.rb +0 -0
  74. data/code/superant.com.rwdtinkerbackwindow/saveconfigurationrecord.rb +2 -2
  75. data/code/superant.com.rwdtinkerbackwindow/viewappletcontents.rb +1 -1
  76. data/code/superant.com.rwdtinkerbackwindow/viewgemappletcontents.rb +1 -1
  77. data/code/zz0applicationend/zz0end.rb +0 -0
  78. data/configuration/language.dist +2 -1
  79. data/configuration/rwdapplicationidentity.dist +2 -2
  80. data/configuration/rwdtinker.dist +6 -3
  81. data/configuration/{rwdaddresses.dist → rwdwaddresses-1.05.dist} +6 -2
  82. data/configuration/tinkerwin2variables.dist +1 -1
  83. data/gui/00coreguibegin/applicationguitop.rwd +1 -1
  84. data/gui/frontwindow0/cc0openphoto.rwd +22 -0
  85. data/gui/{frontwindowselectionbegin/selectiontabbegin/selectiontabbegin.rwd → frontwindowselections/00selectiontabbegin.rwd} +1 -1
  86. data/gui/frontwindowselections/jumplinkcommands.rwd +15 -0
  87. data/gui/{frontwindowselectionzend/viewselectionzend/viewselectionend.rwd → frontwindowselections/wwselectionend.rwd} +0 -0
  88. data/gui/{frontwindowtdocumentbegin/superant.com.documentsbegin/tt0documentbegin.rwd → frontwindowtdocuments/00documentbegin.rwd} +0 -0
  89. data/gui/frontwindowtdocuments/tinkerdocuments.rwd +14 -0
  90. data/gui/frontwindowtdocuments/zzdocumentend.rwd +8 -0
  91. data/gui/{frontwindowz1end/frontwindowend/xx0rwdfirsttab.rwd → helpaboutbegin/zzzrwdlasttab.rwd} +0 -0
  92. data/gui/helpaboutbegin/zzzzhelpscreenstart.rwd +3 -0
  93. data/gui/helpaboutbegin/zzzzzzhelpabouttab.rwd +15 -0
  94. data/gui/helpaboutzend/{superant.com.helpaboutend/helpscreenend.rwd → helpscreenend.rwd} +0 -0
  95. data/gui/helpaboutzend/zhelpscreenstart2.rwd +3 -0
  96. data/gui/helpaboutzend/zzzzhelpabout2.rwd +15 -0
  97. data/gui/helpaboutzend/zzzzhelpscreen2end.rwd +3 -0
  98. data/gui/tinkerbackwindows/superant.com.addressesphotowindow/yy7addressesphoto.rwd +0 -0
  99. data/gui/tinkerbackwindows/superant.com.rwdaddresses/10appletbegin.rwd +4 -0
  100. data/gui/{frontwindow0 → tinkerbackwindows}/superant.com.rwdaddresses/11viewnamedata.rwd +0 -0
  101. data/gui/{frontwindow0 → tinkerbackwindows}/superant.com.rwdaddresses/13listnamerecordfiles.rwd +0 -0
  102. data/gui/{frontwindow0 → tinkerbackwindows}/superant.com.rwdaddresses/16editrecord.rwd +0 -0
  103. data/gui/{frontwindow0 → tinkerbackwindows}/superant.com.rwdaddresses/17viewvcardrecord.rwd +0 -0
  104. data/gui/{frontwindow0 → tinkerbackwindows}/superant.com.rwdaddresses/18contactutilities.rwd +0 -0
  105. data/gui/tinkerbackwindows/superant.com.rwdaddresses/81jumplinkcommands.rwd +17 -0
  106. data/gui/tinkerbackwindows/superant.com.rwdaddresses/9end.rwd +6 -0
  107. data/gui/tinkerbackwindows/superant.com.rwdaddressessyncbackwindow/1appname.rwd +0 -0
  108. data/gui/tinkerbackwindows/superant.com.rwdaddressessyncbackwindow/20downloadftp.rwd +0 -0
  109. data/gui/tinkerbackwindows/superant.com.rwdaddressessyncbackwindow/70rwddiagnostics.rwd +0 -0
  110. data/gui/tinkerbackwindows/superant.com.rwdaddressessyncbackwindow/87viewconfiguration.rwd +34 -0
  111. data/gui/tinkerbackwindows/superant.com.rwdaddressessyncbackwindow/94selectiontab.rwd +0 -0
  112. data/gui/tinkerbackwindows/superant.com.rwdaddressessyncbackwindow/95jumplink.rwd +0 -0
  113. data/gui/tinkerbackwindows/superant.com.rwdaddressessyncbackwindow/97selectionend.rwd +0 -0
  114. data/gui/tinkerbackwindows/superant.com.rwdaddressessyncbackwindow/zvbackend.rwd +0 -0
  115. data/gui/tinkerbackwindows/superant.com.rwdschedulebackwindow/1appname.rwd +5 -0
  116. data/gui/tinkerbackwindows/superant.com.rwdschedulebackwindow/20downloadftp.rwd +45 -0
  117. data/gui/tinkerbackwindows/superant.com.rwdschedulebackwindow/67viewconfiguration.rwd +29 -0
  118. data/gui/tinkerbackwindows/superant.com.rwdschedulebackwindow/70rwddiagnostics.rwd +16 -0
  119. data/gui/{frontwindowselections/superant.com.rwdtinkerwin2selectiontab/jumplinkcommands.rwd → tinkerbackwindows/superant.com.rwdschedulebackwindow/m01menubegin.rwd} +5 -2
  120. data/gui/tinkerbackwindows/superant.com.rwdschedulebackwindow/zvbackend.rwd +6 -0
  121. data/gui/tinkerbackwindows/superant.com.tinkerbackwindow/1appname.rwd +1 -1
  122. data/gui/tinkerbackwindows/superant.com.tinkerbackwindow/40rwdlistzips.rwd +9 -10
  123. data/gui/tinkerbackwindows/superant.com.tinkerbackwindow/45installremotezip.rwd +5 -5
  124. data/gui/tinkerbackwindows/superant.com.tinkerbackwindow/50rwdlistapplets.rwd +9 -9
  125. data/gui/tinkerbackwindows/superant.com.tinkerbackwindow/60editconfiguration.rwd +4 -12
  126. data/gui/tinkerbackwindows/superant.com.tinkerbackwindow/70rwddiagnostics.rwd +1 -1
  127. data/gui/tinkerbackwindows/superant.com.tinkerbackwindow/81jumplinkcommands.rwd +4 -4
  128. data/gui/tinkerbackwindows/superant.com.tinkerbackwindow/9backend.rwd +0 -0
  129. data/gui/tinkerbackwindows/superant.com.tinkerhelpwindow/1appname.rwd +1 -1
  130. data/gui/tinkerbackwindows/superant.com.tinkerhelpwindow/9end.rwd +0 -0
  131. data/gui/tinkerbackwindows/superant.com.versionwindow/1appname.rwd +2 -2
  132. data/gui/tinkerbackwindows/superant.com.versionwindow/helpaboutwindow.rwd +17 -0
  133. data/gui/zzcoreguiend/{tinkerapplicationguiend/yy9rwdend.rwd → yy9rwdend.rwd} +0 -0
  134. data/init.rb +7 -7
  135. data/installed/rwdaddressesdata2.inf +7 -0
  136. data/installed/rwdwaddresses-1.05.inf +12 -0
  137. data/{lib → installed}/temp.rb +0 -0
  138. data/lang/en/rwdcore/languagefile.rb +57 -15
  139. data/lang/es/rwdcore/languagefile-es.rb +61 -13
  140. data/lang/fr/rwdcore/languagefile.rb +64 -0
  141. data/lang/jp/rwdcore/languagefile.rb +69 -6
  142. data/lang/nl/rwdcore/languagefile.rb +56 -0
  143. data/{extras → lib}/rconftool.rb +0 -0
  144. data/{ev → lib/rwd}/browser.rb +2 -2
  145. data/{ev → lib/rwd}/ftools.rb +0 -0
  146. data/{ev → lib/rwd}/mime.rb +0 -0
  147. data/{ev → lib/rwd}/net.rb +5 -5
  148. data/{ev → lib/rwd}/ruby.rb +0 -0
  149. data/{ev → lib/rwd}/rwd.rb +37 -17
  150. data/{ev → lib/rwd}/sgml.rb +1 -1
  151. data/{ev → lib/rwd}/thread.rb +1 -1
  152. data/{ev → lib/rwd}/tree.rb +2 -2
  153. data/{ev → lib/rwd}/xml.rb +1 -1
  154. data/{extras → lib}/zip/ioextras.rb +0 -0
  155. data/{extras → lib}/zip/stdrubyext.rb +0 -0
  156. data/{extras → lib}/zip/tempfile_bugfixed.rb +0 -0
  157. data/{extras → lib}/zip/zip.rb +5 -4
  158. data/{extras → lib}/zip/zipfilesystem.rb +0 -0
  159. data/{extras → lib}/zip/ziprequire.rb +0 -0
  160. data/names/Angelina Jolie.jpg b/data/names/Angelina → Jolie.jpg +0 -0
  161. data/names/Angelina Jolie.nam b/data/names/Angelina → Jolie.nam +0 -0
  162. data/names/Angelina Jolie.vcf b/data/names/Angelina → Jolie.vcf +0 -0
  163. data/names/Steven Gibson.jpg b/data/names/Steven → Gibson.jpg +0 -0
  164. data/names/Steven Gibson.nam b/data/names/Steven → Gibson.nam +0 -0
  165. data/names/elektra.jpg +0 -0
  166. data/names/elektra.nam +0 -0
  167. data/names/nophoto.jpg +0 -0
  168. data/rwd_files/HowTo_Addresses.txt +8 -0
  169. data/rwd_files/HowTo_BigTinker.txt +146 -0
  170. data/rwd_files/HowTo_Tinker.txt +52 -0
  171. data/rwd_files/HowTo_TinkerWin2.txt +0 -0
  172. data/rwd_files/Readme.txt +0 -0
  173. data/rwd_files/{rwdindex.html → RubyWebDialogs.html} +0 -0
  174. data/rwd_files/contacttmp.jpg +0 -0
  175. data/rwd_files/favicon.ico +0 -0
  176. data/rwd_files/rdoc-style.css +0 -0
  177. data/rwd_files/rwdapplications.html +0 -0
  178. data/rwd_files/tinker.png +0 -0
  179. data/rwdaddresses.rb +1 -0
  180. data/rwdconfig.dist +11 -2
  181. data/tests/checkdepends.sh +0 -0
  182. data/tests/cleancnf.sh +2 -1
  183. data/tests/makedist-rwdwaddesses.rb +56 -0
  184. data/tests/makedist.rb +12 -5
  185. data/tests/rdep.rb +0 -0
  186. data/tests/totranslate.lang +0 -0
  187. data/updates/temp.rb +1 -0
  188. data/zips/rwdwaddresses-1.05.zip +0 -0
  189. data/zips/rwdwcalc-0.61.zip +0 -0
  190. data/zips/rwdwgutenberg-0.09.zip +0 -0
  191. data/zips/rwdwschedule-1.04.zip +0 -0
  192. data/zips/rwdwshell-1.04.zip +0 -0
  193. data/zips/temp.rb +1 -0
  194. data/zips/wrubyslippers-1.06.zip +0 -0
  195. metadata +78 -77
  196. data/code/superant.com.rwdaddresses/jumplinkupdate.rb +0 -11
  197. data/code/superant.com.rwdaddresses/returntomain.rb +0 -10
  198. data/code/superant.com.rwdtinkerbackwindow/controlclient.rb +0 -96
  199. data/code/superant.com.rwdtinkerbackwindow/installapplet.rb +0 -25
  200. data/extras/vpim/date.rb +0 -198
  201. data/extras/vpim/dirinfo.rb +0 -229
  202. data/extras/vpim/enumerator.rb +0 -29
  203. data/extras/vpim/field.rb +0 -497
  204. data/extras/vpim/maker/vcard.rb +0 -312
  205. data/extras/vpim/rfc2425.rb +0 -244
  206. data/extras/vpim/rrule.rb +0 -482
  207. data/extras/vpim/time.rb +0 -42
  208. data/extras/vpim/vcard.rb +0 -151
  209. data/extras/vpim/vpim.rb +0 -94
  210. data/gui/frontwindowtdocuments/superant.com.addressesdocuments/uu8doc_rwdschedule.rwd +0 -5
  211. data/gui/frontwindowtdocuments/superant.com.documents/uu5documents.rwd +0 -15
  212. data/gui/frontwindowtdocuments/superant.com.tinkerwin2documents/uu5documents.rwd +0 -6
  213. data/gui/frontwindowtdocumentzend/superant.com.documentsend/ww0documentend.rwd +0 -12
  214. data/gui/helpaboutbegin/superant.com.helpaboutbegin/ya0helpscreenstart.rwd +0 -3
  215. data/gui/helpaboutinstalled/superant.com.rwdaddresseshelpabout/1appname.rwd +0 -4
  216. data/gui/helpaboutinstalled/superant.com.rwdaddresseshelpabout/3copyright.rwd +0 -3
  217. data/gui/helpaboutinstalled/superant.com.rwdaddresseshelpabout/5version.rwd +0 -9
  218. data/gui/helpaboutinstalled/superant.com.tinkerhelpabout/1appname.rwd +0 -4
  219. data/gui/helpaboutinstalled/superant.com.tinkerhelpabout/3copyright.rwd +0 -3
  220. data/gui/helpaboutinstalled/superant.com.tinkerhelpabout/5version.rwd +0 -10
  221. data/gui/tinkerbackwindows/superant.com.rwdaddressessyncbackwindow/88viewconfiguration.rwd +0 -47
  222. data/installed/rwdviewlogo-0.4.inf +0 -4
  223. data/zips/rwdahelloworld-0.5.zip +0 -0
@@ -1,482 +0,0 @@
1
- =begin
2
- $Id: rrule.rb,v 1.18 2005/01/23 22:19:48 sam Exp $
3
-
4
- Copyright (C) 2005 Sam Roberts
5
-
6
- This library is free software; you can redistribute it and/or modify it
7
- under the same terms as the ruby language itself, see the file COPYING for
8
- details.
9
- =end
10
-
11
- require 'vpim/rfc2425'
12
- require 'vpim/date'
13
- require 'vpim/time'
14
- require 'vpim/vpim'
15
-
16
- =begin
17
- require 'pp'
18
-
19
- $debug = ENV['DEBUG']
20
-
21
- def debug(*objs)
22
- if $debug
23
- pp(*objs)
24
- print ' (', caller(1)[0], ')', "\n"
25
- end
26
- end
27
- =end
28
-
29
- module Vpim
30
-
31
- # Implements the iCalendar recurence rule syntax. See etc/rrule.txt for the
32
- # syntax description and examples from RFC 2445. The description is pretty
33
- # hard to understand, but the examples are more helpful.
34
- #
35
- # The implementation is pretty complete, but still lacks support for:
36
- #
37
- # TODO - BYWEEKLY, BYWEEKNO, WKST: rules that recur by the week, or are
38
- # limited to particular weeks, not hard, but not trivial, I'll do it for the
39
- # next release
40
- #
41
- # TODO - BYHOUR, BYMINUTE, BYSECOND: trivial to do, but I don't have an
42
- # immediate need for them, I'll do it for the next release
43
- #
44
- # TODO - BYSETPOS: limiting to only certain recurrences in a set (what does
45
- # -1, last occurence, mean for an infinitely occuring rule?)
46
- #
47
- # TODO - new API? -> Rrule#infinite?
48
- #
49
- # == Examples
50
- #
51
- # - link:rrule.txt: utility for printing recurrence rules
52
- class Rrule
53
- include Enumerable
54
-
55
- # The recurrence rule, +rrule+, specifies how to generate a set of times
56
- # from a start time, +dtstart+ (which must the first of the set of
57
- # recurring times). If +rrule+ is nil, the set contains only +dtstart+.
58
- def initialize(dtstart, rrule = nil)
59
- # dtstart must be in local time, they say, but I think that really
60
- # means must be in a particular timezone
61
-
62
- # Note: DTSTART is always in the recurrence set
63
- @dtstart = dtstart
64
- @rrule = rrule
65
-
66
- # Freq is mandatory, but must occur only once.
67
- @freq = nil
68
-
69
- # Both Until and Count must not occur, neither is OK.
70
- @until = nil
71
- @count = nil
72
-
73
- # Interval is optional, but defaults to 1.
74
- @interval = 1
75
-
76
- # WKST defines what day a week begins on, the default is monday.
77
- @wkst = 'MO'
78
-
79
- # Recurrence can modified by these.
80
- @by = {}
81
-
82
- if @rrule
83
- @rrule.scan(/([^;=]+)=([^;=]+)/) do |key,value|
84
- key.upcase!
85
- value.upcase!
86
-
87
- case key
88
- when 'FREQ'
89
- @freq = value.upcase
90
-
91
- when 'UNTIL'
92
- if @count
93
- raise "found UNTIL, but COUNT already specified"
94
- end
95
- @until = Rrule.time_from_rfc2425(value)
96
-
97
- when 'COUNT'
98
- if @until
99
- raise "found COUNT, but UNTIL already specified"
100
- end
101
- @count = value.to_i
102
-
103
- when 'INTERVAL'
104
- @interval = value.to_i
105
- if @interval < 1
106
- raise "interval must be a positive integer"
107
- end
108
-
109
- when 'WKST'
110
- # TODO - check value is MO-SU
111
- @wkst = value
112
-
113
- else
114
- @by[key] = value
115
- end
116
- end
117
-
118
- if !@freq
119
- # TODO - this shouldn't be an arg error, but a FormatError, its not the
120
- # caller's fault!
121
- raise ArgumentError, "recurrence rule lacks a frequency"
122
- end
123
- end
124
- end
125
-
126
- # Return an Enumerable, it's #each() will yield over all occurences up to
127
- # (and not including) time +dountil+.
128
- def each_until(dountil)
129
- Vpim::Enumerator.new(self, dountil)
130
- end
131
-
132
- # Yields for each +ytime+ in the recurring set of events.
133
- #
134
- # Warning: the set may be infinite! If you need an upper bound on the
135
- # number of occurences, you need to implement a count, or pass a time,
136
- # +dountil+, which will not be iterated past (i.e. all times yielded will be
137
- # less than +dountil+).
138
- #
139
- # Also, iteration will not currently continue past the limit of a Time
140
- # object, which is some time in 2037 with 32-bit time_t's common on
141
- # most systems.
142
- def each(dountil = nil) #:yield: ytime
143
- t = @dtstart.clone
144
- count = 1
145
-
146
- # Time.to_a => [ sec, min, hour, day, month, year, wday, yday, isdst, zone ]
147
-
148
- # Every event occurs at least once, at its start time, but only if the start
149
- # time is earlier than 'dountil'...
150
- if !@rrule
151
- if !dountil || t < dountil
152
- yield t
153
- end
154
- return self
155
- end
156
-
157
- loop do
158
- # Build the set of times to yield within this interval (and after
159
- # DTSTART)
160
-
161
- days = DaySet.new(t)
162
- hour = nil
163
- min = nil
164
- sec = nil
165
-
166
- # Need to make a Dates class, and make month an instance of it, and add
167
- # the "intersect" operator.
168
-
169
- case @freq
170
- #when 'YEARLY' then
171
- # Don't need to keep track of year, all occurences are within t's
172
- # year.
173
- when 'MONTHLY' then days.month = t.month #month = { t.month => nil }
174
- # when 'WEEKLY' then days.mday = t.month, t.mday
175
- # TODO - WEEKLY
176
- when 'DAILY' then days.mday = t.month, t.mday #month = { t.month => [ t.mday ] }
177
- when 'HOURLY' then hour = [t.hour]
178
- when 'MINUTELY' then min = [t.min]
179
- when 'SECONDLY' then sec = [t.sec]
180
- end
181
-
182
- # Process the BY* modifiers in RFC defined order:
183
- # BYMONTH, BYWEEKNO, BYYEARDAY, BYMONTHDAY, BYDAY,
184
- # BYHOUR, BYMINUTE, BYSECOND and BYSETPOS
185
-
186
- if @by['BYMONTH']
187
- bymon = @by['BYMONTH'].split(',')
188
- bymon = bymon.collect { |m| m.to_i }
189
- # debug bymon
190
-
191
- # In yearly, at this point, month will always be nil. At other
192
- # frequencies, it will not.
193
- days.intersect_bymon(bymon)
194
-
195
- # debug days
196
- end
197
-
198
- # TODO - BYWEEKNO
199
-
200
- if @by['BYYEARDAY']
201
- byyday = @by['BYYEARDAY'].scan(/,?([+-]?[1-9]\d*)/)
202
- # debug byyday
203
- dates = byyearday(t.year, byyday)
204
- days.intersect_dates(dates)
205
- end
206
-
207
- if @by['BYMONTHDAY']
208
- bymday = @by['BYMONTHDAY'].scan(/,?([+-]?[1-9]\d*)/)
209
- # debug bymday
210
- # Generate all days matching this for all months. For yearly, this
211
- # is what we want, for anything of monthly or higher frequency, it
212
- # is too many days, but that's OK, since the month will already
213
- # be specified and intersection will eliminate the out-of-range
214
- # dates.
215
- dates = bymonthday(t.year, bymday)
216
- # debug dates
217
- days.intersect_dates(dates)
218
- # debug days
219
- end
220
-
221
- if @by['BYDAY']
222
- byday = @by['BYDAY'].scan(/,?([+-]?[1-9]?\d*)?(SU|MO|TU|WE|TH|FR|SA)/i)
223
- # debug byday
224
-
225
- # BYDAY means different things in different frequencies. The +n+
226
- # is only meaningful when freq is yearly or monthly.
227
-
228
- case @freq
229
- when 'YEARLY'
230
- dates = byday_in_yearly(t.year, byday)
231
- when 'MONTHLY'
232
- dates = byday_in_monthly(t.year, t.month, byday)
233
- when 'WEEKLY'
234
- # dates = byday_in_weekly(t.year, wkstart, t.month, t.day, byday)
235
- when 'DAILY', 'HOURLY', 'MINUTELY', 'SECONDLY'
236
- # Reuse the bday_in_monthly. Current day is already specified,
237
- # so this will just eliminate the current day if its no allowed
238
- # in BYDAY.
239
- dates = byday_in_monthly(t.year, t.month, byday)
240
- end
241
-
242
- # debug dates
243
- days.intersect_dates(dates)
244
- # debug days
245
- end
246
-
247
- # TODO - BYHOUR, BYMINUTE, BYSECOND
248
-
249
- # TODO - BYSETPOS
250
-
251
- # Yield the time, if we haven't gone over COUNT, or past UNTIL, or past
252
- # the end of representable time.
253
-
254
- hour = [@dtstart.hour] if !hour
255
- min = [@dtstart.min] if !min
256
- sec = [@dtstart.sec] if !sec
257
-
258
- # debug days
259
-
260
- days.each do |m,d|
261
- hour.each do |h|
262
- min.each do |n|
263
- sec.each do |s|
264
- if(@count && (count > @count))
265
- return self
266
- end
267
- y = Time.local(t.year, m, d, h, n, s, 0)
268
-
269
- next if y.hour != h
270
-
271
- # The generated set can sometimes generate results earlier
272
- # than the DTSTART, skip them.
273
- next if y < @dtstart
274
-
275
- # We are done if current time is past @until.
276
- if @until && (y > @until)
277
- return self
278
- end
279
- # We are also done if current time is past the
280
- # caller-requested until.
281
- if dountil && (y > dountil)
282
- return self
283
- end
284
- yield y
285
- count += 1
286
- end
287
- end
288
- end
289
- end
290
-
291
-
292
- # Add @interval to @freq component
293
-
294
- # Note - when we got past representable time, the error is:
295
- # time out of range (ArgumentError)
296
- # Finish when we see this.
297
- begin
298
- case @freq
299
- when 'YEARLY' then
300
- t = t.plus_year(@interval)
301
-
302
- when 'MONTHLY' then
303
- t = t.plus_month(@interval)
304
-
305
- when 'WEEKLY' then
306
- t = t.plus_day(@interval * 7)
307
-
308
- when 'DAILY' then
309
- t = t.plus_day(@interval)
310
-
311
- when 'HOURLY' then
312
- t += @interval * 60 * 60
313
-
314
- when 'MINUTELY' then
315
- t += @interval * 60
316
-
317
- when 'SECONDLY' then
318
- t += @interval
319
-
320
- when nil
321
- return self
322
- end
323
- rescue ArgumentError
324
- return self if $!.message =~ /^time out of range$/
325
-
326
- raise ArgumentError, "#{$!.message} while adding interval to #{t.inspect}"
327
- end
328
-
329
- return self if dountil && (t > dountil)
330
- end
331
- end
332
-
333
- class DaySet #:nodoc:
334
-
335
- def initialize(ref)
336
- @ref = ref # Need to know because leap years have an extra day, and to get
337
- # our defaults.
338
- @month = nil
339
- @week = nil
340
- end
341
-
342
- def month=(mon)
343
- @month = { mon => nil }
344
- end
345
-
346
- def week=(week)
347
- @week = week
348
- end
349
-
350
- def mday=(pair)
351
- @month = { pair[0] => [ pair[1] ] }
352
- end
353
-
354
- def intersect_bymon(bymon) #:nodoc:
355
- if !@month
356
- @month = {}
357
- bymon.each do |m|
358
- @month[m] = nil
359
- end
360
- else
361
- @month.delete_if { |m, days| ! bymon.include? m }
362
- end
363
- end
364
-
365
- def intersect_dates(dates) #:nodoc:
366
- if dates
367
- # If no months are in the dayset, add all the ones in dates
368
- if !@month
369
- @month = {}
370
-
371
- dates.each do |d|
372
- @month[d.mon] = nil
373
- end
374
- end
375
-
376
- # In each month,
377
- # if there are days,
378
- # eliminate those not in dates
379
- # otherwise
380
- # add all those in dates
381
- @month.each do |mon, days|
382
- days_in_mon = dates.find_all { |d| d.mon == mon }
383
- days_in_mon = days_in_mon.collect { |d| d.day }
384
-
385
- if days
386
- days_in_mon = days_in_mon & days
387
- end
388
- @month[mon] = days_in_mon
389
- end
390
- end
391
- end
392
-
393
- def each
394
- @month = { @ref.month => [ @ref.mday ] } if !@month
395
- @month.each_key do |m|
396
- @month[m] = [@ref.day] if !@month[m]
397
- # FIXME - if @ref.day is 31, and the month doesn't have 32 days, we'll
398
- # generate invalid dates here, check for that, and eliminate them
399
- end
400
-
401
- @month.keys.sort.each do |m|
402
- @month[m].sort.each do |d|
403
- yield m, d
404
- end
405
- end
406
- end
407
- end
408
-
409
- def self.time_from_rfc2425(str) #:nodoc:
410
- # With ruby1.8 we can use DateTime to do this quick-n-easy:
411
- # dt = DateTime.parse(str)
412
- # Time.local(dt.year, dt.month, dt.day, dt.hour, dt.min, dt.sec, 0)
413
-
414
- # The time can be a DATE or a DATE-TIME, the latter always has a 'T' in it.
415
-
416
- if str =~ /T/
417
- d = Vpim.decode_date_time(str)
418
- # We get [ year, month, day, hour, min, sec, usec, tz ]
419
- if(d.pop == "Z")
420
- t = Time.gm(*d)
421
- else
422
- t = Time.local(*d)
423
- end
424
- else
425
- d = Vpim.decode_date(str)
426
- # We get [ year, month, day ]
427
- # FIXME - I have to choose gm or local, though neither makes much
428
- # sense. This is a bit of a hack - what we should really do is return
429
- # an instance of Date, and Time should allow itself to be compared to
430
- # Date... This hack will give odd results when comparing times, because
431
- # it will create a Time on the right date but whos time is 00:00:00.
432
- t = Time.local(*d)
433
- end
434
- if t.month != d[1] || t.day != d[2] || (d[3] && t.hour != d[3])
435
- raise Vpim::InvalidEncodingError, "Error - datetime does not exist"
436
- end
437
- t
438
- end
439
-
440
- def bymonthday(year, bymday) #:nodoc:
441
- dates = []
442
-
443
- bymday.each do |mday|
444
- dates |= DateGen.bymonthday(year, nil, mday[0].to_i)
445
- end
446
- dates.sort!
447
- dates
448
- end
449
-
450
- def byyearday(year, byyday) #:nodoc:
451
- dates = []
452
-
453
- byyday.each do |yday|
454
- dates << Date.new2(year, yday[0].to_i)
455
- end
456
- dates.sort!
457
- dates
458
- end
459
-
460
- def byday_in_yearly(year, byday) #:nodoc:
461
- byday_in_monthly(year, nil, byday)
462
- end
463
-
464
- def byday_in_monthly(year, mon, byday) #:nodoc:
465
- dates = []
466
-
467
- byday.each do |rule|
468
- if rule[0].empty?
469
- n = nil
470
- else
471
- n = rule[0].to_i
472
- end
473
- dates |= DateGen.bywday(year, mon, Date.str2wday(rule[1]), n)
474
- end
475
- dates.sort!
476
- dates
477
- end
478
-
479
- end
480
-
481
- end
482
-