remove rejected messages from queue
This commit is contained in:
parent
5891b70035
commit
bcd81e8bd9
@ -1750,8 +1750,6 @@ class gui(QtGui.QWidget):
|
||||
|
||||
msg += "%"
|
||||
|
||||
# Avoid duplicate messages
|
||||
if self.lastmsg != msg:
|
||||
self.msgqueueList.addItem(self.icchatinput.text())
|
||||
self.msgqueue.append(msg)
|
||||
self.lastmsg = msg
|
||||
@ -1834,7 +1832,7 @@ class gui(QtGui.QWidget):
|
||||
|
||||
if self.msgqueue:
|
||||
chatmsgcomp = (self.msgqueue[0].split('#')[5]).replace('<dollar>', '$').replace('<percent>', '%').replace('<and>', '&').replace('<num>', '#')
|
||||
if (chatmsgcomp == '>' or chatmsgcomp == '<') or (f_char_id == self.mychar and self.m_chatmessage[CHATMSG] == chatmsgcomp): # our message showed up
|
||||
if (f_char_id == self.mychar and self.m_chatmessage[CHATMSG] == chatmsgcomp): # our message showed up
|
||||
del self.msgqueue[0]
|
||||
self.msgqueueList.takeItem(0)
|
||||
if self.additivebtn.isChecked():
|
||||
@ -3028,6 +3026,11 @@ class TCP_Thread(QtCore.QThread):
|
||||
|
||||
error, total = self.parent.tcp.recv()
|
||||
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)
|
||||
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"))
|
||||
|
Loading…
Reference in New Issue
Block a user