about summary refs log tree commit diff
path: root/weechat
diff options
context:
space:
mode:
authorBen Harris <ben@tilde.team>2021-01-15 14:15:52 -0500
committerBen Harris <ben@tilde.team>2021-01-15 14:15:52 -0500
commit9cd6bc92ba600173fa9f5db4c8eb7509e8af4777 (patch)
tree2f21d4434fdfd1c4fed7be418adba993ae62fd51 /weechat
parent67829c71a49ba2fd07555c8244347fa97b4832ad (diff)
switch to autojoinem.py
Diffstat (limited to 'weechat')
-rw-r--r--weechat/.weechat/irc.conf30
-rw-r--r--weechat/.weechat/logger.conf1
-rw-r--r--weechat/.weechat/plugins.conf10
-rw-r--r--weechat/.weechat/python/wee_slack.py134
-rw-r--r--weechat/.weechat/spell.conf2
-rw-r--r--weechat/.weechat/trigger.conf40
-rw-r--r--weechat/.weechat/weechat.conf2
7 files changed, 114 insertions, 105 deletions
diff --git a/weechat/.weechat/irc.conf b/weechat/.weechat/irc.conf
index 11aad1d..1e79655 100644
--- a/weechat/.weechat/irc.conf
+++ b/weechat/.weechat/irc.conf
@@ -189,7 +189,7 @@ tilde.local_hostname
 tilde.usermode
 tilde.command = "/msg operserv login ${sec.data.pass}"
 tilde.command_delay
-tilde.autojoin = "#meta,#admin,#opers,#music,#politics,#gopher,#tildeverse,#idlerpg,#tilderadio,#minecraft,#cosmic,#institute,#.tilde,#tildetel,#thunix,#theasylum,#aussie,#projects,#hamradio,#vim,#pink,#bots,#ctrl-c,#radiofreqs,#envs,#gemini,#club,#zine,#team,#geocities,#helpdesk,#counting,#covid19,#rw.rs,#counting-meta,#irctokens,#linux,#fr,#factorio,#nsfw,#crawl,#mumble,#tilderadio-djs,#tilde.zone-admin,#tildebot,#submeta,#coffee,#envs_german,#wtf,#beer,#espanol,#meta_german,#tildelinux,#sus,#anelki,#bread,#secret-sudoers,#UT99,#prepping,##ekbots,#bungame,#texto-plano,#netnews,#red :10:20,adminsonly"
+tilde.autojoin = "#admin,#opers,#music,#tildeverse,#cosmic,#.tilde,#tildetel,#thunix,#theasylum,#aussie,#projects,#vim,#pink,#club,#zine,#geocities,#counting,#rw.rs,#counting-meta,#irctokens,#linux,#fr,#factorio,#tilde.zone-admin,#tildebot,#envs_german,#meta_german,#sus,#secret-sudoers,#prepping,##ekbots,#texto-plano,#netnews,#red,#covid19,#coffee,#minecraft,#espanol,#politics,#gopher,#UT99,#tilderadio-djs,#tilderadio,#ctrl-c,#anelki,#institute,#bread,#nsfw,#envs,#bots,#gemini,#team,#meta adminsonly"
 tilde.autorejoin
 tilde.autorejoin_delay
 tilde.connection_timeout
@@ -232,7 +232,7 @@ hashbang.local_hostname
 hashbang.usermode
 hashbang.command
 hashbang.command_delay
-hashbang.autojoin = "#!opers,#!os,#!social,#!,#!cast"
+hashbang.autojoin = "#!opers,#!os,#!social,#!cast,#!"
 hashbang.autorejoin
 hashbang.autorejoin_delay
 hashbang.connection_timeout
@@ -275,7 +275,7 @@ town.local_hostname
 town.usermode
 town.command
 town.command_delay
-town.autojoin = "#tildetown,#bots,#counting,#counting-meta,#admins,#announcements,#politics"
+town.autojoin = "#bots,#admins,#announcements,#politics,#tildetown,#counting,#counting-meta"
 town.autorejoin
 town.autorejoin_delay
 town.connection_timeout
@@ -318,7 +318,7 @@ esper.local_hostname
 esper.usermode
 esper.command
 esper.command_delay
