summaryrefslogtreecommitdiff
path: root/gentoobrowse/console/emailebuilds.xml
blob: 660e2d71214d1c53957f208e0c5486f8368a1012 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<?xml version="1.0"?>
<emailebuild name="emailebuild" xmlns:xi="http://www.w3.org/2001/XInclude"
		xmlns:project2="http://project2.randomdan.homeip.net">
	<project2:sqlrows name="usersToEmail" datasource="postgres">
		<sql>
			select ut.userid, ut.useremail from
				(select e.ebuildid, u.userid, u.useremail
				from ebuilds e, user_packages up, users u
				where e.packageid = up.packageid
				and u.userid = up.userid
				and e.firstseen > up.trackedsince) as ut left outer join user_ebuild_emails ebe
					on ebe.userid = ut.userid and ebe.ebuildid = ut.ebuildid
			where ebe.userid is null
			group by ut.userid, ut.useremail
		</sql>
	</project2:sqlrows>
	<project2:iterate name="users" source="usersToEmail">
		<project2:sendmail name="sendemail" server="smtp.random.lan:25" subject="Gentoo Browse - New package versions"
				present="newpackageversions" from="&quot;Gentoo Browse&quot; &lt;noreply@gentoobrowse.randomdan.homeip.net&gt;">
			<to source="parent" name="useremail" depth="1" />
		</project2:sendmail>
		<project2:sqltask name="recordsent" datasource="postgres">
			<sql>
				insert into user_ebuild_emails(ebuildid, userid, sentat)
				select ut.ebuildid, ut.userid, now()
				from (
					select e.ebuildid, up.userid
					from ebuilds e, user_packages up, users u
					where e.packageid = up.packageid
					and u.userid = up.userid
					and u.userid = <param source="parent" name="userid" />
					and e.firstseen > up.trackedsince) as ut left outer join user_ebuild_emails ebe
						on ebe.userid = ut.userid and ebe.ebuildid = ut.ebuildid
				where ebe.userid is null
			</sql>
		</project2:sqltask>
	</project2:iterate>
</emailebuild>