def send_buffer_read(buffer, server_name, short_name): server = server_by_name(server_name) hdata = weechat.hdata_get("irc_server") cap_list = weechat.hdata_hashtable(hdata, server, "cap_list") if not READ_CAP in cap_list: return t = get_last_message_time(buffer) if t == None: return if not set_buffer_read_time(buffer, t): return # Workaround for WeeChat timestamps missing millisecond granularity t += datetime.timedelta(milliseconds=999) t = t.astimezone(datetime.timezone.utc) s = t.isoformat(timespec="milliseconds").replace("+00:00", "Z") cmd = "READ " + short_name + " timestamp=" + s server_buffer = weechat.buffer_search("irc", "server." + server_name) weechat.command_options(server_buffer, "/quote " + cmd, {"commands": "quote"})
def test_command(): """Test command functions.""" check(weechat.command('', '/mute') == 0) check(weechat.command_options('', '/mute', {'commands': '*,!print'}) == 0) check(weechat.command_options('', '/mute', {'commands': '*,!mute'}) == -1)