prevent warning
This commit is contained in:
parent
bf1dc7cba5
commit
d69fcc9e1e
|
@ -40,6 +40,7 @@ import operator
|
||||||
import time
|
import time
|
||||||
import locale
|
import locale
|
||||||
import hmac
|
import hmac
|
||||||
|
import hashlib
|
||||||
import json
|
import json
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
@ -2655,7 +2656,8 @@ class Connection(CommonConnection, ConnectionHandlers):
|
||||||
|
|
||||||
p = nbxmpp.Presence(to='%s/%s' % (room_jid, nick),
|
p = nbxmpp.Presence(to='%s/%s' % (room_jid, nick),
|
||||||
show=show, status=self.status)
|
show=show, status=self.status)
|
||||||
h = hmac.new(self.secret_hmac, room_jid.encode('utf-8')).hexdigest()[:6]
|
h = hmac.new(self.secret_hmac, room_jid.encode('utf-8'), hashlib.md5).\
|
||||||
|
hexdigest()[:6]
|
||||||
id_ = self.connection.getAnID()
|
id_ = self.connection.getAnID()
|
||||||
id_ = 'gajim_muc_' + id_ + '_' + h
|
id_ = 'gajim_muc_' + id_ + '_' + h
|
||||||
p.setID(id_)
|
p.setID(id_)
|
||||||
|
@ -2763,7 +2765,8 @@ class Connection(CommonConnection, ConnectionHandlers):
|
||||||
xmpp_show = helpers.get_xmpp_show(show)
|
xmpp_show = helpers.get_xmpp_show(show)
|
||||||
p = nbxmpp.Presence(to='%s/%s' % (jid, nick), typ=ptype,
|
p = nbxmpp.Presence(to='%s/%s' % (jid, nick), typ=ptype,
|
||||||
show=xmpp_show, status=status)
|
show=xmpp_show, status=status)
|
||||||
h = hmac.new(self.secret_hmac, jid.encode('utf-8')).hexdigest()[:6]
|
h = hmac.new(self.secret_hmac, jid.encode('utf-8'), hashlib.md5).\
|
||||||
|
hexdigest()[:6]
|
||||||
id_ = self.connection.getAnID()
|
id_ = self.connection.getAnID()
|
||||||
id_ = 'gajim_muc_' + id_ + '_' + h
|
id_ = 'gajim_muc_' + id_ + '_' + h
|
||||||
p.setID(id_)
|
p.setID(id_)
|
||||||
|
|
|
@ -24,6 +24,7 @@ import os
|
||||||
from time import (localtime, time as time_time)
|
from time import (localtime, time as time_time)
|
||||||
from calendar import timegm
|
from calendar import timegm
|
||||||
import hmac
|
import hmac
|
||||||
|
import hashlib
|
||||||
|
|
||||||
from common import atom
|
from common import atom
|
||||||
from common import nec
|
from common import nec
|
||||||
|
@ -808,8 +809,8 @@ PresenceHelperEvent):
|
||||||
and self.ptype == 'error':
|
and self.ptype == 'error':
|
||||||
# Error presences may not include sent stanza, so we don't detect
|
# Error presences may not include sent stanza, so we don't detect
|
||||||
# it's a muc presence. So detect it by ID
|
# it's a muc presence. So detect it by ID
|
||||||
h = hmac.new(self.conn.secret_hmac, self.jid.encode('utf-8')).\
|
h = hmac.new(self.conn.secret_hmac, self.jid.encode('utf-8'),
|
||||||
hexdigest()[:6]
|
hashlib.md5).hexdigest()[:6]
|
||||||
if self.id_.split('_')[-1] == h:
|
if self.id_.split('_')[-1] == h:
|
||||||
self.is_gc = True
|
self.is_gc = True
|
||||||
self.status = self.stanza.getStatus() or ''
|
self.status = self.stanza.getStatus() or ''
|
||||||
|
|
Loading…
Reference in New Issue