-esper.autojoin = "#lobby,#coders,#factorio 10:30"
+esper.autojoin = "#coders,#factorio,#lobby"
 esper.autorejoin
 esper.autorejoin_delay
 esper.connection_timeout
@@ -361,7 +361,7 @@ sdf.local_hostname
 sdf.usermode
 sdf.command
 sdf.command_delay
-sdf.autojoin = "#sdf,#gopher,#spanish :kick:20:75"
+sdf.autojoin = "#gopher,#spanish,#sdf"
 sdf.autorejoin
 sdf.autorejoin_delay
 sdf.connection_timeout
@@ -447,7 +447,7 @@ oftc.local_hostname
 oftc.usermode
 oftc.command
 oftc.command_delay
-oftc.autojoin = "#debian-devel,#fish"
+oftc.autojoin = "#fish,#debian-devel"
 oftc.autorejoin
 oftc.autorejoin_delay
 oftc.connection_timeout
@@ -490,7 +490,7 @@ freenode.local_hostname
 freenode.usermode
 freenode.command
 freenode.command_delay
-freenode.autojoin = "#weechat,##oodnet,#lobsters,#gitea,#mastodon,#pleroma,#oragono,#sr.ht,#cmpwn,#bitbot,#gophernicus,##jan6,#ascii.town,##ircv3-chat,#futel,#trashtown,#weechat-android,#ovh,#tilde.team,#fosshost,#fosshost-meet,#fosshost-dev,##crustaceans,##irctokens,#borgmatic,#fosshost-volunteers,#fosshost-social,#mailman,#ubuntu-packaging,#among-sus,#borgbackup 6:10"
+freenode.autojoin = "##oodnet,#gophernicus,##jan6,##ircv3-chat,#trashtown,#tilde.team,#fosshost-dev,##irctokens,#fosshost-volunteers,#among-sus,#mailman,#ascii.town,#mastodon,#cmpwn,#lobsters,#oragono,##crustaceans,#bitbot,#ovh,#borgmatic,#weechat-android,#gitea,#fosshost,#pleroma,#sr.ht,#weechat"
 freenode.autorejoin
 freenode.autorejoin_delay
 freenode.connection_timeout
@@ -576,7 +576,7 @@ inspircd.local_hostname
 inspircd.usermode
 inspircd.command
 inspircd.command_delay
-inspircd.autojoin = "#inspircd 10"
+inspircd.autojoin = "#inspircd"
 inspircd.autorejoin
 inspircd.autorejoin_delay
 inspircd.connection_timeout
@@ -633,10 +633,10 @@ slashnet.msg_quit
 slashnet.notify
 slashnet.split_msg_max_length
 slashnet.charset_message
-bitlbee.addresses = "irc.net/6697"
+bitlbee.addresses = "localhost"
 bitlbee.proxy
 bitlbee.ipv6
-bitlbee.ssl = on
+bitlbee.ssl
 bitlbee.ssl_cert
 bitlbee.ssl_password
 bitlbee.ssl_priorities
@@ -646,7 +646,7 @@ bitlbee.ssl_verify
 bitlbee.password
 bitlbee.capabilities
 bitlbee.sasl_mechanism
-bitlbee.sasl_username = "benharri"
+bitlbee.sasl_username = "ben"
 bitlbee.sasl_password = "${sec.data.pass}"
 bitlbee.sasl_key
 bitlbee.sasl_timeout
@@ -654,7 +654,7 @@ bitlbee.sasl_fail
 bitlbee.autoconnect
 bitlbee.autoreconnect
 bitlbee.autoreconnect_delay
-bitlbee.nicks = "benharri"
+bitlbee.nicks
 bitlbee.nicks_alternate
 bitlbee.username
 bitlbee.realname
@@ -662,7 +662,7 @@ bitlbee.local_hostname
 bitlbee.usermode
 bitlbee.command
 bitlbee.command_delay
-bitlbee.autojoin = "&bitlbee,#cifuzofu,#harris,#team,#conversations,#dino,#ejabberd,#biboumi,#soprani.ca,#operators,#xsf,#gajim,#hmm,#lobby,#conversations-offtopic,&jabber,&jabber2,#jabberzac,#mx-frendos"
+bitlbee.autojoin = "&bitlbee,&hmm,&tilde,#brendo,#harris,&SMS,#gritty,#cifuzofu,#jabberzac,#tilde.team,#biboumi,#dino,#movim,#ejabberd,#gajim,#openhardware,#conversations"
 bitlbee.autorejoin
 bitlbee.autorejoin_delay
 bitlbee.connection_timeout
@@ -705,7 +705,7 @@ technet.local_hostname
 technet.usermode
 technet.command
 technet.command_delay
-technet.autojoin = "#tilde,#technet,#computertech"
+technet.autojoin = "#computertech,#technet"
 technet.autorejoin
 technet.autorejoin_delay
 technet.connection_timeout
@@ -748,7 +748,7 @@ pine.local_hostname
 pine.usermode
 pine.command
 pine.command_delay
-pine.autojoin = "#pine-community,#pinephone"
+pine.autojoin = "#pinephone,#pine-community"
 pine.autorejoin
 pine.autorejoin_delay
 pine.connection_timeout
diff --git a/weechat/.weechat/logger.conf b/weechat/.weechat/logger.conf
index affc933..df97888 100644
--- a/weechat/.weechat/logger.conf
+++ b/weechat/.weechat/logger.conf
@@ -33,6 +33,5 @@ time_format = "%Y-%m-%d %H:%M:%S"
 
 [level]
 irc = 3
-irc.bitlbee.#tilde.zone_@ben = 0
 
 [mask]
diff --git a/weechat/.weechat/plugins.conf b/weechat/.weechat/plugins.conf
index 6f20687..18e8583 100644
--- a/weechat/.weechat/plugins.conf
+++ b/weechat/.weechat/plugins.conf
@@ -13,7 +13,6 @@
 fifo.fifo = "on"
 guile.check_license = "off"
 lua.check_license = "off"
-lua.matrix.autojoin_on_invite = "on"
 lua.matrix.backlog_lines = "120"
 lua.matrix.debug = "off"
 lua.matrix.encrypted_message_color = "lightgreen"
@@ -57,19 +56,10 @@ python.apply_corrections.data_timeout = "60"
 python.apply_corrections.message_limit = "2"
 python.apply_corrections.print_format = "[nick]: [corrected]"
 python.apply_corrections.print_limit = "1"
-python.autojoin.autosave = "on"
-python.autojoin_on_invite.autojoin_key = "on"
-python.autojoin_on_invite.ignore_channels = ""
-python.autojoin_on_invite.ignore_nicks = ""
-python.autojoin_on_invite.whitelist_channels = ""
-python.autojoin_on_invite.whitelist_nicks = ""
 python.autojoinem.sorted = "off"
 python.autosavekey.add = "on"
 python.autosavekey.mute = "off"
 python.autosavekey.secure = "on"
-python.bitlbee_typing_notice.channel = "&bitlbee"
-python.bitlbee_typing_notice.server = "bitlbee"
-python.bitlbee_typing_notice.timeout = "4"
 python.buffer_autoclose.age_limit = "30"
 python.buffer_autoclose.ignore = "bitlbee.maddie"
 python.buffer_autoclose.interval = "1"
diff --git a/weechat/.weechat/python/wee_slack.py b/weechat/.weechat/python/wee_slack.py
index dbbccc5..a3d779c 100644
--- a/weechat/.weechat/python/wee_slack.py
+++ b/weechat/.weechat/python/wee_slack.py
@@ -348,8 +348,15 @@ def format_exc_only():
     return ''.join(decode_from_utf8(traceback.format_exception_only(etype, value)))
 
 
+def get_localvar_type(slack_type):
+    if slack_type in ("im", "mpim"):
+        return "private"
+    else:
+        return "channel"
+
+
 def get_nick_color(nick):
-    info_name_prefix = "irc_" if int(weechat_version) < 0x1050000 else ""
+    info_name_prefix = "irc_" if weechat_version < 0x1050000 else ""
     return w.info_get(info_name_prefix + "nick_color_name", nick)
 
 
@@ -361,7 +368,7 @@ def get_thread_color(thread_id):
 
 
 def sha1_hex(s):
