]> git.rmz.io Git - dotfiles.git/blobdiff - weechat/perl/highmon.pl
lazyvim: absorb icons into rmz.util.ui
[dotfiles.git] / weechat / perl / highmon.pl
index 1c0771250afef3cb39685b3959f5ae39cc7c3223..f843cade98fb108aa2eb4e6dc200d36a85433c27 100644 (file)
@@ -1,6 +1,5 @@
 #
 # highmon.pl - Highlight Monitoring for weechat 0.3.0
-# Version 2.5
 #
 # Add 'Highlight Monitor' buffer/bar to log all highlights in one spot
 #
 # Bugs and feature requests at: https://github.com/KenjiE20/highmon
 
 # History:
+# 2020-06-21, Sebastien Helleu <flashcode@flashtux.org>:
+#      v2.7: make call to bar_new compatible with WeeChat >= 2.9
+# 2019-05-13, HubbeKing <hubbe128@gmail.com>
+#      v2.6:   -add: send "logger_backlog" signal on buffer open if logging is enabled
 # 2014-08-16, KenjiE20 <longbow@longbowslair.co.uk>:
 #      v2.5:   -add: clearbar command to clear bar output
 #                      -add: firstrun output prompt to check the help text for set up hints as they were being missed
@@ -264,7 +267,14 @@ sub highmon_bar_open
        # Make the bar item
        weechat::bar_item_new("highmon", "highmon_bar_build", "");
 
-       $highmon_bar = weechat::bar_new ("highmon", "off", 100, "root", "", "bottom", "vertical", "vertical", 0, 0, "default", "cyan", "default", "on", "highmon");
+        if (weechat::info_get("version_number", "") >= 0x02090000)
+        {
+            $highmon_bar = weechat::bar_new ("highmon", "off", 100, "root", "", "bottom", "vertical", "vertical", 0, 0, "default", "cyan", "default", "default", "on", "highmon");
+        }
+        else
+        {
+            $highmon_bar = weechat::bar_new ("highmon", "off", 100, "root", "", "bottom", "vertical", "vertical", 0, 0, "default", "cyan", "default", "on", "highmon");
+        }
 
        return weechat::WEECHAT_RC_OK;
 }
@@ -306,7 +316,7 @@ sub highmon_buffer_open
        # Turn off notify, highlights
        if ($highmon_buffer ne "")
        {
-               if (weechat::config_get_plugin("hotlist_show" eq "off"))
+               if (weechat::config_get_plugin("hotlist_show") eq "off")
                {
                        weechat::buffer_set($highmon_buffer, "notify", "0");
                }
@@ -317,6 +327,11 @@ sub highmon_buffer_open
                {
                        weechat::buffer_set($highmon_buffer, "localvar_set_no_log", "1");
                }
+               # send "logger_backlog" signal if logging is enabled to display backlog
+               if (weechat::config_get_plugin("logging") eq "on")
+               {
+                       weechat::hook_signal_send("logger_backlog", weechat::WEECHAT_HOOK_SIGNAL_POINTER, $highmon_buffer)
+               }
        }
        return weechat::WEECHAT_RC_OK;
 }
@@ -710,7 +725,7 @@ sub highmon_new_message
        if ($cb_high == "1" || (weechat::config_get_plugin("merge_private") eq "on" && $cb_tags =~ /notify_private/))
        {
                # Pre bug #29618 (0.3.3) away detect
-               if (weechat::info_get("version_number", "") <= 197120)
+               if (weechat::info_get("version_number", "") <= 0x00030200)
                {
                        $away = '';
                        # Get infolist for this server
@@ -1124,7 +1139,7 @@ sub format_buffer_name
 }
 
 # Check result of register, and attempt to behave in a sane manner
-if (!weechat::register("highmon", "KenjiE20", "2.5", "GPL3", "Highlight Monitor", "", ""))
+if (!weechat::register("highmon", "KenjiE20", "2.7", "GPL3", "Highlight Monitor", "", ""))
 {
        # Double load
        weechat::print ("", "\tHighmon is already loaded");