Created
November 2, 2010 11:26
-
-
Save ha1t/659503 to your computer and use it in GitHub Desktop.
weechat plugin:all.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# weechat plugin | |
# | |
def weechat_init | |
Weechat.register( | |
'all', | |
'halt', | |
'0.3', | |
'GPL3', | |
'All messages are displayed in one buffer', | |
'', | |
'' | |
) | |
buffer = Weechat.buffer_new("all", "all_input_cb", "", "all_close_cb", "") | |
Weechat.hook_print("", "", "", 1, "all_forward_message", "") | |
return Weechat::WEECHAT_RC_OK | |
end | |
def all_forward_message(data, from_buffer, time, tags, displayed, highlight, prefix, message) | |
buffer = Weechat.buffer_search("ruby", "all") | |
if buffer == from_buffer | |
return Weechat::WEECHAT_RC_OK | |
end | |
if prefix == '' | |
return Weechat::WEECHAT_RC_OK | |
end | |
buffer_number = Weechat.buffer_get_integer(from_buffer, "number").to_s | |
buffer_name = Weechat.buffer_get_string(from_buffer, "short_name").sub(/@.+$/, '') | |
Weechat.print( | |
buffer, | |
"[#{buffer_number}]#{buffer_name}|" + prefix + ": " + message | |
) | |
return Weechat::WEECHAT_RC_OK | |
end | |
def all_input_cb(data, buffer, input_data) | |
Weechat.print(buffer, input_data) | |
return Weechat::WEECHAT_RC_OK | |
end | |
def all_close_cb(data, buffer) | |
return Weechat::WEECHAT_RC_OK | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment