261 """ |
261 """ |
262 if self.__pongTime.elapsed() > PongTimeout: |
262 if self.__pongTime.elapsed() > PongTimeout: |
263 self.abort() |
263 self.abort() |
264 return |
264 return |
265 |
265 |
266 self.write("{0}{1}1{1}p".format( |
266 self.write(QByteArray("{0}{1}1{1}p".format( |
267 Connection.ProtocolPing, SeparatorToken)) |
267 Connection.ProtocolPing, SeparatorToken).encode("utf-8"))) |
268 |
268 |
269 def __sendGreetingMessage(self): |
269 def __sendGreetingMessage(self): |
270 """ |
270 """ |
271 Private slot to send a greeting message. |
271 Private slot to send a greeting message. |
272 """ |
272 """ |
388 |
388 |
389 if self.__currentDataType == Connection.PlainText: |
389 if self.__currentDataType == Connection.PlainText: |
390 self.newMessage.emit( |
390 self.newMessage.emit( |
391 self.__username, str(self.__buffer, encoding="utf-8")) |
391 self.__username, str(self.__buffer, encoding="utf-8")) |
392 elif self.__currentDataType == Connection.Ping: |
392 elif self.__currentDataType == Connection.Ping: |
393 self.write("{0}{1}1{1}p".format( |
393 self.write(QByteArray("{0}{1}1{1}p".format( |
394 Connection.ProtocolPong, SeparatorToken)) |
394 Connection.ProtocolPong, SeparatorToken).encode("utf-8"))) |
395 elif self.__currentDataType == Connection.Pong: |
395 elif self.__currentDataType == Connection.Pong: |
396 self.__pongTime.restart() |
396 self.__pongTime.restart() |
397 elif self.__currentDataType == Connection.GetParticipants: |
397 elif self.__currentDataType == Connection.GetParticipants: |
398 self.getParticipants.emit() |
398 self.getParticipants.emit() |
399 elif self.__currentDataType == Connection.Participants: |
399 elif self.__currentDataType == Connection.Participants: |
414 |
414 |
415 def sendGetParticipants(self): |
415 def sendGetParticipants(self): |
416 """ |
416 """ |
417 Public method to request a list of participants. |
417 Public method to request a list of participants. |
418 """ |
418 """ |
419 self.write( |
419 self.write(QByteArray( |
420 "{0}{1}1{1}l".format( |
420 "{0}{1}1{1}l".format( |
421 Connection.ProtocolGetParticipants, SeparatorToken) |
421 Connection.ProtocolGetParticipants, SeparatorToken |
422 ) |
422 ).encode("utf-8") |
|
423 )) |
423 |
424 |
424 def sendParticipants(self, participants): |
425 def sendParticipants(self, participants): |
425 """ |
426 """ |
426 Public method to send the list of participants. |
427 Public method to send the list of participants. |
427 |
428 |