-    return hashlib.sha1(s.encode('utf-8')).hexdigest()
+    return str(hashlib.sha1(s.encode('utf-8')).hexdigest())
 
 
 def get_functions_with_prefix(prefix):
@@ -863,7 +870,8 @@ def buffer_input_callback(signal, buffer_ptr, data):
     this includes add/remove reactions, modifying messages, and
     sending messages.
     """
-    data = data.replace('\r', '\n')
+    if weechat_version < 0x2090000:
+        data = data.replace('\r', '\n')
     eventrouter = eval(signal)
     channel = eventrouter.weechat_controller.get_channel_from_buffer_ptr(buffer_ptr)
     if not channel:
@@ -1377,6 +1385,7 @@ class SlackTeam(object):
         if not self.channel_buffer:
             self.channel_buffer = w.buffer_new(self.name, "buffer_input_callback", "EVENTROUTER", "", "")
             self.eventrouter.weechat_controller.register_buffer(self.channel_buffer, self)
+            w.buffer_set(self.channel_buffer, "input_multiline", "1")
             w.buffer_set(self.channel_buffer, "localvar_set_type", 'server')
             w.buffer_set(self.channel_buffer, "localvar_set_slack_type", self.type)
             w.buffer_set(self.channel_buffer, "localvar_set_nick", self.nick)
@@ -1455,10 +1464,11 @@ class SlackTeam(object):
                 try:
                     # only http proxy is currently supported
                     proxy = ProxyWrapper()
+                    timeout = config.slack_timeout / 1000
                     if proxy.has_proxy == True:
-                        ws = create_connection(self.ws_url, sslopt=sslopt_ca_certs, http_proxy_host=proxy.proxy_address, http_proxy_port=proxy.proxy_port, http_proxy_auth=(proxy.proxy_user, proxy.proxy_password))
+                        ws = create_connection(self.ws_url, timeout=timeout, sslopt=sslopt_ca_certs, http_proxy_host=proxy.proxy_address, http_proxy_port=proxy.proxy_port, http_proxy_auth=(proxy.proxy_user, proxy.proxy_password))
                     else:
-                        ws = create_connection(self.ws_url, sslopt=sslopt_ca_certs)
+                        ws = create_connection(self.ws_url, timeout=timeout, sslopt=sslopt_ca_certs)
 
                     self.hook = w.hook_fd(ws.sock.fileno(), 1, 0, 0, "receive_ws_callback", self.get_team_hash())
                     ws.sock.setblocking(0)
@@ -1575,7 +1585,9 @@ class SlackChannelCommon(object):
                 prefix = message.sender
 
         extra_tags = None
-        if message.subtype == "thread_message" and not thread_channel:
+        if message.subtype == "thread_broadcast":
+            extra_tags = [message.subtype]
+        elif type(message) == SlackThreadMessage and not thread_channel:
             if config.thread_messages_in_channel:
                 extra_tags = [message.subtype]
             else:
@@ -1602,6 +1614,17 @@ class SlackChannelCommon(object):
                     config.thread_messages_in_channel and self.pending_history_requests):
                 self.print_getting_history()
 
+    def send_message(self, message, subtype=None, request_dict_ext={}):
+        message = linkify_text(message, self.team)
+        if subtype == 'me_message':
+            s = SlackRequest(self.team, "chat.meMessage", {"channel": self.identifier, "text": message}, channel=self)
+            self.eventrouter.receive(s)
+        else:
+            request = {"type": "message", "channel": self.identifier,
+                    "text": message, "user": self.team.myidentifier}
+            request.update(request_dict_ext)
+            self.team.send_to_websocket(request)
+
     def send_add_reaction(self, msg_id, reaction):
         self.send_change_reaction("reactions.add", msg_id, reaction)
 
@@ -1822,7 +1845,7 @@ class SlackChannel(SlackChannelCommon):
                 w.buffer_set(self.channel_buffer, "hotlist", "1")
 
     def formatted_name(self, style="default", typing=False, present=None):
-        show_typing = typing and config.channel_name_typing_indicator
+        show_typing = typing and not self.muted and config.channel_name_typing_indicator
         if style == "sidebar" and show_typing:
             prepend = ">"
         elif self.type == "group" or self.type == "private":
@@ -1960,10 +1983,8 @@ class SlackChannel(SlackChannelCommon):
             self.active = True
             self.channel_buffer = w.buffer_new(self.formatted_name(style="long_default"), "buffer_input_callback", "EVENTROUTER", "", "")
             self.eventrouter.weechat_controller.register_buffer(self.channel_buffer, self)
-            if self.type in ("im", "mpim"):
-                w.buffer_set(self.channel_buffer, "localvar_set_type", 'private')
-            else:
-                w.buffer_set(self.channel_buffer, "localvar_set_type", 'channel')
+            w.buffer_set(self.channel_buffer, "input_multiline", "1")
+            w.buffer_set(self.channel_buffer, "localvar_set_type", get_localvar_type(self.type))
             w.buffer_set(self.channel_buffer, "localvar_set_slack_type", self.type)
             w.buffer_set(self.channel_buffer, "localvar_set_channel", self.formatted_name())
             w.buffer_set(self.channel_buffer, "localvar_set_nick", self.team.nick)
@@ -2024,18 +2045,6 @@ class SlackChannel(SlackChannelCommon):
             if backlog or self_msg:
                 self.mark_read(ts, update_remote=False, force=True)
 
-    def send_message(self, message, subtype=None, request_dict_ext={}):
-        message = linkify_text(message, self.team)
-        dbg(message)
-        if subtype == 'me_message':
-            s = SlackRequest(self.team, "chat.meMessage", {"channel": self.identifier, "text": message}, channel=self)
-            self.eventrouter.receive(s)
-        else:
-            request = {"type": "message", "channel": self.identifier,
-                    "text": message, "user": self.team.myidentifier}
-            request.update(request_dict_ext)
-            self.team.send_to_websocket(request)
-
     def store_message(self, message_to_store):
         if not self.active:
             return
@@ -2243,7 +2252,7 @@ class SlackChannelVisibleMessages(MappingReversible):
             return False
 
         message = self.get(ts)
-        if (message and message.subtype == "thread_message" and
+        if (type(message) == SlackThreadMessage and message.subtype != "thread_broadcast" and
                 not config.thread_messages_in_channel):
             return False
 
@@ -2492,8 +2501,9 @@ class SlackThreadChannel(SlackChannelCommon):
                 return name
             else:
                 indent_expr = w.config_string(w.config_get("buflist.format.indent"))
-                indent = w.string_eval_expression(indent_expr, {}, {"slack_thread": "1"}, {})
-                return "{}{}${}".format(indent, w.color("default"), name)
+                # Only indent with space if slack_type isn't mentioned in the indent option
+                indent = "" if "slack_type" in indent_expr else " "
+                return "{}${}".format(indent, name)
         elif style == "long_default":
             if self.label_full_drop_prefix:
                 return name
@@ -2552,14 +2562,10 @@ class SlackThreadChannel(SlackChannelCommon):
         if subtype == 'me_message':
             w.prnt("", "ERROR: /me is not supported in threads")
             return w.WEECHAT_RC_ERROR
-        message = linkify_text(message, self.team)
-        dbg(message)
-        request = {"type": "message", "text": message,
-                "channel": self.parent_channel.identifier,
-                "thread_ts": str(self.thread_ts),
-                "user": self.team.myidentifier}
+
+        request = {"thread_ts": str(self.thread_ts)}
         request.update(request_dict_ext)
-        self.team.send_to_websocket(request)
+        super(SlackThreadChannel, self).send_message(message, subtype, request)
 
     def open(self, update_remote=True):
         self.create_buffer()
@@ -2591,7 +2597,8 @@ class SlackThreadChannel(SlackChannelCommon):
         if not self.channel_buffer:
             self.channel_buffer = w.buffer_new(self.formatted_name(style="long_default"), "buffer_input_callback", "EVENTROUTER", "", "")
             self.eventrouter.weechat_controller.register_buffer(self.channel_buffer, self)
-            w.buffer_set(self.channel_buffer, "localvar_set_type", 'channel')
+            w.buffer_set(self.channel_buffer, "input_multiline", "1")
+            w.buffer_set(self.channel_buffer, "localvar_set_type", get_localvar_type(self.parent_channel.type))
             w.buffer_set(self.channel_buffer, "localvar_set_slack_type", self.type)
             w.buffer_set(self.channel_buffer, "localvar_set_nick", self.team.nick)
             w.buffer_set(self.channel_buffer, "localvar_set_channel", self.formatted_name())
@@ -2708,8 +2715,8 @@ class SlackMessage(object):
     Note: these can't be tied to a SlackUser object because users
     can be deleted, so we have to store sender in each one.
     """
-    def __init__(self, subtype, message_json, team, channel):
-        self.team = team
+    def __init__(self, subtype, message_json, channel):
+        self.team = channel.team
         self.channel = channel
         self.subtype = subtype
         self.user_identifier = message_json.get('user')
@@ -2891,7 +2898,9 @@ class SlackMessage(object):
 class SlackThreadMessage(SlackMessage):
 
     def __init__(self, parent_channel, thread_ts, message_json, *args):
-        super(SlackThreadMessage, self).__init__(message_json['subtype'], message_json, *args)
+        subtype = message_json.get('subtype',
+                'thread_broadcast' if message_json.get("reply_broadcast") else 'thread_message')
+        super(SlackThreadMessage, self).__init__(subtype, message_json, *args)
         self.parent_channel = parent_channel
         self.thread_ts = thread_ts
 
@@ -3312,7 +3321,7 @@ def process_user_change(message_json, eventrouter, team, channel, metadata):
 
 
 def process_user_typing(message_json, eventrouter, team, channel, metadata):
-    if channel:
+    if channel and metadata["user"]:
         channel.set_typing(metadata["user"])
         w.bar_item_update("slack_typing_notice")
 
@@ -3330,19 +3339,15 @@ def process_message(message_json, eventrouter, team, channel, metadata, history_
     if not history_message and "ts" in message_json and SlackTS(message_json["ts"]) in channel.messages:
         return
 
-    if "thread_ts" in message_json and "reply_count" not in message_json and "subtype" not in message_json:
-        if message_json.get("reply_broadcast"):
-            message_json["subtype"] = "thread_broadcast"
-        else:
-            message_json["subtype"] = "thread_message"
-
     subtype = message_json.get("subtype")
     subtype_functions = get_functions_with_prefix("subprocess_")
 
-    if subtype in subtype_functions:
+    if "thread_ts" in message_json and "reply_count" not in message_json:
+        message = subprocess_thread_message(message_json, eventrouter, team, channel, history_message)
+    elif subtype in subtype_functions:
         message = subtype_functions[subtype](message_json, eventrouter, team, channel, history_message)
     else:
-        message = SlackMessage(subtype or "normal", message_json, team, channel)
+        message = SlackMessage(subtype or "normal", message_json, channel)
         channel.store_message(message)
         channel.unread_count_display += 1
 
@@ -3395,7 +3400,7 @@ def download_files(message_json, team):
 
 def subprocess_thread_message(message_json, eventrouter, team, channel, history_message):
     parent_ts = SlackTS(message_json['thread_ts'])
-    message = SlackThreadMessage(channel, parent_ts, message_json, team, channel)
+    message = SlackThreadMessage(channel, parent_ts, message_json, channel)
 
     parent_message = message.parent_message
     if parent_message and message.ts not in parent_message.submessages:
@@ -3421,21 +3426,21 @@ subprocess_thread_broadcast = subprocess_thread_message
 
 
 def subprocess_channel_join(message_json, eventrouter, team, channel, history_message):
-    message = SlackMessage("join", message_json, team, channel)
+    message = SlackMessage("join", message_json, channel)
     channel.store_message(message)
     channel.user_joined(message_json["user"])
     return message
 
 
 def subprocess_channel_leave(message_json, eventrouter, team, channel, history_message):
-    message = SlackMessage("leave", message_json, team, channel)
+    message = SlackMessage("leave", message_json,  channel)
     channel.store_message(message)
     channel.user_left(message_json["user"])
     return message
 
 
 def subprocess_channel_topic(message_json, eventrouter, team, channel, history_message):
-    message = SlackMessage("topic", message_json, team, channel)
+    message = SlackMessage("topic", message_json, channel)
     channel.store_message(message)
     channel.set_topic(message_json["topic"])
     return message
@@ -3464,10 +3469,13 @@ def process_reply(message_json, eventrouter, team, channel, metadata):
     reply_to = int(message_json["reply_to"])
     original_message_json = team.ws_replies.pop(reply_to, None)
     if original_message_json:
-        original_message_json.update(message_json)
-        channel = team.channels[original_message_json.get('channel')]
-        process_message(original_message_json, eventrouter, team=team, channel=channel, metadata={})
         dbg("REPLY {}".format(message_json))
+        channel = team.channels[original_message_json.get('channel')]
+        if message_json["ok"]:
+            original_message_json.update(message_json)
+            process_message(original_message_json, eventrouter, team=team, channel=channel, metadata={})
+        else:
+            print_error("Couldn't send message to channel {}: {}".format(channel.name, message_json["error"]))
     else:
         dbg("Unexpected reply {}".format(message_json))
 
@@ -3588,7 +3596,7 @@ def process_subteam_updated(subteam_json, eventrouter, team, channel, metadata):
 
     if config.notify_usergroup_handle_updated and current_subteam_info.handle != new_subteam_info.handle:
         message = 'User group {old_handle} has updated its handle to {new_handle} in team {team}.'.format(
-            name=current_subteam_info.handle, handle=new_subteam_info.handle, team=team.name)
+            old_handle=current_subteam_info.handle, new_handle=new_subteam_info.handle, team=team.name)
         team.buffer_prnt(message, message=True)
 
 
