diff options
author | diSabler <dissy@ya.ru> | 2015-03-04 18:59:03 +0300 |
---|---|---|
committer | diSabler <dissy@ya.ru> | 2015-03-04 18:59:03 +0300 |
commit | 54a4609b4f706906e897f0b4963cc22f0b3292c0 (patch) | |
tree | b45645a04b96a50c4b9b084ad5117c53d1953b0e | |
parent | bb408d8c37f2c460b0a687e0223aca7558df8a12 (diff) |
chg: paste in muc-filter
-rw-r--r-- | kernel.py | 9 | ||||
-rw-r--r-- | plugins/mucfilter.py | 2 |
2 files changed, 9 insertions, 2 deletions
@@ -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]) diff --git a/plugins/mucfilter.py b/plugins/mucfilter.py index 8becb5f..e39ef8b 100644 --- a/plugins/mucfilter.py +++ b/plugins/mucfilter.py @@ -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) |