github
Advanced Search
  • Home
  • Pricing and Signup
  • Explore GitHub
  • Blog
  • Login

msparks / irssiscripts

  • Admin
  • Watch Unwatch
  • Fork
  • Your Fork
  • Pull Request
  • Download Source
    • 4
    • 1
  • Source
  • Commits
  • Network (1)
  • Issues (0)
  • Downloads (0)
  • Wiki (1)
  • Graphs
  • Branch: master

click here to add a description

click here to add a homepage

  • Branches (1)
    • master ✓
  • Tags (0)
Sending Request…
Enable Donations

Pledgie Donations

Once activated, we'll place the following badge in your repository's detail box:
Pledgie_example
This service is courtesy of Pledgie.

Scripts for the Irssi IRC client — Read more

  cancel

http://quadpoint.org/projects/irssiscripts

  cancel
  • Private
  • Read-Only
  • HTTP Read-Only

This URL has Read+Write access

bumping version and change date 
msparks (author)
Mon Feb 08 17:18:16 -0800 2010
commit  07f77deb13165e61efaa1488422f1e73a447b281
tree    b9da7850542c5d30624c1049f2834183213f37f0
parent  51c4411f9120009d8b38ad57c39262306461ff93
irssiscripts / rtm.pl rtm.pl
100644 126 lines (109 sloc) 2.918 kb
edit raw blame history
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
# rtm.pl - add new tasks to rememberthemilk.com
#
# Install:
# 1) /script load rtm
# 2) /set rtm_email <your remember the milk email address>
# 3) /save
#
# Usage:
# /rtm <task> <options>
#
# where:
# <task> task name, e.g. "do laundry"
# <options> a string formatted like: [D: tomorrow E: 3 hours]
#
# possible options (case insensitive):
# D: due
# E: time estimate
# L: list
# O: location
# P: priority
# R: repeat
# S: tags (comma separated)
# U: url
#
# Examples:
# Do the dishes for an hour, priority 2.
# /rtm do dishes [E: 1 hour P: 2]
#
# Do homework, due tomorrow.
# /rtm homework [D: tomorrow]
#
# See also:
# http://www.rememberthemilk.com/help/answers/sending/emailinbox.rtm
use strict;
use Irssi;
 
use vars qw($VERSION %IRSSI);
 
$VERSION = '1.0';
%IRSSI = (
  authors => 'Matt "f0rked" Sparks',
  contact => 'ms+irssi@quadpoint.org',
  name => 'rtm',
  description => 'Add new tasks to rememberthemilk.com',
  license => 'BSD',
  url => 'http://quadpoint.org',
  changed => '2007-09-08',
);
 
 
sub rtm_print
{
  my($text) = @_;
  my $window = Irssi::active_win();
  my $b = chr(2);
  $window->print("[${b}rtm${b}] $text", MSGLEVEL_CRAP);
}
 
 
sub add_task
{
  my($email, $text, $options_str) = @_;
  my %opt_list = (priority => "p",
                  due => "d",
                  repeat => "r",
                  estimate => "e",
                  tags => "s",
                  location => "o",
                  url => "u",
                  list => "l");
 
  # parse out options
  my %options;
 
  my $key = "";
  for my $word (split / /, $options_str) {
    if ($word =~ /:$/) {
      $word =~ s/:$//;
      if (grep /^\Q$word\E$/i, keys(%opt_list)) {
        $key = $opt_list{$word};
      } elsif (grep /^\Q$word\E$/i, values(%opt_list)) {
        $key = $word;
      }
      next;
    }
    $options{$key} .= "$word " if $key ne "";
  }
 
  open SM, qq(| mail -s "$text" $email);
  for my $key (keys %options) {
    printf SM "%s: %s\n", $key, substr($options{$key}, 0, -1);
  }
  print SM "\n\n";
  close SM;
}
 
 
sub cmd_rtm
{
  my($data, $server, $witem) = @_;
  my $email_addr = Irssi::settings_get_str("rtm_email");
  if (!$email_addr) {
    rtm_print("your rememberthemilk.com email address is not set. ".
              "Use /set rtm_email <email address> to set it. Don't forget ".
              "to /save.");
    return;
  }
 
  # task options are specified in [ ] at the end of the data
  my($options) = $data =~ / \[\s*(.+?)\s*\]\s*$/;
  $data =~ s/ \[(.+?)\]\s*$//;
  $data =~ s/^\s*(.+?)\s*$/$1/;
 
  add_task($email_addr, $data, $options);
 
  if ($options) {
    rtm_print("$data [$options]");
  } else {
    rtm_print($data);
  }
}
 
 
Irssi::command_bind("rtm", "cmd_rtm");
Irssi::settings_add_str("rtm", "rtm_email", "");
 
Blog | Support | Training | Contact | API | Status | Twitter | Help | Security
© 2010 GitHub Inc. All rights reserved. | Terms of Service | Privacy Policy
Powered by the Dedicated Servers and
Cloud Computing of Rackspace Hosting®
Dedicated Server