Skip to content

Commit 8f14f9d

Browse files
committed
Fixed for relay-usage
Replaced WeeChat's hook_command_run with a hook_modifier against outgoing PRIVMSGs to alter relay messages.
1 parent 01d7360 commit 8f14f9d

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

weechataboo.scm

+7-10
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
; WeeChat-Script to replace emotion-tags with random emoticons.
2-
; Copyright (C) 2017 Alvar <[email protected]>
2+
; Copyright (C) 2017-2018 Alvar <[email protected]>
33
;
44
; This program is free software: you can redistribute it and/or modify
55
; it under the terms of the GNU General Public License as published by
@@ -53,15 +53,11 @@
5353
(emoticonize-line new-line)
5454
new-line)))
5555

56-
; Pointer String String -> Weechat-Return
56+
; Pointer ? ? String -> String
5757
; This function was registered to be called when an input was submitted and
5858
; will try to replace ~~EMOTIONs to emoticons.
59-
(define (command-run data buffer command)
60-
(let*
61-
((input (weechat:buffer_get_string buffer "input"))
62-
(output (emoticonize-line input)))
63-
(weechat:buffer_set buffer "input" output))
64-
weechat:WEECHAT_RC_OK)
59+
(define (weechataboo-hook data modifier modifier-data msg)
60+
(emoticonize-line msg))
6561

6662
; Pointer String List -> Weechat-Return
6763
; Function which tells you to RTFM.
@@ -115,13 +111,14 @@
115111

116112

117113
(weechat:register
118-
"weechataboo" "Alvar" "0.1.1" "GPL3"
114+
"weechataboo" "Alvar" "0.1.2" "GPL3"
119115
"Replace emotion-tags with random emoticons" "clean-up" "")
120116

121117
(and (eq? (weechat:config_is_set_plugin "emotions") 0)
122118
(initial-setup))
123119

124-
(weechat:hook_command_run "/input return" "command-run" "")
120+
(weechat:hook_modifier "irc_out1_privmsg" "weechataboo-hook" "")
121+
125122
(weechat:hook_command
126123
"weechataboo"
127124
(string-append "This script automatically replaces written emotion-keywords\n"

0 commit comments

Comments
 (0)