Skip to content
Snippets Groups Projects
Commit c981ac6b authored by Yann Leboulanger's avatar Yann Leboulanger
Browse files

messages and presences are now logged

parent d17289df
No related branches found
No related tags found
No related merge requests found
......@@ -163,7 +163,9 @@ class connection:
self.dispatch('GC_SUBJECT', (str(msg.getFrom()), subject))
else:
self.dispatch('GC_MSG', (str(msg.getFrom()), msgtxt, tim))
gajim.logger.write('gc', msgtxt, str(msg.getFrom()), tim = tim)
else:
gajim.logger.write('incoming', msgtxt, str(msg.getFrom()), tim = tim)
self.dispatch('MSG', (str(msg.getFrom()), msgtxt, tim))
# END messageCB
......@@ -193,15 +195,8 @@ class connection:
show = prs.getShow()
if not show:
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':
self.dispatch('NOTIFY', (prs.getFrom().getStripped(), 'offline', \
status, prs.getFrom().getResource(), prio, keyID, prs.getRole(), \
prs.getAffiliation(), prs.getJid(), prs.getReason(), \
prs.getActor(), prs.getStatusCode()))
show = 'offline'
elif ptype == 'subscribe':
gajim.log.debug('subscribe request from %s' % who)
if gajim.config.get('alwaysauth') or who.find("@") <= 0:
......@@ -258,6 +253,12 @@ class connection:
self.dispatch('NOTIFY', (prs.getFrom().getStripped(), 'error', \
errmsg, prs.getFrom().getResource(), prio, keyID, 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
def _disconnectedCB(self, con):
......@@ -518,6 +519,7 @@ class connection:
if msgenc:
msg_iq.setX(common.jabber.NS_XENCRYPTED).insertData(msgenc)
self.connection.send(msg_iq)
gajim.logger.write('outgoing', msg, jid)
self.dispatch('MSGSENT', (jid, msg, keyID))
def request_subscription(self, jid, msg):
......
......@@ -75,7 +75,10 @@ class Logger:
show = nick
for f in files:
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()
def get_nb_line(self, jid):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment