From 5425652914476cefe8562dd4de7520ff78574122 Mon Sep 17 00:00:00 2001 From: HarHar Date: Thu, 24 Jan 2013 19:43:12 -0200 Subject: [PATCH 1/4] [irc] Fix error message when user is not on the server --- syncplay/ircBot.py | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/syncplay/ircBot.py b/syncplay/ircBot.py index 4ea5e53..a0ddd5d 100644 --- a/syncplay/ircBot.py +++ b/syncplay/ircBot.py @@ -138,10 +138,8 @@ class Bot(object): for u in users: if u['nick'] == nickFrom: self.functions[6](nickFrom, True) - break - else: - self.msg(to, chr(3) + '5Error!' + chr(15) + ' Your nick was not found on the server') - return + return + self.msg(to, chr(3) + '5Error!' + chr(15) + ' Your nick was not found on the server') elif split[0].lower() == '!play': rooms = self.functions[1]() @@ -150,10 +148,8 @@ class Bot(object): for u in users: if u['nick'] == nickFrom: self.functions[6](nickFrom, False) - break - else: - self.msg(to, chr(3) + '5Error!' + chr(15) + ' Your nick was not found on the server') - return + return + self.msg(to, chr(3) + '5Error!' + chr(15) + ' Your nick was not found on the server') elif split[0].lower() == '!help': self.msg(to, chr(2) + 'Available commands:' + chr(15) + ' !rooms / !roominfo [room] / !pause / !play') From 6588d2a18d67951f28fe566b59982bbd54c28048 Mon Sep 17 00:00:00 2001 From: HarHar Date: Thu, 24 Jan 2013 19:46:29 -0200 Subject: [PATCH 2/4] [irc] improve message --- syncplay/ircBot.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/syncplay/ircBot.py b/syncplay/ircBot.py index a0ddd5d..1ba82c7 100644 --- a/syncplay/ircBot.py +++ b/syncplay/ircBot.py @@ -93,6 +93,10 @@ class Bot(object): if split[0].lower() == '!rooms': rooms = self.functions[1]() + if len(rooms) == 0: + self.msg(to, chr(3) + '5Error!' + chr(15) + ' No rooms found on server') + return + out = 'Currently the Syncplay server hosts viewing sessions as follows: ' i = 0 for room in rooms: From 318ea3dbffac68b6abf8849174065d7c8f22e69b Mon Sep 17 00:00:00 2001 From: HarHar Date: Thu, 24 Jan 2013 19:47:25 -0200 Subject: [PATCH 3/4] [irc] remove comment --- syncplay/ircBot.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/syncplay/ircBot.py b/syncplay/ircBot.py index 1ba82c7..67ae436 100644 --- a/syncplay/ircBot.py +++ b/syncplay/ircBot.py @@ -54,7 +54,6 @@ class Bot(object): self.thread.setDaemon(True) self.thread.start() - ##Events that have to be binded## def sp_joined(self, who, room): self.msg(self.channel, chr(2) + '<' + who + '>'+ chr(15) +' has joined ' + room) def sp_left(self, who, room): @@ -67,7 +66,6 @@ class Bot(object): self.msg(self.channel, chr(2) + '<' + who + '>'+ chr(15) +' is playing "' + filename + '" (room ' + room + ')') def sp_seek(self, who, fromTime, toTime, room): self.msg(self.channel, chr(2) + '<' + who + '>'+ chr(15) +' has jumped from ' + utils.formatTime(fromTime) + ' to ' + utils.formatTime(toTime) +' (room ' + room + ')') - ################################## def sockSend(self, s): self.sock.send(s + '\r\n') From 374391b86602a3a690331a6b17a8a06733451a03 Mon Sep 17 00:00:00 2001 From: HarHar Date: Thu, 24 Jan 2013 20:00:39 -0200 Subject: [PATCH 4/4] [irc] workaround for ant being a pile of fail --- syncplay/ircBot.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/syncplay/ircBot.py b/syncplay/ircBot.py index 67ae436..5fdf68c 100644 --- a/syncplay/ircBot.py +++ b/syncplay/ircBot.py @@ -42,9 +42,11 @@ class Bot(object): self.sockSend('PASS ' + serverPassword) self.sockSend('NICK ' + nick) self.sockSend('USER ' + nick + ' ' + nick + ' ' + nick + ' :SyncPlay Bot') #Don't ask me + self.sock.recv(4096) #Wait for authentication to finish if nickservPass != '': self.msg('NickServ', 'IDENTIFY ' + nickservPass) + self.sock.recv(4096) #We don't want to join if nickserv hasn't done its job (shouldn't really matter, but good for vHost) if channel != '': self.join(channel)