<return 0>
<!---
Balloon uses a simple model for handling notifications. Each notification pauses the user before they continue
to Balloon, and regardless of how they handle the notification, it ultimately is deleted and gets out of their way.
The idea is to take care of your notifications before you continue using the site.
--->
<fake_person> <BREAK> </fake_person>
<var _stop = 0>
<var o = "ping"><!--- stolen from /routine-ping --->
<var _select = reReplace('
#o#.id,
#o#.so_dateinserted,
#o#.title,
#o#.name,
#o#.body,
#o#.notes,
#o#.giveto_unsignedint,
#o#.read_unsignedint,
#o#.content_extension (what was the named content''s file extension)
',"([[:space:]]|\([^\)]*\))","","all")>
<!---
WHAT PINGS REQUIRE ACTION?
--->
<var _action_list = "follow">
<var _action_list_sql = "">
<loop list="#_action_list#" index="x">
<var _action_list_sql = _action_list_sql & "," & "'|#x#|'">
</loop>
<var _action_list_sql = replace(_action_list_sql,",","")>
<!--- delete pings that do not require action --->
<delete orb="ping" where="ping.giveto_unsignedint = #client_id# AND ping.notes NOT IN (#_action_list_sql#)">
<!--- select oldest ping that requires action --->
<set select="#_select#,ping.user_id" orb="ping" where="ping.giveto_unsignedint = #client_id# AND ping.notes IN (#_action_list_sql#)" orderby="ping.so_dateinserted ASC" maxrows="1">
<setcrawl>
<if set.read_unsignedint EQ 1 AND ( get.s1 EQ "" OR get.s1 EQ "home" )>
<!--- delete, redirect --->
<var _stop = 1>
<delete orb="ping" where="ping.id = #set.id#">
<goto url="http://#this_domain#/">
<break>
</if>
<if isDefined("get.ping_id") AND get.ping_id EQ set.id>
<if set.read_unsignedint NEQ 1>
<!--- mark read, bypass --->
<update orb="ping" where="ping.id = #set.id#" read_unsignedint="1">
<else>
<!--- bypass --->
</if>
<break>
<else>
<return "break">
</if>
<var Owner = QueryNew('id')>
<set j="/user-#set.user_id##GLOBAL.Def.Estate.field_lists.user#" maxrows="1">
<var Owner = set>
</set>
<if Owner.recordcount NEQ 1>
<!--- this ping is from a non-user... delete and redirect. --->
<var _stop = 1>
<delete orb="ping" where="ping.id = #set.id#">
<goto url="http://#this_domain#/">
<break>
</if><if _stop EQ 1><break></if>
<var _owner_name = "/user-#Owner.id#">
<if trim(Owner.name) NEQ "">
<var _owner_name = escapeMarkup(Owner.name)>
</if>
<var Txt = StructNew()>
<var Txt.fname = listFirst(_owner_name,' ')>
<var Txt.has = "has">
<var Txt.is = "is">
<var Txt.fnames = listFirst(_owner_name,' ')>
<if right(Txt.fnames,1) EQ "s">
<var Txt.fnames = Txt.fnames & "'">
<else>
<var Txt.fnames = Txt.fnames & "'s">
</if>
<if Owner.id EQ client_id>
<var Txt.fname = "You">
<var Txt.has = "have">
<var Txt.is = "are">
<var Txt.fnames = "Your">
</if>
<!---
The beef.
---->
<if set.notes EQ "|follow|">
<tag.bn_estate_ping_follow>
<else>
<!--- what kind of ping is this? no clue. delete. --->
<delete orb="ping" where="ping.id = #set.id#">
<goto url="http://#this_domain#/">
<break>
</if>
</setcrawl>
</set>