Merge pull request #8141 from Baystation12/master

master -> dev
This commit is contained in:
Chinsky
2015-02-16 11:53:14 +03:00
5 changed files with 17 additions and 6 deletions
+13 -2
View File
@@ -329,14 +329,25 @@ proc/TextPreview(var/string,var/len=40)
//This means that it doesn't just remove < and > and call it a day.
//Also limit the size of the input, if specified.
/proc/strip_html_properly(var/input, var/max_length = MAX_MESSAGE_LEN)
if(!input)
return
var/opentag = 1 //These store the position of < and > respectively.
var/closetag = 1
while(1)
opentag = findtext(input, "<")
closetag = findtext(input, ">")
if(!closetag || !opentag)
if(closetag && opentag)
if(closetag < opentag)
input = copytext(input, (closetag + 1))
else
input = copytext(input, 1, opentag) + copytext(input, (closetag + 1))
else if(closetag || opentag)
if(opentag)
input = copytext(input, 1, opentag)
else
input = copytext(input, (closetag + 1))
else
break
input = copytext(input, 1, opentag) + copytext(input, (closetag + 1))
if(max_length)
input = copytext(input,1,max_length)
return sanitize(input)
+1 -1
View File
@@ -36,7 +36,7 @@
var/tmp/message_title = new_title ? new_title : title
var/tmp/message_sound = new_sound ? sound(new_sound) : sound
message = html_encode(message)
message = trim_strip_html_properly(message)
message_title = html_encode(message_title)
Message(message, message_title)
@@ -110,7 +110,7 @@
if(message_cooldown)
usr << "Please allow at least one minute to pass between announcements"
return
var/input = stripped_input(usr, "Please write a message to announce to the station crew.", "Priority Announcement")
var/input = input(usr, "Please write a message to announce to the station crew.", "Priority Announcement")
if(!input || !(usr in view(1,src)))
return
crew_announcement.Announce(input)
@@ -115,7 +115,7 @@
if(message_cooldown)
usr << "Please allow at least one minute to pass between announcements"
return
var/input = stripped_input(usr, "Please write a message to announce to the station crew.", "Priority Announcement")
var/input = input(usr, "Please write a message to announce to the station crew.", "Priority Announcement")
if(!input || !interactable())
return
crew_announcement.Announce(input)
+1 -1
View File
@@ -367,7 +367,7 @@ var/list/ai_verbs_default = list(
if(message_cooldown)
src << "Please allow one minute to pass between announcements."
return
var/input = stripped_input(usr, "Please write a message to announce to the station crew.", "A.I. Announcement")
var/input = input(usr, "Please write a message to announce to the station crew.", "A.I. Announcement")
if(!input)
return