Пример #1
0
        public static string async_get_server_status()
        {
            if (Settings.TransmitAgent == "hylafax")
            {
                hfax = new Hylafax();

                if (!hfax.connect())
                {
                    return(Catalog.GetString("No Connection"));
                }
                hfax.asyncstatus("status");
                hfax.close();
                hfax = null;
                return("");
            }

            if (Settings.TransmitAgent == "efax")
            {
                //TODO put modem ready status here
                if (firstRun)
                {
                    firstRun = false;
                    return(Catalog.GetString("Efax transmit process running...\nScanning job files every 30 seconds."));
                }
                else
                {
                    return(null);
                }
            }

            return(Catalog.GetString("Error transport agent not specified!"));
        }
Пример #2
0
        public static ArrayList async_get_queue_status(string queue)
        {
            if (Settings.TransmitAgent == "hylafax")
            {
                hfax = new Hylafax();

                if (hfax.connect())
                {
                    hfax.asyncstatus(queue);
                }
                hfax.close();
                hfax = null;
            }

            if (Settings.TransmitAgent == "efax")
            {
                string reply = gfax.efax.status(queue);

                if (queue == "doneq" || queue == "sendq")
                {
                    return(parse_senddone(reply));
                }
                else                 // (queue == "recvq")
                {
                    return(parse_receive(reply));
                }
            }
            return(null);
        }
Пример #3
0
        public static int delete_file(string fname)
        {
            if (Settings.TransmitAgent == "hylafax")
            {
                hfax = new Hylafax();
                hfax.connect();
                int reply = hfax.deletefile(fname);
                hfax = null;
                return(reply);
            }

            if (Settings.TransmitAgent == "efax")
            {
                return(0);
            }
            return(0);
        }
Пример #4
0
        public static void delete_job(string jobid)
        {
            if (Settings.TransmitAgent == "hylafax")
            {
                hfax = new Hylafax();
                hfax.connect();
                hfax.job_select(jobid);
                hfax.job_kill();
                hfax.job_delete();
                hfax = null;
            }

            if (Settings.TransmitAgent == "efax")
            {
                gfax.efax.job_kill(jobid);
                gfax.efax.job_delete(jobid);
            }
        }
Пример #5
0
        public static bool recvfax(string fname)
        {
            // Hylafax support
            if (Settings.TransmitAgent == "hylafax")
            {
                hfax = new Hylafax();
                // hylafax actually stores the file to the server
                hfax.connect();
                return(hfax.getfile(fname));
            }

            // Efax transport
            if (Settings.TransmitAgent == "efax")
            {
                return(false);
            }

            return(false);
        }
Пример #6
0
        public static void resubmit_job(string jobid, string number, string sendat, string dials)
        {
            // will have to query the job, get the file name
            // possibly retrieve the file and then re-submit the job

            if (Settings.TransmitAgent == "hylafax")
            {
                hfax = new Hylafax();
                hfax.connect();
                hfax.job_select(jobid);

                /*
                 * hfax.job_reset("P");
                 * hfax.job_suspend();
                 * hfax.job_param_set("SENDTIME", sendat);
                 * hfax.job_param_set("EXTERNAL", number);
                 * hfax.job_param_set("DIALSTRING", number);
                 * hfax.job_param_set("MAXDIALS", dials);
                 * hfax.job_submit();
                 * hfax = null;
                 */
            }
        }
Пример #7
0
        public static void modify_job(string jobid, string number, string sendat, string dials)
        {
            if (Settings.TransmitAgent == "hylafax")
            {
                hfax = new Hylafax();
                hfax.connect();
                hfax.job_select(jobid);
                hfax.job_suspend();
                hfax.job_param_set("SENDTIME", sendat);
                hfax.job_param_set("EXTERNAL", number);
                hfax.job_param_set("DIALSTRING", number);
                hfax.job_param_set("MAXDIALS", dials);
                hfax.job_submit();
                hfax = null;
            }

            /*
             * if (Settings.TransmitAgent == "efax") {
             *      gfax.efax.job_kill(jobid);
             *      gfax.efax.job_delete(jobid);
             * }
             */
        }
Пример #8
0
        public static void sendfax(string fname)
        {
            string remote_fname;

            if (Settings.Faxtracing == true)
            {
                Console.WriteLine("[Fax.sendfax] File name is : {0}", fname);
            }

            if (Settings.TransmitAgent == "hylafax")
            {
                Hylafax hfaxsf = new Hylafax();
                // hylafax actually stores the file to the server
                hfaxsf.connect();
                remote_fname = hfaxsf.send_init(fname);

                // if "Cancel" button pressed on progess bar
                if (remote_fname == "cancelled")
                {
                    return;
                }

                if (Settings.Faxtracing == true)
                {
                    if (Settings.TransmitAgent == "hylafax")
                    {
                        Console.WriteLine("[Fax.sendfax] Remote file name is : {0}", remote_fname);
                    }
                }

                //System.Threading.Thread.Sleep(2000);

                IEnumerator enu = gfax.Destinations.GetEnumerator();

                if (Settings.Faxtracing == true)
                {
                    if (Settings.TransmitAgent == "hylafax")
                    {
                        Console.WriteLine("[Fax.sendfax] Destinations has a count of : {0}", gfax.Destinations.Count);
                    }
                }

                while (enu.MoveNext())
                {
                    // TODO try catch exception here
                    GfaxContact c = (GfaxContact)enu.Current;

                    if (Settings.Faxtracing == true)
                    {
                        if (Settings.TransmitAgent == "hylafax")
                        {
                            Console.WriteLine("[Fax.sendfax] In while loop contact is -----> {0}", c.PhoneNumber);
                        }
                    }

                    hfaxsf.send(remote_fname, c);

                    if (Settings.Faxtracing == true)
                    {
                        if (Settings.TransmitAgent == "hylafax")
                        {
                            Console.WriteLine("[Fax.sendfax] In while loop bottom... ");
                        }
                    }

                    //System.Threading.Thread.Sleep(1000);
                    // open the log and log out going fax to server
                    // Date Time PhoneNumber Organization ContactPerson
                    // log file is in ~/.etc/gfax
                    //if (Settings.LogEnabled)
                    //log_it((GfaxContact)enu.Current);
                }

                if (Settings.Faxtracing == true)
                {
                    if (Settings.TransmitAgent == "hylafax")
                    {
                        Console.WriteLine("[Fax.sendfax] End of send contact loop...");
                    }
                }

                hfaxsf = null;
            }


            //Efax transport
            if (Settings.TransmitAgent == "efax")
            {
                // Convert the file with ghostscript
                string directory = gfax.efax.send_init(fname);
                if (directory == "cancelled")
                {
                    return;
                }

                IEnumerator enu = gfax.Destinations.GetEnumerator();
                while (enu.MoveNext())
                {
                    gfax.efax.send(directory, (GfaxContact)enu.Current);
                    if (Settings.LogEnabled)
                    {
                        log_it((GfaxContact)enu.Current);
                    }
                }
            }
        }