xotcl.wu-wien.ac.at
Begin main content
Methods: Source: Variables:
[All Methods | Documented Methods | Hide Methods] [Display Source | Hide Source] [Show Variables | Hide Variables]

::xotcl::Object[i] ::xo::ical

The Object ::calendar::ical provides the methods for importing and exporting single or multiple calendar items in the ical format (see rfc 2445). Currently only the part of ical is implemented, which is used by the mozilla calendar (Sunbird, or Lightning for Thunderbird).
Author:
Gustaf Neumann
Defined in packages/xotcl-core/tcl/ical-procs.tcl

::xotcl::Object create ::xo::ical

Methods

  • proc clock_to_iso

    ::622873 proc clock_to_iso seconds {
        clock format $seconds -format "%Y-%m-%dT%H:%M:%SZ" -gmt 1
      }
    
  • proc clock_to_local_day

    ::622873 proc clock_to_local_day seconds {
        clock format $seconds -format "%Y%m%d"
      }
    
  • proc clock_to_oacstime

    ::622873 proc clock_to_oacstime seconds {
        clock format $seconds -format "%Y-%m-%d %H:%M" 
      }
    
  • proc clock_to_utc

    ::622873 proc clock_to_utc seconds {
        clock format $seconds -format "%Y%m%dT%H%M%SZ" -gmt 1
      }
    
  • proc date_time_to_clock

    ::622873 proc date_time_to_clock {date time utc} {
        set year  [string range $date 0 3]
        set month [string range $date 4 5]
        set day   [string range $date 6 7]
        set hour  [string range $time 0 1]
        set min   [string range $time 2 3]
        set sec   [string range $time 4 5]
        set TZ [expr {$utc ? "GMT" : ""}]
        return [clock scan "$year-$month-$day $hour:$min $TZ"]
      }
    
  • proc dates_valid_p (public)

    ::xo::ical[i] dates_valid_p -start_date start_date  -end_date end_date 
    A sanity check that the start time is before the end time. This is a rewrite of calendar::item::dates_valid_p, but about 100 times faster.

    Switches:
    -start_date (required)
    -end_date (required)
    ::622873 proc dates_valid_p {-start_date:required -end_date:required} {
        #my log "$start_date <= $end_date = [expr {[clock scan $start_date] <= [clock scan $end_date]}]"
        expr {[clock scan $start_date] <= [clock scan $end_date]}
      }
    
  • proc ical_to_text (public)

    ::xo::ical[i] ical_to_text text
    Transform the escaped ical text format to plain text

    Parameters:
    text
    ::622873 proc ical_to_text text {
        regsub -all {\\(n|N)} $text \n text
        regsub -all {\\(\\|\;|\,)} $text {\1} text
        return $text
      }
    
  • proc tcl_time_to_local_day

    ::622873 proc tcl_time_to_local_day time {
        VALUE=DATE:[my clock_to_local_day [clock scan $time]]
      }
    
  • proc tcl_time_to_utc

    ::622873 proc tcl_time_to_utc time {
        clock format [clock scan $time] -format "%Y%m%dT%H%M%SZ" -gmt 1
      }
    
  • proc text_to_ical (public)

    ::xo::ical[i] text_to_ical [ -remove_tags remove_tags ] text
    Transform arbitrary text to the escaped ical text format (see rfc 2445)

    Switches:
    -remove_tags (defaults to "false") (optional)
    Parameters:
    text
    ::622873 proc text_to_ical {{-remove_tags false} text} {
        if {$remove_tags} {regsub -all {<[^>]+>} $text "" text}
        regsub -all \n $text \\n text
        regsub -all {(\\|\;|\,)} $text {\\\1} text
        return $text
      }
    
  • proc utc_to_clock

    ::622873 proc utc_to_clock utc_time {
        clock scan $utc_time -format "%Y%m%dT%H%M%SZ" -gmt 1
      }
    

Methods: Source: Variables:
[All Methods | Documented Methods | Hide Methods] [Display Source | Hide Source] [Show Variables | Hide Variables]