@@ -3929,7 +3937,7 @@ def resolve_ref(ref):
                     else:
                         token = token.replace('_pretty', '')
                 if token in token_to_format:
-                    return ref_datetime.strftime(token_to_format[token])
+                    return decode_from_utf8(ref_datetime.strftime(token_to_format[token]))
                 else:
                     return match.group(0)
 
@@ -5128,8 +5136,13 @@ def create_slack_debug_buffer():
 
 def load_emoji():
     try:
-        DIR = w.info_get('weechat_dir', '')
-        with open('{}/weemoji.json'.format(DIR), 'r') as ef:
+        weechat_dir = w.info_get('weechat_dir', '')
+        weechat_sharedir = w.info_get('weechat_sharedir', '')
+        local_weemoji, global_weemoji = ('{}/weemoji.json'.format(path)
+                for path in (weechat_dir, weechat_sharedir))
+        path = (global_weemoji if os.path.exists(global_weemoji) and
+                not os.path.exists(local_weemoji) else local_weemoji)
+        with open(path, 'r') as ef:
             emojis = json.loads(ef.read())
             if 'emoji' in emojis:
                 print_error('The weemoji.json file is in an old format. Please update it.')
@@ -5635,10 +5648,10 @@ if __name__ == "__main__":
     if w.register(SCRIPT_NAME, SCRIPT_AUTHOR, SCRIPT_VERSION, SCRIPT_LICENSE,
                   SCRIPT_DESC, "script_unloaded", ""):
 
-        weechat_version = w.info_get("version_number", "") or 0
+        weechat_version = int(w.info_get("version_number", "") or 0)
         weechat_upgrading = w.info_get("weechat_upgrading", "")
 
-        if int(weechat_version) < 0x1030000:
+        if weechat_version < 0x1030000:
             w.prnt("", "\nERROR: Weechat version 1.3+ is required to use {}.\n\n".format(SCRIPT_NAME))
         elif weechat_upgrading == "1":
             w.prnt("", "NOTE: wee-slack will not work after running /upgrade until it's"
@@ -5663,7 +5676,8 @@ if __name__ == "__main__":
 
             w.hook_config(CONFIG_PREFIX + ".*", "config_changed_cb", "")
             w.hook_config("irc.look.server_buffer", "config_server_buffer_cb", "")
-            w.hook_modifier("input_text_for_buffer", "input_text_for_buffer_cb", "")
+            if weechat_version < 0x2090000:
+                w.hook_modifier("input_text_for_buffer", "input_text_for_buffer_cb", "")
 
             EMOJI, EMOJI_WITH_SKIN_TONES_REVERSE = load_emoji()
             setup_hooks()
diff --git a/weechat/.weechat/spell.conf b/weechat/.weechat/spell.conf
index ef9e2c8..c0355f3 100644
--- a/weechat/.weechat/spell.conf
+++ b/weechat/.weechat/spell.conf
@@ -19,7 +19,7 @@ suggestion_delimiter_word = cyan
 commands = "ame,amsg,away,command,cycle,kick,kickban,me,msg,notice,part,query,quit,topic"
 default_dict = "en"
 during_search = off
-enabled = on
+enabled = off
 real_time = off
 suggestions = 2
 word_min_length = 2
diff --git a/weechat/.weechat/trigger.conf b/weechat/.weechat/trigger.conf
index 59aacb8..8409a21 100644
--- a/weechat/.weechat/trigger.conf
+++ b/weechat/.weechat/trigger.conf
@@ -25,6 +25,30 @@ trigger = green
 trigger_disabled = red
 
 [trigger]
+autojoin.arguments = "*,irc_in_join"
+autojoin.command = "/autojoinem add ${server} ${channel};/mute save"
+autojoin.conditions = ""
+autojoin.enabled = on
+autojoin.hook = signal
+autojoin.post_action = none
+autojoin.regex = ""
+autojoin.return_code = ok
+autojoinem_on_quit.arguments = "quit"
+autojoinem_on_quit.command = "/allchan /autojoinem add"
+autojoinem_on_quit.conditions = ""
+autojoinem_on_quit.enabled = on
+autojoinem_on_quit.hook = signal
+autojoinem_on_quit.post_action = none
+autojoinem_on_quit.regex = ""
+autojoinem_on_quit.return_code = ok
+autopart.arguments = "*,irc_in_part"
+autopart.command = "/autojoinem del ${server} ${channel};/mute save"
+autopart.conditions = ""
+autopart.enabled = on
+autopart.hook = signal
+autopart.post_action = none
+autopart.regex = ""
+autopart.return_code = ok
 beep.arguments = ""
 beep.command = "/print -beep"
 beep.conditions = "${tg_highlight} || ${tg_msg_pv}"
@@ -33,14 +57,6 @@ beep.hook = print
 beep.post_action = none
 beep.regex = ""
 beep.return_code = ok
-chansaver.arguments = "buffer_closed;buffer_opened"
-chansaver.command = "/mute /autojoin --run;/mute /save"
-chansaver.conditions = ""
-chansaver.enabled = on
-chansaver.hook = signal
-chansaver.post_action = none
-chansaver.regex = ""
-chansaver.return_code = ok
 cmd_pass.arguments = "5000|input_text_display;5000|history_add;5000|irc_command_auth"
 cmd_pass.command = ""
 cmd_pass.conditions = ""
@@ -97,14 +113,6 @@ msg_auth.hook = modifier
 msg_auth.post_action = none
 msg_auth.regex = "==^(.*(id|identify|register|ghost +[^ ]+|release +[^ ]+) +)(.*)==${re:1}${hide:*,${re:+}}"
 msg_auth.return_code = ok
-pong.arguments = ""
-pong.command = "pong"
-pong.conditions = "${type} == private && ${tg_message} == ping"
-pong.enabled = on
-pong.hook = print
-pong.post_action = none
-pong.regex = ""
-pong.return_code = ok
 resize_big.arguments = "signal_sigwinch"
 resize_big.command = "/bar show nicklist"
 resize_big.conditions = "${info:term_width} >= 100"
diff --git a/weechat/.weechat/weechat.conf b/weechat/.weechat/weechat.conf
index 40c63cd..e46a7d9 100644
--- a/weechat/.weechat/weechat.conf
+++ b/weechat/.weechat/weechat.conf
@@ -361,8 +361,6 @@ default.window = "3;1;0;0;core;weechat"
 default.current = on
 
 [notify]
-irc.bitlbee.#tilde.zone_@ben = highlight
-irc.bitlbee.#twitter_nebsirrah = highlight
 irc.server.tilde = highlight
 perl.highmon = none