Skip to content

Commit

Permalink
20 mai 2017 #4
Browse files Browse the repository at this point in the history
  • Loading branch information
loicdm committed May 19, 2017
1 parent c764d64 commit 694ec2f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
8 changes: 6 additions & 2 deletions functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,8 @@ def new_channel(userinput, self):
cnx = connect_db(0)
cursor = cnx.cursor()
SQL = (
"""INSERT INTO """ + readcfg(['DATABASE', 'database_channels']) + """.channels_infos (password, channel_name, owner) VALUES ('""" + password + """', '""" + name + """', '""" + user + """');""")
"""INSERT INTO """ + readcfg(['DATABASE',
'database_channels']) + """.channels_infos (password, channel_name, owner) VALUES ('""" + password + """', '""" + name + """', '""" + user + """');""")
cursor.execute(SQL)
cnx.commit()
cursor.close()
Expand Down Expand Up @@ -290,7 +291,8 @@ def del_channel(userinput, self):
try:
cnx = connect_db(0)
cursor = cnx.cursor()
SQL = ("""DELETE FROM """ + readcfg(['DATABASE', 'database_channels']) + """.channels_infos WHERE channels_infos.id = '""" + str(channel) + """';
SQL = ("""DELETE FROM """ + readcfg(
['DATABASE', 'database_channels']) + """.channels_infos WHERE channels_infos.id = '""" + str(channel) + """';
DROP TABLE IF EXISTS """ + str(tablename) + """;""")
for query in cursor.execute(SQL, multi=True):
pass
Expand All @@ -304,6 +306,7 @@ def del_channel(userinput, self):
else:
self.clientsocket.send(pickle.dumps(False))


def clear_channel(userinput, self):
username = userinput[1]
userpassword = userinput[2]
Expand Down Expand Up @@ -332,6 +335,7 @@ def clear_channel(userinput, self):
else:
self.clientsocket.send(pickle.dumps(False))


def check_chan_owner(id, username):
try:
cnx = connect_db(0)
Expand Down
3 changes: 1 addition & 2 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# coding: utf-8
from functions import *

version = "1.0.1"
version = "1.0.2"

check_cfg()
check_db()
Expand Down Expand Up @@ -57,7 +57,6 @@ def run(self):
self.clientsocket.send(pickle.dumps(False))



tcpsock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
tcpsock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
tcpsock.bind((readcfg(['SOCKET', 'host']), int(readcfg(['SOCKET', 'port']))))
Expand Down

0 comments on commit 694ec2f

Please sign in to comment.