+$spamfilter_target_info = Array(
+ "p"=>Array("short_text" => "usermsg", "long_text" => "User message"),
+ "n"=>Array("short_text" => "usernotice", "long_text" => "User notice"),
+ "c"=>Array("short_text" => "chanmsg", "long_text" => "Channel message"),
+ "N"=>Array("short_text" => "channotice", "long_text" => "Channel notice"),
+ "P"=>Array("short_text" => "part", "long_text" => "Part message"),
+ "q"=>Array("short_text" => "quit", "long_text" => "Quit message"),
+ "d"=>Array("short_text" => "dcc", "long_text" => "DCC Filename"),
+ "a"=>Array("short_text" => "away", "long_text" => "Away message"),
+ "t"=>Array("short_text" => "topic", "long_text" => "Channel topic"),
+ "T"=>Array("short_text" => "message-tag", "long_text" => "Message tag"),
+ "u"=>Array("short_text" => "usermask", "long_text" => "User mask (nick!user@host:realname)"),
+);
+
+function spamfilter_targets_to_string($targets)
+{
+ global $spamfilter_target_info;
+
+ $ret = '';
+ for ($i = 0, $targs = ""; $i < strlen($targets); $i++)
+ {
+ $c = $targets[$i];
+ if (isset($spamfilter_target_info[$c]))
+ $ret .= $spamfilter_target_info[$c]["short_text"].", ";
+ else
+ $ret .= "??, ";
+ }
+ $ret = rtrim($ret,", ");
+ return $ret;
+}
+
+function spamfilter_targets_to_string_with_info($targets)
+{
+ global $spamfilter_target_info;
+
+ $ret = '';
+ for ($i = 0, $targs = ""; $i < strlen($targets); $i++)
+ {
+ $c = $targets[$i];
+ if (isset($spamfilter_target_info[$c]))
+ $ret .= "<span data-toggle=\"tooltip\" data-placement=\"bottom\" title=\"".$spamfilter_target_info[$c]["long_text"]."\" style=\"border-bottom: 1px dotted #000000\">".$spamfilter_target_info[$c]["short_text"]."</span>, ";
+ else
+ $ret .= "??, ";
+ }
+ $ret = rtrim($ret,", ");
+ return $ret;
+}
+
+function spamfilter_target_name_to_char($name)
+{
+ global $spamfilter_target_info;
+
+ foreach ($spamfilter_target_info as $char=>$e)
+ {
+ if ($e["short_text"] == $name)
+ return $char;
+ }
+ return false;
+}
+
+function spamfilter_targets_from_array_to_chars($ar)
+{
+ $ret = '';
+ foreach ($ar as $name)
+ {
+ $c = spamfilter_target_name_to_char($name);
+ if ($c !== false)
+ $ret .= $c;
+ }
+ return $ret;
+}