release-1.10release-1.4release-1.5release-1.6release-1.7release-1.8release-1.9
Last change
on this file since ffc4df6 was
5b483a6,
checked in by Nelson Elhage <nelhage@mit.edu>, 15 years ago
|
Add minimal completion for 'aimwrite'.
|
-
Property mode set to
100644
|
File size:
630 bytes
|
Line | |
---|
1 | use strict; |
---|
2 | use warnings; |
---|
3 | |
---|
4 | package BarnOwl::Complete::AIM; |
---|
5 | |
---|
6 | our %users; |
---|
7 | |
---|
8 | sub complete_user { keys %users } |
---|
9 | |
---|
10 | sub canonicalize_aim { |
---|
11 | my $who = shift; |
---|
12 | $who =~ s{ }{}g; |
---|
13 | return lc $who; |
---|
14 | } |
---|
15 | |
---|
16 | sub complete_aimwrite { |
---|
17 | my $ctx = shift; |
---|
18 | return unless $ctx->word == 1; |
---|
19 | return complete_user(); |
---|
20 | } |
---|
21 | |
---|
22 | sub on_message { |
---|
23 | my $m = shift; |
---|
24 | return unless $m->type eq 'AIM'; |
---|
25 | $users{canonicalize_aim($m->sender)} = 1; |
---|
26 | $users{canonicalize_aim($m->recipient)} = 1; |
---|
27 | } |
---|
28 | |
---|
29 | BarnOwl::Completion::register_completer(aimwrite => \&complete_aimwrite); |
---|
30 | |
---|
31 | $BarnOwl::Hooks::newMessage->add("BarnOwl::Complete::AIM::on_message"); |
---|
32 | |
---|
33 | |
---|
34 | 1; |
---|
Note: See
TracBrowser
for help on using the repository browser.