don't fail when we receive a MAM message without a body. Fixes #8140

This commit is contained in:
Yann Leboulanger 2015-09-03 22:06:04 +02:00
parent 1eba16df6e
commit 0f2e66d7a2

View file

@ -1104,21 +1104,22 @@ class Logger:
time_col = int(float(time.mktime(tim))) time_col = int(float(time.mktime(tim)))
else: else:
time_col = int(float(time.time())) time_col = int(float(time.time()))
if msg: if not msg:
if self.jid_is_from_pm(with_) or nick: return
# It's a groupchat message if self.jid_is_from_pm(with_) or nick:
if nick: # It's a groupchat message
# It's a message from a groupchat occupent if nick:
type_ = 'gc_msg' # It's a message from a groupchat occupent
with_ = with_ + '/' + nick type_ = 'gc_msg'
else: with_ = with_ + '/' + nick
# It's a server message message, we don't log them
return
else: else:
if direction == 'from': # It's a server message message, we don't log them
type_ = 'chat_msg_recv' return
elif direction == 'to': else:
type_ = 'chat_msg_sent' if direction == 'from':
type_ = 'chat_msg_recv'
elif direction == 'to':
type_ = 'chat_msg_sent'
jid_id = self.get_jid_id(with_) jid_id = self.get_jid_id(with_)
where_sql = 'jid_id = %s AND message=?' % jid_id where_sql = 'jid_id = %s AND message=?' % jid_id
if type_ == 'gc_msg': if type_ == 'gc_msg':