chg: paste in muc-filter
This commit is contained in:
@@ -659,10 +659,17 @@ def muc_filter_action(act,jid,room,reason):
|
||||
return None
|
||||
|
||||
def paste_text(text,room,jid):
|
||||
return paste_text_raw(text,room,jid,True)
|
||||
|
||||
def paste_text_muc(text,room,jid):
|
||||
return paste_text_raw(text,room,jid,False)
|
||||
|
||||
def paste_text_raw(text,room,jid,need_replace):
|
||||
nick = get_nick_by_jid_res(room,jid)
|
||||
_html_paste = GT('html_paste_enable')
|
||||
if _html_paste:
|
||||
text = html_escape(text).replace(' ',' ')
|
||||
if need_replace: text = html_escape(text).replace(' ',' ')
|
||||
else: text = html_escape(text)
|
||||
nick = html_escape(nick)
|
||||
paste_header = ['','<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ru" lang="ru"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><link href="%s" rel="stylesheet" type="text/css" /><title>\n' % paste_css_path][_html_paste]
|
||||
url = '%s%s' % (str(hex(int(time.time()*100)))[2:-1],['.txt','.html'][_html_paste])
|
||||
|
||||
@@ -232,7 +232,7 @@ def muc_filter_set(iq,id,room,acclvl,query,towh,al):
|
||||
act = get_config(gr,'muc_filter_large')
|
||||
muc_pprint('MUC-Filter msg large message (%s): %s [%s] %s' % (act,jid,room,body),'brown')
|
||||
if act == 'paste' or act == 'truncate':
|
||||
url = paste_text(rss_replace(body),room,jid)
|
||||
url = paste_text_muc(rss_replace(body),room,jid)
|
||||
if act == 'truncate': body = u'%s[…] %s' % (body[:GT('muc_filter_large_message_size')],url)
|
||||
else: body = L('Large message%s %s',rn) % (u'…',url)
|
||||
msg = msg.replace(get_tag_full(msg,'body'),'<body>%s</body>' % body)
|
||||
|
||||
Reference in New Issue
Block a user