diff --git a/gameview.py b/gameview.py index 56aea23..3c5d52a 100644 --- a/gameview.py +++ b/gameview.py @@ -1587,10 +1587,12 @@ class gui(QtGui.QWidget): if self.ooclog.verticalScrollBar().value() == self.ooclog.verticalScrollBar().maximum(): self.ooclog.verticalScrollBar().setValue(self.ooclog.verticalScrollBar().maximum()) def sendOOCchat(self, name, text): + print type(name) + print type(text) self.tcp.send('CT#' + name + '#' + text + '#%') def onOOCreturn(self): - text = self.oocinput.text().toUtf8().replace('#', '').replace('%', '').replace('&', '').replace('$', '').replace('\\n', '\n') + text = self.oocinput.text().replace('#', '').replace('%', '').replace('&', '').replace('$', '').replace('\\n', '\n') if text.startsWith('//'): code = str(self.oocinput.text()).replace('//', '', 1).replace('\\NEWLINE', '\n') try: @@ -1835,7 +1837,9 @@ class gui(QtGui.QWidget): if self.msgqueue: chatmsgcomp = (self.msgqueue[0].split('#')[5]).replace('', '$').replace('', '%').replace('', '&').replace('', '#') - if (f_char_id == self.mychar and self.m_chatmessage[CHATMSG] == chatmsgcomp): # our message showed up + examine = chatmsgcomp == ">" or chatmsgcomp == "<" + special = not chatmsgcomp or chatmsgcomp.isspace() + if examine or (f_char_id == self.mychar and (special or self.m_chatmessage[CHATMSG] == chatmsgcomp)): # our message showed up del self.msgqueue[0] self.msgqueueList.takeItem(0) if self.additivebtn.isChecked(): @@ -2218,12 +2222,9 @@ class gui(QtGui.QWidget): self.playSound(fx_sound) if "effects" not in self.features: return - #print "effect", repr(effect) self.effectview.set_play_once(True) - #try: self.effectview.play(effect) - #except: pass # Windows XP webp error with Pillow def start_chat_ticking(self): if self.text_state != 0: @@ -2852,8 +2853,8 @@ class EditEvidenceDialog(QtGui.QDialog): self.evipicture.setPixmap(QtGui.QPixmap(AO2XPpath + 'themes/default/evidence_selected.png')) def onSave(self): - name = encode_ao_str(self.eviname.text().toUtf8()) - desc = encode_ao_str(self.evidesc.toPlainText().toUtf8()) + name = encode_ao_str(self.eviname.text()) + desc = encode_ao_str(self.evidesc.toPlainText()) if self.editing: self.gamegui.tcp.send('EE#' + str(self.edit_ind) + '#' + name + '#' + desc + '#' + self.filename + '#%') @@ -2988,6 +2989,9 @@ class TCP_Thread(QtCore.QThread): #rainbowColor = QtCore.pyqtSignal(str) updatePlayerList = QtCore.pyqtSignal(str, int, int, str) + send_attempts = 0 + max_attempts = 5 + def __init__(self, parent): super(TCP_Thread, self).__init__(parent) self.parent = parent @@ -3032,15 +3036,20 @@ class TCP_Thread(QtCore.QThread): if error == -2: # if the message can't be sent, discard it if sendtick == 4: - print '[warning] The server rejected the message' - del self.parent.msgqueue[0] - self.parent.msgqueueList.takeItem(0) + self.send_attempts += 1 + if self.send_attempts >= self.max_attempts: + self.send_attempts = 0 + print "[warning] message discarded" + del self.parent.msgqueue[0] + self.parent.msgqueueList.takeItem(0) continue elif error == -1: self.parent.emit(QtCore.SIGNAL('showMessage(QString, QString, QString)'), 'critical', 'Connection lost', "%s connection to server lost." % ("WebSocket" if self.parent.tcp.isWS else "TCP")) self.parent.willDisconnect = True self.quit() - return + return + else: + self.send_attempts = 0 for network in total: header = network[0]