about summary refs log tree commit diff
path: root/weechat/.weechat/python/topicdiff_alt.py
diff options
context:
space:
mode:
authorBen Harris <ben@tilde.team>2019-05-29 13:39:18 -0400
committerBen Harris <ben@tilde.team>2019-05-29 13:39:18 -0400
commit08a6fa8739440966a06f18b4f060c1abcb05f045 (patch)
tree702fb80d6e9dd8edc43d79cabe2f0eea2b7bd821 /weechat/.weechat/python/topicdiff_alt.py
parentfa2beb76767d124d4f1ef59c0d86b78005402371 (diff)
new aliases and upgraded scripts
Diffstat (limited to 'weechat/.weechat/python/topicdiff_alt.py')
-rw-r--r--weechat/.weechat/python/topicdiff_alt.py70
1 files changed, 0 insertions, 70 deletions
diff --git a/weechat/.weechat/python/topicdiff_alt.py b/weechat/.weechat/python/topicdiff_alt.py
deleted file mode 100644
index c76fa22..0000000
--- a/weechat/.weechat/python/topicdiff_alt.py
+++ /dev/null
@@ -1,70 +0,0 @@
-import weechat
-import diff_match_patch
-import re
-
-weechat.register('topicdiff_alt', 'Juerd <#####@juerd.nl>', '1.01', 'PD', "Announce topic with changes highlighted", '', '')
-
-def topic(data, tags, msg):
-    server = tags.split(",")[0]
-
-    match = re.search(r':(\S+)\s+TOPIC\s+(\S+)\s+:(.*)', msg)
-
-    if not match:
-        return weechat.WEECHAT_RC_ERROR
-
-    usermask, channel, newtopic = match.groups()
-    nick, host = usermask.split("!", 1)
-
-    buffer = weechat.buffer_search("irc", server + "." + channel)
-    weechat.prnt("", server + "." + channel)
-
-    if not buffer:
-        return weechat.WEECHAT_RC_ERROR
-
-    oldtopic = weechat.buffer_get_string(buffer, "title")
-    if oldtopic == None:
-        oldtopic = ""
-
-    dmp = diff_match_patch.diff_match_patch()
-    diff = dmp.diff_main(oldtopic, newtopic)
-    dmp.diff_cleanupEfficiency(diff)
-
-    topic = ""
-
-    color_reset = weechat.color("reset")
-    color_ins = weechat.color(weechat.config_get_plugin("color_ins"))
-    color_del = weechat.color(weechat.config_get_plugin("color_del"))
-
-    for chunk in diff:
-        changed, text = chunk
-
-        topic += "%s%s%s" % (
-            # 0 (unchanged), 1 (added), -1 (removed)
-            ["", color_ins, color_del][changed],
-            text,
-            ["", color_reset, color_reset][changed]
-        )
-
-    weechat.prnt_date_tags(buffer, 0, "irc_topicdiff",
-        "%s%s%s%s has changed topic for %s%s%s: %s" % (
-        weechat.prefix("network"),
-        weechat.color(weechat.info_get("irc_nick_color", nick)) \
-            if weechat.config_boolean("irc.look.color_nicks_in_server_messages") \
-            else weechat.color("chat_nick"),
-        nick,
-        color_reset,
-        weechat.color("chat_channel"),
-        channel,
-        color_reset,
-        topic
-    ))
-
-    return weechat.WEECHAT_RC_OK
-
-weechat.hook_signal("*,irc_in_topic", "topic", "")
-
-if not weechat.config_is_set_plugin("color_ins"):
-    weechat.config_set_plugin("color_ins", "lightcyan")
-
-if not weechat.config_is_set_plugin("color_del"):
-    weechat.config_set_plugin("color_del", "darkgray")