HylaFAX The world's most advanced open source fax server

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [hylafax-users] Broadcast faxing



Ok I spent a little time to create (i suppose enough scalable) solution for
multicasting to fax numbers from file.
This patch adds new option -z <filename> to sendfax that equivalent to using
multiple -d <destination> at time, where nubers go from that file
<filename>.
Due to functionality of sendfax this way conserve MUCH space in
/var/spool/hylafax/docq by using only one copy of document for the first
number and hard LINKS to it for the next numbers. Futhermore, it can be used
with the (almost) infinite ;) quantity of phonenumbers.
All solution that uses scripts with the multiple -d <destinations> doesn't
scale well - on the HUGE quantity of numbers they give E2BIG error.

Dmitry.


--- HERE GOES MY PATCH ---
--- sendfax.c++.orig	Sat Mar 30 17:29:56 2002
+++ sendfax.c++	Sat Mar 30 21:16:15 2002
@@ -43,6 +43,7 @@
     static fxStr dbName;
 
     void addDestination(const char* cp);
+    void addDestinationsFromFile(const char* filename);
     void copyToTemporary(int fin, fxStr& tmpl);
     void fatal(const char* fmt ...);
     void usage();
@@ -86,7 +87,7 @@
     int verbose = 0;
     SendFaxJob& proto = getProtoJob();
     db = new FaxDB(tildeExpand(dbName));
-    while ((c = Sys::getopt(argc, argv,
"a:b:B:c:C:d:f:F:h:i:I:k:M:P:r:s:t:T:U:V:W:x:X:y:Y:12lmnpvwDENR")) != -1)
+    while ((c = Sys::getopt(argc, argv,
"a:b:B:c:C:d:f:F:h:i:I:k:M:P:r:s:t:T:U:V:W:x:X:y:Y:z:12lmnpvwDENR")) != -1)
     switch (c) {
     case '1':                   // restrict to 1D-encoded data
         proto.setDesiredDF(0);
@@ -115,6 +116,9 @@
     case 'd':                   // destination name and number
         addDestination(optarg);
         break;
+    case 'z':                   // destinations form file
+        addDestinationsFromFile(optarg);
+        break;
     case 'E':                   // disable use of ECM
         proto.setDesiredEC(false);
         break;
@@ -275,6 +279,28 @@
     SendFaxJob& job = addJob();
     job.setDialString(dest);
     job.setCoverName(recipient);
+}
+
+/*
+ * Add a destinations form file
+ */
+void
+sendFaxApp::addDestinationsFromFile(const char* filename)
+{
+        FILE* destfile;
+        char dest[ 256 ];
+
+        if( ( destfile = fopen( filename, "r" ) ) != NULL )
+        {
+                while( fscanf( destfile, "%256s", dest ) != EOF )
+                {
+                        addDestination( dest );
+                }
+        }
+        else
+        {
+                fatal("%s: no such file", filename);
+        }
 }
 
 /*
---END OF PATCH---

____________________ HylaFAX(tm) Users Mailing List _______________________
  To subscribe/unsubscribe, click http://lists.hylafax.org/cgi-bin/lsg2.cgi
 On UNIX: mail -s unsubscribe hylafax-users-request@hylafax.org < /dev/null




Project hosted by iFAX Solutions