Skip to content

Commit

Permalink
v1.3.2
Browse files Browse the repository at this point in the history
  • Loading branch information
9001 committed Sep 1, 2022
1 parent eebd68b commit cbc3d95
Show file tree
Hide file tree
Showing 9 changed files with 43 additions and 55 deletions.
5 changes: 4 additions & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@
"module": "r0c",
"console": "integratedTerminal",
"cwd": "${workspaceFolder}",
"args": []
"args": [
//"--hex-rx",
//"--hex-tx"
]
}
]
}
3 changes: 1 addition & 2 deletions r0c/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,6 @@ def start(self, argv=None):
print("\033[0m")

print(" * Logs at " + EP.log)
Util.compat_chans_in_root()

self.stopping = 0
self.threadmon = False
Expand Down Expand Up @@ -353,7 +352,7 @@ def select_worker(self):
fast = {}
for srv in self.servers:
for c in srv.clients:
if c.slowmo_tx or c.wizard_stage is not None:
if c.slowmo_tx or (c.wizard_stage is not None and not c.is_bot):
slow[c.socket] = c
else:
fast[c.socket] = c
Expand Down
4 changes: 2 additions & 2 deletions r0c/__version__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
VERSION = (1, 3, 1)
BUILD_DT = (2022, 7, 4)
VERSION = (1, 3, 2)
BUILD_DT = (2022, 9, 1)

S_VERSION = u".".join(map(str, VERSION))
S_BUILD_DT = u"{0:04d}-{1:02d}-{2:02d}".format(*BUILD_DT)
Expand Down
4 changes: 4 additions & 0 deletions r0c/diag.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ def memory_dump():
)


"""
def get_obj_name(target_id):
variables = {}
variables.extend(locals())
Expand Down Expand Up @@ -60,6 +62,8 @@ def find_leaked_messages():
print("ref:", ref_objs)
print()
"""


# repl notepad
"""
Expand Down
20 changes: 7 additions & 13 deletions r0c/ivt100.py
Original file line number Diff line number Diff line change
Expand Up @@ -821,7 +821,6 @@ def delayed_drop():

else:
# always clear and resend the status bar for non-vt100
to_send += u"\r" + (u" " * 78) + u"\r"
to_send += self.update_status_bar(True)

# handle keyboard strokes from non-linemode clients,
Expand Down Expand Up @@ -954,7 +953,7 @@ def update_status_bar(self, full_redraw):
len(nchan.msgs) - uchan.vis[-1].im
)

if nchan.name:
if nchan.name and self.vt100:
online = u"\033[22;36m {0}".format(nchan.usernames)
else:
online = u""
Expand All @@ -975,17 +974,10 @@ def update_status_bar(self, full_redraw):
)[0]

if not self.vt100:
now = int(time.time())
ret = u""
if (
full_redraw
or (now % 5 == 1)
or ((hilights or activity) and now % 2 == 1)
):
ret = u"\r{0} {1}> ".format(Util.strip_ansi(line), self.user.nick)
self.left_chrome = ret

return ret
self.left_chrome = u"{0} {1}> ".format(
Util.strip_ansi(line), self.user.nick
)
return u"\r{0}\r{1}".format(u" " * 78, self.left_chrome)

elif full_redraw:
if self.screen[self.h - (self.y_status + 1)] != line:
Expand Down Expand Up @@ -1810,6 +1802,7 @@ def conf_wizard(self, growth):
if self.host.re_bot.search(self.in_text_full):
self.wizard_stage = "bot1"
self.is_bot = True
self.world.cserial += 1

m = "{0} {1}".format(self.user.nick, self.adr[0])
self.host.schedule_kick(self, 69, " botkick: " + m)
Expand Down Expand Up @@ -2074,6 +2067,7 @@ def conf_wizard(self, growth):

# cheatcode: windows telnet + join
elif self.in_text.startswith("wtn"):
self.slowmo_tx = 1
self.set_codec("cp437")
self.wizard_stage = "end"
join_ch = self.in_text[3:]
Expand Down
6 changes: 5 additions & 1 deletion r0c/user.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# coding: utf-8
from __future__ import print_function
from .__version__ import S_VERSION, S_BUILD_DT
from .__init__ import EP, PY2
from .__init__ import EP, PY2, TYPE_CHECKING
from . import util as Util
from . import chat as Chat
from . import diag as Diag
Expand All @@ -16,6 +16,9 @@
import code
import gc

if TYPE_CHECKING:
from . import world as World

print = Util.print


Expand Down Expand Up @@ -61,6 +64,7 @@

class User(object):
def __init__(self, world, address):
# type: (World.World, tuple[str, int]) -> User
self.ar = world.ar
self.world = world
self.admin = False # set true after challenge success
Expand Down
36 changes: 8 additions & 28 deletions r0c/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,8 @@ def hexdump(pk, prefix="", file=None):
ascstr += " "


"""
def test_hexdump():
try:
from StringIO import StringIO as bio
Expand All @@ -147,6 +149,8 @@ def test_hexdump():
sys.exit(0)
"""


def trunc(txt, maxlen):
eoc = azAZ
Expand Down Expand Up @@ -465,6 +469,8 @@ def b35dec(b35str):
return factor * ret


"""
def visualize_all_unicode_codepoints_as_utf8():
stats = [0] * 256
nmax = sys.maxunicode + 1
Expand Down Expand Up @@ -509,6 +515,8 @@ def visualize_all_unicode_codepoints_as_utf8():
# visualize_all_unicode_codepoints_as_utf8()
"""


def wrap(txt, maxlen, maxlen2):
words = txt.rstrip().split()
Expand Down Expand Up @@ -603,34 +611,6 @@ def host_os():
return "{0} on {1}{2}".format(py_ver, host_os, bitness)


def compat_chans_in_root():
bad_dirs = []
good_dirs = ["pm", "chan", "wire"]
for (dirpath, dirnames, filenames) in os.walk(EP.log):
for d in dirnames:
if d not in good_dirs:
bad_dirs.append(d)
break

if bad_dirs:
print()
print("== performing upgrade in 5 seconds ==")
print()
print("Will move the following directories from [log] to [log/chan]:")
print(", ".join(bad_dirs))
print()
print("PRESS CTRL-C TO ABORT")
for n in range(5):
print("{0} ...".format(5 - n))
time.sleep(1)

for d in bad_dirs:
os.rename("{0}{1}".format(EP.log, d), "{0}chan/{1}".format(EP.log, d))

print("upgrade done \\o/")
print()


def py26_threading_event_wait(event):
"""
threading.Event.wait() is broken on py2.6;
Expand Down
19 changes: 12 additions & 7 deletions r0c/world.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,11 +205,8 @@ def send_chan_msg(self, from_nick, nchan, text, ping_self=True):

nchan.log_ctr += 1
nchan.log_fh.write(
(
u" ".join(
[hex(int(msg.ts * 8.0))[2:].rstrip("L"), msg.user, msg.txt]
)
+ u"\n"
u"{0} {1} {2}\n".format(
hex(int(msg.ts * 8.0))[2:].rstrip("L"), msg.user, msg.txt
).encode("utf-8")
)

Expand Down Expand Up @@ -300,6 +297,7 @@ def join_priv_chan(self, user, alias):
uchan.alias = alias
return uchan

"""
def broadcast_banner(self, msg):
with self.mutex:
chans = {}
Expand Down Expand Up @@ -330,6 +328,7 @@ def broadcast_banner(self, msg):
user.client.say(
to_send.encode(user.client.codec, "backslashreplace")
)
"""

def broadcast_message(self, msg, severity=1):
"""1=append, 2=append+scroll"""
Expand Down Expand Up @@ -377,8 +376,14 @@ def part_chan(self, uchan, quiet=False):
user.new_active_chan = user.chans[i]

if not quiet:
suf = u""
if not nchan.name:
suf = u"; reinvite by typing another msg here"

self.send_chan_msg(
u"--", nchan, u"\033[1;33m{0}\033[22m has left".format(user.nick)
u"--",
nchan,
u"\033[1;33m{0}\033[22m has left{1}".format(user.nick, suf),
)

if not nchan.uchans:
Expand Down Expand Up @@ -528,7 +533,7 @@ def start_logging(self, nchan, chat_backlog=None):
nchan.log_fh.write(
u"{0} {1} {2}\n".format(
hex(int(msg.ts * 8.0))[2:].rstrip("L"), msg.user, msg.txt
)
).encode("utf-8")
)

# potential chance that a render goes through
Expand Down
1 change: 0 additions & 1 deletion scripts/sfx.py
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,6 @@ def run(tmp):
def main():
sysver = str(sys.version).replace("\n", "\n" + " " * 18)
pktime = time.strftime("%Y-%m-%d, %H:%M:%S", time.gmtime(STAMP))
os.system("rem") # best girl
msg()
msg(" this is: PKG_NAME", VER)
msg(" packed at:", pktime, "UTC,", STAMP)
Expand Down

0 comments on commit cbc3d95

Please sign in to comment.