1/* Backward-compatible _poll* functions for Mailfromd -*- mfl -*- 2 Copyright (C) 2010-2021 Sergey Poznyakoff 3 4 This program is free software; you can redistribute it and/or modify 5 it under the terms of the GNU General Public License as published by 6 the Free Software Foundation; either version 3, or (at your option) 7 any later version. 8 9 This program is distributed in the hope that it will be useful, 10 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 GNU General Public License for more details. 13 14 You should have received a copy of the GNU General Public License 15 along with this program. If not, see <http://www.gnu.org/licenses/>. */ 16 17module 'poll'. 18require 'callout' 19 20static func __make_extra_arg(string arg, string ehlo, string mailfrom) 21 returns string 22do 23 if ehlo != "" 24 set arg arg . " EHLO=\"%ehlo\"" 25 fi 26 if mailfrom != "" 27 set arg arg . " MAILFROM=\"%mailfrom\"" 28 fi 29 return arg 30done 31 32func _pollhost(string ip, string email, string domain, string mailfrom) 33 returns number 34do 35 return callout_do(__callout_open_default(), email, 36 __make_extra_arg("MODE=hostonly HOST=\"%ip\"", 37 domain, mailfrom)) 38done 39 40func _pollmx (string domain, string email, string ehlo, string mailfrom) 41 returns number 42do 43 return callout_do(__callout_open_default(), email, 44 __make_extra_arg("MODE=mxonly HOST=\"%domain\"", 45 ehlo, mailfrom)) 46done 47 48func stdpoll(string email, string ehlo, string mailfrom) 49 returns number 50do 51 return callout_do(__callout_open_default(), email, 52 __make_extra_arg("MODE=mxfirst", ehlo, mailfrom)) 53done 54 55func strictpoll(string host, string email, string ehlo, string mailfrom) 56 returns number 57do 58 return callout_do(__callout_open_default(), email, 59 __make_extra_arg("MODE=hostfirst HOST=\"%host\"", 60 ehlo, mailfrom)) 61done 62 63 64 65 66 67