Skip to content

Commit

Permalink
Fixed bug with /channels polling, added support for Chan Operators te…
Browse files Browse the repository at this point in the history
…xt to be color white in chatroom
  • Loading branch information
reillychase committed Oct 27, 2016
1 parent 7a503fa commit 3318edf
Showing 1 changed file with 38 additions and 19 deletions.
57 changes: 38 additions & 19 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,7 @@ def back_to_chat(self):
def check_admins(self):

if self.endflag == 0:
self.print_channels = 0
self.get_thread.s.send("/channels " + self.client_tag)
self.get_thread.s.send("\r\n")
threading.Timer(60, self.check_admins).start()
Expand Down Expand Up @@ -487,7 +488,7 @@ def catch_textedit_chat(self, msg, color):
# This is where all the chatroom data styling and filtering takes place
msg = unicode(msg.toUtf8(), encoding="latin-1")

if re.findall('^ -----------name----------- users ----admin/operator----', msg):
if re.findall('-----------name----------- users ----admin/operator----', msg):
self.list_channels.clear()
self.channels = []
self.logged_on_admins = []
Expand All @@ -510,6 +511,7 @@ def catch_textedit_chat(self, msg, color):
chan = 'all'
channel_admin_list = []
chan = re.findall('^ (.+) .?.?.?.?.?.?.?.?.? -', line)[0].strip()
channel_admin_list.append(admin_level)
channel_admin_list.append(chan)
channel_admin_list.append(admin[:-3])
self.logged_on_admins.append(channel_admin_list)
Expand All @@ -527,7 +529,7 @@ def catch_textedit_chat(self, msg, color):
return


if re.findall('^ ------name------ p -status- --------type--------- count', msg):
if re.findall('------name------ p -status- --------type--------- count', msg):
self.list_games.clear()
self.games = []

Expand Down Expand Up @@ -633,11 +635,11 @@ def catch_textedit_chat(self, msg, color):


else:
line = '<span>' + cgi.escape(line) + '</span>'
list_profile_description.append(line)
line2 = '<span>' + cgi.escape(line) + '</span>'
list_profile_description.append(line2)

if self.print_finger == 1:
line = '<span style="color: #ffff00;">' + line + '</span>'
line = '<span style="color: #ffff00;">' + cgi.escape(line) + '</span>'
self.textedit_chat.append(line.decode('string_escape'))
self.print_finger = 0

Expand Down Expand Up @@ -842,22 +844,39 @@ def catch_textedit_chat(self, msg, color):

for admin_list in self.logged_on_admins:

if admin_list[1] == username:
if admin_list[2] == username:

if admin_list[0] == 'all' or admin_list[0] == self.channel_name:
if admin_list[1] == 'all' or admin_list[1] == self.channel_name:

if self.link_flag == 1:
line = '<span style="color: #00ffff;">&lt;' + username + '&gt;</span><span style="color: #00ffff;"> ' + self.line_w_links + '</span>'
line = line.encode('latin-1')
self.textedit_chat.append(line.decode('utf-8'))
return
if admin_list[0].lower() == 'a':

else:
line = line.decode('unicode-escape')
line = '<span style="color: #00ffff;">&lt;' + username + '&gt;</span><span style="color: #00ffff;"> ' + line + '</span>'
line = line.encode('latin-1')
self.textedit_chat.append(line.decode('utf-8'))
return
if self.link_flag == 1:
line = '<span style="color: #00ffff;">&lt;' + username + '&gt;</span><span style="color: #00ffff;"> ' + self.line_w_links + '</span>'
line = line.encode('latin-1')
self.textedit_chat.append(line.decode('utf-8'))
return

else:
line = line.decode('unicode-escape')
line = '<span style="color: #00ffff;">&lt;' + username + '&gt;</span><span style="color: #00ffff;"> ' + line + '</span>'
line = line.encode('latin-1')
self.textedit_chat.append(line.decode('utf-8'))
return

elif admin_list[0].lower() == 'o':

if self.link_flag == 1:
line = '<span style="color: white;">&lt;' + username + '&gt;</span><span style="color: white;"> ' + self.line_w_links + '</span>'
line = line.encode('latin-1')
self.textedit_chat.append(line.decode('utf-8'))
return

else:
line = line.decode('unicode-escape')
line = '<span style="color: white;">&lt;' + username + '&gt;</span><span style="color: white;"> ' + line + '</span>'
line = line.encode('latin-1')
self.textedit_chat.append(line.decode('utf-8'))
return

if self.link_flag == 1:
line = '<span style="color: #ffff00;">&lt;' + username + '&gt;</span><span style="color: white;" > ' + self.line_w_links + '</span>'
Expand All @@ -880,7 +899,7 @@ def catch_textedit_chat(self, msg, color):
line = line.decode('unicode-escape')
line = '<span style="color: #ffff00;">' + line + '</span>'
line = line.encode('latin-1')
self.textedit_chat.append(line.decode('utf-8'))
self.textedit_chat.append(line)


def remove_from_user_list(self, user):
Expand Down

0 comments on commit 3318edf

Please sign in to comment.