1

add: ad-hoc config logging in-out users

This commit is contained in:
Atterratio Aeternus
2015-11-03 17:17:26 +03:00
parent 909f8c2073
commit 20ff4e405d
2 changed files with 29 additions and 27 deletions

View File

@@ -174,33 +174,34 @@ def presence_logger(room,jid,nick,type,mass,mode,logfile):
if not os.path.exists(curr_path): os.mkdir(curr_path)
curr_file = ['%s/%02d.txt','%s/%02d.html'][GT('html_logs_enable')] % (curr_path,lt[2])
ott = onlytimeadd(lt)
log_body = ['[%s] ' % ott,'<p><a id="%s" name="%s" href="#%s" class="time">%s</a> ' % (ott,ott,ott,ott)][GT('html_logs_enable')]
if type == 'unavailable':
log_body += ['*** %s','<span class="unavailable">%s'][GT('html_logs_enable')] % nick
if mode and jid != 'None': log_body += ' (%s)' % jid
if len(exit_type): log_body += ' %s' % exit_type
else: log_body += ' %s' % L('leave')
if exit_message != '': log_body += ' (%s)' % exit_message
if mode and '\r' in mass[4]: log_body += ', %s %s' % (L('Client:'),mass[4].split('\r')[1])
log_body += '%s\n' % ['','</span></p>'][GT('html_logs_enable')]
else:
log_body += ['*** %s','<span class="status">%s'][GT('html_logs_enable')] % nick
if not_found == 0:
if GT('movement_logs_enable'):
log_body = ['[%s] ' % ott,'<p><a id="%s" name="%s" href="#%s" class="time">%s</a> ' % (ott,ott,ott,ott)][GT('html_logs_enable')]
if type == 'unavailable':
log_body += ['*** %s','<span class="unavailable">%s'][GT('html_logs_enable')] % nick
if mode and jid != 'None': log_body += ' (%s)' % jid
log_body += ' %s %s' % (L('join as'),L("%s/%s" % (role,affiliation)))
status_type = '%s_log_join'
elif not_found == 1:
log_body += ' %s %s' % (L('now is'),L("%s/%s" % (role,affiliation)))
if exit_message: log_body += ' (%s)' % exit_message
elif not_found == 2: status_type = '%s_log_change'
if not_found == 0 or not_found == 2:
status_mask = ' %s' if not_found else ', %s'
if show != 'None': log_body += status_mask % L(status_type % show).replace(status_type % '','')
else: log_body += status_mask % L(status_type % "online").replace(status_type % '','')
if priority != 'None': log_body += ' [%s]' % priority
else: log_body += ' [0]'
if text != 'None': log_body += ' (%s)' % text
log_body += '%s\n' % ['','</span></p>'][GT('html_logs_enable')]
if len(exit_type): log_body += ' %s' % exit_type
else: log_body += ' %s' % L('leave')
if exit_message != '': log_body += ' (%s)' % exit_message
if mode and '\r' in mass[4]: log_body += ', %s %s' % (L('Client:'),mass[4].split('\r')[1])
log_body += '%s\n' % ['','</span></p>'][GT('html_logs_enable')]
else:
log_body += ['*** %s','<span class="status">%s'][GT('html_logs_enable')] % nick
if not_found == 0:
if mode and jid != 'None': log_body += ' (%s)' % jid
log_body += ' %s %s' % (L('join as'),L("%s/%s" % (role,affiliation)))
status_type = '%s_log_join'
elif not_found == 1:
log_body += ' %s %s' % (L('now is'),L("%s/%s" % (role,affiliation)))
if exit_message: log_body += ' (%s)' % exit_message
elif not_found == 2: status_type = '%s_log_change'
if not_found == 0 or not_found == 2:
status_mask = ' %s' if not_found else ', %s'
if show != 'None': log_body += status_mask % L(status_type % show).replace(status_type % '','')
else: log_body += status_mask % L(status_type % "online").replace(status_type % '','')
if priority != 'None': log_body += ' [%s]' % priority
else: log_body += ' [0]'
if text != 'None': log_body += ' (%s)' % text
log_body += '%s\n' % ['','</span></p>'][GT('html_logs_enable')]
lht = '%s - %02d/%02d/%02d' % (room,lt[0],lt[1],lt[2])
log_he = ['%s\t\thttp://isida-bot.com\n\n' % lht,log_header+lht+'</title></head><body><div class="main"><div class="top"><div class="heart"><a href="http://isida-bot.com">http://isida-bot.com</a></div><div class="conference">'+lht+'</div></div><div class="container">\n'][GT('html_logs_enable')]
try: log_he += initial_log_users(room,ott) + ['[%s] ' % ott,'<p><a id="%s" name="%s" href="#%s" class="time">%s</a> ' % (ott,ott,ott,ott)][GT('html_logs_enable')] + ['*** %s\n','<span class="topic">%s</span></p>'][GT('html_logs_enable')] % [topics[room],html_escape(topics[room]).replace('\n','<br/>')][GT('html_logs_enable')]

View File

@@ -1754,6 +1754,7 @@ config_groups = [config_group_mucfilter,config_group_mucfilter_newbie,config_gro
# XXe - execute latest field by eval
owner_prefs = {'syslogs_enable': ['Logger. Enable system logs','b',True],
'movement_logs_enable':['Logger. Enable logging ins and outs of the conference','b',True],
'status_logs_enable':['Logger. Enable status change logging','b',True],
'aff_role_logs_enable':['Logger. Enable role and affiliation logging','b',True],
'html_logs_enable':['Logger. Html logs. Otherwize in text','b',True],
@@ -1877,7 +1878,7 @@ owner_group_juick = ['Juick settings','#owner-juick',
['juick_user_post_limit','juick_user_post_size','juick_msg_answers_default','juick_user_tags_limit']]
owner_group_logs = ['Logs settings','#owner-logs',
['syslogs_enable','status_logs_enable','aff_role_logs_enable','html_logs_enable','html_logs_end_text','chatlogs_logs_gmt']]
['syslogs_enable','status_logs_enable','aff_role_logs_enable','movement_logs_enable','html_logs_enable','html_logs_end_text','chatlogs_logs_gmt']]
owner_group_youtube = ['Youtube settings','#owner-youtube',
['youtube_max_videos','youtube_default_videos','youtube_max_page_size','youtube_default_lang']]