take into account the no_log_for option
This commit is contained in:
parent
a1d3a26464
commit
140f03221f
|
@ -316,6 +316,8 @@ class Connection:
|
||||||
tim = time.strptime(tim, '%Y%m%dT%H:%M:%S')
|
tim = time.strptime(tim, '%Y%m%dT%H:%M:%S')
|
||||||
tim = time.localtime(timegm(tim))
|
tim = time.localtime(timegm(tim))
|
||||||
frm = self.get_full_jid(msg)
|
frm = self.get_full_jid(msg)
|
||||||
|
jid = self.get_jid(msg)
|
||||||
|
no_log_for = gajim.config.get('accounts', self.name, 'no_log_for')
|
||||||
encrypted = False
|
encrypted = False
|
||||||
chatstate = None
|
chatstate = None
|
||||||
xtags = msg.getTags('x')
|
xtags = msg.getTags('x')
|
||||||
|
@ -365,16 +367,19 @@ class Connection:
|
||||||
if not msg.getTag('body'): #no <body>
|
if not msg.getTag('body'): #no <body>
|
||||||
return
|
return
|
||||||
self.dispatch('GC_MSG', (frm, msgtxt, tim))
|
self.dispatch('GC_MSG', (frm, msgtxt, tim))
|
||||||
gajim.logger.write('gc_msg', frm, msgtxt, tim = tim)
|
if self.name not in no_log_for:
|
||||||
|
gajim.logger.write('gc_msg', frm, msgtxt, tim = tim)
|
||||||
elif mtype == 'chat': # it's type 'chat'
|
elif mtype == 'chat': # it's type 'chat'
|
||||||
if not msg.getTag('body') and chatstate is None: #no <body>
|
if not msg.getTag('body') and chatstate is None: #no <body>
|
||||||
return
|
return
|
||||||
if msg.getTag('body'):
|
if msg.getTag('body') and self.name not in no_log_for and jid not in\
|
||||||
|
no_log_for:
|
||||||
gajim.logger.write('chat_msg_recv', frm, msgtxt, tim = tim, subject = subject)
|
gajim.logger.write('chat_msg_recv', frm, msgtxt, tim = tim, subject = subject)
|
||||||
self.dispatch('MSG', (frm, msgtxt, tim, encrypted, mtype, subject,
|
self.dispatch('MSG', (frm, msgtxt, tim, encrypted, mtype, subject,
|
||||||
chatstate))
|
chatstate))
|
||||||
else: # it's single message
|
else: # it's single message
|
||||||
gajim.logger.write('single_msg_recv', frm, msgtxt, tim = tim, subject = subject)
|
if self.name not in no_log_for and jid not in no_log_for:
|
||||||
|
gajim.logger.write('single_msg_recv', frm, msgtxt, tim = tim, subject = subject)
|
||||||
if invite is not None:
|
if invite is not None:
|
||||||
item = invite.getTag('invite')
|
item = invite.getTag('invite')
|
||||||
jid_from = item.getAttr('from')
|
jid_from = item.getAttr('from')
|
||||||
|
@ -407,6 +412,7 @@ class Connection:
|
||||||
|
|
||||||
who = self.get_full_jid(prs)
|
who = self.get_full_jid(prs)
|
||||||
jid_stripped, resource = gajim.get_room_and_nick_from_fjid(who)
|
jid_stripped, resource = gajim.get_room_and_nick_from_fjid(who)
|
||||||
|
no_log_for = gajim.config.get('accounts', self.name, 'no_log_for')
|
||||||
status = prs.getStatus()
|
status = prs.getStatus()
|
||||||
show = prs.getShow()
|
show = prs.getShow()
|
||||||
if not show in STATUS_LIST:
|
if not show in STATUS_LIST:
|
||||||
|
@ -464,7 +470,8 @@ class Connection:
|
||||||
self.dispatch('ERROR_ANSWER', ('', jid_stripped,
|
self.dispatch('ERROR_ANSWER', ('', jid_stripped,
|
||||||
errmsg, errcode))
|
errmsg, errcode))
|
||||||
if not ptype or ptype == 'unavailable':
|
if not ptype or ptype == 'unavailable':
|
||||||
if gajim.config.get('log_contact_status_changes'):
|
if gajim.config.get('log_contact_status_changes') and self.name\
|
||||||
|
not in no_log_for and jid_stripped not in no_log_for:
|
||||||
gajim.logger.write('gcstatus', who, status, show)
|
gajim.logger.write('gcstatus', who, status, show)
|
||||||
self.dispatch('GC_NOTIFY', (jid_stripped, show, status, resource,
|
self.dispatch('GC_NOTIFY', (jid_stripped, show, status, resource,
|
||||||
prs.getRole(), prs.getAffiliation(), prs.getJid(),
|
prs.getRole(), prs.getAffiliation(), prs.getJid(),
|
||||||
|
@ -513,7 +520,8 @@ class Connection:
|
||||||
else:
|
else:
|
||||||
self.vcard_shas[jid_stripped] = avatar_sha
|
self.vcard_shas[jid_stripped] = avatar_sha
|
||||||
if not ptype or ptype == 'unavailable':
|
if not ptype or ptype == 'unavailable':
|
||||||
if gajim.config.get('log_contact_status_changes'):
|
if gajim.config.get('log_contact_status_changes') and self.name\
|
||||||
|
not in no_log_for and jid_stripped not in no_log_for:
|
||||||
gajim.logger.write('status', jid_stripped, status, show)
|
gajim.logger.write('status', jid_stripped, status, show)
|
||||||
self.dispatch('NOTIFY', (jid_stripped, show, status, resource, prio,
|
self.dispatch('NOTIFY', (jid_stripped, show, status, resource, prio,
|
||||||
keyID))
|
keyID))
|
||||||
|
@ -1915,15 +1923,18 @@ class Connection:
|
||||||
namespace = 'http://jabber.org/protocol/chatstates')
|
namespace = 'http://jabber.org/protocol/chatstates')
|
||||||
|
|
||||||
self.to_be_sent.append(msg_iq)
|
self.to_be_sent.append(msg_iq)
|
||||||
log_msg = msg
|
no_log_for = gajim.config.get('accounts', self.name, 'no_log_for')
|
||||||
if subject:
|
ji = gajim.get_jid_without_resource(jid)
|
||||||
log_msg = _('Subject: %s\n%s') % (subject, msg)
|
if self.name not in no_log_for and ji not in no_log_for:
|
||||||
if log_msg:
|
log_msg = msg
|
||||||
if type == 'chat':
|
if subject:
|
||||||
kind = 'chat_msg_sent'
|
log_msg = _('Subject: %s\n%s') % (subject, msg)
|
||||||
else:
|
if log_msg:
|
||||||
kind = 'single_msg_sent'
|
if type == 'chat':
|
||||||
gajim.logger.write(kind, jid, log_msg)
|
kind = 'chat_msg_sent'
|
||||||
|
else:
|
||||||
|
kind = 'single_msg_sent'
|
||||||
|
gajim.logger.write(kind, jid, log_msg)
|
||||||
self.dispatch('MSGSENT', (jid, msg, keyID))
|
self.dispatch('MSGSENT', (jid, msg, keyID))
|
||||||
|
|
||||||
def send_stanza(self, stanza):
|
def send_stanza(self, stanza):
|
||||||
|
|
Loading…
Reference in New Issue