Advertisement
Guest User

Untitled

a guest
Jun 2nd, 2018
207
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.19 KB | None | 0 0
  1. #
  2. # Copyright (c) 2006-2008 by FlashCode <flashcode@flashtux.org>
  3. #
  4. # This program is free software; you can redistribute it and/or modify
  5. # it under the terms of the GNU General Public License as published by
  6. # the Free Software Foundation; either version 3 of the License, or
  7. # (at your option) any later version.
  8. #
  9. # This program is distributed in the hope that it will be useful,
  10. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. # GNU General Public License for more details.
  13. #
  14. # You should have received a copy of the GNU General Public License
  15. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  16. #
  17.  
  18. #
  19. # Speaker beep on highlight/private msg.
  20. #
  21. # History:
  22. # 2009-05-02, FlashCode <flashcode@flashtux.org>:
  23. # version 0.4: sync with last API changes
  24. # 2008-11-05, FlashCode <flashcode@flashtux.org>:
  25. # version 0.3: conversion to WeeChat 0.3.0+
  26. # 2007-08-10, FlashCode <flashcode@flashtux.org>:
  27. # version 0.2: upgraded licence to GPL 3
  28. # 2006-09-02, FlashCode <flashcode@flashtux.org>:
  29. # version 0.1: initial release
  30. #
  31.  
  32. use strict;
  33.  
  34. my $version = "0.4";
  35. my $beep_command = "(play -q /usr/share/sounds/speech-dispatcher/test.wav) &";
  36.  
  37. # default values in setup file (~/.weechat/plugins.conf)
  38. my $default_beep_highlight = "on";
  39. my $default_beep_pv = "on";
  40.  
  41. weechat::register("beep", "FlashCode <flashcode\@flashtux.org>", $version,
  42. "GPL3", "Speaker beep on highlight/private message", "", "");
  43. weechat::config_set_plugin("beep_highlight", $default_beep_highlight) if (weechat::config_get_plugin("beep_highlight") eq "");
  44. weechat::config_set_plugin("beep_pv", $default_beep_pv) if (weechat::config_get_plugin("beep_pv") eq "");
  45.  
  46. weechat::hook_signal("weechat_highlight", "highlight", "");
  47. weechat::hook_signal("irc_pv", "pv", "");
  48.  
  49. sub highlight
  50. {
  51. my $beep = weechat::config_get_plugin("beep_highlight");
  52. system($beep_command) if ($beep eq "on");
  53. return weechat::WEECHAT_RC_OK;
  54. }
  55.  
  56. sub pv
  57. {
  58. my $beep = weechat::config_get_plugin("beep_pv");
  59. system($beep_command) if ($beep eq "on");
  60. return weechat::WEECHAT_RC_OK;
  61. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement