messages and presences are now logged
This commit is contained in:
parent
d17289dfbd
commit
c981ac6b00
|
@ -163,7 +163,9 @@ class connection:
|
||||||
self.dispatch('GC_SUBJECT', (str(msg.getFrom()), subject))
|
self.dispatch('GC_SUBJECT', (str(msg.getFrom()), subject))
|
||||||
else:
|
else:
|
||||||
self.dispatch('GC_MSG', (str(msg.getFrom()), msgtxt, tim))
|
self.dispatch('GC_MSG', (str(msg.getFrom()), msgtxt, tim))
|
||||||
|
gajim.logger.write('gc', msgtxt, str(msg.getFrom()), tim = tim)
|
||||||
else:
|
else:
|
||||||
|
gajim.logger.write('incoming', msgtxt, str(msg.getFrom()), tim = tim)
|
||||||
self.dispatch('MSG', (str(msg.getFrom()), msgtxt, tim))
|
self.dispatch('MSG', (str(msg.getFrom()), msgtxt, tim))
|
||||||
# END messageCB
|
# END messageCB
|
||||||
|
|
||||||
|
@ -193,15 +195,8 @@ class connection:
|
||||||
show = prs.getShow()
|
show = prs.getShow()
|
||||||
if not show:
|
if not show:
|
||||||
show = 'online'
|
show = 'online'
|
||||||
self.dispatch('NOTIFY', (prs.getFrom().getStripped(), show, status, \
|
|
||||||
prs.getFrom().getResource(), prio, keyID, prs.getRole(), \
|
|
||||||
prs.getAffiliation(), prs.getJid(), prs.getReason(), \
|
|
||||||
prs.getActor(), prs.getStatusCode()))
|
|
||||||
elif ptype == 'unavailable':
|
elif ptype == 'unavailable':
|
||||||
self.dispatch('NOTIFY', (prs.getFrom().getStripped(), 'offline', \
|
show = 'offline'
|
||||||
status, prs.getFrom().getResource(), prio, keyID, prs.getRole(), \
|
|
||||||
prs.getAffiliation(), prs.getJid(), prs.getReason(), \
|
|
||||||
prs.getActor(), prs.getStatusCode()))
|
|
||||||
elif ptype == 'subscribe':
|
elif ptype == 'subscribe':
|
||||||
gajim.log.debug('subscribe request from %s' % who)
|
gajim.log.debug('subscribe request from %s' % who)
|
||||||
if gajim.config.get('alwaysauth') or who.find("@") <= 0:
|
if gajim.config.get('alwaysauth') or who.find("@") <= 0:
|
||||||
|
@ -258,6 +253,12 @@ class connection:
|
||||||
self.dispatch('NOTIFY', (prs.getFrom().getStripped(), 'error', \
|
self.dispatch('NOTIFY', (prs.getFrom().getStripped(), 'error', \
|
||||||
errmsg, prs.getFrom().getResource(), prio, keyID, None, None, \
|
errmsg, prs.getFrom().getResource(), prio, keyID, None, None, \
|
||||||
None, None, None, None))
|
None, None, None, None))
|
||||||
|
if ptype == 'available' or ptype == 'unavailable':
|
||||||
|
gajim.logger.write('status', status, prs.getFrom().getStripped(), show)
|
||||||
|
self.dispatch('NOTIFY', (prs.getFrom().getStripped(), show, status, \
|
||||||
|
prs.getFrom().getResource(), prio, keyID, prs.getRole(), \
|
||||||
|
prs.getAffiliation(), prs.getJid(), prs.getReason(), \
|
||||||
|
prs.getActor(), prs.getStatusCode()))
|
||||||
# END presenceCB
|
# END presenceCB
|
||||||
|
|
||||||
def _disconnectedCB(self, con):
|
def _disconnectedCB(self, con):
|
||||||
|
@ -518,6 +519,7 @@ class connection:
|
||||||
if msgenc:
|
if msgenc:
|
||||||
msg_iq.setX(common.jabber.NS_XENCRYPTED).insertData(msgenc)
|
msg_iq.setX(common.jabber.NS_XENCRYPTED).insertData(msgenc)
|
||||||
self.connection.send(msg_iq)
|
self.connection.send(msg_iq)
|
||||||
|
gajim.logger.write('outgoing', msg, jid)
|
||||||
self.dispatch('MSGSENT', (jid, msg, keyID))
|
self.dispatch('MSGSENT', (jid, msg, keyID))
|
||||||
|
|
||||||
def request_subscription(self, jid, msg):
|
def request_subscription(self, jid, msg):
|
||||||
|
|
|
@ -75,7 +75,10 @@ class Logger:
|
||||||
show = nick
|
show = nick
|
||||||
for f in files:
|
for f in files:
|
||||||
fic = open(LOGPATH + f, 'a')
|
fic = open(LOGPATH + f, 'a')
|
||||||
fic.write('%s:%s:%s:%s\n' % (tim, jid, show, msg))
|
fic.write('%s:%s:%s' % (tim, jid, show))
|
||||||
|
if msg:
|
||||||
|
fic.write(':' + msg)
|
||||||
|
fic.write('\n')
|
||||||
fic.close()
|
fic.close()
|
||||||
|
|
||||||
def get_nb_line(self, jid):
|
def get_nb_line(self, jid):
|
||||||
|
|
Loading…
Reference in New Issue