summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Pointner <equinox@spreadspace.org>2016-06-03 23:28:57 +0200
committerChristian Pointner <equinox@spreadspace.org>2016-06-03 23:28:57 +0200
commitef846df2ca53a4832638f2fe280adb2837ed16f5 (patch)
tree49584025f2c4e8d5a72b6e7bb7ea763aeb663d4d
parentadded color blinks, removed all printf's (diff)
first simple version works now
-rw-r--r--plugin/blinkyfications.pl26
1 files changed, 10 insertions, 16 deletions
diff --git a/plugin/blinkyfications.pl b/plugin/blinkyfications.pl
index aa068d3..d5d14c4 100644
--- a/plugin/blinkyfications.pl
+++ b/plugin/blinkyfications.pl
@@ -47,8 +47,8 @@ sub plugin_load {
# Signals/Callbacks
my $conv_handle = Purple::Conversations::get_handle();
- Purple::Signal::connect($conv_handle, "received-im-msg", $plugin, \&received_msg_cb, $plugin);
-# Purple::Signal::connect($conv_handle, "received-chat-msg", $plugin, \&received_msg_cb, $plugin);
+ Purple::Signal::connect($conv_handle, "received-im-msg", $plugin, \&received_msg_cb, "im");
+ Purple::Signal::connect($conv_handle, "received-chat-msg", $plugin, \&received_msg_cb, "chat");
}
sub plugin_unload {
@@ -68,23 +68,17 @@ sub prefs_info_cb {
}
sub received_msg_cb {
- my ($account, $sender, $message, $conv, $flags, $plugin) = @_;
- Purple::Debug::misc("blinkyfications", $account->get_username() . ": $sender says '$message'\n");
+ my ($account, $sender, $message, $conv, $flags, $type) = @_;
+# Purple::Debug::misc("blinkyfications", $account->get_username() . ": $sender says '$message'\n");
my $device = Purple::Prefs::get_string("/plugins/core/blinkyfications/device");
open(my $fh, '>', $device) or return Purple::Debug::error("blinkyfications", "can't open device: " . $device .": " . $! . "\n");
- print $fh "r";
- close $fh;
- Purple::timeout_add($plugin, 0.3, \&timeout_cb, $plugin);
- return 0;
-}
-
-sub timeout_cb {
- my $plugin = shift;
-
- my $device = Purple::Prefs::get_string("/plugins/core/blinkyfications/device");
- open(my $fh, '>', $device) or return Purple::Debug::error("blinkyfications", "can't open device: " . $device .": " . $! . "\n");
- print $fh "0";
+ if($type eq "im") {
+ print $fh ".";
+ } else {
+ print $fh "R";
+ }
close $fh;
+ return 0;
}