Skip to content

Commit d4535be

Browse files
authored
Add files via upload
1 parent 8ab3ba8 commit d4535be

File tree

2 files changed

+25
-15
lines changed

2 files changed

+25
-15
lines changed

bbs.py

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def do_welcome(connection):
4141
#SEND HEADER FILE (.SEQ)
4242
# print ("STATUS > will send seq")
4343
send_ln(connection, "\n\n") #sends text
44-
send_seq(connection, "welcome.seq") #sends a seq file to screen
44+
send_seq(connection, "seq/welcome.seq") #sends a seq file to screen
4545

4646
#THIS SECTION SENDS RANDOM THINGS (FOR YOU TO LEARN HOW)
4747
send_cr(connection, "red") #cbmcursor sends color red code
@@ -57,6 +57,14 @@ def do_welcome(connection):
5757
send_ln(connection, "up1")
5858
cursorxy(connection,1,25)
5959
send_ln(connection, "down25")
60+
cursorxy(connection,10,20)
61+
get_char(connection)
62+
63+
send_cr(connection, "clear") #sends a coded cursor
64+
send_cr(connection, "home") #sends a coded cursor
65+
send_seq(connection, "seq/colaburger.seq")
66+
cursorxy(connection,30,5)
67+
get_char(connection)
6068

6169
def do_login(connection):
6270

@@ -74,7 +82,7 @@ def do_login(connection):
7482

7583
if (uname=="new"):
7684
uname,realid = do_newuser(connection)
77-
print("new user created")
85+
print("NEW user created")
7886
break
7987

8088
connection.send(cbmencode("Password: "))
@@ -97,16 +105,14 @@ def do_login(connection):
97105

98106
# Check if there is a match
99107
if(realpass==upass):
100-
print("match!!")
101108
break
102109
else:
103110
send_ln(connection, "\n\nIncorrect username or password.\n\n")
104111
attempts=attempts+1
105112
if (attempts>=maxtries):
106113
connection.send(cbmencode("\n\nSorry maximum number of attempts reached..\n\n"))
107114
connection.close()
108-
print("ok")
109-
print("uname->",uname,"realid->",realid)
115+
print("JUST LOGGED IN -> uname->",uname,"realid->",realid)
110116
return uname,realid;
111117

112118
def do_newuser(connection):
@@ -136,11 +142,9 @@ def do_newuser(connection):
136142
if(myresult == None and uname!="" and uname !="new"):
137143
send_ln(connection, "Your username is: "+uname+"\nAre you sure? (y/n): ")
138144
letter=get_char(connection)
139-
print("letra: ",letter)
140145
send_ln(connection, "\n\n")
141146
attempts=attempts+1
142147
if(letter=="y" or letter=="Y"):
143-
print("YES!")
144148
break
145149
else:
146150
send_ln(connection, "\nError: User already exists.\n")
@@ -159,7 +163,6 @@ def do_newuser(connection):
159163
send_ln(connection, "\nRepeat your password: ")
160164
pass2=input_pass(connection) #input_line function reads a line
161165
if(pass1!="" and pass2==pass1):
162-
print("->"+pass1+"<-")
163166
break
164167
attempts=attempts+1
165168
if attempts >= maxtries:
@@ -176,7 +179,6 @@ def do_newuser(connection):
176179
send_ln(connection, "\nRepeat your email: ")
177180
mail2=input_line(connection) #input_line function reads a line
178181
if(mail1!="" and mail2==mail1):
179-
print("email matches!")
180182
break
181183
attempts=attempts+1
182184
if attempts >= maxtries:
@@ -191,14 +193,14 @@ def do_newuser(connection):
191193
mycursor.execute(query)
192194
mydb.commit() #imperative
193195
realid=mycursor.lastrowid
194-
print("new id:",realid)
196+
print("NEW User just registered with id:",realid)
195197
return uname,realid;
196198

197199
def do_bucle(connection,namex,idx):
198200

199201
while True:
200202
#Clears Screen and sends MENU
201-
print("USER -> ",namex,"->",idx)
203+
print("USER -> ",namex,"->",idx,"Main Menu") #Outputs for sysop
202204
send_ln(connection, "\n\nChoose an option: ")
203205
bucl=get_char(connection)
204206
print(bucl)
@@ -215,10 +217,9 @@ def user_session(connection):
215217
send_cr(connection,"clear")
216218
send_cr(connection,"home")
217219
send_ln(connection, "Connected. Hit any key...")
218-
bucl=get_char(connection)
220+
bucl=input_line(connection)
219221

220222
do_welcome(connection)
221-
time.sleep(6)
222223

223224
userx,idx = do_login(connection)
224225

funct.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,15 @@ def input_line(connection):
128128
print("no data - closed connection")
129129
connection.close()
130130
break
131-
if (data==b'\xff' or data==b'\xfb' or data==b'\x00' or data==b'\x01' or data==b'\xfd'):
131+
if (data==b'\xff' or data==b'\xe6' or data==b'\xfe' or data==b'\xfb' or data==b'\x00' or data==b'\x01' or data==b'\xfd'):
132+
data=b''
133+
if (data==b'\xff\xfb\x01'):
134+
data=b''
135+
if (data==b'\xff\xfb\x00'):
136+
data=b''
137+
if (data==b'\xff\xfb\x00\xff\xfd\x00'):
138+
data=b''
139+
if (data==b'\xff\xfb\x00\xff\xfb\x00'):
132140
data=b''
133141
if (data==b'\xff\xfb\x01\xff\xfb\x00\xff\xfd\x00'):
134142
data=b''
@@ -197,7 +205,8 @@ def get_char(connection):
197205

198206
#this is to send the SEQ file to the user (useful for petscii graphics portions)
199207
def send_seq(connection, filen):
200-
print (filen)
208+
print("inicio send_seq")
209+
print("FN->",filen)
201210
with open(filen, "rb") as f:
202211
nb=b''
203212
byte = f.read(1)

0 commit comments

Comments
 (0)