/******************************************************************************* * rfaxlist.cpp * List a RightFax user's faxes. * * Compile: * CL -I "-DVERS=\"R.L\"" rfaxlist.cpp rfaxprogram.obj \rfwin32.lib * where * 'R.L' is the program version number; * '' is the directory containing "rfapi.h" and "rfwin32.lib". * *------------------------------------------------------------------------------ * @version $Revision: 1.1 $ $Date: 2008/04/12 22:07:49 $ * @since 2008-04-12 * @author David R. Tribble (david@tribble.com) * * Copyright ©2008 by David R. Tribble, all rights reserved. * Permission is granted to any person or entity except those designated * by the United States Department of State as a terrorist, or terrorist * government or agency, to use and distribute this source code provided * that the original copyright notice remains present and unaltered. */ // Identification static char REV[] = "@(#)drt/rightfax/src/rfaxlist.cpp $Revision: 1.1 $ $Date: 2008/04/12 22:07:49 $"; static char PROG[] = "rfaxlist"; static char TITLE[] = "RFaxList - List faxes on a RightFax server"; #ifndef VERS #error Please define macro "VERS" as a string in the format "R.L" #endif static char VERSION[] = VERS; static char VERSION_W[] = "@(#)" "Release: " VERS; static char BUILT[] = "@(#)" "Built: " __DATE__; // System includes #ifndef _WIN32 #error Compile this file for Win32 only #endif #include #include #include #include #include #include #include #define WIN32 #define WIN32_LEAN_AND_MEAN 1 #include #include // Local includes #define rfaxprogram_cpp #include "rfaxprogram.hpp" //------------------------------------------------------------------------------ // Local classes //------------------------------------------------------------------------------ /******************************************************************************* * class RFaxLister * List a user's RightFax faxes. * * @since 1.1, 2008-04-12 */ #define RFaxLister_VS 100 // Class version, 1.0 class RFaxLister: public RFaxProgram { // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // Constants public: // Program exit status enum ExitCode { RC_OKAY = 0, // Success RC_CONNECT = 1, // Can't connect to server RC_INFO = 2, // Can't retrieve server info RC_USER = 3, // Bad user-ID RC_USAGE = 255, // Improper usage }; // Inclusion control bitflags enum InclFlags { INCL_NONE = 0x0000, // No faxes specified INCL_RECV = 0x0001, // Include only received faxes INCL_SENT = 0x0002, // Include only sent faxes INCL_ALL = 0x0003, // Include all faxes }; // Listing types enum ListTypes { LIST_NONE = 0, // No listing specified LIST_SHORT = 1, // Short listing LIST_LONG = 2, // Long (verbose) listing LIST_EXT = 3, // Extended fax info listing }; // Sorting control bitflags enum SortFlags { SORT_NONE = 0, // Do not sort SORT_ASC = 1, // Sort in ascending order SORT_DESC = 2, // Sort in descending order }; // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // Static functions public: /*************************************************************************** * List a user's RightFax faxes. * * @usage * rfaxlist [-options...] uniqueID... * * @param argc * Argument count, i.e., the number of elements in 'argv[]'. * * @param argv * Command line arguments. * * @return * Exit status code, which is one of the 'RC_XXX' constants. * * @see run() * * @since 1.1, 2008-04-12 */ static int main(int argc, const char **argv); protected: /*************************************************************************** * Compare two fax list elements by date. * * @param e1 * A fax list element (of type FAXLISTELEMENT1). * * @param e2 * Another fax list element (of type FAXLISTELEMENT1). * * @return * A signed result x, where * x < 0 if e1 < e2 (by date), or * x = 0 if e1 = e2 (by date), or * x > 0 if e1 > e2 (by date). * The sense of the comparison is reversed if 's_sort' is 'SORT_DESC'. * * @since 1.1, 2008-04-12 */ static int cmpFaxElems(const void *e1, const void *e2); // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // Static variables protected: static enum SortFlags s_sort; // How to sort the fax list // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // Functions protected: /*************************************************************************** * Destructor. * * @since 1.1, 2008-04-12 */ virtual ~RFaxLister(); /*************************************************************************** * Default constructor. * * @since 1.1, 2008-04-12 */ RFaxLister(); /*************************************************************************** * List a user's RightFax faxes. * This function is called by main(). * * @param argc * Argument count, i.e., the number of elements in 'argv[]'. * * @param argv * Command line arguments. * * @return * Exit status code, which is one of the 'RC_XXX' constants. * * @see main() * * @since 1.1, 2008-04-12 */ int run(int argc, const char **argv); /*************************************************************************** * List a user's RightFax faxes. * * @param inclFlags * Bitflags controlling the inclusion/exclusion of faxes, which is an or-ing * of zero or more 'INCL_XXX' constants. * * @param listFlags * Bitflags controlling listing (list-only) output, which is one of the * 'LIST_XXX' constants. * * @param faxIDs * Fax-IDs to list (which can contain '?' and '*' wildcard characters). * The last element in this array must be null. * * @since 1.1, 2008-04-12 */ void listFaxes(unsigned inclFlags, unsigned listFlags, const char *const *faxIDs); /*************************************************************************** * List a user's fax. * * @param fax * A fax list element. * * @param n * Fax sequence number (starting at 1). * * @param listFlags * Bitflags controlling listing (list-only) output, which is one of the * 'LIST_XXX' constants. * * @return * True if the fax was successfully listed, otherwise false. * * @since 1.1, 2008-04-12 */ bool listFax(FAXLISTELEMENT1 *fax, int n, unsigned listFlags); private: // Not implemented RFaxLister(const RFaxLister &o); // Not implemented const RFaxLister & operator =(const RFaxLister &o); // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // Variables protected: FILE * m_out; // Output stream bool m_onlyMain; // Only list faxes in folder "main" bool m_utcZone; // Use UTC (Z) timezone }; //------------------------------------------------------------------------------ // Static class variables //------------------------------------------------------------------------------ /*static*/ enum RFaxLister::SortFlags RFaxLister::s_sort = SORT_NONE; // How to sort the fax list //------------------------------------------------------------------------------ // Static class functions //------------------------------------------------------------------------------ /******************************************************************************* * RFaxLister::main() * List a user's RightFax faxes. * * @param argc * Argument count, i.e., the number of elements in 'argv[]'. * * @param argv * Command line arguments. * * @see run() * * @since 1.1, 2008-04-12 */ /*static*/ int RFaxLister::main(int argc, const char **argv) { #if RFaxLister_VS/100 != 1 #error class RFaxLister has changed #endif RFaxLister * srv = NULL; int rc; // Display program version info ::printf("%s\n", TITLE); ::printf("Version %s [%s]\n", VERSION, BUILT+4); ::printf("\n"); ::printf("List a RightFax user's faxes.\n"); ::printf("\n"); ::fflush(stdout); // Establish a RightFax server connection srv = new RFaxLister(); srv->m_out = stdout; rc = srv->run(argc, argv); // Clean up if (srv->m_hdl != NULL) srv->disconnect(); return rc; } /****************************************************************************** * RFaxLister::cmpFaxElems() * Compare two fax list elements by date. * * @param e1 * A fax list element (of type FAXLISTELEMENT1). * * @param e2 * Another fax list element (of type FAXLISTELEMENT1). * * @return * A signed result x, where * x < 0 if e1 < e2 (by date), or * x = 0 if e1 = e2 (by date), or * x > 0 if e1 > e2 (by date). * * @since 1.1, 2008-04-12 */ /*static*/ int RFaxLister::cmpFaxElems(const void *e1, const void *e2) { #if RFaxLister_VS/100 != 1 #error class RFaxLister has changed #endif const FAXLISTELEMENT1 * item1; const FAXLISTELEMENT1 * item2; int cmp = 0; // Compare the fax list elements item1 = (const FAXLISTELEMENT1 *) e1; item2 = (const FAXLISTELEMENT1 *) e2; if (item1->fax_datetime < item2->fax_datetime) cmp = -1; else if (item1->fax_datetime > item2->fax_datetime) cmp = +1; if (s_sort == SORT_DESC) cmp = -cmp; return cmp; } //------------------------------------------------------------------------------ // Class functions //------------------------------------------------------------------------------ /******************************************************************************* * RFaxLister::run() * List a user's RightFax faxes. * This function is called by main(). * * @usage * rfaxlist [-option...] uniqueID... * * @options * -a Show faxes in all folders, not just "main". * -e Show extended fax information. * -s host RightFax server name or IP address (required). * -R Show only received faxes. * -S Show only sent faxes. * -t Sort the list by date. * -tr Sort the list in reverse date order. * -u user Owner user-ID/in-box for faxes to list (required). * -v Verbose listing. * -z List times in UTC (Z) timezone. * * Listed times are UTC. * * @param argc * Argument count, i.e., the number of elements in 'argv[]'. * * @param argv * Command line arguments. * * @see main() * * @since 1.1, 2008-04-12 */ int RFaxLister::run(int argc, const char **argv) { #if RFaxLister_VS/100 != 1 #error class RFaxLister has changed #endif int rc = RC_OKAY; const char * node = NULL; const char * user = NULL; enum SortFlags sort = SORT_NONE; bool onlyMain = true; bool utcZone = false; unsigned inclFlags = INCL_NONE; unsigned listFlags = LIST_SHORT; int i; // Parse options for (i = 1; i < argc and argv[i][0] == '-'; i++) { if (::stricmp(argv[i], "-?") == 0 or ::stricmp(argv[i], "/?") == 0 or ::stricmp(argv[i], "-help") == 0 or ::stricmp(argv[i], "/help") == 0) goto usage2; /*+++NOT IMPLEMENTED YET else if (::strcmp(argv[i], "-d+") == 0 and i+1 < argc) afterDate = argv[++i]; else if (::strcmp(argv[i], "-d-") == 0 and i+1 < argc) beforeDate = argv[++i]; +++*/ else if (::strcmp(argv[i], "-a") == 0) onlyMain = false; else if (::strcmp(argv[i], "-e") == 0) listFlags = LIST_EXT; else if (::strcmp(argv[i], "-s") == 0 and i+1 < argc) node = argv[++i]; else if (::strcmp(argv[i], "-R") == 0) inclFlags |= INCL_RECV; else if (::strcmp(argv[i], "-S") == 0) inclFlags |= INCL_SENT; else if (::strcmp(argv[i], "-t") == 0) sort = SORT_ASC; else if (::strcmp(argv[i], "-tr") == 0) sort = SORT_DESC; else if (::strcmp(argv[i], "-u") == 0 and i+1 < argc) user = argv[++i]; else if (::strcmp(argv[i], "-v") == 0) listFlags = LIST_LONG; else if (::strcmp(argv[i], "-z") == 0) utcZone = true; else goto usage2; } // Check command options if (inclFlags == INCL_NONE) inclFlags = INCL_ALL; if (node == NULL) { //::printf("Missing '-s' server option.\n"); goto usage; } if (user == NULL) { ::printf("Missing '-u' user-ID option.\n"); goto usage; } if (i >= argc) { // Assume "*" as the UniqueID to list argv[1] = "*"; argc = 2; i = 1; } // Establish a connection to the RightFax server ::printf("Server: %s\n", node); ::fflush(m_out); if (not connect(node)) return RC_CONNECT; ::printf("\n"); ::fflush(m_out); // Retrieve information about the RightFax server if (getServerInfo()) { ::printf("RightFax server: %s, %s\n", m_serverIP, m_server); ::printf("\n"); } else { ::printf("Can't retrieve server info: %s\n", node); ::fflush(stdout); rc = RC_INFO; goto done; } // Retrieve info about the specified user from the fax server ::fprintf(m_out, "Retrieving user info...\n"); ::fflush(m_out); if (getUserInfo(user)) { ::printf("User: %s\\%s \"%s\"\n\n", m_group, m_user, m_uname); } else { ::printf("Invalid user: \"%s\"\n", user); rc = RC_USER; goto done; } // List some faxes s_sort = sort; m_onlyMain = onlyMain; m_utcZone = utcZone; listFaxes(inclFlags, listFlags, argv+i); ::printf("\n"); ::fflush(m_out); done: // Disconnect from server if (m_hdl != NULL) disconnect(); // Done ::fflush(m_out); return rc; usage: // Display a program usage help message ::printf("\n"); usage2: ::printf("usage: %s [-option...] fax-ID...\n", PROG); ::printf("\n"); ::printf("Options:\n"); /*+++NOT IMPLEMENTED YET ::printf(" -d+ date Show faxes after a specified date.\n"); ::printf(" -d- date Show faxes before a specified date.\n"); +++*/ ::printf(" -a Show faxes in all folders, not just \"main\".\n"); ::printf(" -e Show extended fax information.\n"); ::printf(" -s host RightFax server name or IP address " "(required).\n"); ::printf(" -R Show only received faxes.\n"); ::printf(" -S Show only sent faxes.\n"); ::printf(" -t Sort the list by date.\n"); ::printf(" -tr Sort the list in reverse date order.\n"); ::printf(" -u user Owner user-ID/in-box (required).\n"); ::printf(" -v Verbose listing.\n"); ::printf(" -z Show times in UTC (Z) timezone.\n"); ::printf("\n"); ::printf("Faxes are specified by either their unique-ID (e.g., " "APP0438B2C87FE62B9) or\n"); ::printf("their filename (e.g., B000409E2). Fax-IDs can contain wildcard " "('?' and '*')\n"); ::printf("characters.\n"); ::printf("\n"); ::fflush(m_out); return RC_USAGE; } /******************************************************************************* * RFaxLister::~RFaxLister() * Destructor. * * @since 1.1, 2008-04-12 */ RFaxLister::~RFaxLister() { #if RFaxLister_VS != 100 #error class RFaxLister has changed #endif // Deallocate } /******************************************************************************* * RFaxLister::RFaxLister() * Default constructor. * * @since 1.1, 2008-04-12 */ RFaxLister::RFaxLister(): RFaxProgram() { #if RFaxLister_VS != 100 #error class RFaxLister has changed #endif // Initialize } /******************************************************************************* * RFaxLister::listFaxes() * List a user's RightFax faxes. * * @param inclFlags * Bitflags controlling the inclusion/exclusion of faxes, which is an or-ing * of zero or more 'INCL_XXX' constants. * * @param listFlags * Bitflags controlling listing (list-only) output, which is one of the * 'LIST_XXX' constants. * * @param faxIDs * Fax-IDs to list (which can contain '?' and '*' wildcard characters). * The last element in this array must be null. * * @since 1.1, 2008-04-12 */ void RFaxLister::listFaxes(unsigned inclFlags, unsigned listFlags, const char *const *faxIDs) { #if RFaxLister_VS/100 != 1 #error class RFaxLister has changed #endif RFAXLISTHANDLE svrHdl; RFAXLISTHANDLE listHdl; FAXLISTELEMENT1 * item; int fold; int nFaxes = 0; int nTouched = 0; int nSkipped = 0; int nRecv = 0; int nSent = 0; int nPages = 0; int nViewed = 0; int nErrs = 0; int rc; // Get the list of faxes owned by the user ::fprintf(m_out, "Retrieving fax list...\n"); ::fflush(m_out); svrHdl = (RFAXSERVERHANDLE) m_hdl; fold = (m_onlyMain ? FAXFOLDER_MAIN : FAXFOLDER_ALLBUTTRASH); rc = ::RFaxGetFaxList(svrHdl, m_user, 1, fold, FAXFILTER_NONE, &listHdl); if (rc != RFAX_SUCCESS) { ::fprintf(m_out, "Can't retrieve fax list for user: %s\n", m_user); ::fflush(m_out); return; } // Sort the list by date order if (s_sort != SORT_NONE) { ::fprintf(m_out, "Sorting fax list by date...\n"); ::fflush(m_out); rc = ::RFaxListSort(listHdl, &cmpFaxElems); if (rc != RFAX_SUCCESS) { ::fprintf(m_out, "Can't sort the fax list for user: %s\n", m_user); ::fflush(m_out); } } // Find and list the faxes in the list rc = ::RFaxListGetFirstElementPtr(listHdl, (RFAXPVOID *) &item); faxLoop: while (rc == RFAX_SUCCESS) { const char * faxID; unsigned long flg; int i; // Determine if the fax was specified by the user faxID = NULL; flg = item->flags; for (i = 0; faxIDs[i] != NULL; i++) { // Compare the fax's unique-ID faxID = item->unique_id; if (matchesPattern(faxID, faxIDs[i])) break; faxID = NULL; } if ((flg & FAXFLAG_RECEIVED) and not (inclFlags & INCL_RECV)) faxID = NULL; if (not (flg & FAXFLAG_RECEIVED) and not (inclFlags & INCL_SENT)) faxID = NULL; // Display the matching fax if (faxID != NULL) { // Get info for the fax nFaxes++; if (nFaxes == 1) ::fprintf(m_out, "\n"); nPages += item->numpages; nErrs += (item->fax_error_code == 0 ? 0 : 1); nRecv += (flg & FAXFLAG_RECEIVED ? 1 : 0); nSent += (flg & FAXFLAG_RECEIVED ? 0 : 1); nViewed += (flg & FAXFLAG_VIEWED ? 1 : 0); // List the fax if (listFax(item, nFaxes, listFlags)) nTouched++; #if IS_INCOMPLETE___ // Remove the fax from the list rc = ::RFaxListDeleteElement(listHdl, n?); ...; #endif } else { // Skip this fax ///::fprintf(m_out, "$ skip '%s'\n", item->unique_id); nSkipped++; } nextLoop: // Get the next fax in the list (for the next iteration) rc = ::RFaxListGetNextElementPtr(listHdl, (RFAXPVOID *) &item); } // Done ::fprintf(m_out, "\n"); ::fprintf(m_out, "faxes:%d listed:%d failed:%d skipped:%d total:%d\n", nFaxes, nTouched, nFaxes-nTouched, nSkipped, nFaxes+nSkipped); if (inclFlags & INCL_RECV) ::fprintf(m_out, "recv:%d", nRecv); else ::fprintf(m_out, "recv:-"); if (inclFlags & INCL_SENT) ::fprintf(m_out, " sent:%d", nSent); else ::fprintf(m_out, " sent:-"); ::fprintf(m_out, " viewed:%d pages:%d errs:%d\n", nViewed, nPages, nErrs); ::fflush(m_out); done: // Clean up ::RFaxCloseListHandle(listHdl); } /******************************************************************************* * RFaxLister::listFax() * List a user's fax. * * @param fax * A fax list element. * * @param n * Fax sequence number (starting at 1). * * @param listFlags * Bitflags controlling listing (list-only) output, which is one of the * 'LIST_XXX' constants. * * @return * True if the fax was successfully listed, otherwise false. * * @since 1.1, 2008-04-12 */ bool RFaxLister::listFax(FAXLISTELEMENT1 *fax, int n, unsigned listFlags) { #if RFaxLister_VS/100 != 1 #error class RFaxLister has changed #endif RFAXLISTHANDLE svrHdl; FAXHANDLE faxHdl; const char * faxID; unsigned long flg; unsigned long oth; unsigned long dsp; time_t t; struct tm ts; int rc; char tbuf[80+1]; FAXINFO_11 meta; // Get information about the fax faxID = fax->unique_id; flg = fax->flags; oth = fax->otherstuff; dsp = fax->displayflags; t = fax->fax_datetime; t += m_tz; if (m_utcZone) ts = *::gmtime(&t); else ts = *::localtime(&t); ::strftime(tbuf, sizeof(tbuf), "%Y-%m-%d %H:%M:%S", &ts); // Get extended information about the fax if (listFlags == LIST_EXT or listFlags == LIST_LONG) { ::memset(&meta, 0, sizeof(meta)); svrHdl = (RFAXSERVERHANDLE) m_hdl; faxHdl = fax->handle; rc = ::RFaxLoadFax3(svrHdl, faxHdl, NULL, LOADFAX_NOCOVER|LOADFAX_NOBODY, NULL, &meta, 11); if (rc != RFAX_SUCCESS) { ::fprintf(m_out, "Can't retrieve extended fax info: %s (%08p)\n", faxID, faxHdl); ::fflush(m_out); return false; } } // Process the fax if (listFlags == LIST_SHORT or listFlags == LIST_EXT) { if (n == 1) { // List a short format heading //::fprintf(m_out, "%5s ", "Num"); ::fprintf(m_out, "%-12s", "Flags"); ::fprintf(m_out, " %-10s", "Date"); ::fprintf(m_out, " %-8s", "Time"); ::fprintf(m_out, " %3s", "Pg"); ::fprintf(m_out, " %2s", "Fol"); ::fprintf(m_out, " %s\n", "UniqueID"); } // List the fax (short format) //::fprintf(m_out, "%5d ", n); ::fprintf(m_out, "%c%c%c%c%c%c%c%c%c%c%c%c", (flg & FAXFLAG_RECEIVED ? 'R' : 'S'), (flg & FAXFLAG_VIEWED ? 'v' : '-'), (flg & FAXFLAG_PRINTED ? 'p' : '-'), (flg & FAXFLAG_WAS_FORWARDED ? 'f' : '-'), (flg & FAXFLAG_WASAPPROVED ? 'a' : '-'), (flg & FAXFLAG_HELD ? 'h' : '-'), (flg & FAXFLAG_GENERIC1 ? '1' : '-'), (flg & FAXFLAG_GENERIC2 ? '2' : '-'), (flg & FAXFLAG_DELETED ? 'd' : '-'), (oth & 0x0001 ? 'f' : '-'), (dsp & 0x0001 ? 'c' : '-'), (fax->fax_error_code != 0 ? 'E' : '-')); ::fprintf(m_out, " %s", tbuf); ::fprintf(m_out, " %3d", fax->numpages); if (fax->usFolderIndex == 0) ::fprintf(m_out, " %2s", "M"); else ::fprintf(m_out, " %2d", fax->usFolderIndex); ::fprintf(m_out, " %-15s", faxID); if (listFlags == LIST_EXT) { ::fprintf(m_out, " %s", meta.faxfilename); ::fprintf(m_out, " %-10s", meta.faxdidnum); } ::fprintf(m_out, "\n"); ::fflush(m_out); } else //(listFlags == LIST_LONG) { const char * s; // List the fax (verbose format) if (n > 1) ::fprintf(m_out, "\n"); ::fprintf(m_out, "%d %s\n", n, faxID); ::fprintf(m_out, " Flags %s%s%s%s%s%s%s%s%s%s%s%s\n", (flg & FAXFLAG_RECEIVED ? " recv" : " sent"), (flg & FAXFLAG_VIEWED ? " view" : " unview"), (flg & FAXFLAG_PRINTED ? " print" : " unprint"), (flg & FAXFLAG_WAS_FORWARDED ? " fwd" : ""), (flg & FAXFLAG_WASAPPROVED ? " approved" : " unapproved"), (flg & FAXFLAG_HELD ? " held" : " rel"), (flg & FAXFLAG_GENERIC1 ? " user1" : ""), (flg & FAXFLAG_GENERIC2 ? " user2" : ""), (flg & FAXFLAG_DELETED ? " del" : ""), (oth & 0x0001 ? " fine" : " coarse"), (dsp & 0x0001 ? " cover" : ""), (fax->fax_error_code != 0 ? " err" : "")); ::fprintf(m_out, " FaxFile %s\n", meta.faxfilename); ::fprintf(m_out, " Handle %08p\n", fax->handle); ::fprintf(m_out, " %s %s Z\n", (flg & FAXFLAG_RECEIVED ? "RecvDate" : "SendDate"), tbuf); ::fprintf(m_out, " DID %s\n", meta.faxdidnum); ::fprintf(m_out, " Pages %d\n", meta.numpages); ::fprintf(m_out, " Error %d\n", meta.fax_error_code); ::fprintf(m_out, " Status %d, %s\n", meta.fax_status, cvtStatus(meta.fax_status)); ::fprintf(m_out, " SendTime %d sec, %d:%02d\n", meta.send_time, meta.send_time/60, meta.send_time%60); ::fprintf(m_out, " OwnerID %s\n", meta.owner_id); if (fax->userid[0] != '\0') ::fprintf(m_out, " UserID %s\n", fax->userid); ::fprintf(m_out, " Folder %d%s\n", meta.usFolder, (meta.usFolder == 0 ? ", Main" : "")); ::fprintf(m_out, " RemoteID %s\n", meta.remoteid); ::fprintf(m_out, " FromName %s\n", meta.from_name); ::fprintf(m_out, " FromPhone %s\n", meta.from_phonenum); ::fprintf(m_out, " Comment %s\n", meta.szComment); ::fprintf(m_out, " ToName %s\n", meta.to_name); ::fprintf(m_out, " ToPhone %s\n", meta.to_faxnum); ::fprintf(m_out, " ToCompany %s\n", meta.to_company); ::fprintf(m_out, " ToCityState %s\n", meta.to_citystate); ::fprintf(m_out, " ToContact %s\n", meta.to_contactnum); ::fprintf(m_out, " BillInfo1 %s\n", meta.billinfo1); ::fprintf(m_out, " BillInfo2 %s\n", meta.billinfo2); ::fprintf(m_out, " OperatorPhone %s\n", meta.operatornum); ::fprintf(m_out, " GeneralFaxPhone %s\n", meta.generalfaxnum); ::fprintf(m_out, " FaxID %d\n", meta.fax_id); ::fprintf(m_out, " JobID %d\n", meta.jobid); ::fprintf(m_out, " Coversheet %s\n", meta.fcsfile); ::fprintf(m_out, " PaperType %d\n", meta.papernum); ::fprintf(m_out, " FaxType %d\n", meta.faxtype); ::fprintf(m_out, " Disposition %d\n", meta.fax_disposition); ::fprintf(m_out, " Custom1 %d\n", meta.usCustom1); switch (meta.ucPriority) { case PRIORITY_NORMAL: s = "Normal"; break; case PRIORITY_LOW: s = "Low"; break; case PRIORITY_HIGH: s = "High"; break; default: s = "Unknown"; break; } ::fprintf(m_out, " Priority %d, %s\n", meta.ucPriority, s); switch (meta.printjobtype) { case PRINTJOBTYPE_PCL: s = "PCL-5"; break; case PRINTJOBTYPE_PCL2: s = "PCL-5/alt"; break; case PRINTJOBTYPE_PS: s = "PostScript"; break; case PRINTJOBTYPE_PS2: s = "PostScript/alt"; break; case PRINTJOBTYPE_CVL: s = "ConversionList"; break; default: s = "Unknown"; break; } ::fprintf(m_out, " PrintJobType %d, %s\n", meta.printjobtype, s); ::fflush(m_out); } return true; } //------------------------------------------------------------------------------ // Public (non-class) functions //------------------------------------------------------------------------------ /******************************************************************************* * ::main() * List a user's RightFax faxes. * * @param argc * Argument count, i.e., the number of elements in 'argv[]'. * * @param argv * Command line arguments. * * @see RFaxLister::main() * * @since 1.1, 2008-04-12 */ int main(int argc, char *argv[]) { // Execute this program return RFaxLister::main(argc, (const char **)argv); } // End rfaxlist.cpp