Skip to content

Instantly share code, notes, and snippets.

@jvolkman
Created February 3, 2011 13:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jvolkman/809479 to your computer and use it in GitHub Desktop.
Save jvolkman/809479 to your computer and use it in GitHub Desktop.
Adds private message support to chanmon.pl
--- chanmon.pl.orig 2011-02-02 23:00:19.000000000 -0500
+++ chanmon.pl 2011-02-02 23:00:22.000000000 -0500
@@ -544,6 +544,11 @@
weechat::config_set_plugin("nick_suffix", "");
}
}
+
+ if (!(weechat::config_is_set_plugin("private")))
+ {
+ weechat::config_set_plugin("private", "off");
+ }
}
# Get config updates
@@ -658,9 +663,9 @@
# Only work on messages and topic notices
if ($cb_tags =~ /irc_privmsg/ || $cb_tags =~ /irc_topic/)
{
- # Check buffer name is an IRC channel
+ # Check buffer name is an IRC channel or a private message
$bufname = weechat::buffer_get_string($cb_bufferp, 'name');
- if ($bufname =~ /(.*)\.([#&\+!])(.*)/)
+ if ($bufname =~ /(.*)\.([#&\+!])(.*)/ || (weechat::config_get_plugin("private") eq "on" && $cb_tags =~ /notify_private/))
{
# Are we running on this channel
if (weechat::config_get_plugin($bufname) ne "off" && $cb_disp eq "1")
@@ -725,9 +730,9 @@
# Special outgoing ACTION & away_info catcher
elsif ($cb_tags eq "" || $cb_tags =~ /away_info/ && weechat::config_get_plugin("show_aways") eq "on" )
{
- # Check buffer name is an IRC channel
+ # Check buffer name is an IRC channel or a private message
$bufname = weechat::buffer_get_string($cb_bufferp, 'name');
- if ($bufname =~ /(.*)\.([#&\+!])(.*)/)
+ if ($bufname =~ /(.*)\.([#&\+!])(.*)/ || (weechat::config_get_plugin("private") eq "on" && $cb_tags =~ /notify_private/))
{
# Are we running dynamically
if (weechat::config_get_plugin("dynamic") eq "on")
@jvolkman
Copy link
Author

jvolkman commented Feb 3, 2011

In case it's not obvious, you need to set plugins.var.perl.chanmon.private = "on" for it to work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment