summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/commands.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/commands.py b/lib/commands.py
index 663f231..942bc0e 100644
--- a/lib/commands.py
+++ b/lib/commands.py
@@ -19,8 +19,15 @@ class Commands(object):
self.user = cmd[2]
+ with open(co['path'], 'rb') as fin:
+ listOld = [x.decode('utf-8') for x in fin.readlines()]
+ del listOld[0]
+
with open(co['path'], 'wb') as fout:
fout.write((cmd[2] + '\n').encode('utf-8'))
+ for i in listOld:
+ fout.write((i).encode('utf-8'))
+ del listOld
print('Ok')
elif cmd[1] is not ListCommands.commands['set']:
@@ -82,6 +89,7 @@ class Commands(object):
try:
with open(co['path'], 'ab') as fout:
+ fout.seek(1, 1)
fout.write((msg + '\n').encode('utf-8'))
print('Ok')