@@ 361-375 (lines=15) @@ | ||
358 | message.content = data[VarNames.CONTENT] |
|
359 | MessageHistory(message=message, content=message.content, giphy=message.giphy).save() |
|
360 | message.edited_times += 1 |
|
361 | giphy_match = self.isGiphy(data[VarNames.CONTENT]) |
|
362 | if message.content is None: |
|
363 | Message.objects.filter(id=data[VarNames.MESSAGE_ID]).update(deleted=True, edited_times=message.edited_times) |
|
364 | self.publish(self.create_send_message(message, Actions.DELETE_MESSAGE, None, js_id), message.room_id) |
|
365 | elif giphy_match is not None: |
|
366 | self.edit_message_giphy(giphy_match, message, js_id) |
|
367 | else: |
|
368 | self.edit_message_edit(data, message, js_id) |
|
369 | ||
370 | def edit_message_giphy(self, giphy_match, message, js_id): |
|
371 | def edit_glyphy(message, giphy): |
|
372 | do_db(Message.objects.filter(id=message.id).update, content=message.content, symbol=message.symbol, giphy=giphy, |
|
373 | edited_times=message.edited_times) |
|
374 | message.giphy = giphy |
|
375 | self.publish(self.create_send_message(message, Actions.EDIT_MESSAGE, None, js_id), message.room_id) |
|
376 | ||
377 | self.search_giphy(message, giphy_match, edit_glyphy) |
|
378 | ||
@@ 459-470 (lines=12) @@ | ||
456 | connection_id = id_generator(RedisPrefix.CONNECTION_ID_LENGTH) |
|
457 | # use list because sets dont have 1st element which is offerer |
|
458 | self.async_redis_publisher.hset(WEBRTC_CONNECTION, connection_id, self.id) |
|
459 | self.async_redis_publisher.hset(connection_id, self.id, WebRtcRedisStates.READY) |
|
460 | opponents_message = self.offer_webrtc(content, connection_id, room_id, in_message[VarNames.EVENT]) |
|
461 | self_message = self.set_connection_id(qued_id, connection_id) |
|
462 | self.ws_write(self_message) |
|
463 | self.logger.info('!! Offering a webrtc, connection_id %s', connection_id) |
|
464 | self.publish(opponents_message, room_id, True) |
|
465 | ||
466 | def retry_file_connection(self, in_message): |
|
467 | connection_id = in_message[VarNames.CONNECTION_ID] |
|
468 | opponent_ws_id = in_message[VarNames.WEBRTC_OPPONENT_ID] |
|
469 | sender_ws_id = self.sync_redis.shget(WEBRTC_CONNECTION, connection_id) |
|
470 | receiver_ws_status = self.sync_redis.shget(connection_id, opponent_ws_id) |
|
471 | if receiver_ws_status == WebRtcRedisStates.READY and self.id == sender_ws_id: |
|
472 | self.publish(self.retry_file(connection_id), opponent_ws_id) |
|
473 | else: |