summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Pointner <equinox@spreadspace.org>2016-06-03 00:06:13 +0200
committerChristian Pointner <equinox@spreadspace.org>2016-06-03 00:06:13 +0200
commitfd47b7802d6def4570ce5b4860415533a6f65df4 (patch)
tree2004956002dea8f6bd37d72867a8fb6ee2fbd9ca
parentadded config option for blinky device name (diff)
added callback for messages
-rw-r--r--plugin/blinkyfications.pl15
1 files changed, 14 insertions, 1 deletions
diff --git a/plugin/blinkyfications.pl b/plugin/blinkyfications.pl
index 6736e87..a4fd2a5 100644
--- a/plugin/blinkyfications.pl
+++ b/plugin/blinkyfications.pl
@@ -39,9 +39,16 @@ sub plugin_init {
sub plugin_load {
my $plugin = shift;
+
+ # Prefrences
Purple::Debug::info("blinkyfications", "make notifications blink again!\n");
Purple::Prefs::add_none("/plugins/core/blinkyfications");
Purple::Prefs::add_string("/plugins/core/blinkyfications/device", "/dev/ttyACM0");
+
+ # Signals/Callbacks
+ my $conv_handle = Purple::Conversations::get_handle();
+ 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 {
@@ -54,8 +61,14 @@ sub prefs_info_cb {
$ppref = Purple::PluginPref->new_with_name_and_label("/plugins/core/blinkyfications/device", "Blinky-Device");
$ppref->set_type(2);
- $ppref->set_max_length(32);
+ $ppref->set_max_length(256);
$frame->add($ppref);
return $frame;
}
+
+sub received_msg_cb {
+ my ($account, $sender, $message, $conv, $flags, $type) = @_;
+ Purple::Debug::misc("blinkyfications", "$data (" . $account->get_username() . ", $sender, $message, $flags)\n");
+ return 0
+}