More robust regex
Anirudh Oppiliappan x@icyphox.sh
Thu, 17 Sep 2020 10:23:45 +0530
2 files changed,
43 insertions(+),
56 deletions(-)
M
weechat/gt.py
→
weechat/gt.py
@@ -1,4 +1,4 @@
-import weechat +import weechat, re # modifies the string about to be sent to the IRC server # thus, not interfering with non-IRC buffer text like wee-slack@@ -7,10 +7,6 @@ "gt.py", "icyphox", "1.0", "MIT", "greentexting like the hacker called 4chan", "", ""
) def greentext_cb(data, modifier, modifier_data, string): - parts = string.split(':') - if parts[1].startswith(">"): - parts[1] = ":" + parts[1].replace(">", "\x033" + ">") - return "".join(parts) - return string + return re.sub(r">(?! )", "\x033>", string) weechat.hook_modifier("irc_out1_privmsg", "greentext_cb", "")
M
weechat/weechat.conf
→
weechat/weechat.conf
@@ -390,56 +390,47 @@ title.type = window
[layout] default.buffer = "core;weechat;1" -default.buffer = "fset;fset;2" -default.buffer = "irc;server.freenode;3" -default.buffer = "irc;freenode.##crustaceans;4" -default.buffer = "irc;freenode.#kisslinux;5" -default.buffer = "irc;freenode.#lobsters;6" -default.buffer = "irc;freenode.#merveilles;7" -default.buffer = "irc;freenode.#openbsd;8" -default.buffer = "irc;freenode.#radare;9" -default.buffer = "irc;freenode.DarkHacker_656;10" -default.buffer = "irc;server.rizon;11" -default.buffer = "irc;rizon.#buddy;12" -default.buffer = "irc;rizon.#crimson;13" -default.buffer = "irc;rizon.#homescreen;14" -default.buffer = "irc;rizon.#rice;15" -default.buffer = "python;makera-org.slack.com;16" -default.buffer = "python;makera-org.slack.com.#bugs;17" -default.buffer = "python;makera-org.slack.com.#celebrations;18" -default.buffer = "python;makera-org.slack.com.#design;19" -default.buffer = "python;makera-org.slack.com.#dev;20" -default.buffer = "python;makera-org.slack.com.#general;21" -default.buffer = "python;makera-org.slack.com.#innerjourney;22" -default.buffer = "python;makera-org.slack.com.#legal;23" -default.buffer = "python;makera-org.slack.com.#makera;24" -default.buffer = "python;makera-org.slack.com.#makera.653;25" -default.buffer = "python;makera-org.slack.com.#random;26" -default.buffer = "python;makera-org.slack.com.#ycombinator;27" -default.buffer = "python;makera-org.slack.com.Abhishek;28" -default.buffer = "python;makera-org.slack.com.Anirudh;29" -default.buffer = "python;makera-org.slack.com.Dish;30" -default.buffer = "python;makera-org.slack.com.GitHub;31" -default.buffer = "python;makera-org.slack.com.Kavya;32" -default.buffer = "python;makera-org.slack.com.Vishesh;33" -default.buffer = "python;teamcometchat.slack.com;34" -default.buffer = "python;teamcometchat.slack.com.&breakouts-pro;35" -default.buffer = "python;teamcometchat.slack.com.&hipaa;36" -default.buffer = "python;teamcometchat.slack.com.&interns-pro;37" -default.buffer = "python;teamcometchat.slack.com.&xmpp-pro;38" -default.buffer = "python;teamcometchat.slack.com.AjayGajra,Bosky,KetanYekale,RaviRanjan;39" -default.buffer = "python;teamcometchat.slack.com.#general;40" -default.buffer = "python;teamcometchat.slack.com.PrathameshMajgaonkar,RaviRanjan;41" -default.buffer = "python;teamcometchat.slack.com.#product-releases;42" -default.buffer = "python;teamcometchat.slack.com.#random;43" -default.buffer = "python;teamcometchat.slack.com.#spotlight;44" -default.buffer = "python;teamcometchat.slack.com.AjayGajra;45" -default.buffer = "python;teamcometchat.slack.com.AjayPrabhakar;46" -default.buffer = "python;teamcometchat.slack.com.Bosky;47" -default.buffer = "python;teamcometchat.slack.com.donut;48" -default.buffer = "python;teamcometchat.slack.com.KetanYekale;49" -default.buffer = "python;teamcometchat.slack.com.PrathameshMajgaonkar;50" -default.buffer = "python;teamcometchat.slack.com.RaviRanjan;51" +default.buffer = "irc;server.rizon;2" +default.buffer = "irc;rizon.#buddy;3" +default.buffer = "irc;rizon.#bullshit;4" +default.buffer = "irc;rizon.#crimson;5" +default.buffer = "irc;rizon.#homescreen;6" +default.buffer = "irc;rizon.#rice;7" +default.buffer = "python;makera-org.slack.com;8" +default.buffer = "python;makera-org.slack.com.#bugs;9" +default.buffer = "python;makera-org.slack.com.#celebrations;10" +default.buffer = "python;makera-org.slack.com.#design;11" +default.buffer = "python;makera-org.slack.com.#dev;12" +default.buffer = "python;makera-org.slack.com.#general;13" +default.buffer = "python;makera-org.slack.com.#innerjourney;14" +default.buffer = "python;makera-org.slack.com.#legal;15" +default.buffer = "python;makera-org.slack.com.#makera;16" +default.buffer = "python;makera-org.slack.com.#random;17" +default.buffer = "python;makera-org.slack.com.#ycombinator;18" +default.buffer = "python;makera-org.slack.com.Abhishek;19" +default.buffer = "python;makera-org.slack.com.Anirudh;20" +default.buffer = "python;makera-org.slack.com.Dish;21" +default.buffer = "python;makera-org.slack.com.GitHub;22" +default.buffer = "python;makera-org.slack.com.Kavya;23" +default.buffer = "python;makera-org.slack.com.Vishesh;24" +default.buffer = "python;teamcometchat.slack.com;25" +default.buffer = "python;teamcometchat.slack.com.&breakouts-pro;26" +default.buffer = "python;teamcometchat.slack.com.&hipaa;27" +default.buffer = "python;teamcometchat.slack.com.&interns-pro;28" +default.buffer = "python;teamcometchat.slack.com.&xmpp-pro;29" +default.buffer = "python;teamcometchat.slack.com.AjayGajra,Bosky,KetanYekale,RaviRanjan;30" +default.buffer = "python;teamcometchat.slack.com.#general;31" +default.buffer = "python;teamcometchat.slack.com.PrathameshMajgaonkar,RaviRanjan;32" +default.buffer = "python;teamcometchat.slack.com.#product-releases;33" +default.buffer = "python;teamcometchat.slack.com.#random;34" +default.buffer = "python;teamcometchat.slack.com.#spotlight;35" +default.buffer = "python;teamcometchat.slack.com.AjayGajra;36" +default.buffer = "python;teamcometchat.slack.com.AjayPrabhakar;37" +default.buffer = "python;teamcometchat.slack.com.Bosky;38" +default.buffer = "python;teamcometchat.slack.com.donut;39" +default.buffer = "python;teamcometchat.slack.com.KetanYekale;40" +default.buffer = "python;teamcometchat.slack.com.PrathameshMajgaonkar;41" +default.buffer = "python;teamcometchat.slack.com.RaviRanjan;42" default.window = "1;0;0;0;irc;rizon.Carp" default.current = on _zoom.window = "1;0;0;0;irc;freenode.##crustaceans"